Code refactoring

This commit is contained in:
Burak Civan 2021-06-03 18:40:26 +03:00
parent bdbca0f175
commit 38ee37818a

View File

@ -136,7 +136,7 @@
<td class="border-top-0 p-0" colspan="4"> <td class="border-top-0 p-0" colspan="4">
<table class="w-100"> <table class="w-100">
<colgroup> <!-- <colgroup>
@if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both'])) @if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both']))
<col style="width: 25%;"> <col style="width: 25%;">
<col style="width: 30%;"> <col style="width: 30%;">
@ -148,12 +148,13 @@
<col style="width: 42%;"> <col style="width: 42%;">
<col style="width: 40px;"> <col style="width: 40px;">
@endif @endif
</colgroup> </colgroup> -->
<tbody> <tbody>
@if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both'])) @if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both']))
<tr v-if="!row.add_tax || !row.add_discount"> <tr v-if="!row.add_tax || !row.add_discount">
<td class="text-left border-0 p-0"> <td class="text-left border-0 p-0" style="display: block;">
<div> <div>
<button type="button" class="btn btn-link btn-sm p-0" @click="onAddLineDiscount(index)" v-if="!row.add_discount"> <button type="button" class="btn btn-link btn-sm p-0" @click="onAddLineDiscount(index)" v-if="!row.add_discount">
{{ trans('general.title.add', ['type' => trans('invoices.discount')]) }} {{ trans('general.title.add', ['type' => trans('invoices.discount')]) }}
@ -161,8 +162,8 @@
</div> </div>
</td> </td>
<td class="text-right border-0 p-0 pr-4"> <td class="text-right border-0 p-0 pr-4" style="display: block;">
<div> <div style="float:left;">
<button type="button" class="btn btn-link btn-sm p-0" @click="onAddTax(index)" v-if="!row.add_tax"> <button type="button" class="btn btn-link btn-sm p-0" @click="onAddTax(index)" v-if="!row.add_tax">
{{ trans('general.title.add', ['type' => trans_choice('general.taxes', 1)]) }} {{ trans('general.title.add', ['type' => trans_choice('general.taxes', 1)]) }}
</button> </button>
@ -177,9 +178,9 @@
</tr> </tr>
<tr v-if="row.add_discount"> <tr v-if="row.add_discount">
<td colspan="2" class="pl-0 pb-0 border-0" :class="{'pb-2' : !row.add_tax}"> <td colspan="2" class="pl-0 pb-0 border-0" :class="{'pb-2' : !row.add_tax}" style="width:42%;">
<div> <div>
<div style="float: left; margin-top: 15px; margin-left: -65px"> <div style="float: left; margin-top: 15px; margin-left: -65px;">
{{ trans('invoices.discount') }} {{ trans('invoices.discount') }}
</div> </div>
@ -213,7 +214,7 @@
</div> </div>
</td> </td>
<td class="border-0 pb-0 text-right long-texts" :class="{'pb-2' : !row.add_tax}"> <td class="border-0 pb-0 text-right long-texts" :class="{'pb-2' : !row.add_tax}" style="width:231px;">
<div> <div>
{{ Form::moneyGroup('discount_amount', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row.discount_amount', 'data-item' => 'discount_amount', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }} {{ Form::moneyGroup('discount_amount', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row.discount_amount', 'data-item' => 'discount_amount', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
</div> </div>
@ -229,9 +230,9 @@
<tr v-for="(row_tax, row_tax_index) in row.tax_ids" <tr v-for="(row_tax, row_tax_index) in row.tax_ids"
:index="row_tax_index"> :index="row_tax_index">
<td colspan="2" class="pl-0 pb-0 border-0 row-tax-input" :class="{'pb-2' : !row.add_tax}"> <td colspan="2" class="pl-0 pb-0 border-0" :class="{'pb-2' : !row.add_tax}" style="width:42%;">
<div> <div style="position: relative;">
<div style="float: left; margin-top: 15px; margin-right:2px; position:absolute; margin-left:-35px;"> <div style="float: left; margin-top: 15px; margin-right:2px; position: absolute; left: -33px;">
{{ trans_choice('general.taxes', 1) }} {{ trans_choice('general.taxes', 1) }}
</div> </div>
@ -257,13 +258,13 @@
</div> </div>
</td> </td>
<td :class="{'pb-2' : !row.add_tax}" class="border-0 pb-0 text-right long-texts"> <td :class="{'pb-2' : !row.add_tax}" class="border-0 pb-0 text-right long-texts" style="width:231px;">
<div> <div>
{{ 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') }} {{ 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') }}
</div> </div>
</td> </td>
<td class="pb-3 pl-2 align-bottom border-0" :class="{'pb-2' : !row.add_tax}" style="max-width: 40px;"> <td class="pb-3 pl-2 align-bottom border-0" :class="{'pb-2' : !row.add_tax}" style="max-width: 40px;" >
<button type="button" @click="onDeleteTax(index, row_tax_index)" class="btn btn-link btn-delete p-0"> <button type="button" @click="onDeleteTax(index, row_tax_index)" class="btn btn-link btn-delete p-0">
<i class="far fa-trash-alt"></i> <i class="far fa-trash-alt"></i>
</button> </button>
@ -271,9 +272,9 @@
</tr> </tr>
<tr v-if="row.add_tax"> <tr v-if="row.add_tax">
<td colspan="2" class="pl-0 border-0 row-tax-input"> <td colspan="2" class="pl-0 border-0" style="width: 42%;">
<div style="position: relative;"> <div style="position: relative;">
<div style="float: left; margin-top: 15px; margin-right:2px; position: absolute; margin-left: -35px;"> <div style="float: left; margin-top: 15px; margin-right:2px; position: absolute; left: -33px;" style="width:231px;">
{{ trans_choice('general.taxes', 1) }} {{ trans_choice('general.taxes', 1) }}
</div> </div>
@ -321,18 +322,18 @@
</div> </div>
</td> </td>
<td class="border-0 text-right long-texts align-middle row-tax-value"> <td class="border-0 text-right long-texts align-middle;" style="width:231px;">
<div> <div>
__ __
</div> </div>
</td> </td>
<td class="pb-3 pl-2 align-bottom border-0 row-tax-clear" style="max-width: 40px;"> <td class="pb-3 pl-2 align-bottom border-0" style="max-width:40px;" >
@if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both'])) @if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both']))
<button type="button" @click="onDeleteTax(index, 999)" class="btn btn-link btn-delete p-0"> <button type="button" @click="onDeleteTax(index, 999)" class="btn btn-link btn-delete p-0">
<i class="far fa-trash-alt"></i> <i class="far fa-trash-alt"></i>
</button> </button>
@endif @endif
</td> </td>
</tr> </tr>