%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/crm-dub-code/resources/views/backend/modules/fresh/
Upload File :
Create Path :
Current File : /home/silvzytp/crm-dub-code/resources/views/backend/modules/fresh/lead-pool.blade.php

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

@push('styles')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.17/css/intlTelInput.css" />
<style>
    label[for="all_checked"]::before{
        border-color: #ffffff !important;
    }
    .table:not(.table-dark) thead th,
    .table:not(.table-dark) tfoot th,
    .table:not(.table-dark) td,
    .table:not(.table-dark) th {
        padding: 0.3em 1em !important;
    }
    .table thead th {
        vertical-align: middle !important;
    }
    .filter-row-bg{
        background: #0c2e66d1;
    }
    td input, td select {
        height: 24px;
        padding: 3px 5px;
        border: 0;
        width: 100%
    }
    input:focus,
    select:focus{
        outline: none;
    }
    ul{
        list-style: none;
    }
    .col-form-label{
        font-size: 12px !important;
    }
    .text-sm{
        font-size: 14px !important;
    }
    .contact-ul li{
        margin-bottom: 5px;
    }
    .v-scroll {
        width: 100%;
        max-height: 350px;
        height: 350px;
        overflow-y: auto;
    }
    .comment-form textarea{
        height: 40px;
        width: 100%;
        border: 1px solid #ddd;
        overflow: hidden;
    }
    textarea:focus{
        outline: none;
    }
    .comment-form button {
        border: 0;
        width: 40px;
        color: #fff;
        height: 40px;
        text-align: center;
    }
    input[type="tel"] {
        height: 32px;
        width: 100%;
        border: 1px solid #dddddd !important;
        border-radius: 2px;
    }
    .iti.iti--allow-dropdown {
        width: 100%;
    }
    tbody tr td a{
        min-height: 30px;
        display: block;
        line-height: 30px;
    }
</style>
@endpush

@section('content')
    <div class="row mt-3">
        <div class="col-12">
            <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>
                            <option value="delete">Delete</option>
                            <option value="assign">Assign Agent</option>
                        </x-form.selectbox>

                        <x-form.selectbox name="assign_agent" divClass="mb-0 ml-2 agent-list d-none">
                            <option value="">-- Select --</option>
                            @foreach ($agents as $agent)
                            <option value="{{ $agent->id }}">{{ $agent->name }}</option>
                            @endforeach
                        </x-form.selectbox>

                        <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-hover table-style" id="fresh-datatables">
                            <thead>
                                <tr class="bg-primary text-light">
                                    @permission('app.fresh-lead.bulk-operation')
                                    <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>
                                    @endpermission
                                    <th style="min-width: 90px">Ref</th>
                                    <th style="min-width: 130px">Campaign Name</th>
                                    <th style="min-width: 150px">Date</th>
                                    <th style="min-width: 100px">Agent</th>
                                    <th style="min-width: 130px">Name</th>
                                    @if(Auth::user()->role->slug != 'manager')
                                    <th style="min-width: 150px">Email</th>
                                    <th style="min-width: 100px">Phone</th>
                                    <th style="min-width: 100px">Number 1</th>
                                    <th style="min-width: 100px">Number 2</th>
                                    @endif
                                    <th style="min-width: 120px">Lead Type</th>
                                    <th style="min-width: 120px">Hot Link</th>
                                    <th style="min-width: 120px">Status</th>
                                    <th style="min-width: 140px">Sub Status</th>
                                    <th style="min-width: 140px">Category</th>
                                    <th style="min-width: 140px">Channel</th>
                                    <th style="min-width: 140px">Emirate</th>
                                    <th style="min-width: 140px">Source</th>
                                    <th style="min-width: 140px">Location</th>
                                    <th style="min-width: 140px">Sub Location</th>
                                    <th style="min-width: 120px">Potential</th>
                                    <th class="text-right" style="min-width: 60px">Action</th>
                                </tr>
                                <tr class="filter-row-bg text-light">
                                    @permission('app.fresh-lead.bulk-operation')
                                    <td></td>
                                    @endpermission
                                    <td>
                                        <input type="text" name="filter_reference_id">
                                    </td>

                                    <td>
                                        <select name="filter_campaign">
                                            <option value="">-- Select --</option>
                                            @foreach ($campaigns as $campaign)
                                            <option value="{{ $campaign->id }}">{{ $campaign->name }}</option>
                                            @endforeach
                                        </select>
                                    </td>
                                    <td>
                                        <input type="input" placeholder="YY-MM-DD" autocomplete="off" id="date_range">
                                        <input type="hidden" name="start_date">
                                        <input type="hidden" name="end_date">
                                    </td>
                                    <td>
                                        <select name="filter_agent">
                                            <option value="">-- Select --</option>
                                            @forelse ($agents as $agent)
                                            <option value="{{ $agent->id }}">{{ $agent->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <input type="text" name="filter_name">
                                    </td>
                                    @if(Auth::user()->role->slug != 'manager')
                                    <td>
                                        <input type="email" name="filter_email">
                                    </td>
                                    <td>
                                        <input type="text" name="filter_phone">
                                    </td>
                                    <td>
                                        <input type="text" name="filter_number">
                                    </td>
                                    <td>
                                        <input type="text" name="filter_number2">
                                    </td>
                                    @endif
                                    <td>
                                        <select name="filter_lead_type">
                                            <option value="">-- Select --</option>
                                            @forelse ($leadTypes as $leadType)
                                            <option value="{{ $leadType->id }}">{{ $leadType->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_hot_link">
                                            <option value="">-- Select --</option>
                                            @forelse (HOT_LINK as $key=>$value)
                                            <option value="{{ $key }}">{{ $value }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_status" onchange="filterSubStatus(this.value)">
                                            <option value="">-- Select --</option>
                                            @forelse ($statuses as $status)
                                            <option value="{{ $status->id }}">{{ $status->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_sub_status">
                                            <option value="">-- Select --</option>
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_category">
                                            <option value="">-- Select --</option>
                                            @forelse ($categories as $category)
                                            <option value="{{ $category->id }}">{{ $category->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_channel">
                                            <option value="">-- Select --</option>
                                            @forelse ($channels as $channel)
                                            <option value="{{ $channel->id }}">{{ $channel->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_emirate">
                                            <option value="">-- Select --</option>
                                            @forelse ($emirates as $emirate)
                                            <option value="{{ $emirate->id }}">{{ $emirate->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_source">
                                            <option value="">-- Select --</option>
                                            @forelse ($sources as $source)
                                            <option value="{{ $source->id }}">{{ $source->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_location" onchange="filterSubLocation(this.value)">
                                            <option value="">-- Select --</option>
                                            @forelse ($locations as $location)
                                            <option value="{{ $location->id }}">{{ $location->name }}</option>
                                            @empty

                                            @endforelse
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_sub_location">
                                            <option value="">-- Select --</option>
                                        </select>
                                    </td>
                                    <td>
                                        <select name="filter_potential">
                                            <option value="">-- Select --</option>
                                            @foreach (POTENTIAL as $key=>$value)
                                                <option value="{{ $key }}">{{ $value }}</option>
                                            @endforeach
                                        </select>
                                    </td>
                                    <td></td>
                                </tr>
                            </thead>
                            <tbody>

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

    @include('backend.modal.calling-modal')
@endsection

@push('scripts')
    <script>
        var calling_id = $('input[name="calling_id"]').val();

        table = $('#fresh-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: false,
            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(routeName().'.fresh-lead.lead-pool') }}",
                type: "GET",
                dataType: "JSON",
                data: function(d) {
                    d._token       = _token;
                    d.reference    = $('input[name="filter_reference_id"]').val();
                    d.campaign     = $('select[name="filter_campaign"]').val();
                    d.start_date   = $('input[name="start_date"]').val();
                    d.end_date     = $('input[name="end_date"]').val();
                    d.agent        = $('select[name="filter_agent"]').val();
                    d.name         = $('input[name="filter_name"]').val();
                    d.email        = $('input[name="filter_email"]').val();
                    d.phone        = $('input[name="filter_phone"]').val();
                    d.number1      = $('input[name="filter_number1"]').val();
                    d.number2      = $('input[name="filter_number2"]').val();
                    d.lead_type    = $('select[name="filter_lead_type"]').val();
                    d.hot_link     = $('select[name="filter_hot_link"]').val();
                    d.status       = $('select[name="filter_status"]').val();
                    d.sub_status   = $('select[name="filter_sub_status"]').val();
                    d.category     = $('select[name="filter_category"]').val();
                    d.channel      = $('select[name="filter_channel"]').val();
                    d.emirate      = $('select[name="filter_emirate"]').val();
                    d.source       = $('select[name="filter_source"]').val();
                    d.location     = $('select[name="filter_location"]').val();
                    d.sub_location = $('select[name="filter_sub_location"]').val();
                    d.potential    = $('select[name="filter_potential"]').val();
                },
            },
            columns: [
                @permission('app.fresh-lead.bulk-operation')
                {data: 'bulk_check',orderable: false, searchable: true},
                @endpermission
                {data: 'reference_id'},
                {data: 'campaign_name'},
                {data: 'enquiry_date'},
                {data: 'agent'},
                {data: 'name'},
                @if(Auth::user()->role->slug != 'manager')
                {data: 'email'},
                {data: 'phone'},
                {data: 'number_1'},
                {data: 'number_2'},
                @endif
                {data: 'lead_type'},
                {data: 'hot_link'},
                {data: 'status'},
                {data: 'sub_status'},
                {data: 'category'},
                {data: 'channel'},
                {data: 'emirate'},
                {data: 'source'},
                {data: 'location'},
                {data: 'sub_location'},
                {data: 'potential'},
                {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_"
            }
        });

        $(document).on('keyup keypress', '.filter-row-bg td input', function(){
            table.ajax.reload();
        });

        $(document).on('change', '.filter-row-bg td select', function(){
            table.ajax.reload();
        });

        // deletable btn
        $(document).on('click', 'button.confirm-deletable-action', function(){
            // modal data
            let data_id = $('#deletable-modal input.datatable').val();
            const url = "{{ route(routeName().'.fresh-lead.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().'.fresh-lead.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') {
                $('.agent-list').removeClass('d-none');
            }else{
                $('.agent-list').addClass('d-none');
            }
        });

        // 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'));
            table.ajax.reload();
        });

        $('input#date_range').on('cancel.daterangepicker', function(ev, picker) {
            $(this).val('');
            $('input[name="start_date"]').val('');
            $('input[name="end_date"]').val('');
            table.ajax.reload();
        });


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

        // filter sub location get
        function filterSubLocation(location_id){
            $.ajax({
                type: "POST",
                url: "{{ route(routeName().'.locations.sub-location.get') }}",
                data: {_token:_token,location:location_id},
                dataType: "JSON",
                success: function (response) {
                    $('select[name="filter_sub_location"]').html('');
                    if (response) {
                        $('select[name="filter_sub_location"]').html(response);
                    }
                }
            });
        }

    </script>
@endpush

Zerion Mini Shell 1.0