Form group readonly and disabled feature added

This commit is contained in:
Cüneyt Şentürk
2020-02-01 18:47:15 +03:00
parent 9cb174f68c
commit 37e10eae8f
29 changed files with 306 additions and 51 deletions

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="row">
@foreach($items as $item)

View File

@ -1,7 +1,7 @@
@stack($name . '_input_start')
<akaunting-date
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}"
@if (!empty($attributes['v-error']))
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
@ -33,6 +33,14 @@
@interface="form.{{ $name }} = $event"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else

View File

@ -0,0 +1,56 @@
@stack($name . '_input_start')
<akaunting-date
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}"
@if (!empty($attributes['v-error']))
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
@else
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
@endif
:icon="'fa fa-{{ $icon }}'"
:title="'{{ $text }}'"
:placeholder="'{{ trans('general.form.select.field', ['field' => $text]) }}'"
:name="'{{ $name }}'"
:value="'{{ old($name, $value) }}'"
:config="{
allowInput: true,
@if (!empty($attributes['show-date-format']))
altInput: true,
altFormat: '{{ $attributes['show-date-format'] }}',
@endif
@if (!empty($attributes['date-format']))
dateFormat: '{{ $attributes['date-format'] }}',
@endif
wrap: true,
enableTime: true,
@if (!empty($attributes['seconds']))
enableSeconds: true
@endif
}"
@if (!empty($attributes['v-model']))
@interface="{{ $attributes['v-model'] . ' = $event' }}"
@elseif (!empty($attributes['data-field']))
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
@else
@interface="form.{{ $name }} = $event"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else
:form-error="form.errors.get('{{ $name }}')"
@endif
></akaunting-date>
@stack($name . '_input_end')

View File

@ -1,10 +1,10 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
@if ($text)
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="input-group input-group-merge {{ $group_class }}">

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': errors.{{ $name }}}]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="custom-file">
{!! Form::file($name, array_merge([

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': form.errors.get('{{ $name }}')}]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="input-group input-group-merge {{ $group_class }}">
<div class="input-group-prepend">

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="input-group input-group-merge {{ $group_class }}">
<div class="input-group-prepend">

View File

@ -15,6 +15,7 @@
:name="'{{ $name }}'"
:options="{{ json_encode($values) }}"
:value="{{ json_encode(old($name, $selected)) }}"
:multiple="true"
:add-new="{{ json_encode([
'status' => true,
@ -52,6 +53,14 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else

View File

@ -15,6 +15,7 @@
:name="'{{ $name }}'"
:options="{{ json_encode($values) }}"
:value="{{ json_encode(old($name, $selected)) }}"
:multiple="true"
@if (!empty($attributes['collapse']))
@ -33,6 +34,14 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="input-group input-group-merge {{ $group_class }}">
<div class="input-group-prepend">

View File

@ -1,10 +1,10 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
@if ($text)
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="input-group input-group-merge {{ $group_class }}">

View File

@ -1,15 +1,17 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="tab-pane tab-example-result fade show active" role="tabpanel" aria-labelledby="-component-tab">
<div class="btn-group btn-group-toggle radio-yes-no" data-toggle="buttons">
<label class="btn btn-success" @click="form.{{ $name }}=1" v-bind:class="{ active: form.{{ $name }} == 1 }">
{{ trans('general.yes') }}
<input type="radio" name="{{ $name }}" id="{{ $name }}-1" v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name) }}">
<input type="radio" name="{{ $name }}" id="{{ $name }}-1" v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name) }}">
</label>
<label class="btn btn-danger" @click="form.{{ $name }}=0" v-bind:class="{ active: form.{{ $name }} == 0 }">
@ -17,6 +19,7 @@
<input type="radio" name="{{ $name }}" id="{{ $name }}-0" v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name) }}">
</label>
</div>
<input type="hidden" name="{{ $name }}" value="{{ ($value) ? true : false }}" />
</div>

View File

@ -15,6 +15,7 @@
:name="'{{ $name }}'"
:options="{{ json_encode($values) }}"
:value="'{{ old($name, $selected) }}'"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
@ -47,6 +48,14 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else

View File

@ -28,8 +28,12 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="{{ $attributes['disabled'] }}"
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))

View File

@ -15,6 +15,7 @@
:name="'{{ $name }}'"
:options="{{ json_encode($values) }}"
:value="'{{ old($name, $selected) }}'"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
@ -48,6 +49,14 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else

View File

@ -15,6 +15,7 @@
:name="'{{ $name }}'"
:options="{{ json_encode($values) }}"
:value="'{{ old($name, $selected) }}'"
:group="true"
@if (!empty($attributes['v-model']))
@ -29,6 +30,14 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else

View File

@ -28,8 +28,12 @@
@change="{{ $attributes['change'] }}($event)"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="{{ $attributes['disabled'] }}"
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<html-editor
:name="'{{ $name }}'"
@ -23,7 +25,11 @@
@else
@input="form.{{ $name }} = $event"
@endif
></html-editor>
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
></html-editor>
<div class="invalid-feedback d-block"
v-if="{{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.has("' . $name . '")' }}"

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
<div class="input-group input-group-merge {{ $group_class }}">
<div class="input-group-prepend">

View File

@ -1,9 +1,11 @@
@stack($name . '_input_start')
<div
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}{{ isset($attributes['readonly']) ? ' readonly' : '' }}{{ isset($attributes['disabled']) ? ' disabled' : '' }}"
:class="[{'has-error': {{ isset($attributes['v-error']) ? $attributes['v-error'] : 'form.errors.get("' . $name . '")' }} }]">
{!! Form::label($name, $text, ['class' => 'form-control-label']) !!}
@if (!empty($text))
{!! Form::label($name, $text, ['class' => 'form-control-label'])!!}
@endif
{!! Form::textarea($name, $value, array_merge([
'class' => 'form-control',

View File

@ -0,0 +1,50 @@
@stack($name . '_input_start')
<akaunting-date
class="{{ $col }}{{ isset($attributes['required']) ? ' required' : '' }}"
@if (!empty($attributes['v-error']))
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
@else
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
@endif
:icon="'fa fa-{{ $icon }}'"
:title="'{{ $text }}'"
:placeholder="'{{ trans('general.form.select.field', ['field' => $text]) }}'"
:name="'{{ $name }}'"
:value="'{{ old($name, $value) }}'"
:config="{
allowInput: true,
wrap: true,
enableTime: true,
@if (!empty($attributes['seconds']))
enableSeconds: true,
@endif
noCalendar: true
}"
@if (!empty($attributes['v-model']))
@interface="{{ $attributes['v-model'] . ' = $event' }}"
@elseif (!empty($attributes['data-field']))
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
@else
@interface="form.{{ $name }} = $event"
@endif
@if (isset($attributes['readonly']))
:readonly="'{{ $attributes['readonly'] }}'"
@endif
@if (isset($attributes['disabled']))
:disabled="'{{ $attributes['disabled'] }}'"
@endif
@if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}"
@else
:form-error="form.errors.get('{{ $name }}')"
@endif
></akaunting-date>
@stack($name . '_input_end')

View File

@ -60,7 +60,8 @@
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
@if ($payment->bill)
{{ Form::textGroup('document_id', trans_choice('general.bills', 1), 'file-invoice', ['disabled' => 'disabled'], $payment->bill->bill_number) }}
{{ Form::textGroup('document', trans_choice('general.bills', 1), 'file-invoice', ['disabled' => 'disabled'], $payment->bill->bill_number) }}
{{ Form::hidden('document_id', $payment->bill->id) }}
@endif
</div>
</div>

View File

@ -60,7 +60,8 @@
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
@if ($revenue->invoice)
{{ Form::textGroup('document_id', trans_choice('general.invoices', 1), 'file-invoice', ['disabled' => 'disabled'], $revenue->invoice->invoice_number) }}
{{ Form::textGroup('document', trans_choice('general.invoices', 1), 'file-invoice', ['disabled' => 'disabled'], $revenue->invoice->invoice_number) }}
{{ Form::hidden('document_id', $revenue->invoice->id) }}
@endif
</div>
</div>