%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/calling_code/resources/views/backend/pages/calling/
Upload File :
Create Path :
Current File : /home/silvzytp/calling_code/resources/views/backend/pages/calling/import-list.blade.php

@extends('layouts.backend')
@section('title', $siteTitle)
@section('action')
@if(Auth::user()->role->slug != 'agent')
<div class="d-flex align-items center">
    <button class="btn btn-sm btn-secondary import-calling mr-1"><i class="ti-plus fs-ism"></i> Import</button>
</div>
@endif
@endsection
@push('styles')
<style>
    .import-file {
        width: 100%;
        border: 1px dotted #ccc;
        padding: 20px;
        text-align: center;
        margin-bottom: 0;
    }
    label[for="all_checked"]::before {
        border-color: #fff !important;
    }
</style>
@endpush

@section('content')

    <div class="row">
        <div class="col-12">
            @if (Auth::user()->role->slug != 'agent')
                <div class="card mb-3">
                    <div class="card-header">
                        <h6 class="card-title">Filter</h6>
                    </div>
                    <div class="card-body">
                        <form method="POST">
                            <div class="row">
                                <div class="col-md-2">
                                    <select name="agent" class="form-control">
                                        <option value="">-- Select Agent --</option>
                                        @foreach ($agents as $agent)
                                        <option value="{{ $agent->id }}">{{ $agent->name }}</option>
                                        @endforeach
                                    </select>
                                </div>

                                <div class="col-md-2">
                                    <select class="form-control" name="status" onchange="select_status(this.value)">
                                        <option value="">-- Select Status --</option>
                                        @forelse ($statuses as $status)
                                            <option value="{{ $status->id }}">{{ $status->name }}</option>
                                        @empty

                                        @endforelse
                                    </select>
                                </div>

                                <div class="col-md-2">
                                    <select class="form-control" name="sub_status">
                                        <option value="">-- Select Sub Status --</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <select class="form-control" name="potential">
                                        <option value="">-- Select Potential --</option>
                                        @foreach (POTENTIAL as $key=>$value)
                                        <option value="{{ $key }}">{{ $value }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <input type="text" class="form-control" required id="date_range" placeholder="MM/DD/YY" autocomplete="off" autofocus>
                                    <input type="hidden" name="start_date">
                                    <input type="hidden" name="end_date">
                                </div>
                                <div class="col-md-2 text-right">
                                    <button type="button" id="filter-btn" class="btn btn-md btn-primary"><i class="fas fa-search"></i></button>
                                    <button type="button" id="filter-reset" class="btn btn-md btn-warning"><i class="fas fa-sync-alt"></i></button>
                                </div>
                            </div>
                            <div class="row mt-3">
                                <div class="col-6">
                                    <div class="d-flex align-items-center">
                                        <label class="mb-0" style="min-width: 100px">Call Date</label>
                                        <input type="text" class="form-control" name="call_date" id="call_date_range" placeholder="MM/DD/YY" autocomplete="off" autofocus>
                                        <input type="hidden" name="call_start_date">
                                        <input type="hidden" name="call_end_date">
                                    </div>
                                </div>
                                <div class="col-6">
                                    <input type="text" class="form-control" name="search" placeholder="File name search here...">
                                </div>
                            </div>
                            <div class="row mt-3">
                                <div class="col-6">
                                    <select class="form-control" name="assign_select">
                                        <option value="">-- Select Please --</option>
                                        <option value="1">Assign</option>
                                        <option value="2">Unassign</option>
                                    </select>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            @endif

            <div id="bulk-card" class="d-none">
                <form method="POST" id="bulk-form">
                    @csrf
                    <div class="d-flex align-items-center mb-3">
                        <x-form.selectbox name="operation" divClass="mb-0">
                            <option value="">-- Select --</option>
                            @permission('app.callings.delete')
                            <option value="delete">Delete</option>
                            @endpermission
                            @permission('app.callings.assign')
                            <option value="assign">Assign</option>
                            @endpermission
                            @permission('app.callings.reject')
                            <option value="soft">Move to Lead Pool</option>
                            @endpermission
                        </x-form.selectbox>

                        @permission('app.callings.assign')
                        @if ($agents->isNotEmpty())
                            <x-form.selectbox name="managers" divClass="mb-0 ml-2 manager-list d-none">
                                <option value="">-- Select Agent --</option>
                                @foreach ($agents as $value)
                                    <option value="{{ $value->id }}">{{ $value->name }}</option>
                                @endforeach
                            </x-form.selectbox>
                        @endif
                        @endpermission


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

            <div class="card">
                <div class="card-body px-0">
                    <div class="table-responsive">
                        <table class="table table-sm table-bordered table-style" id="calling-datatables">
                            <thead>
                                <tr class="bg-primary text-light">
                                    <th>
                                        <div class="custom-control custom-checkbox">
                                            <input type="checkbox" class="custom-control-input" id="all_checked">
                                            <label class="custom-control-label" for="all_checked"></label>
                                        </div>
                                    </th>
                                    <th>File Name</th>
                                    <th>Date</th>
                                    <th>Agent</th>
                                    <th>Serial</th>
                                    <th>Name</th>
                                    <th>Email</th>
                                    <th>Phone</th>
                                    <th>Number 1</th>
                                    <th>Number 2</th>
                                    <th>Status</th>
                                    <th>Sub Status</th>
                                    <th>Potential</th>
                                    <th>Time Of Call</th>
                                    <th>Comment</th>
                                    <th>Follow up 1</th>
                                    <th>Follow up 2</th>
                                    <th>Follow up 3</th>
                                    <th class="text-right">Action</th>
                                </tr>
                            </thead>
                            <tbody>

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

    @include('backend.modal.import')
    @include('backend.modal.calling-modal')
    @include('backend.pages.calling.export')
@endsection

@push('scripts')
    <script>
        table = $('#calling-datatables').DataTable({
            processing: true,
            serverSide: true,
            autoWidth: false,
            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: 10, //number of data show per page
            ajax: {
                url: "{{ route('app.import.callings.get-data') }}",
                type: "GET",
                dataType: "JSON",
                data: function(d) {
                    d._token = _token;
                    d.status = $('select[name="status"]').val();
                    d.sub_status = $('select[name="sub_status"]').val();
                    d.agent = $('select[name="agent"]').val();
                    d.potential = $('select[name="potential"]').val();
                    d.start_date = $('input[name="start_date"]').val();
                    d.end_date   = $('input[name="end_date"]').val();
                    d.call_start_date = $('input[name="call_start_date"]').val();
                    d.call_end_date   = $('input[name="call_end_date"]').val();
                    d.search_text = $('input[name="search"]').val();
                    d.assign_agent_data = $('select[name="assign_select"]').val();
                },
            },
            columns: [
                {data: 'bulk_check',orderable: false, searchable: true},
                {data: 'file_name'},
                {data: 'date'},
                {data: 'agent'},
                {data: 'serial'},
                {data: 'name'},
                {data: 'email'},
                {data: 'phone'},
                {data: 'number_1'},
                {data: 'number_2'},
                {data: 'status'},
                {data: 'sub_status'},
                {data: 'potential'},
                {data: 'time_of_call'},
                {data: 'comment'},
                {data: 'follow_up1'},
                {data: 'follow_up2'},
                {data: 'follow_up3'},
                {data: 'action', orderable: false, searchable: false},
            ],
            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_"
            },
            @permission('app.calling.export')
            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);
                        }
                    },
                    {
                        text: '<i class="fa fa-file-excel-o" aria-hidden="true"></i> Export',
                        className: 'export_data btn btn-sm btn-primary'
                    }
                ]
            }
            @endpermission
        });

        // deletable btn
        $(document).on('click', 'button.confirm-deletable-action', function(){
            // modal data
            let data_id = $('#deletable-modal input.datatable').val();
            const url = "{{ route(routeName().'.callings.destroy') }}";

            deletable_action(data_id,url); // define function
        });

        // user bulk operation
        $(document).on('click', 'button.bulk-deletable-action', function(){
            var data_id = $('#deletable-modal input.datatable').val();
            var operation_type = $('#deletable-modal .modal-body input.operation-type').val();
            const url = "{{ route(routeName().'.callings.bulk-operation') }}";
            var assign_user = $('#deletable-modal .modal-body input.manager-select').val();
            bulk_deletable_action(data_id,operation_type,assign_user,url);
        });


        // operation assign manager
        $(document).on('change','select[name="operation"]', function(){
            let selected_value = $(this).val();
            if (selected_value == 'assign') {
                $('.manager-list').removeClass('d-none');
            }else{
                $('.manager-list').addClass('d-none');
            }
        });

        $(document).on('click', 'button.import-calling', function(){
            $('form#import-form-submit')[0].reset();
            $('#import-modal').modal({
                backdrop: 'static',
                keyboard: false
            });
        });

        $(document).on('submit', 'form#import-form-submit', function(e){
            e.preventDefault()
            $.ajax({
                type: "POST",
                url: "{{ route(routeName().'.callings.import') }}",
                data: new FormData(this),
                processData: false,
                contentType: false,
                dataType: "JSON",
                beforeSend: function(){
                    $('.modal-loader').removeClass('d-none');
                },
                complete: function(){
                    $('.modal-loader').addClass('d-none');
                },
                success: function (response) {
                    if (response.status == 'success') {
                        $('#import-modal').modal('hide');
                        table.draw();
                        flashMessage(response.status,response.message);
                    }else{
                        flashMessage(response.status,response.message);
                    }
                }
            });
        });

        function select_status(status){
            $.ajax({
                type: "POST",
                url: "{{ route(routeName().'.callings.status.get-data') }}",
                data: {_token:_token,status:status},
                dataType: "JSON",
                success: function (response) {
                    $('select[name="sub_status"]').html('');
                    if (response) {
                        $('select[name="sub_status"]').html(response);
                    }
                }
            });
        }

        // sub status get
        function export_select_status(status){
            $.ajax({
                type: "POST",
                url: "{{ route(routeName().'.callings.status.get-data') }}",
                data: {_token:_token,status:status},
                dataType: "JSON",
                success: function (response) {
                    $('select[name="export_sub_status"]').html('');
                    if (response) {
                        $('select[name="export_sub_status"]').html(response);
                    }
                }
            });
        }
        
        $(document).on('click', 'button#filter-btn',function(){
            table.ajax.reload();
        });

        $(document).on('click', 'button#filter-reset',function(){
            $('form')[0].reset();
            table.ajax.reload();
        });

        

        // datepicker
        $('input#date_range').daterangepicker({
            opens: 'right',
            autoUpdateInput: false,
            locale: {
                cancelLabel: 'Clear'
            },
            ranges: {
                'Today'       : [moment(), moment()],
                'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                'This Month'  : [moment().startOf('month'), moment().endOf('month')],
                'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
            }
        }, function(start, end, label) {
            $('input[name="start_date"]').val(start.format('YYYY-MM-DD'));
            $('input[name="end_date"]').val(end.format('YYYY-MM-DD'));
        });

        $('input#date_range').on('apply.daterangepicker', function(ev, picker) {
            $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
        });

        $('input#date_range').on('cancel.daterangepicker', function(ev, picker) {
            $(this).val('');
        });

        // call datepicker
        $('input#call_date_range').daterangepicker({
            opens: 'right',
            autoUpdateInput: false,
            locale: {
                cancelLabel: 'Clear'
            },
            ranges: {
                'Today'       : [moment(), moment()],
                'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                'This Month'  : [moment().startOf('month'), moment().endOf('month')],
                'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
            }
        }, function(start, end, label) {
            $('input[name="call_start_date"]').val(start.format('YYYY-MM-DD'));
            $('input[name="call_end_date"]').val(end.format('YYYY-MM-DD'));
        });

        $('input#call_date_range').on('apply.daterangepicker', function(ev, picker) {
            $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
        });

        $('input#call_date_range').on('cancel.daterangepicker', function(ev, picker) {
            $(this).val('');
        });


        $(document).on('click', 'button.data-view', function(){
            var data_id = $(this).data('id');
            var type_name = $(this).data('type');
            var content = $(this).data('content');
            var serial = $(this).data('serial');
            $('#calling-single-modal .modal-title').text(type_name+' ('+serial+')');
            $('#calling-single-modal .content').text(content == '' ? type_name +' is empty!' : content);
            $('#calling-single-modal').modal({
                keyboard: false,
                backdrop: 'static'
            });
        });

        $(document).on('click', 'button.data-time-view', function(){
            var serial = $(this).data('serial');
            var data_time = $(this).data('time');
            $('#calling-single-modal .modal-title').text(serial);
            $('#calling-single-modal .content').html(data_time);
            $('#calling-single-modal').modal({
                keyboard: false,
                backdrop: 'static'
            });
        });

        $(document).on('click', 'button#btn-time-data', function(){
            $('.modal-title').text('Time Of Call');
            $('.content > p').text('');
            var data_id = $(this).data('id');
            $.ajax({
                type: "POST",
                url: "{{ route(routeName().'.callings.time') }}",
                data: {
                    _token:_token,
                    data_id:data_id
                },
                dataType: "JSON",
                success: function (response) {
                    $('#calling-data').html('');
                    if (response) {
                        $('#calling-data').append(response)
                        $('#calling-single-modal').modal({
                            keyboard: false,
                            backdrop: 'static'
                        });
                    }
                }
            });
        });

        // modal
        $(document).on('click', 'button.export_data', function(){
            $('form#export_form')[0].reset();
            $('#export-modal').modal({
                keyboard: false,
                dackdrop: 'static'
            })
        });
    </script>
@endpush

Zerion Mini Shell 1.0