From a274bb32e59000c74529f72324ca795ca3ca8a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 24 Nov 2020 15:00:36 +0300 Subject: [PATCH] Invoice columns name change issue solved. --- resources/assets/js/plugins/form.js | 4 +- .../partials/form/invoice_text.blade.php | 128 +++++++----------- 2 files changed, 53 insertions(+), 79 deletions(-) diff --git a/resources/assets/js/plugins/form.js b/resources/assets/js/plugins/form.js index e7e7314b3..6018dc7ff 100644 --- a/resources/assets/js/plugins/form.js +++ b/resources/assets/js/plugins/form.js @@ -56,7 +56,7 @@ export default class Form { if (type == 'radio') { if (!this[form_element.getAttribute('data-field')][name]) { - this[form_element.getAttribute('data-field')][name] = (form_element.getAttribute('value') ? 1 : 0) || 0; + this[form_element.getAttribute('data-field')][name] = (form_element.getAttribute('value') ? form_element.getAttribute('value') : 0) || 0; } } else if (type == 'checkbox') { if (this[form_element.getAttribute('data-field')][name]) { @@ -83,7 +83,7 @@ export default class Form { if (type == 'radio') { if (!this[name]) { - this[name] = (form_element.getAttribute('value') ? 1 : 0) || 0; + this[name] = (form_element.getAttribute('value') ? form_element.getAttribute('value') : 0) || 0; } } else if (type == 'checkbox') { if (this[name]) { diff --git a/resources/views/partials/form/invoice_text.blade.php b/resources/views/partials/form/invoice_text.blade.php index 41a86f0cc..fe1129e93 100644 --- a/resources/views/partials/form/invoice_text.blade.php +++ b/resources/views/partials/form/invoice_text.blade.php @@ -1,88 +1,62 @@ @stack($name . '_input_start') -
- + @if (!empty($text)) + {!! Form::label($name, $text, ['class' => 'form-control-label'])!!} + @endif - icon="{{ $icon }}" - title="{{ $text }}" - placeholder="{{ trans('general.form.select.field', ['field' => $text]) }}" - name="{{ $name }}" - :options="{{ json_encode($values) }}" +
+ @foreach ($values as $input_key => $input_value) +
+ + - @if (isset($selected) || old($name)) - value="{{ old($name, $selected) }}" - @endif + @if ($input_key == 'custom') +
+
+
+ + + +
- @if (!empty($attributes['model'])) - :model="{{ $attributes['model'] }}" - @endif + {!! Form::text($input_name, $input_value, [ + 'class' => 'form-control', + 'data-name' => $input_name, + 'data-value' => $input_value, + 'placeholder' => trans('general.form.enter', ['field' => $text]), + 'v-model' => !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $input_name : 'form.' . $input_name), + ]) !!} +
- @if (!empty($attributes['v-model'])) - @interface="form.errors.clear('{{ $attributes['v-model'] }}'); {{ $attributes['v-model'] . ' = $event' }}" - @elseif (!empty($attributes['data-field'])) - @interface="form.errors.clear('{{ 'form.' . $attributes['data-field'] . '.' . $name }}'); {{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}" - @else - @interface="form.errors.clear('{{ $name }}'); form.{{ $name }} = $event;" - @endif - - @if (!empty($attributes['change'])) - @change="{{ $attributes['change'] }}($event)" - @endif - - @if (isset($attributes['readonly'])) - :readonly="{{ $attributes['readonly'] }}" - @endif - - @if (isset($attributes['disabled'])) - :disabled="{{ $attributes['disabled'] }}" - @endif - - @if (isset($attributes['show'])) - v-if="{{ $attributes['show'] }}" - @endif - - @if (isset($attributes['v-error-message'])) - :form-error="{{ $attributes['v-error-message'] }}" - @else - :form-error="form.errors.get('{{ $name }}')" - @endif - - no-data-text="{{ trans('general.no_data') }}" - no-matching-data-text="{{ trans('general.no_matching_data') }}" - > - -
- {!! Form::label($input_name, trans('settings.invoice.custom'), ['class' => 'form-control-label'])!!} - -
-
- - - +
+
- - {!! Form::text($input_name, $input_value, [ - 'class' => 'form-control', - 'data-name' => $input_name, - 'data-value' => $input_value, - 'placeholder' => trans('general.form.enter', ['field' => $text]), - 'v-model' => !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $input_name : 'form.' . $input_name), - ]) !!} + @endif
- -
-
-
+ @endforeach
+
+
+
+ @stack($name . '_input_end')