From 0a6ee522cdcc335c5af2fc79d13900c909756bc8 Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Fri, 23 Dec 2022 13:44:14 +0300 Subject: [PATCH] code refactoring --- resources/assets/js/views/common/documents.js | 20 +- .../documents/form/line-item.blade.php | 737 +++++++++--------- 2 files changed, 373 insertions(+), 384 deletions(-) diff --git a/resources/assets/js/views/common/documents.js b/resources/assets/js/views/common/documents.js index 318937156..fbd41d21c 100644 --- a/resources/assets/js/views/common/documents.js +++ b/resources/assets/js/views/common/documents.js @@ -117,24 +117,14 @@ const app = new Vue({ }, methods: { - checkMove(event) { - debugger; - }, - - onStart(event) { - debugger; - }, - - onEnd(event, index) { + onEnd() { this.drag = false; - - let element = this.items[index]; - this.items.splice(index, 1); - this.items.splice(event.newIndex, 0, element); }, - log(event) { - debugger; + onUpdate(event) { + let fromIndex = this.form.items.indexOf(this.form.items[event.oldIndex]); + let element = this.form.items.splice(fromIndex, 1)[0]; + this.form.items.splice(event.newIndex, 0, element); }, onRefFocus(ref) { diff --git a/resources/views/components/documents/form/line-item.blade.php b/resources/views/components/documents/form/line-item.blade.php index 1eb244aae..0eb0cc234 100644 --- a/resources/views/components/documents/form/line-item.blade.php +++ b/resources/views/components/documents/form/line-item.blade.php @@ -1,431 +1,430 @@ - - @stack('name_td_start') + + + @stack('name_td_start') - - - - - - - - - - - + - @stack('name_td_end') - +
+ {{ trans_choice('general.taxes', 1) }} + +
+ @stack('taxes_input_start') + + + + @stack('taxes_input_end') +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ {{ trans_choice('general.taxes', 1) }} + +
+ @stack('taxes_input_start') + + + + @stack('taxes_input_end') +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ + + +
+ + + + + + + + + + - - - @stack('move_td_start') - + + @stack('move_td_start') + - @stack('move_td_end') - - @stack('items_td_start') - - @if (! $hideItems || (! $hideItemName && ! $hideItemDescription)) - @stack('name_td_start') - + @stack('move_td_end') - @stack('name_td_end') + @stack('items_td_start') - @stack('description_td_start') + @if (! $hideItems || (! $hideItemName && ! $hideItemDescription)) + @stack('name_td_start') + +
+ @stack('name_input_start') - @stack('description_td_end') - @endif + - @stack('items_td_end') +
- @stack('quantity_td_start') - -
- - @stack('quantity_td_end') - - @stack('price_td_start') - - - - @stack('price_td_end') - - @stack('total_td_start') - - - - @stack('total_td_end') - - @stack('delete_td_start') - - - - @stack('delete_td_end') - - - - - - -
- - - {{ trans('general.title.add', ['type' => trans_choice('general.taxes', 1)]) }} - - -
- - + @stack('name_td_end') -
- @stack('discount_input_start') + @stack('description_td_start') -
-
-
- +
- - + @stack('description_td_end') + @endif - + @if (! $hideItemQuantity) +
+ @stack('quantity_input_start') + +
+ v-if="form.errors.has('items.' + index + '.quantity')" + v-html="form.errors.get('items.' + index + '.quantity')">
+ + @stack('quantity_input_end')
- + @endif + - @stack('discount_input_end') + @stack('quantity_td_end') + + @stack('price_td_start') + + -
- -
- - + @stack('price_td_end') -
- {{ trans_choice('general.taxes', 1) }} + @stack('total_td_start') -
- @stack('taxes_input_start') - - - - @stack('taxes_input_end') -
- -
-
+
-
- + @stack('total_td_end') + + @stack('delete_td_start') + +
+ + @stack('delete_td_end') + + + + + + - - -
- -
+
+ - - - @if (! $hideItemName) - -
-
- -
- @stack('name_input_start') - - - -
- - @stack('name_input_end') -
- @endif
+ @if (! $hideItemName) + +
+
-
- @if (! $hideItemDescription) - - @endif - - @if (! $hideItemQuantity) -
- @stack('quantity_input_start') - - - -
-
- - @stack('quantity_input_end') -
- @endif -
- @if (! $hideItemPrice) -
- @stack('price_input_start') - - - - @stack('price_input_end') -
- @endif -
- @if (! $hideItemAmount) -
- -
- @endif -
- -
- @stack('item_custom_fields') - -
-
- @if (! $hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both'])) -
- - - {{ trans('general.title.add', ['type' => trans('invoices.discount')]) }} - - + @stack('name_input_end')
@endif +
+ @if (! $hideItemDescription) + + @endif + + @if (! $hideItemPrice) +
+ @stack('price_input_start') -
-
+ + @stack('price_input_end')
+ @endif +
+ @if (! $hideItemAmount) +
+ @endif +
+ +
+ @stack('item_custom_fields') + +
+
+ @if (! $hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both'])) +
+ + + {{ trans('general.title.add', ['type' => trans('invoices.discount')]) }} + + +
+ @endif + +
+ + + {{ trans('general.title.add', ['type' => trans_choice('general.taxes', 1)]) }} + + +
- -
- {{ trans_choice('general.taxes', 1) }} +
+ @stack('discount_input_start') -
- @stack('taxes_input_start') +
+
+
+ - + +
- @stack('taxes_input_end') -
+ -
-
-
- +
+
-
- + @stack('discount_input_end') + +
+
+ +
+ +
+ +
-
-
-
+ + + @stack('name_td_end') + +