<?php $__env->startSection('page_title'); ?>
    <?php echo e($lead->title); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('css'); ?>
    <style>
        .modal-container .modal-header {
            border: 0;
        }

        .modal-container .modal-body {
            padding: 0;
        }

        .content-container .content .page-header {
            margin-bottom: 30px;
        }
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content-wrapper'); ?>

    <div class="content full-page">

        <?php echo view_render_event('admin.leads.view.header.before', ['lead' => $lead]); ?>


        <div class="page-header">

            <?php echo e(Breadcrumbs::render('leads.view', $lead)); ?>


            <div class="page-title">
                <h1>
                    <?php echo e($lead->title); ?>


                    <?php echo $__env->make('admin::leads.view.tags', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                </h1>
            </div>

            <div class="page-action">
                <button class="btn btn-primary btn-md" @click="openModal('updateLeadModal')"><?php echo e(__('admin::app.leads.edit')); ?></button>
            </div>
        </div>

        <?php echo view_render_event('admin.leads.view.header.after', ['lead' => $lead]); ?>



        <?php echo view_render_event('admin.leads.view.informations.before', ['lead' => $lead]); ?>


        <div class="page-content lead-view">

            <div class="lead-content-left">
                <?php echo view_render_event('admin.leads.view.informations.details.before', ['lead' => $lead]); ?>


                <div class="panel">
                    <div class="panel-header" style="padding-top: 0">
                        <?php echo e(__('admin::app.leads.details')); ?>


                        <?php if(($days = $lead->rotten_days) > 0): ?>
                            <span class="lead-rotten-info">
                                <i class="icon alert-danger-icon"></i>
                                <?php echo e(__('admin::app.leads.rotten-info', ['days' => $days])); ?>

                            </span>
                        <?php endif; ?>
                    </div>

                    <div class="panel-body">

                        <div class="custom-attribute-view">
                            <?php echo $__env->make('admin::common.custom-attributes.view', [
                                'customAttributes' => app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
                                    'entity_type' => 'leads',
                                ]),
                                'entity'           => $lead,
                            ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                            <?php if($lead->stage->code == 'lost'): ?>
                                <div class="attribute-value-row">
                                    <div class="label"><?php echo e(__('admin::app.leads.lost-reason')); ?></div>
                                    <div class="value" v-pre><?php echo e($lead->lost_reason); ?></div>
                                </div>
                            <?php endif; ?>
                        </div>

                    </div>
                </div>

                <?php echo view_render_event('admin.leads.view.informations.details.after', ['lead' => $lead]); ?>



                <?php echo view_render_event('admin.leads.view.informations.contact_person.before', ['lead' => $lead]); ?>


                <div class="panel">
                    <div class="panel-header">
                        <?php echo e(__('admin::app.leads.contact-person')); ?>

                    </div>

                    <div class="panel-body custom-attribute-view">

                        <div class="attribute-value-row">
                            <div class="label">Name</div>

                            <div class="value">
                                <a href="<?php echo e(route('admin.contacts.persons.edit', $lead->person->id)); ?>" target="_blank">
                                    <?php echo e($lead->person->name); ?>

                                </a>
                            </div>
                        </div>

                        <div class="attribute-value-row">
                            <div class="label">Email</div>

                            <div class="value">
                                <?php echo $__env->make('admin::common.custom-attributes.view.email', ['value' => $lead->person->emails], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                            </div>
                        </div>

                        <div class="attribute-value-row">
                            <div class="label">Contact Numbers</div>

                            <div class="value">
                                <?php echo $__env->make('admin::common.custom-attributes.view.phone', ['value' => $lead->person->contact_numbers], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                            </div>
                        </div>

                        <div class="attribute-value-row">
                            <div class="label">Organization</div>

                            <div class="value">
                                <?php if($lead->person->organization): ?>
                                    <a href="<?php echo e(route('admin.contacts.organizations.edit', $lead->person->organization->id)); ?>" target="_blank">
                                        <?php echo e($lead->person->organization->name); ?>

                                    </a>
                                <?php else: ?>
                                    <?php echo e(__('admin::app.common.not-available')); ?>

                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>

                <?php echo view_render_event('admin.leads.view.informations.contact_person.after', ['lead' => $lead]); ?>



                <?php echo view_render_event('admin.leads.view.informations.products.before', ['lead' => $lead]); ?>


                <div class="panel">
                    <div class="panel-header">
                        <?php echo e(__('admin::app.leads.products')); ?>

                    </div>

                    <div class="panel-body" style="position: relative">
                        <?php if($lead->products->count()): ?>
                            <div class="lead-product-list">

                                <?php $__currentLoopData = $lead->products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                    <div class="lead-product">
                                        <div class="top-control-group">
                                            <div class="form-group">
                                                <label><?php echo e(__('admin::app.leads.item')); ?></label>

                                                <div class="control-faker">
                                                    <?php echo e($product->name); ?>

                                                </div>
                                            </div>
                                        </div>

                                        <div class="bottom-control-group" style="padding-right: 0;">
                                            <div class="form-group">
                                                <label><?php echo e(__('admin::app.leads.price')); ?></label>

                                                <div class="control-faker">
                                                    <?php echo e($product->price); ?>

                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label><?php echo e(__('admin::app.leads.quantity')); ?></label>

                                                <div class="control-faker">
                                                    <?php echo e($product->quantity); ?>

                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label><?php echo e(__('admin::app.leads.amount')); ?></label>

                                                <div class="control-faker">
                                                    <?php echo e($product->price * $product->quantity); ?>

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            </div>
                        <?php else: ?>
                            <div class="empty-record">
                                <img src="<?php echo e(asset('vendor/webkul/admin/assets/images/empty-table-icon.svg')); ?>">

                                <span><?php echo e(__('admin::app.common.no-records-found')); ?></span>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>

                <?php echo view_render_event('admin.leads.view.informations.products.after', ['lead' => $lead]); ?>

            </div>

            <div class="lead-content-right">

                <?php echo $__env->make('admin::leads.view.stage', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                <?php echo $__env->make('admin::leads.view.activity-action', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                <?php echo $__env->make('admin::leads.view.activity-list', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            </div>

        </div>

        <?php echo view_render_event('admin.leads.view.informations.after', ['lead' => $lead]); ?>

    </div>

    <edit-lead-form></edit-lead-form>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <script src="<?php echo e(asset('vendor/webkul/admin/assets/js/tinyMCE/tinymce.min.js')); ?>"></script>

    <script type="text/x-template" id="edit-lead-form-template">
        <form action="<?php echo e(route('admin.leads.update', $lead->id)); ?>" method="post" @submit.prevent="onSubmit" enctype="multipart/form-data">
            <modal id="updateLeadModal" :is-open="$root.modalIds.updateLeadModal">
                <h3 slot="header-title"><?php echo e(__('admin::app.leads.edit-title')); ?></h3>

                <div slot="header-actions">
                    <?php echo view_render_event('admin.leads.view.edit.form_buttons.before', ['lead' => $lead]); ?>


                    <button class="btn btn-sm btn-secondary-outline" @click="$root.closeModal('updateLeadModal')"><?php echo e(__('admin::app.leads.cancel')); ?></button>

                    <button class="btn btn-sm btn-primary"><?php echo e(__('admin::app.leads.save-btn-title')); ?></button>

                    <?php echo view_render_event('admin.leads.view.edit.form_buttons.after', ['lead' => $lead]); ?>

                </div>

                <div slot="body">
                    <?php echo view_render_event('admin.leads.view.edit.form_controls.before', ['lead' => $lead]); ?>


                    <?php echo csrf_field(); ?>

                    <input name="_method" type="hidden" value="PUT">
                    <input type="hidden" id="lead_pipeline_stage_id" name="lead_pipeline_stage_id" value="<?php echo e($lead->lead_pipeline_stage_id); ?>" />
                    <tabs>
                        <?php echo view_render_event('admin.leads.view.edit.form_controls.details.before', ['lead' => $lead]); ?>


                        <tab name="<?php echo e(__('admin::app.leads.details')); ?>" :selected="true">
                            <?php echo $__env->make('admin::common.custom-attributes.edit', [
                                'customAttributes'  => app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
                                    'entity_type' => 'leads',
                                ]),
                                'customValidations' => [
                                    'expected_close_date' => [
                                        'date_format:yyyy-MM-dd',
                                        'after:' .  \Carbon\Carbon::yesterday()->format('Y-m-d')
                                    ],
                                ],
                                'entity'            => $lead,
                            ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                        </tab>

                        <?php echo view_render_event('admin.leads.view.edit.form_controls.details.after', ['lead' => $lead]); ?>



                        <?php echo view_render_event('admin.leads.view.edit.form_controls.contact_person.before', ['lead' => $lead]); ?>


                        <tab name="<?php echo e(__('admin::app.leads.contact-person')); ?>">
                            <?php echo $__env->make('admin::leads.common.contact', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                            <contact-component :data='<?php echo json_encode(old('person') ?: $lead->person, 15, 512) ?>'></contact-component>
                        </tab>

                        <?php echo view_render_event('admin.leads.view.edit.form_controls.contact_person.after', ['lead' => $lead]); ?>



                        <?php echo view_render_event('admin.leads.view.edit.form_controls.products.before', ['lead' => $lead]); ?>


                        <tab name="<?php echo e(__('admin::app.leads.products')); ?>">
                            <?php echo $__env->make('admin::leads.common.products', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                            <product-list :data='<?php echo json_encode(old('products') ?: $lead->products, 15, 512) ?>'></product-list>
                        </tab>

                        <?php echo view_render_event('admin.leads.view.edit.form_controls.products.after', ['lead' => $lead]); ?>

                    </tabs>

                    <?php echo view_render_event('admin.leads.view.edit.form_controls.after', ['lead' => $lead]); ?>

                </div>
            </modal>
        </form>
    </script>

    <script>
        Vue.component('edit-lead-form', {

            template: '#edit-lead-form-template',

            inject: ['$validator'],

            mounted: function() {
                if (! Array.isArray(window.serverErrors)) {
                    this.$root.openModal('updateLeadModal');

                    var self = this;

                    setTimeout(() => {
                        self.$root.addServerErrors();
                    });
                }
            },

            methods: {
                onSubmit: function(e) {
                    this.$root.onSubmit(e);
                }
            }
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('admin::layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/quikappspane/public_html/cmr.quik-apps.com.co/laravel-crm/packages/Webkul/Admin/src/Providers/../Resources/views/leads/view.blade.php ENDPATH**/ ?>