@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">
                    <div class="card-header">
                        <div class="d-flex flex-wrap align-items-center">
                            <a href="{{ route('item_requests.create') }}" class="btn btn-sm btn-warning mb-2 mb-md-0 button-cek-permission" data-permission="item_requests.create">
                                <i class="fas fa-plus"></i><span class="d-none d-sm-inline ml-1">Tambah SPB Non-Regular</span>
                            </a>
                            <small class="text-muted ml-3">
                                <i class="fas fa-info-circle"></i> SPB Regular dibuat otomatis dari module Stock Opname
                            </small>
                        </div>
                    </div>
                    <div class="card-body">
                        <table id="id_data_table" class="table table-hover table-sm">
                            <thead class="bg-warning">
                                <tr>
                                    <th width="5%">No</th>
                                    <th>Nomor SPB</th>
                                    <th>Store</th>
                                    <th>Tipe</th>
                                    <th>Tanggal Permintaan</th>
                                    <th>Tanggal Pengiriman</th>
                                    <th>Status</th>
                                    <th>Dibuat</th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<form action="" id="delete-form" method="post">
    @method('delete')
    @csrf
</form>
<script>
    $(function() {
        $('#id_data_table').DataTable({
            processing: true,
            serverSide: true,
            ajax: '{{ route("item_requests.index") }}',
            columns: [{
                    data: 0,
                    name: 'no',
                    orderable: false,
                    searchable: false
                },
                {
                    data: 1,
                    name: 'spb_number'
                },
                {
                    data: 2,
                    name: 'store_id'
                },
                {
                    data: 3,
                    name: 'request_type'
                },
                {
                    data: 4,
                    name: 'request_date'
                },
                {
                    data: 5,
                    name: 'delivery_date'
                },
                {
                    data: 6,
                    name: 'status'
                },
                {
                    data: 7,
                    name: 'created_at'
                }
            ],
            "responsive": false,
            "lengthChange": true,
            "autoWidth": false,
            //"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"],
            drawCallback: function(settings) {
                $('[data-toggle="tooltip"]').tooltip();
            }
        }).buttons().container().appendTo('#id_data_table_wrapper .col-md-6:eq(0)');
    });
</script>
@endsection