added discount location setting

This commit is contained in:
denisdulici 2020-03-26 16:20:31 +03:00
parent 795ddf8aeb
commit eedb5b30a6
15 changed files with 405 additions and 309 deletions

View File

@ -41,12 +41,20 @@ class Localisation extends Controller
'after' => trans('settings.localisation.percent.after'), 'after' => trans('settings.localisation.percent.after'),
]; ];
$discount_locations = [
'no' => trans('general.disabled'),
'item' => trans('settings.localisation.discount_location.item'),
'total' => trans('settings.localisation.discount_location.total'),
'both' => trans('settings.localisation.discount_location.both'),
];
return view('settings.localisation.edit', compact( return view('settings.localisation.edit', compact(
'setting', 'setting',
'timezones', 'timezones',
'date_formats', 'date_formats',
'date_separators', 'date_separators',
'percent_positions' 'percent_positions',
'discount_locations'
)); ));
} }
} }

View File

@ -13,6 +13,13 @@ class BillItem extends Model
protected $table = 'bill_items'; protected $table = 'bill_items';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['discount'];
/** /**
* Attributes that should be mass-assignable. * Attributes that should be mass-assignable.
* *
@ -100,12 +107,12 @@ class BillItem extends Model
* *
* @return string * @return string
*/ */
public function getDiscountRateAttribute($value) public function getDiscountAttribute()
{ {
if (setting('localisation.percent_position', 'after') === 'after') { if (setting('localisation.percent_position', 'after') === 'after') {
$text = ($this->discount_type === 'normal') ? $value . '%' : $value; $text = ($this->discount_type === 'normal') ? $this->discount_rate . '%' : $this->discount_rate;
} else { } else {
$text = ($this->discount_type === 'normal') ? '%' . $value : $value; $text = ($this->discount_type === 'normal') ? '%' . $this->discount_rate : $this->discount_rate;
} }
return $text; return $text;

View File

@ -12,6 +12,13 @@ class InvoiceItem extends Model
protected $table = 'invoice_items'; protected $table = 'invoice_items';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['discount'];
/** /**
* Attributes that should be mass-assignable. * Attributes that should be mass-assignable.
* *
@ -99,12 +106,12 @@ class InvoiceItem extends Model
* *
* @return string * @return string
*/ */
public function getDiscountRateAttribute($value) public function getDiscountAttribute()
{ {
if (setting('localisation.percent_position', 'after') === 'after') { if (setting('localisation.percent_position', 'after') === 'after') {
$text = ($this->discount_type === 'normal') ? $value . '%' : $value; $text = ($this->discount_type === 'normal') ? $this->discount_rate . '%' : $this->discount_rate;
} else { } else {
$text = ($this->discount_type === 'normal') ? '%' . $value : $value; $text = ($this->discount_type === 'normal') ? '%' . $this->discount_rate : $this->discount_rate;
} }
return $text; return $text;

View File

@ -13,7 +13,7 @@ return [
'price' => 'Price', 'price' => 'Price',
'sub_total' => 'Subtotal', 'sub_total' => 'Subtotal',
'discount' => 'Discount', 'discount' => 'Discount',
'item_discount' => 'Item Discount', 'item_discount' => 'Line Discount',
'tax_total' => 'Tax Total', 'tax_total' => 'Tax Total',
'total' => 'Total', 'total' => 'Total',

View File

@ -13,7 +13,7 @@ return [
'price' => 'Price', 'price' => 'Price',
'sub_total' => 'Subtotal', 'sub_total' => 'Subtotal',
'discount' => 'Discount', 'discount' => 'Discount',
'item_discount' => 'Item Discount', 'item_discount' => 'Line Discount',
'tax_total' => 'Tax Total', 'tax_total' => 'Tax Total',
'total' => 'Total', 'total' => 'Total',

View File

@ -29,6 +29,12 @@ return [
'before' => 'Before Number', 'before' => 'Before Number',
'after' => 'After Number', 'after' => 'After Number',
], ],
'discount_location' => [
'name' => 'Discount Location',
'item' => 'At line',
'total' => 'At total',
'both' => 'Both line and total',
],
], ],
'invoice' => [ 'invoice' => [

View File

@ -30,6 +30,7 @@
{{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }} {{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }}
<div class="col-sm-12 mb-4"> <div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice('general.items', 2), ['class' => 'form-control-label']) !!} {!! Form::label('items', trans_choice('general.items', 2), ['class' => 'form-control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden "> <div class="table-responsive overflow-x-scroll overflow-y-hidden ">
<table class="table table-bordered" id="items"> <table class="table table-bordered" id="items">
@ -51,9 +52,11 @@
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.price') }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans('bills.price') }}</th>
@stack('price_th_end') @stack('price_th_end')
@stack('discount_th_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.discount') }}</th> @stack('discount_th_start')
@stack('discount_th_end') <th class="text-right border-right-0 border-bottom-0">{{ trans('bills.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start') @stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@ -73,13 +76,13 @@
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i> <button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button> </button>
</td> </td>
<td class="text-right border-bottom-0" colspan="6" :colspan="colspan"></td> <td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr> </tr>
@stack('add_item_td_end') @stack('add_item_td_end')
@stack('sub_total_td_start') @stack('sub_total_td_start')
<tr id="tr-subtotal"> <tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.sub_total') }}</strong> <strong>{{ trans('bills.sub_total') }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -90,74 +93,78 @@
</tr> </tr>
@stack('sub_total_td_end') @stack('sub_total_td_end')
@stack('item_discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<tr id="tr-subtotal"> @stack('item_discount_td_start')
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <tr id="tr-subtotal">
<strong>{{ trans('bills.item_discount') }}</strong> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
</td> <strong>{{ trans('bills.item_discount') }}</strong>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('item_discount_td_end')
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td> </td>
<td class="text-right border-bottom-0"> <td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }} {{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span> <span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<span v-else>@money(0, $currency->code, true)</span> <span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td> </td>
</tr> </tr>
@stack('add_discount_td_end') @stack('item_discount_td_end')
@endif
@if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@endif
@stack('tax_total_td_start') @stack('tax_total_td_start')
<tr id="tr-tax"> <tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong> <strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -170,7 +177,7 @@
@stack('grand_total_td_start') @stack('grand_total_td_start')
<tr id="tr-total"> <tr id="tr-total">
<td class="text-right border-right-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.total') }}</strong> <strong>{{ trans('bills.total') }}</strong>
</td> </td>
<td class="text-right long-texts"> <td class="text-right long-texts">

View File

@ -31,6 +31,7 @@
{{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }} {{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }}
<div class="col-sm-12 mb-4"> <div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice('general.items', 2), ['class' => 'control-label']) !!} {!! Form::label('items', trans_choice('general.items', 2), ['class' => 'control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden"> <div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table table-bordered" id="items"> <table class="table table-bordered" id="items">
@ -52,9 +53,11 @@
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.price') }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans('bills.price') }}</th>
@stack('price_th_end') @stack('price_th_end')
@stack('discount_th_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.discount') }}</th> @stack('discount_th_start')
@stack('discount_th_end') <th class="text-right border-right-0 border-bottom-0">{{ trans('bills.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start') @stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@ -74,13 +77,13 @@
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i> <button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button> </button>
</td> </td>
<td class="text-right border-bottom-0" colspan="6" :colspan="colspan"></td> <td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr> </tr>
@stack('add_item_td_end') @stack('add_item_td_end')
@stack('sub_total_td_start') @stack('sub_total_td_start')
<tr id="tr-subtotal"> <tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.sub_total') }}</strong> <strong>{{ trans('bills.sub_total') }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -91,61 +94,78 @@
</tr> </tr>
@stack('sub_total_td_end') @stack('sub_total_td_end')
@stack('add_discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<tr id="tr-discount"> @stack('item_discount_td_start')
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <tr id="tr-subtotal">
<el-popover <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
popper-class="p-0 h-0" <strong>{{ trans('bills.item_discount') }}</strong>
placement="bottom" </td>
width="300" <td class="text-right border-bottom-0 long-texts">
v-model="discount"> {{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<div class="card d-none" :class="[{'show' : discount}]"> <span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<div class="discount card-body"> <span v-else>@money(0, $currency->code, true)</span>
<div class="row align-items-center"> </td>
<div class="col-sm-6"> </tr>
<div class="input-group input-group-merge"> @stack('item_discount_td_end')
<div class="input-group-prepend"> @endif
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i> @if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
</span> @stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('bills.discount_desc') }}</strong>
</div> </div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div> </div>
</div> </div>
<div class="col-sm-6"> </div>
<div class="discount-description"> <div class="discount card-footer">
<strong>{{ trans('invoices.discount_desc') }}</strong> <div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="discount card-footer"> <el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('bills.add_discount') }}</el-link>
<div class="row float-right"> <el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
<div class="col-xs-12 col-sm-12"> </el-popover>
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment"> </td>
{{ trans('general.cancel') }} <td class="text-right border-bottom-0">
</a> {{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!} <span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
</div> <span v-else>@money(0, $currency->code, true)</span>
</div> {!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</div> </td>
</div> </tr>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link> @stack('add_discount_td_end')
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link> @endif
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@stack('tax_total_td_start') @stack('tax_total_td_start')
<tr id="tr-tax"> <tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong> <strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -158,7 +178,7 @@
@stack('grand_total_td_start') @stack('grand_total_td_start')
<tr id="tr-total"> <tr id="tr-total">
<td class="text-right border-right-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.total') }}</strong> <strong>{{ trans('bills.total') }}</strong>
</td> </td>
<td class="text-right long-texts"> <td class="text-right long-texts">

View File

@ -98,36 +98,38 @@
</td> </td>
@stack('price_td_end') @stack('price_td_end')
@stack('discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<td class="border-right-0 border-bottom-0 w-12" @stack('discount_td_start')
:class="[{'has-error': form.errors.has('items.' + index + '.discount') }]"> <td class="border-right-0 border-bottom-0 w-12"
@stack('discount_input_start') :class="[{'has-error': form.errors.has('items.' + index + '.discount') }]">
<div class="input-group input-group-merge"> @stack('discount_input_start')
<div class="input-group-prepend"> <div class="input-group input-group-merge">
<span class="input-group-text" id="input-discount"> <div class="input-group-prepend">
<i class="fa fa-percent"></i> <span class="input-group-text" id="input-discount">
</span> <i class="fa fa-percent"></i>
</div> </span>
<input type="number" </div>
max="100" <input type="number"
min="0" max="100"
class="form-control text-center" min="0"
:name="'items.' + index + '.discount'" class="form-control text-center"
autocomplete="off" :name="'items.' + index + '.discount'"
required="required" autocomplete="off"
data-item="quantity" required="required"
v-model="row.discount" data-item="quantity"
@input="onCalculateTotal" v-model="row.discount"
@change="form.errors.clear('items.' + index + '.discount')"> @input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.discount')">
<div class="invalid-feedback d-block" <div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.discount')" v-if="form.errors.has('items.' + index + '.discount')"
v-html="form.errors.get('items.' + index + '.discount')"> v-html="form.errors.get('items.' + index + '.discount')">
</div>
</div> </div>
</div> @stack('discount_input_end')
@stack('discount_input_end') </td>
</td> @stack('discount_td_end')
@stack('discount_td_end') @endif
@stack('taxes_td_start') @stack('taxes_td_start')
<td class="border-right-0 border-bottom-0" <td class="border-right-0 border-bottom-0"

View File

@ -339,9 +339,11 @@
<th class="col-sm-3 text-right d-none d-sm-block">{{ trans('bills.price') }}</th> <th class="col-sm-3 text-right d-none d-sm-block">{{ trans('bills.price') }}</th>
@stack('price_th_end') @stack('price_th_end')
@stack('discount_th_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<th class="col-sm-1 text-center d-none d-sm-block">{{ trans('bills.discount') }}</th> @stack('discount_th_start')
@stack('discount_th_end') <th class="col-sm-1 text-center d-none d-sm-block">{{ trans('bills.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('total_th_start') @stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('bills.total') }}</th> <th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('bills.total') }}</th>
@ -366,9 +368,11 @@
<td class="col-sm-3 text-right d-none d-sm-block">@money($bill_item->price, $bill->currency_code, true)</td> <td class="col-sm-3 text-right d-none d-sm-block">@money($bill_item->price, $bill->currency_code, true)</td>
@stack('price_td_end') @stack('price_td_end')
@stack('discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<td class="col-sm-1 text-center d-none d-sm-block">{{ $bill_item->discount_rate }}</td> @stack('discount_td_start')
@stack('discount_td_end') <td class="col-sm-1 text-center d-none d-sm-block">{{ $bill_item->discount }}</td>
@stack('discount_td_end')
@endif
@stack('total_td_start') @stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($bill_item->total, $bill->currency_code, true)</td> <td class="col-xs-4 col-sm-3 text-right pr-5">@money($bill_item->total, $bill->currency_code, true)</td>

View File

@ -30,6 +30,7 @@
{{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart', []) }} {{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart', []) }}
<div class="col-sm-12 mb-4"> <div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'form-control-label']) !!} {!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'form-control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden"> <div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table table-bordered" id="items"> <table class="table table-bordered" id="items">
@ -51,9 +52,11 @@
<th class="text-right border-right-0 border-bottom-0">{{ trans($text_override['price']) }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans($text_override['price']) }}</th>
@stack('price_th_end') @stack('price_th_end')
@stack('discount_th_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<th class="text-right border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th> @stack('discount_th_start')
@stack('discount_th_end') <th class="text-right border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start') @stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@ -73,13 +76,13 @@
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i> <button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button> </button>
</td> </td>
<td class="text-right border-bottom-0" colspan="6" :colspan="colspan"></td> <td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr> </tr>
@stack('add_item_td_end') @stack('add_item_td_end')
@stack('sub_total_td_start') @stack('sub_total_td_start')
<tr id="tr-subtotal"> <tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.sub_total') }}</strong> <strong>{{ trans('invoices.sub_total') }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -90,74 +93,78 @@
</tr> </tr>
@stack('sub_total_td_end') @stack('sub_total_td_end')
@stack('item_discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<tr id="tr-subtotal"> @stack('item_discount_td_start')
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <tr id="tr-subtotal">
<strong>{{ trans('invoices.item_discount') }}</strong> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
</td> <strong>{{ trans('invoices.item_discount') }}</strong>
<td class="text-right border-bottom-0 long-texts"> </td>
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }} <td class="text-right border-bottom-0 long-texts">
<span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span> {{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span v-else>@money(0, $currency->code, true)</span> <span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
</td> <span v-else>@money(0, $currency->code, true)</span>
</tr> </td>
@stack('item_discount_td_end') </tr>
@stack('item_discount_td_end')
@endif
@stack('add_discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
<tr id="tr-discount"> @stack('add_discount_td_start')
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <tr id="tr-discount">
<el-popover <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
popper-class="p-0 h-0" <el-popover
placement="bottom" popper-class="p-0 h-0"
width="300" placement="bottom"
v-model="discount"> width="300"
<div class="card d-none" :class="[{'show' : discount}]"> v-model="discount">
<div class="discount card-body"> <div class="card d-none" :class="[{'show' : discount}]">
<div class="row align-items-center"> <div class="discount card-body">
<div class="col-sm-6"> <div class="row align-items-center">
<div class="input-group input-group-merge"> <div class="col-sm-6">
<div class="input-group-prepend"> <div class="input-group input-group-merge">
<span class="input-group-text" id="input-discount"> <div class="input-group-prepend">
<i class="fa fa-percent"></i> <span class="input-group-text" id="input-discount">
</span> <i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div> </div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div> </div>
</div> </div>
<div class="col-sm-6"> </div>
<div class="discount-description"> <div class="discount card-footer">
<strong>{{ trans('invoices.discount_desc') }}</strong> <div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="discount card-footer"> <el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<div class="row float-right"> <el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
<div class="col-xs-12 col-sm-12"> </el-popover>
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment"> </td>
{{ trans('general.cancel') }} <td class="text-right border-bottom-0">
</a> {{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!} <span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
</div> <span v-else>@money(0, $currency->code, true)</span>
</div> {!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</div> </td>
</div> </tr>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link> @stack('add_discount_td_end')
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link> @endif
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@stack('tax_total_td_start') @stack('tax_total_td_start')
<tr id="tr-tax"> <tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong> <strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -170,7 +177,7 @@
@stack('grand_total_td_start') @stack('grand_total_td_start')
<tr id="tr-total"> <tr id="tr-total">
<td class="text-right border-right-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.total') }}</strong> <strong>{{ trans('invoices.total') }}</strong>
</td> </td>
<td class="text-right long-texts"> <td class="text-right long-texts">

View File

@ -31,6 +31,7 @@
{{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart',[]) }} {{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart',[]) }}
<div class="col-sm-12 mb-4"> <div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'control-label']) !!} {!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden"> <div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table table-bordered" id="items"> <table class="table table-bordered" id="items">
@ -52,9 +53,11 @@
<th class="text-right border-right-0 border-bottom-0">{{ trans($text_override['price']) }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans($text_override['price']) }}</th>
@stack('price_th_end') @stack('price_th_end')
@stack('discount_th_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<th class="text-right border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th> @stack('discount_th_start')
@stack('discount_th_end') <th class="text-right border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start') @stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th> <th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@ -74,13 +77,13 @@
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i> <button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button> </button>
</td> </td>
<td class="text-right border-bottom-0" colspan="6" :colspan="colspan"></td> <td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr> </tr>
@stack('add_item_td_end') @stack('add_item_td_end')
@stack('sub_total_td_start') @stack('sub_total_td_start')
<tr id="tr-subtotal"> <tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.sub_total') }}</strong> <strong>{{ trans('invoices.sub_total') }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -91,61 +94,78 @@
</tr> </tr>
@stack('sub_total_td_end') @stack('sub_total_td_end')
@stack('add_discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<tr id="tr-discount"> @stack('item_discount_td_start')
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <tr id="tr-subtotal">
<el-popover <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
popper-class="p-0 h-0" <strong>{{ trans('invoices.item_discount') }}</strong>
placement="bottom" </td>
width="300" <td class="text-right border-bottom-0 long-texts">
v-model="discount"> {{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<div class="card d-none" :class="[{'show' : discount}]"> <span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<div class="discount card-body"> <span v-else>@money(0, $currency->code, true)</span>
<div class="row align-items-center"> </td>
<div class="col-sm-6"> </tr>
<div class="input-group input-group-merge"> @stack('item_discount_td_end')
<div class="input-group-prepend"> @endif
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i> @if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
</span> @stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div> </div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control']) !!}
</div> </div>
</div> </div>
<div class="col-sm-6"> </div>
<div class="discount-description"> <div class="discount card-footer">
<strong>{{ trans('invoices.discount_desc') }}</strong> <div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="discount card-footer"> <el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<div class="row float-right"> <el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
<div class="col-xs-12 col-sm-12"> </el-popover>
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary header-button-top" @click="closePayment"> </td>
{{ trans('general.cancel') }} <td class="text-right border-bottom-0">
</a> {{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success header-button-top']) !!} <span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
</div> <span v-else>@money(0, $currency->code, true)</span>
</div> {!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</div> </td>
</div> </tr>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link> @stack('add_discount_td_end')
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link> @endif
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@stack('tax_total_td_start') @stack('tax_total_td_start')
<tr id="tr-tax"> <tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong> <strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td> </td>
<td class="text-right border-bottom-0 long-texts"> <td class="text-right border-bottom-0 long-texts">
@ -158,7 +178,7 @@
@stack('grand_total_td_start') @stack('grand_total_td_start')
<tr id="tr-total"> <tr id="tr-total">
<td class="text-right border-right-0" colspan="6" :colspan="colspan"> <td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.total') }}</strong> <strong>{{ trans('invoices.total') }}</strong>
</td> </td>
<td class="text-right long-texts"> <td class="text-right long-texts">

View File

@ -98,36 +98,38 @@
</td> </td>
@stack('price_td_end') @stack('price_td_end')
@stack('discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<td class="border-right-0 border-bottom-0 w-12" @stack('discount_td_start')
:class="[{'has-error': form.errors.has('items.' + index + '.discount') }]"> <td class="border-right-0 border-bottom-0 w-12"
@stack('discount_input_start') :class="[{'has-error': form.errors.has('items.' + index + '.discount') }]">
<div class="input-group input-group-merge"> @stack('discount_input_start')
<div class="input-group-prepend"> <div class="input-group input-group-merge">
<span class="input-group-text" id="input-discount"> <div class="input-group-prepend">
<i class="fa fa-percent"></i> <span class="input-group-text" id="input-discount">
</span> <i class="fa fa-percent"></i>
</div> </span>
<input type="number" </div>
max="100" <input type="number"
min="0" max="100"
class="form-control text-center" min="0"
:name="'items.' + index + '.discount'" class="form-control text-center"
autocomplete="off" :name="'items.' + index + '.discount'"
required="required" autocomplete="off"
data-item="quantity" required="required"
v-model="row.discount" data-item="quantity"
@input="onCalculateTotal" v-model="row.discount"
@change="form.errors.clear('items.' + index + '.discount')"> @input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.discount')">
<div class="invalid-feedback d-block" <div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.discount')" v-if="form.errors.has('items.' + index + '.discount')"
v-html="form.errors.get('items.' + index + '.discount')"> v-html="form.errors.get('items.' + index + '.discount')">
</div>
</div> </div>
</div> @stack('discount_input_end')
@stack('discount_input_end') </td>
</td> @stack('discount_td_end')
@stack('discount_td_end') @endif
@stack('taxes_td_start') @stack('taxes_td_start')
<td class="border-right-0 border-bottom-0" <td class="border-right-0 border-bottom-0"

View File

@ -356,9 +356,11 @@
<th class="col-sm-3 text-right d-none d-sm-block">{{ trans($text_override['price']) }}</th> <th class="col-sm-3 text-right d-none d-sm-block">{{ trans($text_override['price']) }}</th>
@stack('price_th_end') @stack('price_th_end')
@stack('discount_th_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<th class="col-sm-1 text-center d-none d-sm-block">{{ trans('invoices.discount') }}</th> @stack('discount_th_start')
@stack('discount_th_end') <th class="col-sm-1 text-center d-none d-sm-block">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('total_th_start') @stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th> <th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th>
@ -383,9 +385,11 @@
<td class="col-sm-3 text-right d-none d-sm-block">@money($invoice_item->price, $invoice->currency_code, true)</td> <td class="col-sm-3 text-right d-none d-sm-block">@money($invoice_item->price, $invoice->currency_code, true)</td>
@stack('price_td_end') @stack('price_td_end')
@stack('discount_td_start') @if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<td class="col-sm-1 text-center d-none d-sm-block">{{ $invoice_item->discount_rate }}</td> @stack('discount_td_start')
@stack('discount_td_end') <td class="col-sm-1 text-center d-none d-sm-block">{{ $invoice_item->discount }}</td>
@stack('discount_td_end')
@endif
@stack('total_td_start') @stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($invoice_item->total, $invoice->currency_code, true)</td> <td class="col-xs-4 col-sm-3 text-right pr-5">@money($invoice_item->total, $invoice->currency_code, true)</td>

View File

@ -27,6 +27,8 @@
{{ Form::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, $setting['date_separator'], []) }} {{ Form::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, $setting['date_separator'], []) }}
{{ Form::selectGroup('percent_position', trans('settings.localisation.percent.title'), 'percent', $percent_positions, $setting['percent_position'], []) }} {{ Form::selectGroup('percent_position', trans('settings.localisation.percent.title'), 'percent', $percent_positions, $setting['percent_position'], []) }}
{{ Form::selectGroup('discount_location', trans('settings.localisation.discount_location.name'), 'percent', $discount_locations, !empty($setting['discount_location']) ? $setting['discount_location'] : 'total', []) }}
</div> </div>
</div> </div>