%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/dsr_code/resources/views/global/compare/
Upload File :
Create Path :
Current File : //home/silvzytp/dsr_code/resources/views/global/compare/index.blade.php

@extends('layouts.backend')
@section('title', $siteTitle)

@push('styles')
<style>
    .table-style tbody tr:not(.odd) td:last-child {
        text-align: center;
    }
</style>
@endpush

@section('content')

<div class="row">
    <div class="col-12">
        <div id="bulk-box" class="d-none">
            <form method="GET" action="{{ route(routeName().'.compare.data') }}">
                <div class="d-flex align-items-center mb-3">
                    <input type="hidden" name="manager_id">
                    <x-form.selectbox name="compare" divClass="mb-0">
                        <option value="compare">Compare</option>
                    </x-form.selectbox>

                    <div class="bulk-applys">
                        <button class="btn btn-md btn-primary rounded-0 ml-2 px-3" type="submit">Apply</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="col-12">
        <div class="ibox">
            <div class="ibox-body px-0">
                <table class="table table-sm w-100 table-borderless table-style" id="compare-datatables">
                    <thead>
                        <th>
                            <label class="ui-checkbox">
                                <input type="checkbox" id="checked-all">
                                <span class="input-span"></span>
                            </label>
                        </th>
                        <th>Profile</th>
                        <th>Full Name</th>
                        <th>Date</th>
                        <th>Sale Target</th>
                        <th>Sale Achieved</th>
                        <th>Sale Deficit</th>
                        <th>Revenue Target</th>
                        <th>Revenue Achieved</th>
                        <th class="{{ Auth::user()->role->slug == 'admin' ? '' : 'text-right' }}">Revenue Deficit</th>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

@endsection

@push('scripts')
<script>
    table = $('#compare-datatables').DataTable({
        processing: true,
        serverSide: true,
        order: [], //Initial no order
        bInfo: true, //TO show the total number of data
        bFilter: false, //For datatable default search box show/hide
        responsive: true,
        ordering: false,
        lengthMenu: [
            [5, 10, 15, 25, 50, 100, 1000, 10000, -1],
            [5, 10, 15, 25, 50, 100, 1000, 10000, "All"]
        ],
        pageLength: 25, //number of data show per page
        ajax: {
            url: "{{ $url }}",
            type: "POST",
            dataType: "JSON",
            data: function(d) {
                d._token     = _token;
            },
        },
        columns: [
            {data: 'bulk_check',orderable: false, searchable: false},
            {data: 'profile'},
            {data: 'name'},
            {data: 'created_at'},
            {data: 's_target'},
            {data: 's_achived'},
            {data: 's_deifict'},
            {data: 'a_target'},
            {data: 'a_achived'},
            {data: 'a_deifict'}
        ],
        language: {
            processing: '<img src="{{ asset("uploads/images/table-loading.svg") }}">',
            emptyTable: '<strong class="text-danger">No Data Found</strong>',
            infoEmpty: '',
            zeroRecords: '<strong class="text-danger">No Data Found</strong>',
            oPaginate: {
                sPrevious: "Previous", // This is the link to the previous page
                sNext: "Next", // This is the link to the next page
            },
            lengthMenu: "_MENU_"
        },
        dom: "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6' <'float-right pr-15'B>>>" +
        "<'row'<'col-sm-12'tr>>" +
        "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'<'float-right pr-15'p>>>",
        buttons: {
            buttons: [
                {
                    text: '<i class="fa fa-refresh" aria-hidden="true"></i> Reload',
                    className: 'btn btn-sm btn-primary',
                    action: function (e, dt, node, config) {
                        dt.ajax.reload(null, false);
                    }
                },
                {
                    extend: 'pdf',
                    filename: 'compare_{{ date("d_m_d") }}',
                    title: 'Compare Manager List',
                    text: '<i class="fa fa-file-pdf-o" aria-hidden="true"></i> PDF',
                    orientation: "portrait",
                    pageSize: "A4",
                    className: 'pdfButton btn btn-sm btn-primary',
                    exportOptions: {
                        columns: '2,3,4,5,6,7,8'
                    },
                },
                {
                    extend: 'excel',
                    filename: 'compare_{{ date("d-m-Y") }}',
                    title: 'Compare Manager List',
                    text: '<i class="fa fa-file-excel-o" aria-hidden="true"></i> Excel',
                    className: 'excelButton btn btn-sm btn-primary',
                    exportOptions: {
                        columns: '2,3,4,5,6,7,8'
                    },
                },
                {
                    extend: 'print',
                    text: '<i class="fa fa-print" aria-hidden="true"></i> Print',
                    className: 'printButton btn btn-sm btn-primary',
                    exportOptions: {
                        columns: '2,3,4,5,6,7,8'
                    },
                }
            ]
        }
    });

    //******************* Bulk main check box on click ****************//
    $(document).on('click', 'input#checked-all', function(){
        if(this.checked){
            $('input[name="checked_data"]').each(function(){
                this.checked = true;
            });
        }else{
            $('input[name="checked_data"]').each(function(){
                this.checked = false;
            });
        }

        bulk_manager_compare();
    });

    //******************* Bulk main check box length check ****************//
    $(document).on('change', 'input[name="checked_data"]', function(){
        if($('input[name="checked_data"]').length == $('input[name="checked_data"]:checked').length){
        $('input#checked-all').prop('checked', true);
        }else{
            $('input#checked-all').prop('checked', false);
        }
        bulk_manager_compare();
    });

    //******************* Bulk action button show and hide  ****************//
    function bulk_manager_compare(){
        if($('input[name="checked_data"]:checked').length > 0){
            $('#bulk-box').removeClass('d-none');

            let bulk_data_id = [];
            $('input[name="checked_data"]:checked').each(function(){
                bulk_data_id.push($(this).val())
            });

            $('input[name="manager_id"]').val(bulk_data_id);

        }else{
            $('#bulk-box').addClass('d-none');
            $('input[name="manager_id"]').val('');
            $('#deletable-modal .modal-body input.operation-type').val('');
        }
    }
</script>
@endpush

Zerion Mini Shell 1.0