Untitled

 avatar
unknown
php
2 years ago
11 kB
1
Indexable
@extends('layouts.default')

@section('title')

@endsection

@section('header-style')
    <!--Load custom style link or css-->
@endsection
@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card showFilter" style="display: none">
                <!-- Table Start -->
                <div class="head_title">WareHouse</div>
                <div class="card-body">

                    <form action="" method="post" id="search-form">
                        @csrf
                        <div class="row">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="required">WareHouse Type</label>
                                    <input class="form-control" type="hidden" name="req_dept_id" id="req_dept_id" value="{{isset(Auth()->user()->employee->dpt_department_id) ? Auth()->user()->employee->dpt_department_id : ''}}">
                                    <select class="form-control select2" name="requisition_type_id" id="requisition_type_id">
                                        <option value="">Select Requisition Type</option>
                                        @foreach($requisition_type as $requisition_types)
                                            <option value="{{$requisition_types->store_requisition_type_id}}" {{old('requisition_type_id',$data->store_requisition_type_id) == $requisition_types->store_requisition_type_id ? 'selected' : ''}}>{{$requisition_types->store_requisition_type_name}}</option>
                                        @endforeach
                                    </select>
                                    <span class="text-danger">{{ $errors->first('requisition_type_id') }}</span>

                                    {{--                                    @if(Auth()->user()->employee->dpt_department_id != 6)--}}
                                    {{--                                        @php--}}
                                    {{--                                            $singleDepart = App\Helpers\HelperClass::singledepart(Auth()->user()->employee->dpt_department_id);--}}
                                    {{--                                        @endphp--}}

                                    {{--                                        <input class="form-control" type="hidden" name="req_dept_id" id="req_dept_id" value="{{isset($singleDepart[0]->department_id) ? $singleDepart[0]->department_id : ''}}">--}}
                                    {{--                                        <input class="form-control" type="text" name="department_name"  value="{{isset($singleDepart[0]->department_name) ? $singleDepart[0]->department_name : ''}}" readonly>--}}
                                    {{--                                    @else--}}

                                    {{--                                    <select class="form-control select2" name="req_dept_id" id="req_dept_id" @if($data->submit_yn == 'Y' || $data->approval_status_id == 3)  disabled @endif>--}}
                                    {{--                                        <option value="">Select one</option>--}}
                                    {{--                                        @foreach($departments as $department)--}}
                                    {{--                                            <option value="{{$department->department_id}}" @if(isset($data->req_dept_id) && $data->req_dept_id == $department->department_id) selected @else @if(Auth()->user()->employee->dpt_department_id == $department->department_id) selected @endif @endif--}}
                                    {{--                                                >{{$department->department_name}}</option>--}}
                                    {{--                                        @endforeach--}}
                                    {{--                                    </select>--}}
                                    {{--                                    @endif--}}
                                    {{--                                    <span class="text-danger">{{ $errors->first('req_dept_id') }}</span>--}}
                                </div>
                            </div>
                            <div class="col-md-3">
                                <label class="">Requisition Start Date</label>
                                <div class="input-group date datePiker">
                                    <input type="text"
                                           autocomplete="off"
                                           class="form-control datetimepicker-input"
                                           data-toggle="datetimepicker"
                                           id="srn_date"
                                           data-target="#srn_date"
                                           name="srn_date"
                                           placeholder="{{\App\Helpers\HelperClass::dateFormat()}}"
                                    >
                                    <div class="input-group-append" data-target="#srn_date"  data-toggle="datetimepicker">
                                        <div class="input-group-text"><i class="bx bxs-calendar"></i></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <label class="">Requisition End Date</label>
                                <div class="input-group date datePiker">
                                    <input type="text"
                                           autocomplete="off"
                                           class="form-control datetimepicker-input"
                                           data-toggle="datetimepicker"
                                           id="srn_end_date"
                                           data-target="#srn_end_date"
                                           name="srn_end_date"
                                           placeholder="{{\App\Helpers\HelperClass::dateFormat()}}"
                                    >
                                    <div class="input-group-append" data-target="#srn_end_date"  data-toggle="datetimepicker">
                                        <div class="input-group-text"><i class="bx bxs-calendar"></i></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <label class="">Status</label>
                                <select class="form-control" name="status" id="status">
                                    <option value="">Select One</option>
                                    @foreach($status as $status_approval)
                                        <option value="{{$status_approval->approval_status_id}}">{{$status_approval->status}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="row mt-3">
                            <div class="col-md-12 text-right" id="add">
                                <button type="submit" id="submit"
                                        class="btn btn btn-dark shadow mr-1 mb-1 btn-info"> <i class="bx bx-search-alt"></i> Search
                                </button>
                                <button type="reset" id="reset"
                                        class="btn btn btn-outline shadow mb-1 btn-danger"><i class="bx bx-sync"></i> Reset
                                </button>
                            </div>
                        </div>

                    </form>
                </div>

            </div>
            @include('cims.warehouse.warehouse-transfer.list')
        </div>
    </div>
@endsection

@section('footer-script')
    <script type="text/javascript">
        datetimepickerInit('#srn_date');
        datetimepickerInit('#srn_end_date');
        function requisitionList() {
            let oTable =   $('.dataTable').DataTable({
                processing: true,
                serverSide: true,
                lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "Show All"]],
                ajax: {
                    url: "{{route('warehouse.warehouse-transfer-datatable-list')}}",
                    type:'POST', headers:{  'X-CSRF-TOKEN': '{{ csrf_token() }}' },
                    data: function (d) {
                        d.req_dept_id = $('#req_dept_id').val();
                        d.srn_date = $('input[name=srn_date]').val();
                        d.srn_end_date = $('input[name=srn_end_date]').val();
                        d.requisition_type_id = $('#requisition_type_id').val();
                        d.status = $('#status').val();
                    }
                },
                columns: [
                    {"data": 'DT_RowIndex', "name": 'DT_RowIndex', searchable: true},
                    {data: 'srn_date', name: 'srn_date', searchable: true},
                    {data: 'srn_number', name: 'srn_number', searchable: true},
                    {data: 'req_dept_name', name: 'req_dept_name', searchable: true},
                    {data: 'store', name: 'store', searchable: true},
                    // {data: 'issued_yn', name: 'issued_yn', searchable: true, class:"text-center"},
                    {data: 'submitted_yn', name: 'submitted_yn', searchable: true, class:"text-center"},
                    {data: 'status', name: 'status', searchable: true, class:"text-center"},
                    {data: 'action', name: 'action', searchable: false,class:"text-left"},
                ]
            });
            $('#search-form').on('submit', function (e) {
                oTable.draw();
                e.preventDefault();
            });
        };

        $(document).ready(function() {
            requisitionList();
        });
        function isNumber(evt) {
            evt = (evt) ? evt : window.event;
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
                return false;

            return true;
        }
        $('#request_emp_id').select2({
            minimumInputLength: 1,
            dropdownPosition: 'below',
            ajax: {
                url: '{{route('searchEmpByCodeName')}}',
                dataType: 'json',
                delay: 250,
                data: function (params) {
                    return {
                        emp_name: params.term
                    };
                },
                processResults: function (data) {
                    return {
                        results: $.map(data.results, function (obj) {
                            return {
                                id: obj.id,
                                text: obj.emp_name + '-' + obj.emp_code,
                                department: obj.department
                            };
                        })
                    };
                },
                cache: false
            },

        });

    </script>

@endsection
Editor is loading...