
<?php $__env->startSection('contentSection'); ?>
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <div class="pull-left"><i class="fa fa-table"></i> Calling Database (<span
                            id="module_total_count"></span>)
                    </div>
                    <div class="pull-right">
                        <form action="<?php echo e(route('export-cds')); ?>" method="get">
                            <button style="display: none" id="deleteAllBtn" type="button" class="btn btn-danger"><i
                                    class="fa fa-trash"></i> Delete Selected
                            </button>
                            <button data-toggle="modal" data-target="#cdBulkModal" style="display: none"
                                    id="bulkActionsBtn"
                                    type="button" class="btn btn-primary"><i
                                    class="fa fa-pencil"></i> Bulk Actions
                            </button>
                            
                            
                            
                            
                            <button type="button" data-toggle="modal" data-target="#uploadFileModal"
                                    class="btn btn-primary"><i
                                    class="fa fa-upload"></i> Upload
                            </button>
                            <a target="_blank" href="<?php echo e(asset('assets/files/sample.xlsx')); ?>"
                               class="btn btn-primary"><i
                                    class="fa fa-download"></i> Download Sample
                            </a>
                            <?php if(auth()->user()->type == 1): ?>
                                <button type="submit"
                                        class="btn btn-primary"><i
                                        class="fa fa-download"></i> Export Data
                                </button>
                            <?php endif; ?>
                        </form>
                    </div>
                </div>
                <div class="card-header">
                    <div class="row">
                        <div class="col-md-3 form-group">
                            <i class="fa fa-filter"></i> Filters
                        </div>
                    </div>
                    <form id="cdSearchFrom">
                        <div class="row">
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            <div class="col-md-3 form-group">
                                <label class="control-label">Status</label>
                                <select data-live-search="true" multiple name="cd_status_search[]" id="cd_status_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Status</option>
                                    <?php $__currentLoopData = App\Models\Attribute::orderBy('name')->where('type', 'leadStatus')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($attr->id); ?>">
                                            <?php echo e($attr->name); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Category</label>
                                <select data-live-search="true" multiple name="cd_category_search[]"
                                        id="cd_category_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Category</option>
                                    <?php $__currentLoopData = App\Models\Attribute::orderBy('name')->where('type', 'leadCategory')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($attr->id); ?>">
                                            <?php echo e($attr->name); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <?php if(auth()->user()->type == 1 || auth()->user()->type == 2): ?>
                                <div class="col-md-3 form-group">
                                    <label class="control-label">Assign To</label>
                                    <select data-live-search="true" multiple name="at_search[]" id="at_search"
                                            class="form-control selectpicker show-tick">
                                        <option value="">Select User</option>
                                        <?php if(auth()->user()->type == 1): ?>
                                            <?php $__currentLoopData = App\Models\User::orderBy('name')->where('type', 3)->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($attr->id); ?>">
                                                    <?php echo e($attr->name); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php else: ?>
                                            <?php $__currentLoopData = App\Models\User::orderBy('name')->where('parent_id', auth()->id())->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($attr->id); ?>">
                                                    <?php echo e($attr->name); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endif; ?>
                                    </select>
                                </div>
                            <?php endif; ?>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Assign Status</label>
                                <select name="assign_search"
                                        class="form-control">
                                    <option value="">Select Assign Status</option>
                                    <option value="1">Assigned</option>
                                    <option value="2">Un Assigned</option>
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Property Type</label>
                                <select name="pt_search"
                                        class="form-control">
                                    <option value="">Select Property Type</option>
                                    <?php $__currentLoopData = auth()->user()->calling_databases()->orderBy('property_type')->groupBy('property_type')->pluck('property_type')->toArray(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($pt); ?>"><?php echo e($pt); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Country</label>
                                <select name="country_search"
                                        class="form-control">
                                    <option value="">Select Country</option>
                                    <?php $__currentLoopData = \App\Models\Country::all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($country->dial_code); ?>"><?php echo e($country->title); ?> (<?php echo e($country->dial_code); ?>)
                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Reference From</label>
                                <input onkeypress="return onlyNumberKey(event)" type="text" maxlength="10"
                                       class="form-control" name="from_search">
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Reference To</label>
                                <input onkeypress="return onlyNumberKey(event)" type="text" maxlength="10"
                                       class="form-control" name="to_search">
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-md-12 text-right">
                                <button class="btn btn-primary">Search</button>
                                <button type="reset" id="cdSearchFormReset" class="btn btn-primary">Reset</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="callingDatabaseListTable" class="table table-bordered" style="width: 100%"></table>
                    </div>
                </div>
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('pageSpecificScripts'); ?>
    
    <?php echo $__env->make('admin.callingDatabase.modals.editCallingDatabaseModal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.callingDatabase.modals.uploadFileModal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.callingDatabase.modals.detailsModal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.callingDatabase.detailsTemplate', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.callingDatabase.modals.cdBulkModal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <script src="<?php echo e(asset('back_assets/assets/plugins/summernote/dist/summernote-bs4.min.js')); ?>"></script>
    <script src="<?php echo e(asset('back_assets/assets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('back_assets/assets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js')); ?>"></script>
    <script src="<?php echo e(asset('back_assets/assets/plugins/bootstrap-select/js/bootstrap-select.min.js')); ?>"></script>
    <script src="<?php echo e(asset('back_assets/assets/plugins/alerts-boxes/js/sweetalert.min.js')); ?>"></script>
    <script type="text/javascript" src="<?php echo e(asset('assets/js/ajax-bs.js')); ?>"></script>
    <script>
        var customCheckBox = '<div class="icheck-material-primary f_custom_checkbox" style="pointer-events: none"><input type="checkbox" id="bulk-action-checkbox" class="select_all" /><label for="bulk-action-checkbox"></label></div>';
    </script>
    <?php if(auth()->user()->type == 1 || auth()->user()->type == 3): ?>
        <?php echo $__env->make('admin.callingDatabase.callingDatabaseListTemplate', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <script type="text/javascript">
            var allColumns = [
                {
                    "orderable": true,
                    "searchable": false,
                    "data": 'created_at',
                    "visible": false
                },
                {"orderable": false, "searchable": false, "data": null, "title": customCheckBox},
                {
                    "data": "reference_number",
                    "title": "Ref.",
                    "name": "reference_number",
                    "searchable": true,
                    "orderable": false
                },
                {"data": "name", "title": "Name", "name": "name", "searchable": true, "orderable": false},
                {"data": "email", "title": "Email", "name": "email", "searchable": true, "orderable": false},
                {"data": "phone", "title": "Phone", "name": "phone", "searchable": true, "orderable": false},
                {"data": "unit_no", "title": "Unit No.", "name": "unit_no", "searchable": true, "orderable": false},
                {"data": "tower", "title": "Tower", "name": "tower", "searchable": true, "orderable": false},
                {"data": "district", "title": "Area", "name": "district", "searchable": true, "orderable": false},
                {"data": "city", "title": "City", "name": "city", "searchable": true, "orderable": false},
                {
                    "data": "property_type",
                    "title": "Property Type",
                    "name": "property_type",
                    "searchable": true,
                    "orderable": false
                },
                {
                    "data": "assignee",
                    "title": "Assigned To",
                    "name": "assignee.name",
                    "searchable": false,
                    "orderable": false
                },
                {
                    "data": "cd_status",
                    "title": "Status",
                    "name": "cd_status.name",
                    "searchable": false,
                    "orderable": false
                },
                {
                    "data": "cd_category",
                    "title": "Category",
                    "name": "cd_category.name",
                    "searchable": false,
                    "orderable": false
                },
                {
                    "data": null,
                    "title": "Actions",
                    "searchable": false,
                    "orderable": false
                }
            ];
        </script>
    <?php else: ?>
        <?php echo $__env->make('admin.callingDatabase.callingDatabaseListAgentTemplate', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <script type="text/javascript">
            var allColumns = [
                {
                    "orderable": true,
                    "searchable": false,
                    "data": 'created_at',
                    "visible": false
                },
                {"orderable": false, "searchable": false, "data": null, "title": customCheckBox},
                {
                    "data": "reference_number",
                    "title": "Ref.",
                    "name": "reference_number",
                    "searchable": true,
                    "orderable": false
                },
                {"data": "name", "title": "Name", "name": "name", "searchable": true, "orderable": false},
                {"data": "email", "title": "Email", "name": "email", "searchable": true, "orderable": false},
                {"data": "phone", "title": "Phone", "name": "phone", "searchable": true, "orderable": false},
                {"data": "unit_no", "title": "Unit No.", "name": "unit_no", "searchable": true, "orderable": false},
                {"data": "tower", "title": "Tower", "name": "tower", "searchable": true, "orderable": false},
                {"data": "district", "title": "Area", "name": "district", "searchable": true, "orderable": false},
                {"data": "city", "title": "City", "name": "city", "searchable": true, "orderable": false},
                {
                    "data": "property_type",
                    "title": "Property Type",
                    "name": "property_type",
                    "searchable": true,
                    "orderable": false
                },
                {
                    "data": "cd_status",
                    "title": "Status",
                    "name": "cd_status.name",
                    "searchable": false,
                    "orderable": false
                },
                {
                    "data": "cd_category",
                    "title": "Category",
                    "name": "cd_category.name",
                    "searchable": false,
                    "orderable": false
                },
                {
                    "data": null,
                    "title": "Actions",
                    "searchable": false,
                    "orderable": false
                }
            ];
        </script>
    <?php endif; ?>
    <script>
        function onlyNumberKey(evt) {
            var ASCIICode = (evt.which) ? evt.which : evt.keyCode
            return !(ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57));
        }
    </script>
    <script src="<?php echo e(asset('back_assets/assets/js/app/callingDatabaseScript.js')); ?>?<?php echo e(app_version()); ?>"></script>
    <?php if(Session::has('errors')): ?>
        <script type="text/javascript">
            swal({
                html: "true",
                title: "",
                text: "<ul style='text-align: left;list-style: disc;margin-left: 0;'><?php $__currentLoopData = Session::get('errors'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <li><?php echo e($error); ?></li> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></ul>",
                type: "error"
            }, function () {
                $('#uploadFileModal').modal('show')
            });
        </script>
    <?php endif; ?>
    <?php if(Session::has('success')): ?>
        <script type="text/javascript">
            swal({
                title: "",
                text: '<?php echo e(Session::get('success')); ?>',
                type: "success"
            });
        </script>
    <?php endif; ?>
    <?php if(Session::has('bsuccess')): ?>
        <script type="text/javascript">
            swal({
                title: "",
                text: '<?php echo e(Session::get('bsuccess')); ?>',
                type: "success"
            });
        </script>
    <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\xampp\htdocs\propco\resources\views/admin/callingDatabase/callingDatabase.blade.php ENDPATH**/ ?>