@php
/** @var array|bool $transaction */
$transaction = $transaction ?? [];
// if item exists, input prefix will be "items[{item->id}]"
// if not, it will be null and will be added by javascript later
$inputPrefix = 'items[' . ($transaction ? $id : 'new') . ']';
$disabled = $disabled ?? false;
if($disabled || !$transaction || array_get($transaction, 'stock_item_trashed')){
$disabled = 'disabled';
} else {
$disabled = '';
}
$deletable = $deletable ?? true;
@endphp
|
@if(!$transaction || array_get($transaction, 'new'))
{!! Form::select("{$inputPrefix}[stock_item_id]", $items, array_get($transaction, 'stock_item_id'), ['class' => 'form-control item', $disabled]) !!}
@else
{{ array_get($transaction, 'stock_item_name') }}
@if(array_get($transaction, 'stock_item_trashed'))
[@transUc('models.generic.trashed')]
@endif
@endif
|
{!! Form::number("{$inputPrefix}[change]", ($transaction ? array_get($transaction, 'change') : 1), ['class' => 'form-control change', 'step' => '0.001', $disabled]) !!}
{{ array_get($transaction, 'transUom') ?? '?' }}
|
{!! Form::number("{$inputPrefix}[base_price]",
array_get($transaction, 'base_price'),
['class' => 'form-control base_price text-right', 'step' => '0.01', $disabled]) !!}
@currencySymbolLg
|
{!! Form::number("{$inputPrefix}[discount_pct]",
number_format(array_get($transaction, 'discount_pct', "0"), 0),
['class' => 'form-control discount-pct', $disabled, 'min' => 0, 'max' => 100, 'step' => '1']) !!}
|
{!! Form::number("{$inputPrefix}[total_discount]",
array_get($transaction, 'total_discount', "0.00"),
['class' => 'form-control total_discount text-right', 'min' => 0, 'max' => 100, 'step' => '0.01', $disabled]) !!}
@currencySymbolLg
|
{{ formatCurrency(array_get($transaction, 'base_price') * array_get($transaction, 'change')) }}
@currencySymbol
|
{!! Form::text("{$inputPrefix}[vat_pct]",
number_format(array_get($transaction, 'vat_pct', "0"), 0),
['class' => 'form-control vat', $disabled, 'min' => 0, 'max' => 100, 'step' => '1']) !!}
|
{{ formatCurrency(array_get($transaction, 'total_vat')) }}
@currencySymbol
|
{{ formatCurrency(array_get($transaction, 'total_price')) }}
@currencySymbol
|
@if($deletable)
|
@endif