
<?php $__env->startSection('contentSection'); ?>
    <div class="row">
        <div class="col-lg-6">
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="card-title font-weight-bold">Basic Information</div>
                            <hr class="mt-0">
                            <p><strong>Reference Number: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->reference_number); ?></span></p>
                            <p><strong>Title: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->title ? : 'N/A'); ?></span></p>
                            <p><strong>Name: </strong><span class="font-weight-normal"><?php echo e($lead->name ? : 'N/A'); ?></span>
                            </p>
                            <p><strong>Phone: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->phone ? : 'N/A'); ?></span></p>
                            <p><strong>Email: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->email ? : 'N/A'); ?></span></p>
                            <p><strong>Property Type: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->property_type ? $lead->property_type->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Lead Status: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->lead_status ? $lead->lead_status->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Lead Type: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->lead_type ? $lead->lead_type->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Lead Category: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->lead_category ? $lead->lead_category->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Lead Primary Source: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->lead_primary_source ? $lead->lead_primary_source->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Lead Interest Level: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->lead_interest_level ? $lead->lead_interest_level->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Assigned To: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->assignee ? $lead->assignee->name : 'N/A'); ?></span>
                            </p>
                            <p><strong>Additional info: </strong><span
                                    class="font-weight-normal"><?php echo e($lead->description ? : 'N/A'); ?></span></p>
                            <div class="row">
                                <div class="col-xs-12 col-lg-12 text-right">
                                    <button data-id="<?php echo e($lead->id); ?>" type="button" class="btn btn-secondary edit-btn"><i
                                            class="fa fa-edit fa-lg"></i> Edit
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="card-title font-weight-bold">Lead Status</div>
                            <hr class="mt-0">
                            <div class="row">
                                <div class="col-xs-12 col-lg-12">
                                    <select data-type="Status" data-column="lead_status_id" data-id="<?php echo e($lead->id); ?>"
                                            class="form-control update_lead_status">
                                        <option value="">Select Lead 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 <?php echo e($lead->lead_status && $lead->lead_status->id == $attr->id ? 'selected' : ''); ?> value="<?php echo e($attr->id); ?>">
                                                <?php echo e($attr->name); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="card-title font-weight-bold">Lead Category</div>
                            <hr class="mt-0">
                            <div class="row">
                                <div class="col-xs-12 col-lg-12">
                                    <select data-type="Category" data-column="lead_category_id" data-id="<?php echo e($lead->id); ?>"
                                            class="form-control update_lead_status">
                                        <option value="">Select Lead 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 <?php echo e($lead->lead_category && $lead->lead_category->id == $attr->id ? 'selected' : ''); ?> value="<?php echo e($attr->id); ?>">
                                                <?php echo e($attr->name); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="card-title font-weight-bold">Move to Contact</div>
                            <hr class="mt-0">
                            <div class="row">
                                <div class="col-xs-12 col-lg-12">
                                    <?php if($lead->converted_to): ?>
                                        <p>Already moved</p>
                                    <?php else: ?>
                                        <button data-type="Contacts" data-id="<?php echo e($lead->id); ?>" type="button"
                                                class="btn btn-warning convert-btn"><i
                                                class="fa fa-exchange fa-lg"></i> Move to Contact
                                        </button>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-6">
            <div class="card">
                <div class="card-header">
                    <div class="card-title font-weight-bold">Lead Logs</div>
                    <hr class="mt-0">
                    <table id="logs-table"
                           class="table table-striped table-hover table-bordered"
                           style="width:100%">
                        <thead>
                        <tr>
                            <th>Log</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php $__currentLoopData = $lead->logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><?php echo e($log->message); ?> by <?php echo e($log->user->name); ?></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="card">
                <div class="card-header">
                    <div class="card-title font-weight-bold">Lead Notes</div>
                    <hr class="mt-0">
                    <div class="row mb-3">
                        <div class="col-md-12">
                            <form action="<?php echo e(route('save-lead-note')); ?>" method="post">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" value="<?php echo e($lead->id); ?>" name="lead_id" />
                                <textarea required minlength="3" maxlength="1000" name="note" cols="30" rows="2"
                                          class="form-control content_area"></textarea>
                                <button type="submit" class="btn btn-primary pull-right mt-3"><i class="fa fa-plus"></i> Add Note</button>
                            </form>
                        </div>
                    </div>
                    <table id="notes-table"
                           class="table table-striped table-hover table-bordered"
                           style="width:100%">
                        <thead>
                        <tr>
                            <th>Note</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php $__currentLoopData = $lead->notes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $note): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><?php echo $note->note; ?></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('pageSpecificScripts'); ?>
    <?php echo $__env->make('admin.leads.modals.editLeadModal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <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/summernote/dist/summernote-bs4.min.js')); ?>"></script>
    <script src="<?php echo e(asset('back_assets/assets/js/app/leadsScript.js')); ?>?<?php echo e(app_version()); ?>"></script>
    <script type="text/javascript">
        $('.content_area').summernote({
            onCreateLink: function (originalLink) {
                return originalLink; // return original link
            },
            dialogsInBody: true,
            height: 100,
            tabsize: 2
        });
        $('#logs-table').DataTable({
            "ordering": false,
            "searching": false,
            "lengthMenu": [[5, 10, 50], [5, 10, 50]],
            "pageLength": 5,
        });
        $('#notes-table').DataTable({
            "ordering": false,
            "lengthMenu": [[5, 10, 50], [5, 10, 50]],
            "pageLength": 5,
        });
    </script>
    <?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/leads/leadDetails.blade.php ENDPATH**/ ?>