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

63 lines
3.0 KiB
PHP

@extends('layouts.app')
@section('title', __('tms::lang.customs'))
@section('content')
@include('tms::layouts.nav')
<section class="content no-print mt-page">
<div class="mt-page-header">
<h1><i class="fas fa-passport" style="color:#3b82f6;margin-left:8px;"></i> @lang('tms::lang.customs')</h1>
@can('tms.customs.create')
<a href="{{ action([\Modules\Tms\Http\Controllers\CustomsClearanceController::class,'create']) }}" class="mt-btn-primary btn"><i class="fa fa-plus"></i> @lang('tms::lang.add')</a>
@endcan
</div>
<div class="mt-card"><div class="mt-card-body table-responsive">
<div class="row" style="margin-bottom:12px;">
<div class="col-md-3">
{!! Form::select('filter_status', [''=>__('tms::lang.all')] + $statuses, null, ['class'=>'form-control','id'=>'customs_filter_status']) !!}
</div>
<div class="col-md-3">
{!! Form::select('filter_type', [''=>__('tms::lang.all')] + $types, null, ['class'=>'form-control','id'=>'customs_filter_type']) !!}
</div>
</div>
<table class="table table-bordered table-striped" id="tms_customs_table" style="width:100%">
<thead><tr>
<th>@lang('tms::lang.ref_no')</th>
<th>@lang('tms::lang.customs_type')</th>
<th>@lang('tms::lang.status')</th>
<th>@lang('tms::lang.contact')</th>
<th>@lang('tms::lang.broker')</th>
<th>@lang('tms::lang.shipment')</th>
<th>@lang('tms::lang.total_duties')</th>
<th>@lang('tms::lang.action')</th>
</tr></thead>
</table>
</div></div>
</section>
@endsection
@section('javascript')
<script>
$(function(){
var table=$('#tms_customs_table').DataTable({
processing:true,serverSide:true,
ajax:{url:'{{ action([\Modules\Tms\Http\Controllers\CustomsClearanceController::class,"index"]) }}',data:function(d){
d.status=$('#customs_filter_status').val();
d.clearance_type=$('#customs_filter_type').val();
}},
columns:[
{data:'ref_no'},{data:'clearance_type'},{data:'status'},{data:'contact_name',orderable:false},
{data:'broker_name',orderable:false},{data:'shipment_ref',orderable:false},{data:'total_duties'},{data:'action',orderable:false,searchable:false}
]
});
$('#customs_filter_status, #customs_filter_type').on('change',function(){table.ajax.reload();});
$(document).on('click','.delete_tms_customs',function(){
var url=$(this).data('href');
swal({title:LANG.sure,icon:'warning',buttons:true,dangerMode:true}).then(function(ok){
if(!ok)return;
$.ajax({method:'DELETE',url:url,data:{_token:'{{ csrf_token() }}'},dataType:'json',success:function(r){
if(r.success){toastr.success(r.msg);if(r.redirect)window.location=r.redirect;else table.ajax.reload();}
}});
});
});
});
</script>
@endsection