ultimatepos/Modules/Tms/Resources/views/customs/_form.blade.php

127 lines
6.8 KiB
PHP

@php
$clearance = $clearance ?? null;
$defaultClearanceType = ($transaction->type ?? null) === 'sell' ? 'export' : 'import';
@endphp
<div class="row">
<div class="col-md-3">
<div class="form-group">
{!! Form::label('clearance_type', __('tms::lang.customs_type').':*') !!}
{!! Form::select('clearance_type', $types, $clearance->clearance_type ?? $defaultClearanceType, ['class'=>'form-control','required','id'=>'clearance_type']) !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('status', __('tms::lang.status').':*') !!}
{!! Form::select('status', $statuses, $clearance->status ?? 'draft', ['class'=>'form-control','required']) !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('broker_id', __('tms::lang.broker').':') !!}
{!! Form::select('broker_id', $brokers, $clearance->broker_id ?? null, ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('shipment_id', __('tms::lang.shipment').':') !!}
{!! Form::select('shipment_id', $shipments, $clearance->shipment_id ?? ($shipment->id ?? null), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
{!! Form::label('contact_id', __('tms::lang.contact').':') !!}
{!! Form::select('contact_id', $customers + $suppliers, $clearance->contact_id ?? ($transaction->contact_id ?? ($shipment->contact_id ?? null)), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{!! Form::label('customs_office', __('tms::lang.customs_office').':') !!}
{!! Form::text('customs_office', $clearance->customs_office ?? null, ['class'=>'form-control']) !!}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{!! Form::label('declaration_no', __('tms::lang.declaration_no').':') !!}
{!! Form::text('declaration_no', $clearance->declaration_no ?? null, ['class'=>'form-control']) !!}
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
{!! Form::label('bill_of_lading', __('tms::lang.bill_of_lading').':') !!}
{!! Form::text('bill_of_lading', $clearance->bill_of_lading ?? null, ['class'=>'form-control']) !!}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{!! Form::label('country_of_origin', __('tms::lang.country_of_origin').':') !!}
{!! Form::text('country_of_origin', $clearance->country_of_origin ?? null, ['class'=>'form-control']) !!}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{!! Form::label('other_charges', __('tms::lang.other_charges').':') !!}
{!! Form::text('other_charges', $clearance->other_charges ?? 0, ['class'=>'form-control input_number','id'=>'customs_other_charges']) !!}
</div>
</div>
</div>
@if(!empty($transaction))
{!! Form::hidden('transaction_id', $transaction->id) !!}
@elseif(!empty($clearance->transaction_id))
{!! Form::hidden('transaction_id', $clearance->transaction_id) !!}
@endif
<hr>
<h4>@lang('tms::lang.customs_items')</h4>
<div class="table-responsive">
<table class="table table-bordered" id="customs_items_table">
<thead>
<tr>
<th>@lang('tms::lang.description')</th>
<th>@lang('tms::lang.hs_code')</th>
<th>@lang('tms::lang.quantity')</th>
<th>@lang('tms::lang.unit')</th>
<th>@lang('tms::lang.customs_value')</th>
<th>@lang('tms::lang.duty_rate') %</th>
<th>@lang('tms::lang.vat_rate') %</th>
<th></th>
</tr>
</thead>
<tbody>
@php $items = $clearance?->items ?? collect(); @endphp
@forelse($items as $i => $item)
<tr class="customs-item-row">
<td><input type="text" name="items[{{ $i }}][description]" class="form-control" value="{{ $item->description }}"></td>
<td><input type="text" name="items[{{ $i }}][hs_code]" class="form-control" value="{{ $item->hs_code }}"></td>
<td><input type="text" name="items[{{ $i }}][quantity]" class="form-control input_number item-qty" value="{{ $item->quantity }}"></td>
<td><input type="text" name="items[{{ $i }}][unit]" class="form-control" value="{{ $item->unit }}"></td>
<td><input type="text" name="items[{{ $i }}][customs_value]" class="form-control input_number item-value" value="{{ $item->customs_value }}"></td>
<td><input type="text" name="items[{{ $i }}][duty_rate]" class="form-control input_number item-duty" value="{{ $item->duty_rate }}"></td>
<td><input type="text" name="items[{{ $i }}][vat_rate]" class="form-control input_number item-vat" value="{{ $item->vat_rate }}"></td>
<td><button type="button" class="btn btn-xs btn-danger remove-customs-item"><i class="fa fa-trash"></i></button></td>
</tr>
@empty
<tr class="customs-item-row">
<td><input type="text" name="items[0][description]" class="form-control"></td>
<td><input type="text" name="items[0][hs_code]" class="form-control"></td>
<td><input type="text" name="items[0][quantity]" class="form-control input_number item-qty" value="1"></td>
<td><input type="text" name="items[0][unit]" class="form-control"></td>
<td><input type="text" name="items[0][customs_value]" class="form-control input_number item-value" value="0"></td>
<td><input type="text" name="items[0][duty_rate]" class="form-control input_number item-duty" value="0"></td>
<td><input type="text" name="items[0][vat_rate]" class="form-control input_number item-vat" value="0"></td>
<td><button type="button" class="btn btn-xs btn-danger remove-customs-item"><i class="fa fa-trash"></i></button></td>
</tr>
@endforelse
</tbody>
</table>
</div>
<button type="button" class="btn btn-default btn-sm" id="add_customs_item"><i class="fa fa-plus"></i> @lang('tms::lang.add_item')</button>
<div class="form-group" style="margin-top:15px;">
{!! Form::label('notes', __('tms::lang.notes').':') !!}
{!! Form::textarea('notes', $clearance->notes ?? null, ['class'=>'form-control','rows'=>2]) !!}
</div>