@extends(branchMenu())
@section('content')
    <?php Fun::lang()?>
    <div class="page">
        <div class=container-fluid>
            <div class="top-content">
                <div class="row">
                    <div class="col-sm-12 col-xs-12">
                        <div class="title-add">
                            <div class="pull-left">
                                <h3>{{__('administrator.tailor_stock')}}</h3>
                            </div>
                        </div>
                    </div>
                </div>
                <form class="row form_data">
                    <div class="col-sm-12 col-xs-12">
                        <div class="col-lg-3">
                            <span>{{__('administrator.tailor')}}</span>
                            {!! Form::select('tailor_id',\App\Model\people\TailorModel::pluck('name','id'),null,['class'=>'form-control ','placeholder'=>__('administrator.please_select')]) !!}
                        </div>
                        <div class="col-lg-3">
                            <span>{{__('administrator.packer')}}</span>
                            {!! Form::select('packer_id',\App\Model\setup\PackerModel::pluck('name','id'),null,['class'=>'form-control ','placeholder'=>__('administrator.please_select')]) !!}
                        </div>
                        <div class="col-lg-3">
                            <span>{{__('administrator.type')}}</span>
                            {!! Form::select('type',\App\Model\production\TailorStockPaymentModel::pluck('type','type'),null,['class'=>'form-control ','placeholder'=>__('administrator.please_select')]) !!}
                        </div>
                        <div class="col-lg-3">
                            <span>{{__('administrator.product')}}</span>
                            {!! Form::select('product_id',[],null,['class'=>'form-control search_product','placeholder'=>__('administrator.please_select')]) !!}
                        </div>
                    </div>
                </form>
            </div>
            <div class="wrapper-table">
                <table id="datatable" class="table table-striped table-hover ">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>{{__('administrator.reference_number')}}</th>
                        <th>{{__('administrator.tailor')}} / {{__('administrator.packer')}}</th>
                        <th>{{__('administrator.type')}}</th>
                        <th>{{__('administrator.product')}}</th>
                        <th>{{__('administrator.stock_qty')}}</th>
                        <th>{{__('administrator.price')}}</th>
                        <th>{{__('administrator.payable_amount')}}</th>
                    </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
        </div>
    </div>
 @endsection
@section('script')
    <script type="text/javascript">
        let $table = $('#datatable');
        $(document).ready(function () {
            getTable();
            $(".form_data").on('change','select',function () {
                getTable();
            })
        });
        function getTable() {
            $table.DataTable().destroy();
            $table.DataTable({
                ordering: false,
                serverSide: true,
                lengthMenu: tbLeng,
                ajax: "?"+$(".form_data").serialize(),
                columns:
                    [
                        {data: 'DT_RowIndex', searchable:false,'orderable':false},
                        {data: 'model_id', searchable:false},
                        {data: 'tailor_id', searchable:false},
                        {data: 'type', searchable:false},
                        {data: 'product_id', searchable:false},
                        {data: 'stock_qty', searchable:false},
                        {data: 'price', searchable:false},
                        {data: 'payable_amount', searchable:false},
                    ],

            });

        }
    </script>
@stop



