 @extends('adminlte::page') @section('content')
<?php Fun::lang()?>
    <div class="title-page">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                <li><a href="#">Supplier</a></li>
                <li><a href="#">Supplier List</a></li>
            </ul>
        </div>
    </div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-page">
                        <div class="pull-left">
                            <h3>Supplier List</h3>
                        </div>
                    </div>
                    @can('Supplier-Create')
                    <div class="pull-right">
                        <a class="button_sm button_primary" href="{{ route('supplier.create') }}"><span class="fa fa-plus"></span>  Create New</a>
                    </div>
                    @endcan
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12 col-xs-12">
                <div class="box-body table-responsive">
                    <table id="datatable_users" class="table table-striped table-bordered table-hover nowrap">
                        <thead>
                            <tr>
                                <th>No</th>
                                <th>Supplier Code</th>
                                <th>Supplier Name</th>
                                <th>Contact Person</th>
                                <th>Phone Number</th>
                                <th>E-mail</th>
                                <th>Company Number</th>
                                <th>Total Balance</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    @endsection
    @section('js')
    <script type="text/javascript">
        $(document).ready(function() {
            $('.main-spinner').show();
            $('#datatable_users').DataTable({
                ordering: false,    
                "serverSide": true,
                "lengthMenu": [[20, 30, 50, 100,-1], [20, 30, 50, 100,'all']],
                ajax: "{{ route('datatable.get_product_supplier') }}",
                columns: 
                    [
                        {data: 'DT_RowIndex'}, 
                        {data: 'supplier_code'},
                        {data: 'supplier_name'},
                        {data: 'contact_person'},
                        {data: 'phone_number'},
                        {data: 'email'},
                        {data: 'mobile_number'},
                        {data: 'total_balance'},
                        {data: 'action'},
                    ]

            });

            $.fn.dataTable.ext.errMode = 'throw';
        });
    </script>
    @endsection