@extends('layouts/base_view')
@section('title')
{!! $variables['header_routes'] !!}
@endsection
@section('content')
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card card-outline card-warning">
                    <div class="card-header">
                        <div class="d-flex flex-wrap align-items-center">
                            @include('layouts.partials.excel_upload_buttons', ['module' => 'shipment_deliveries'])
                            <a href="{{ route('shipment_deliveries.create') }}" class="btn btn-sm btn-warning mb-2 mb-md-0 button-cek-permission" data-permission="shipment_deliveries.create">
                                <i class="fas fa-plus"></i><span class="d-none d-sm-inline ml-1">Tambah Pengiriman</span>
                            </a>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table id="dataTable" class="table table-bordered table-striped table-hover table-sm">
                                <thead class="bg-warning">
                                    <tr>
                                        <th width="5%">No</th>
                                        <th width="15%">Store</th>
                                        <th width="12%">Tipe Armada</th>
                                        <th width="8%">Tipe</th>
                                        <th width="10%">Hari</th>
                                        <th width="10%">Kedatangan</th>
                                        <th width="10%">Keberangkatan</th>
                                        <th width="8%">H-Minus</th>
                                        <th width="8%">Status</th>
                                        <th width="14%">Dibuat</th>
                                    </tr>
                                </thead>
                                <tbody></tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<script>
    $(document).ready(function() {
        $('#dataTable').DataTable({
            processing: true,
            serverSide: true,
            ajax: {
                url: "{{ route('shipment_deliveries.index') }}",
                type: "GET"
            },
            columns: [{
                    data: 0,
                    name: 'no',
                    orderable: false,
                    searchable: false
                },
                {
                    data: 1,
                    name: 'store_id'
                },
                {
                    data: 2,
                    name: 'armada_type_id'
                },
                {
                    data: 3,
                    name: 'type'
                },
                {
                    data: 4,
                    name: 'day_name'
                },
                {
                    data: 5,
                    name: 'arrival_time'
                },
                {
                    data: 6,
                    name: 'departure_time'
                },
                {
                    data: 7,
                    name: 'h_minus'
                },
                {
                    data: 8,
                    name: 'status'
                },
                {
                    data: 9,
                    name: 'created_at'
                }
            ],
            order: [
                [9, 'desc']
            ],
            pageLength: 25,
            responsive: false,
            language: {
                processing: "Memuat...",
                search: "Cari:",
                lengthMenu: "Tampilkan _MENU_ data",
                info: "Menampilkan _START_ sampai _END_ dari _TOTAL_ data",
                infoEmpty: "Menampilkan 0 sampai 0 dari 0 data",
                infoFiltered: "(difilter dari _MAX_ total data)",
                paginate: {
                    first: "Pertama",
                    last: "Terakhir",
                    next: "Selanjutnya",
                    previous: "Sebelumnya"
                },
                emptyTable: "Tidak ada data tersedia",
                zeroRecords: "Tidak ada data yang cocok"
            }
        });
    });
</script>

@include('layouts.partials.excel_upload_modal', [
    'module' => 'shipment_deliveries',
    'title' => 'Jadwal Pengiriman',
    'uploadRoute' => route('shipment_deliveries.upload_excel'),
    'downloadRoute' => route('shipment_deliveries.download_template')
])

@endsection