@extends('template.app')



@section('meta') @endsection

@section('title') Transfer Report @endsection



@section('styles')

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">

<link href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" rel="stylesheet">

<link rel="stylesheet" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css">

<style>

    table {

        font-family: Arial, sans-serif;

        border-collapse: collapse;

        width: 100%;

    }



    td, th {

        border: 1px solid #dddddd;

        text-align: left;

        padding: 8px;

    }



    /*tr:nth-child(even) {*/

    /*    background-color: #313762;*/

    /*}*/



    div.dataTables_wrapper div.dataTables_filter label {

        font-weight: normal;

        white-space: nowrap;

        margin-left: auto;

        margin-right: auto;

    }



    .table-responsive {

        overflow-x: auto;

        max-width: 100%;

    }

    /* Commented by Kerav */

    /*.card-body {

        overflow-x: auto;

        max-width: 100%;

        margin-right: 40px;

        margin-left: 40px;

    }



    .card-header {

        margin-right: 40px;

        margin-left: 40px;

    }


    .card.mt-4, .card {

        margin: 20px 40px;

    }*/

    /* Commented by Kerav */



    .dataTables_wrapper {

        width: 100%;

        max-width: 100%;

        overflow-x: auto;

    }

</style>

@endsection



@section('content')

<div class="page-breadcrumb">

    <div class="row">

        <div class="col-7 align-self-center">

            <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Transfer Report</h4>

            <div class="d-flex align-items-center">

                <nav aria-label="breadcrumb">

                    <ol class="breadcrumb m-0 p-0">

                        <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('allReport') }}" class="text-muted">Mis Report</a></li>
                        <li class="breadcrumb-item text-muted active" aria-current="page">Transfer Report</li>

                    </ol>

                </nav>

            </div>

        </div>

        <div class="col-5 align-self-center">

            <div class="customize-input float-right">

                <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">

                    Export

                </button>

            </div>

        </div>

        <div class="col-sm-8"></div>

        <div class="col-sm-4">

            <div class="col-md-12 align-self-center collapse" id="collapseExample">

                <div class="customize-input float-right">

                    <form action="{{ route('transferExport') }}" method="get">

                        @csrf

                        <div class="row">

                            <div class="form-group col-md-6">

                                <select name="slug" class="form-control" required>

                                    <option value="">Select Status</option>

                                    <option value="all">All</option>

                                </select>

                            </div>

                            <div class="form-group col-md-6">

                                <button class="btn btn-primary" type="submit">Submit</button>

                            </div>

                        </div>

                    </form>

                </div>

            </div>

        </div>

    </div>

</div>



<div class="container-fluid">

  <div class="row">

        <div class="col-12">

            <div class="card">

                <div class="card-body table-responsive" id="datatable" style="text-align: center;">

                    <table class="table table-bordered data-table tables" id="data-table" cellspacing="0" width="100%">

                        <thead>

                            <tr>

                                <th>No</th>

                                <th>From Branch</th>

                                <th>To Branch</th>

                                <th>Car Model</th>

                                <th>Car Varient</th>

                                <th>VIN Number</th>

                                <th>Driver Name</th>

                                <th>Driver License Number</th>

                                <th>Driver Pan Number</th>

                                <th>Transfer Remark</th>

                                <th>Tool Kit</th>

                                <th>Health Kit</th>

                                <th>Spare Bulb</th>

                                <th>Harzard Triangle</th>

                                <th>Received vehicle in good condition</th>

                            </tr>

                            <tr class="filterrow">

                                <th></th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="from_branch" value="{{ request()->get('from_branch', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="1" id="from_branch">

                                        </div>

                                    </div>

                                </th>



                                <th>

                                    <div class="search-box-container datatable-form-filter width_250">

                                        <div class="form-group is-empty">

                                            <input type="text" name="to_branch" value="{{ request()->get('to_branch', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="2" id="to_branch">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="cm_name" value="{{ request()->get('cm_name', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="3" id="cm_name">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="cv_name" value="{{ request()->get('cv_name', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="4" id="cv_name">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="vin_number" value="{{ request()->get('vin_number', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="5" id="vin_number">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="d_name" value="{{ request()->get('d_name', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="6" id="d_name">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="d_lic" value="{{ request()->get('d_lic', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="7" id="d_lic">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_250">

                                        <div class="form-group is-empty">

                                            <input type="text" name="d_pan" value="{{ request()->get('d_pan', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="8" id="d_pan">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="remark" value="{{ request()->get('remark', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="9" id="remark">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="tolkit" value="{{ request()->get('tolkit', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="10" id="tolkit">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="medkit" value="{{ request()->get('medkit', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="11" id="medkit">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="sparbulb" value="{{ request()->get('sparbulb', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="12" id="sparbulb">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="hzdtringle" value="{{ request()->get('hzdtringle', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="13" id="hzdtringle">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="gudcondition" value="{{ request()->get('gudcondition', '') }}" class="form-control text-capitalize custom_color" autocomplete="off" autofocus tabindex="14" id="gudcondition">

                                        </div>

                                    </div>

                                </th>

                            </tr>

                        </thead>

                    </table>

                </div>

            </div>

        </div>

@endsection



@section('scripts')

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>

<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

<script src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.min.js"></script>

<script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />

<script src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>



<script type="text/javascript">

    $.ajaxSetup({

        headers: {

            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

        }

    });

</script>

<script type="text/javascript">

    $(document).ready(function() {

        let rowCount = $("table tbody tr").length;

        if (rowCount < 3) {

            $(".table").css("height", "600px");

        }



        $('.js-example-basic-single').select2();



        var tableColumns = [

            {data: 'id', name: 'id' ,title: 'No.'},

            { data: 'from_branch', name: 'from_branch' },

            { data: 'to_branch', name: 'to_branch' },

            { data: 'cm_name', name: 'cm_name' },  

            { data: 'cv_name', name: 'cv_name' },

            { data: 'vin_number', name: 'vin_number' },

            { data: 'd_name', name: 'd_name' },

            { data: 'd_lic', name: 'd_lic' },

            { data: 'd_pan', name: 'd_pan' },

            { data: 'remark', name: 'remark' },

            { data: 'tolkit', name: 'tolkit' },

            { data: 'medkit', name: 'medkit' },

            { data: 'sparbulb', name: 'sparbulb' },

            { data: 'hzdtringle', name: 'hzdtringle' },

            { data: 'gudcondition', name: 'gudcondition' },

        ];



        (function(window, $) {

            window.LaravelDataTables = window.LaravelDataTables || {};

            window.LaravelDataTables["dataTableBuilder"] = $("#data-table").DataTable({

                processing: true,

                serverSide: true,

                language: {

                    "info": "_START_ - _END_ of _TOTAL_",

                    "lengthMenu": "_MENU_ ",

                    "infoFiltered": ""

                },

                // scrollY: '400px',

                scrollCollapse: true,

                paging: true,

                searching: false,



                bSortCellsTop : true,

                ajax: {

                    url: '{!! route("getTransfer") !!}',

                    method: "POST",

                    data: function (d) {

                        d.from_branch = jQuery(".datatable-form-filter input[name='from_branch']").val();

                        d.to_branch = jQuery(".datatable-form-filter input[name='to_branch']").val();

                        d.cm_name = jQuery(".datatable-form-filter input[name='cm_name']").val();

                        d.cv_name = jQuery(".datatable-form-filter input[name='cv_name']").val();

                        d.vin_number = jQuery(".datatable-form-filter input[name='vin_number']").val();

                        d.d_name = jQuery(".datatable-form-filter input[name='d_name']").val();

                        d.d_lic = jQuery(".datatable-form-filter input[name='d_lic']").val();

                        d.d_pan = jQuery(".datatable-form-filter input[name='d_pan']").val();

                        d.remark = jQuery(".datatable-form-filter input[name='remark']").val();

                        d.tolkit = jQuery(".datatable-form-filter input[name='tolkit']").val();

                        d.medkit = jQuery(".datatable-form-filter input[name='medkit']").val();

                        d.sparbulb = jQuery(".datatable-form-filter input[name='sparbulb']").val();

                        d.hzdtringle = jQuery(".datatable-form-filter input[name='hzdtringle']").val();

                        d.gudcondition = jQuery(".datatable-form-filter input[name='gudcondition']").val();

                    },

                    error : function(d) {}

                },

                columns: tableColumns,

                lengthMenu: [

                    [25, 50,100, -1 ],['25', '50','100', 'Show all' ]

                ],

                order: [ [0,'ASC'] ],

                responsive: true,

                colReorder:{

                    enable: false,

                },

                dom: '<"top"f>rt<"bottom"ipl><"clear">',

                fnInitComplete: function(settings, json) {

                    jQuery('table.table input:checkbox').map(function() {

                        if(jQuery(this).prop("checked") != true){

                            var column = table.column( jQuery(this).attr('data-column') );

                            column.visible(false);

                        }

                    });

                },

                pageLength: 25,

            });

        })(window, jQuery);



        $("#min").flatpickr({ onSelect: function () { window.LaravelDataTables["dataTableBuilder"].draw(); }, changeMonth: true, changeYear: true });



        $(document).on("change", "#min", function () {

            window.LaravelDataTables["dataTableBuilder"].draw();

        });







    jQuery('.datatable-form-filter input').on('keyup', function (e) {

        if(jQuery(this).val().length >= 3 || e.keyCode == 13 || !jQuery(this).val()) {

            window.LaravelDataTables["dataTableBuilder"].draw();

            e.preventDefault();

        }

    });



    jQuery('.datatable-form-filter select').on('change', function (e) {

        window.LaravelDataTables["dataTableBuilder"].draw();

        e.preventDefault();

    });



    jQuery('input:checkbox[name="name_sort_asc"],input:checkbox[name="name_sort_desc"]').on('click', function (e) {

        window.LaravelDataTables["dataTableBuilder"].draw();

        e.preventDefault();

    });

}); 

</script>

@endsection