From f753cfa077fca66b2544341e5bd1b36a4465ac31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Mon, 4 Jan 2021 11:24:32 +0300 Subject: [PATCH] document item line discount active then tax styling.. --- resources/assets/js/views/common/documents.js | 10 +- .../components/documents/form/items.blade.php | 2 +- .../documents/form/line-item.blade.php | 95 +++++++++---------- 3 files changed, 56 insertions(+), 51 deletions(-) diff --git a/resources/assets/js/views/common/documents.js b/resources/assets/js/views/common/documents.js index ff7d52fd3..8adcdfe6d 100644 --- a/resources/assets/js/views/common/documents.js +++ b/resources/assets/js/views/common/documents.js @@ -361,6 +361,12 @@ const app = new Vue({ }, onDeleteTax(item_index, tax_index) { + if (tax_index == '999') { + this.items[item_index].add_tax = false; + + return; + } + this.items[item_index].tax_ids.splice(tax_index, 1); this.form.items[item_index].tax_ids.splice(tax_index, 1); @@ -542,9 +548,9 @@ const app = new Vue({ description: item.description === null ? "" : item.description, quantity: item.quantity, price: (item.price).toFixed(2), - add_tax: true, + add_tax: (!item_taxes.length && document.getElementById('invoice-item-discount-rows') != null) ? false : true, tax_ids: item_taxes, - add_discount: (item_taxes.length) ? true : false, + add_discount: (item.discount_rate) ? true : false, discount: item.discount_rate, total: (item.total).toFixed(2) }); diff --git a/resources/views/components/documents/form/items.blade.php b/resources/views/components/documents/form/items.blade.php index 613ef66e5..ac1ca198e 100644 --- a/resources/views/components/documents/form/items.blade.php +++ b/resources/views/components/documents/form/items.blade.php @@ -73,7 +73,7 @@ @stack('add_item_td_start') - + - +
{{ Form::moneyGroup('discount', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'value' => 'row.discount', 'data-item' => 'discount', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
@@ -206,14 +206,11 @@ + @endif - - @else - @endif - +
{{ trans_choice('general.taxes', 1) }} @@ -238,12 +235,12 @@ @stack('taxes_input_end')
- +
{{ Form::moneyGroup('tax', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row_tax.price', 'data-item' => 'total', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
- + @@ -253,48 +250,50 @@
- {{ trans_choice('general.taxes', 1) }} + + {{ trans_choice('general.taxes', 1) }} + - @stack('taxes_input_start') - - @stack('taxes_input_end') + ])}}" + @interface="tax_id = $event" + @visible-change="onSelectedTax(index)" + @new="taxes.push($event)" + :form-error="form.errors.get('items.' + index + '.taxes')" + :no-data-text="'{{ trans('general.no_data') }}'" + :no-matching-data-text="'{{ trans('general.no_matching_data') }}'" + > + @stack('taxes_input_end')
@@ -304,7 +303,7 @@ @if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both'])) - @endif