<?php $__env->startSection('title', trans('brokers.title.one')); ?>

<?php $__env->startSection('page_stylesheets'); ?>
    <link href="<?php echo e(asset('assets/libs/datepicker/datepicker.min.css')); ?>" rel="stylesheet">
    <link href="<?php echo e(asset('assets/libs/dropify/css/dropify.css')); ?>" rel="stylesheet">
    <link href="<?php echo e(asset('assets/libs/intl-tel-input/css/intlTelInput.css')); ?>" rel="stylesheet"/>
    <link href="<?php echo e(asset('assets/libs/sweetalert/sweetalert.css')); ?>" rel="stylesheet">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extra_stylesheets'); ?>
    <link href="<?php echo e(asset('assets/css/split-page.css')); ?>" rel="stylesheet"/>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('profile_bar'); ?>
        <div class="ui segment white right-bar-profile">
            <!-- broker profile -->
            <div class="user-profile m-b-15">
                <div class="circular ui icon button top right pointing dropdown edit-profile-btn" data-inverted="" data-tooltip="<?php echo e(trans('brokers.menu.header.tooltip')); ?>" data-position="left center">
                    <i class="ion-android-more-horizontal icon"></i>
                    <div class="menu">
                        <div class="header"><?php echo e(trans('brokers.menu.header.text')); ?></div>
                        <div class="divider"></div>
                        <div class="item">
                            <a href="#" data-target="#editBrokerModal" data-toggle="modal"><i class="write icon"></i> <?php echo e(trans('brokers.menu.item.edit_profile')); ?></a>
                        </div>
                        <div class="item">
                            <a href="<?php echo e(action('InboxController@getAll', array(
                                'chatee'  => $broker->id
                            ))); ?>"><i class="comments icon"></i> <?php echo e(trans('brokers.menu.item.chat')); ?></a>
                        </div>
                        <form action="<?php echo e(action('BrokerController@delete', array($broker->id))); ?>" class="item negative" method="POST">
                            <?php echo e(csrf_field()); ?>

                            <?php echo e(method_field('DELETE')); ?>

                            <a href="#" class="delete"><i class="trash icon"></i><?php echo e(trans('brokers.menu.item.delete')); ?></a>
                        </form>
                    </div>
                </div>
                <?php if($broker->profile_image_filename === 'default-profile.jpg'): ?>
                <div class="text-avatar" style="background-color:<?php echo e(collect(config('insura.colors'))->random()); ?>;"><?php echo e(strtoupper($broker->first_name[0] . (isset($broker->last_name) ? $broker->last_name[0] : ''))); ?></div>
                <?php else: ?>
                            <img src="<?php echo e(asset('uploads3/images/users/' . $broker->profile_image_filename)); ?>" alt="<?php echo e($broker->first_name); ?> <?php echo e($broker->last_name); ?>"/>
                <?php endif; ?>
                <h3><?php echo e($broker->first_name . ' ' . $broker->last_name); ?></h3>
                <span>
                    <?php if($broker->status): ?>
                    <i class="ion-ios-circle-filled text-success"></i> <?php echo e(trans('brokers.status.active')); ?>

                    <?php else: ?>
                    <i class="ion-ios-circle-filled text-danger"></i> <?php echo e(trans('brokers.status.inactive')); ?>

                    <?php endif; ?>
                </span>
                <div class="m-t-25">
                    <button class="ui button primarish" data-target="#newTextModal" data-toggle="modal"<?php echo e(is_null($user->company->text_provider) || is_null($broker->phone) ? ' disabled' : ''); ?>><i class="comment icon"></i> <?php echo e(trans('brokers.button.text')); ?> </button>
                    <button class="ui button primarish" data-target="#newEmailModal" data-toggle="modal"><i class="mail icon"></i> <?php echo e(trans('brokers.button.email')); ?> </button>
                </div>
            </div>
            <!-- end broker profile -->
            <div class="user-more-data">
                <div class="divider m-t-0"></div>
                <div class="row text-center broker-totals">
                    <div class="col-md-6">
                        <span><?php echo e(trans('brokers.label.total_sales')); ?></span>
                        <?php if($broker->inviteePolicies->sum('premium') > $broker->inviteePayments->sum('amount;')): ?>
                        <p class="text-danger">
                        <?php else: ?>
                        <p class="text-success">
                        <?php endif; ?>
                            <strong><?php echo e($broker->currency_symbol); ?><?php echo e($broker->inviteePolicies->sum('premium')); ?></strong>
                        </p>
                    </div>
                    <div class="col-md-6">
                        <span><?php echo e(trans('brokers.label.total_commission')); ?></span>
                        <?php if($broker->inviteePolicies->sum('premium') > $broker->inviteePayments->sum('amount;')): ?>
                        <p class="text-danger">
                        <?php else: ?>
                        <p class="text-success">
                        <?php endif; ?>
                            <strong><?php echo e($broker->currency_symbol); ?><?php echo e(($broker->commission_rate / 100) * $broker->inviteePolicies->sum('premium')); ?></strong>
                        </p>
                    </div>
                </div>
                <div class="divider m-t-0"></div>
                <!-- broker details -->
                <div class="scrollbar">
                    <div class="user-contact">
                        <div>
                            <span><?php echo e(trans('brokers.label.email')); ?></span>
                            <p><?php echo e($broker->email); ?></p>
                        </div>
                        <div>
                            <span><?php echo e(trans('brokers.label.phone')); ?></span>
                            <p><?php echo e(isset($broker->phone) ? $broker->phone : '(---) ---- --- ---'); ?></p>
                        </div>
                        <div>
                            <span><?php echo e(trans('brokers.label.birthday')); ?></span>
                            <p><?php echo e(is_null($broker->birthday) ? '---------- --, ----' : date('jS F Y', strtotime($broker->birthday))); ?></p>
                        </div>
                        <div>
                            <span><?php echo e(trans('brokers.label.address')); ?></span>
                            <p><?php echo e(isset($broker->address) ? $broker->address : '. . .'); ?></p>
                        </div>
                    </div>
                </div>
                <!-- end broker details -->
            </div>
        </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
        @parent
        <div class="half-page-content">
            <?php echo $__env->make('global.status', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <!-- clients -->
            <div class="ui segment white">
                <div class="segment-header">
                    <h3><?php echo e(trans('brokers.table.title.clients')); ?></h3>
                </div>
                <table class="ui striped table">
                    <thead>
                        <tr>
                            <th><?php echo e(trans('brokers.table.header.number')); ?></th>
                            <th><?php echo e(trans('brokers.table.header.name')); ?></th>
                            <th><?php echo e(trans('brokers.table.header.email')); ?></th>
                            <th class="ui aligned center"><?php echo e(trans('brokers.table.header.policies')); ?></th>
                            <th><?php echo e(trans('brokers.table.header.due')); ?></th>
                            <th class="ui aligned center"><?php echo e(trans('brokers.table.header.action')); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; foreach($clients as $key => $client): $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($key + 1); ?></td>
                            <td><?php echo e($client->first_name . ' ' . $client->last_name); ?></td>
                            <td class="text-ellipsis"><?php echo e($client->email); ?></td>
                            <td class="ui aligned center"><?php echo e($client->policies->count()); ?></td>
                            <td><?php echo e($broker->currency_symbol); ?><?php echo e($client->policies->sum('premium') - $client->payments->sum('amount')); ?></td>
                            <td class="ui aligned center">
                                <a class="ui grey mini label" href="<?php echo e(action('ClientController@getOne', array($client->id))); ?>"> <?php echo e(trans('brokers.table.data.action.view')); ?> </a>
                            </td>
                        </tr>
                        <?php endforeach; if ($__empty_1): ?>
                        <tr>
                            <td class="text-center" colspan="6"><?php echo e($broker->first_name); ?><?php echo e(trans('brokers.table.message.empty.clients')); ?></td>
                        </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
            <!-- end clients -->

            <!-- policies -->
            <div class="ui segment white">
                <div class="segment-header">
                    <h3><?php echo e(trans('brokers.table.title.policies')); ?></h3>
                    <button class="ui right floated button successish m-w-140" data-target="#newPolicyModal" data-toggle="modal"<?php echo e($clients->count() > 0 ? '' : ' disabled'); ?>><?php echo e(trans('policies.button.new')); ?></button>
                </div>
                <table class="ui table">
                    <thead>
                        <tr>
                            <th><?php echo e(trans('brokers.table.header.ref_no')); ?></th>
                            <th><?php echo e(trans('brokers.table.header.product')); ?></th>
                            <th><?php echo e(trans('brokers.table.header.premium')); ?></th>
                            <th><?php echo e(trans('brokers.table.header.commission')); ?> (<?php echo e($broker->commission_rate); ?>%)</th>
                            <th class="center aligned"><?php echo e(trans('brokers.table.header.status')); ?></th>
                            <th class="center aligned"><?php echo e(trans('brokers.table.header.action')); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; foreach($policies as $policy): $__empty_1 = false; ?>
                        <tr class="<?php echo e($policy->statusClass); ?>">
                            <td><?php echo e($policy->ref_no); ?></td>
                            <td class="text-ellipsis"><?php echo e($policy->product->name); ?></td>
                            <td><?php echo e($broker->currency_symbol); ?><?php echo e($policy->premium + 0); ?></td>
                            <td><?php echo e($broker->currency_symbol); ?><?php echo e($policy->premium * $broker->commission_rate / 100); ?></td>
                            <td class="center aligned">
                                <?php if($policy->premium <= $policy->paid && $policy->paid > 0): ?>
                                <div class="ui green mini label"> <?php echo e(trans('brokers.table.data.status.paid')); ?></div>
                                <?php elseif($policy->premium > $policy->paid && $policy->paid > 0): ?>
                                <div class="ui orange mini label"> <?php echo e(trans('brokers.table.data.status.partial')); ?></div>
                                <?php elseif($policy->premium == $policy->paid && $policy->paid === 0): ?>
                                <div class="ui yellow mini label"> <?php echo e(trans('brokers.table.data.status.free')); ?></div>
                                <?php else: ?>
                                <div class="ui red mini label"> <?php echo e(trans('brokers.table.data.status.unpaid')); ?></div>
                                <?php endif; ?>
                            </td>
                            <td class="center aligned">
                                <a class="ui mini grey label" href="<?php echo e(action('PolicyController@getOne', array($policy->id))); ?>"> <?php echo e(trans('brokers.table.data.action.view')); ?> </a>
                            </td>
                        </tr>
                        <?php endforeach; if ($__empty_1): ?>
                        <tr>
                            <td class="text-center" colspan="7"><?php echo e($broker->first_name); ?><?php echo e(trans('brokers.table.message.empty.policies')); ?></td>
                        </tr>
                        <?php endif; ?>
                    </tbody>
                    <tfoot>
                        <tr>
                            <th><?php echo e(trans('brokers.table.header.total')); ?></th>
                            <th></th>
                            <th><?php echo e($broker->currency_symbol); ?><?php echo e($policies->sum('premium')); ?></th>
                            <th><?php echo e($broker->currency_symbol); ?><?php echo e($policies->sum('premium') * $broker->commission_rate / 100); ?></th>
                            <th></th>
                            <th></th>
                        </tr>
                    </tfoot>
                </table>
            </div>
            <!-- end policies -->
        </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('modals'); ?>
    <!-- new email modal -->
    <div class="ui tiny modal" id="newEmailModal">
        <div class="header"><?php echo e(trans('communication.modal.header.email')); ?></div>
        <div class="content">
            <p><?php echo e(trans('communication.modal.instruction.send', array(
                'name'  => $broker->first_name . ' ' . $broker->last_name,
                'type'  => 'an email'
            ))); ?></p>
            <form action="<?php echo e(action('EmailController@add')); ?>" method="POST">
                <?php echo e(csrf_field()); ?>

                <input type="hidden" name="recipient" value="<?php echo e($broker->id); ?>"/>
                <div class="ui form">
                    <div class="field required">
                        <label><?php echo e(trans('communication.input.label.subject')); ?></label>
                        <input type="text" name="subject" placeholder="<?php echo e(trans('communication.input.placeholder.subject')); ?>" required value="<?php echo e(old('subject')); ?>"/>
                    </div>
                    <div class="field required">
                        <label><?php echo e(trans('communication.input.label.message')); ?></label>
                        <textarea rows="5" name="message" placeholder="<?php echo e(trans('communication.input.placeholder.message')); ?>" required><?php echo e(session('text') ? '' : old('message')); ?></textarea>
                    </div>
                </div>
            </form>
        </div>
        <div class="actions">
            <div class="ui buttons">
                <button class="ui cancel button"><?php echo e(trans('communication.modal.button.cancel')); ?></button>
                <div class="or" data-text="<?php echo e(trans('communication.modal.button.or')); ?>"></div>
                <button class="ui positive primary button"><?php echo e(trans('communication.modal.button.confirm')); ?></button>
            </div>
        </div>
    </div>

    <!-- new text modal -->
    <div class="ui tiny modal" id="newTextModal">
        <div class="header"><?php echo e(trans('communication.modal.header.send', array(
                'name'  => $broker->first_name . ' ' . $broker->last_name,
                'type'  => 'a text message'
            ))); ?></div>
        <div class="content">
            <p><?php echo e(trans('communication.modal.instruction.text')); ?></p>
            <form action="<?php echo e(action('TextController@add')); ?>" method="POST">
                <?php echo e(csrf_field()); ?>

                <input type="hidden" name="recipient" value="<?php echo e($broker->id); ?>"/>
                <div class="ui form">
                    <div class="field required">
                        <label><?php echo e(trans('communication.input.label.message')); ?></label>
                        <textarea rows="5" name="message" placeholder="<?php echo e(trans('communication.input.placeholder.message')); ?>" required><?php echo e(session('text') ? old('message') : ''); ?></textarea>
                    </div>
                </div>
            </form>
        </div>
        <div class="actions">
            <div class="ui buttons">
                <button class="ui cancel button"><?php echo e(trans('communication.modal.button.cancel')); ?></button>
                <div class="or" data-text="<?php echo e(trans('communication.modal.button.or')); ?>"></div>
                <button class="ui positive primary button"><?php echo e(trans('communication.modal.button.confirm')); ?></button>
            </div>
        </div>
    </div>

    <!-- new policy modal -->
    <div class="ui tiny modal" id="newPolicyModal">
        <div class="header"><?php echo e(trans('policies.modal.header.new')); ?></div>
        <div class="scrolling content">
            <p><?php echo e(trans('policies.modal.instruction.new')); ?> <?php echo e(trans('brokers.modal.instruction.policy', array(
                'name'  => $broker->first_name
            ))); ?></p>
            <form action="<?php echo e(action('PolicyController@add')); ?>" method="POST">
                <?php echo e(csrf_field()); ?>

                <div class="ui form">
                    <div class="two fields">
                        <div class="field required">
                            <label><?php echo e(trans('policies.input.label.product')); ?></label>
                            <select class="ui fluid search dropdown" name="product" required value="<?php echo e(old('product')); ?>">
                                <option value=""><?php echo e(trans('policies.input.placeholder.product')); ?></option>
                                <?php $__empty_1 = true; foreach($broker->company->products as $product): $__empty_1 = false; ?>
                                <option<?php echo e(old('product') === $product->id ? ' selected' : ''); ?> value="<?php echo e($product->id); ?>"><?php echo e($product->name); ?></option>
                                <?php endforeach; if ($__empty_1): ?>
                                <option disabled value=""><?php echo e(trans('policies.input.option.empty.product')); ?></option>
                                <?php endif; ?>
                            </select>
                        </div>
                        <div class="field required">
                            <label><?php echo e(trans('policies.input.label.type')); ?></label>
                            <select class="ui fluid dropdown selection" name="type" required value="<?php echo e(old('type')); ?>">
                                <option value=""><?php echo e(trans('policies.input.placeholder.type')); ?></option>
                                <option<?php echo e(old('type') === 'annually' ? ' selected' : ''); ?> value="annually"><?php echo e(trans('policies.input.option.type.annually')); ?></option>
                                <option<?php echo e(old('type') === 'monthly' ? ' selected' : ''); ?> value="monthly"><?php echo e(trans('policies.input.option.type.monthly')); ?></option>
                            </select>
                        </div>
                    </div>
                    <div class="two fields">
                        <div class="field required">
                            <label><?php echo e(trans('policies.input.label.expiry')); ?></label>
                            <div class="ui labeled input">
                                <label for="expiry" class="ui label"><i class="calendar icon"></i></label>
                                <input type="text" id="expiry" class="datepicker" name="expiry" placeholder="<?php echo e(trans('policies.input.placeholder.expiry')); ?>" required value="<?php echo e(old('expiry')); ?>"/>
                            </div>
                        </div>
                        <div class="field required">
                            <label><?php echo e(trans('policies.input.label.renewal')); ?></label>
                            <div class="ui labeled input">
                                <label for="renewal" class="ui label"><i class="calendar icon"></i></label>
                                <input type="text" id="renewal" class="datepicker" name="renewal" placeholder="<?php echo e(trans('policies.input.placeholder.renewal')); ?>" required value="<?php echo e(old('renewal')); ?>"/>
                            </div>
                        </div>
                    </div>
                    <div class="field required">
                        <label><?php echo e(trans('policies.input.label.payer')); ?></label>
                        <input type="text" name="payer" maxlength="64" placeholder="<?php echo e(trans('policies.input.placeholder.payer')); ?>" required value="<?php echo e(old('payer')); ?>"/>
                    </div>
                    <div class="field required">
                        <label><?php echo e(trans('policies.input.label.owners')); ?></label>
                        <select class="dropdown fluid ui" name="owners[]" multiple required>
                            <option value=""><?php echo e(trans('policies.input.label.owners')); ?></option>
                            <?php $__empty_1 = true; foreach($clients as $client): $__empty_1 = false; ?>
                            <option<?php echo e(collect(old('owners'))->contains($client->id) ? ' selected' : ''); ?> value="<?php echo e($client->id); ?>"><?php echo e($client->first_name . ' ' . $client->last_name); ?></option>
                            <?php endforeach; if ($__empty_1): ?>
                            <option disabled value=""><?php echo e(trans('policies.input.option.empty.owners')); ?></option>
                            <?php endif; ?>
                        </select>
                    </div>
                    <div class="divider"></div>
                    <div class="field required">
                        <label><?php echo e(trans('policies.input.label.beneficiaries')); ?></label>
                        <input type="text" name="beneficiaries" placeholder="<?php echo e(trans('policies.input.placeholder.beneficiaries')); ?>" required value="<?php echo e(old('beneficiaries')); ?>"/>
                    </div>
                    <div class="field">
                        <label><?php echo e(trans('policies.input.label.special_remarks')); ?></label>
                        <textarea name="special_remarks" placeholder="<?php echo e(trans('policies.input.placeholder.special_remarks')); ?>" rows="4"><?php echo e(old('special_remarks')); ?></textarea>
                    </div>
                    <?php $__empty_1 = true; foreach($clients as $client): $__empty_1 = false; ?>
                    <h5 class="client client<?php echo e($client->id); ?> ui dividing header" style="display:none;"><?php echo e(trans('policies.input.label.payments', array(
                        'name'  => $client->first_name. ' ' .$client->last_name
                    ))); ?></h5>
                    <div class="client client<?php echo e($client->id); ?> two fields" style="display:none;">
                        <div class="field required" data-input-name="premium">
                            <label><?php echo e(trans('policies.input.label.premium')); ?></label>
                            <div class="ui labeled input">
                                <label for="premium" class="ui label"><?php echo e($broker->currency_symbol); ?></label>
                                <input type="number" id="premium" min="0" name="premium[<?php echo e($client->id); ?>]" placeholder="<?php echo e(trans('policies.input.placeholder.premium')); ?>" required value="<?php echo e(old('premium.' . $client->id)); ?>"/>
                            </div>
                        </div>
                        <div class="field">
                            <label><?php echo e(trans('policies.input.label.amount')); ?></label>
                            <div class="ui labeled input">
                                <label for="amount" class="ui label"><?php echo e($broker->currency_symbol); ?></label>
                                <input type="number" id="amount" name="amount[<?php echo e($client->id); ?>]" min="0" placeholder="<?php echo e(trans('policies.input.placeholder.amount')); ?>" value="<?php echo e(old('amount.' . $client->id)); ?>"/>
                            </div>
                        </div>
                    </div>
                    <div class="client client<?php echo e($client->id); ?> two fields" style="display:none;">
                        <div class="field">
                            <label><?php echo e(trans('policies.input.label.payment_date')); ?></label>
                            <input type="text" class="datepicker" name="date[<?php echo e($client->id); ?>]" placeholder="<?php echo e(trans('policies.input.placeholder.payment_date')); ?>" value="<?php echo e(old('date.' . $client->id)); ?>"/>
                        </div>
                        <div class="field">
                            <label><?php echo e(trans('policies.input.label.payment_method')); ?></label>
                            <div class="ui selection dropdown required">
                                <input type="hidden" name="method[<?php echo e($client->id); ?>]" value="<?php echo e(old('method.' . $client->id)); ?>"/>
                                <div class="default text"><?php echo e(trans('policies.input.placeholder.payment_method')); ?></div>
                                <i class="dropdown icon"></i>
                                <div class="menu">
                                    <div class="item<?php echo e(old('method.' . $client->id) === 'card' ? ' selected' : null); ?>" data-value="card">
                                        <i class="credit card alternative icon"></i>
                                        <?php echo e(trans('policies.input.option.method.card')); ?>

                                    </div>
                                    <div class="item<?php echo e(old('method.' . $client->id) === 'cash' ? ' selected' : null); ?>" data-value="cash">
                                        <i class="money icon"></i>
                                        <?php echo e(trans('policies.input.option.method.cash')); ?>

                                    </div>
                                    <div class="item<?php echo e(old('method.' . $client->id) === 'paypal' ? ' selected' : null); ?>" data-value="paypal">
                                        <i class="paypal card icon"></i>
                                        <?php echo e(trans('policies.input.option.method.paypal')); ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php endforeach; if ($__empty_1): ?>
                    <h5 class="ui dividing header disabled"><?php echo e(trans('policies.input.label.payments', array(
                        'name'  => '?'
                    ))); ?></h5>
                    <div class="two fields">
                        <div class="disabled field">
                            <label><?php echo e(trans('policies.input.label.premium')); ?></label>
                            <div class="ui labeled input">
                                <label for="premium" class="ui label"><?php echo e($broker->currency_symbol); ?></label>
                                <input type="number" disabled id="premium" min="0" placeholder="<?php echo e(trans('policies.input.placeholder.premium')); ?>" required/>
                            </div>
                        </div>
                        <div class="disabled field">
                            <label><?php echo e(trans('policies.input.label.amount')); ?></label>
                            <div class="ui labeled input">
                                <label for="amount" class="ui label"><?php echo e($broker->currency_symbol); ?></label>
                                <input type="number" disabled id="amount" min="0" placeholder="<?php echo e(trans('policies.input.placeholder.amount')); ?>"/>
                            </div>
                        </div>
                    </div>
                    <div class="two fields">
                        <div class="disabled field">
                            <label><?php echo e(trans('policies.input.label.payment_date')); ?></label>
                            <input type="text" class="datepicker" disabled placeholder="<?php echo e(trans('policies.input.placeholder.payment_date')); ?>"/>
                        </div>
                        <div class="disabled field">
                            <label><?php echo e(trans('policies.input.label.payment_method')); ?></label>
                            <div class="ui selection disabled dropdown">
                                <input type="hidden" value="<?php echo e(old('method')); ?>"/>
                                <div class="default text"><?php echo e(trans('policies.input.placeholder.payment_method')); ?></div>
                                <i class="dropdown icon"></i>
                                <div class="menu">
                                    <div class="item" data-value="card">
                                        <i class="credit card alternative icon"></i>
                                        <?php echo e(trans('policies.input.option.method.card')); ?>

                                    </div>
                                    <div class="item" data-value="cash">
                                        <i class="money icon"></i>
                                        <?php echo e(trans('policies.input.option.method.cash')); ?>

                                    </div>
                                    <div class="item" data-value="paypal">
                                        <i class="paypal card icon"></i>
                                        <?php echo e(trans('policies.input.option.method.paypal')); ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
            </form>
        </div>
        <div class="actions">
            <div class="ui buttons">
                <button class="ui cancel button"><?php echo e(trans('policies.modal.button.cancel.new')); ?></button>
                <div class="or" data-text="<?php echo e(trans('policies.modal.button.or')); ?>"></div>
                <button class="ui positive primary button"><?php echo e(trans('policies.modal.button.confirm.new')); ?></button>
            </div>
        </div>
    </div>
    <?php echo $__env->yieldContent('broker_modals'); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_scripts'); ?>
    <script src="<?php echo e(asset('assets/libs/datepicker/datepicker.min.js')); ?>" type="text/javascript"></script>
    <script src="<?php echo e(asset('assets/libs/dropify/js/dropify.min.js')); ?>" type="text/javascript"></script>
    <script src="<?php echo e(asset('assets/libs/intl-tel-input/js/intlTelInput.min.js')); ?>" type="text/javascript"></script>
    <script src="<?php echo e(asset('assets/libs/sweetalert/sweetalert.min.js')); ?>" type="text/javascript"></script>
    <script type="text/javascript">
        (function($insura, $) {
            $(document).ready(function() {                
                if ($(window).width() > 992) {
                    getVisible();
                }else{
                    $('.scrollbar').removeAttr("style");
                }

                $(window).resize(function(){
                    if ($(window).width() > 992) {
                        getVisible();
                    }else{
                        $('div.right-bar-profile div.scrollbar').removeAttr("style");
                    }
                });

                $insura.helpers.initDatepicker('input.datepicker');
                $insura.helpers.initDropdown('div.dropdown, select.dropdown');
                $insura.helpers.initDropify('input.file-upload');
                $insura.helpers.initModal('div#newEmailModal, div#newPolicyModal, div#newTextModal', true); 
                $insura.helpers.initModal('div#editBrokerModal', false);
                $insura.helpers.initScrollbar('div.scrollbar');
                $insura.helpers.initSwal('form a.delete', {
                    confirmButtonText: '<?php echo e(trans('brokers.swal.warning.delete.confirm')); ?>',
                    text: '<?php echo e(trans('brokers.swal.warning.delete.text')); ?>',
                    title: '<?php echo e(trans('brokers.swal.warning.delete.title')); ?>'
                });
                $insura.helpers.initTelInput('input[type="tel"]');
                $insura.helpers.listenForChats();
                $insura.helpers.requireDropdownFields('form div.required select, form div.required div.dropdown input[type="hidden"]');

                $('div#newPolicyModal input[name^="premium["]').change(function() {
                    var input = $(this);
                    input.closest('div.fields').find('input[name^="amount["]').attr('max', input.val());
                }).change();
                $('select[name="owners[]"]').change(function() {
                    $('h5.client').fadeOut(200);
                    $('div.client').fadeOut(200).find('input').attr('required', false);
                    $.each($(this).val(), function(i, value) {
                        $('h5.client' + value).fadeIn(200);
                        $('div.client' + value).fadeIn(200).find('input').attr('required', true);
                    });
                }).change();
            });
        })(window.insura, window.jQuery);
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('global.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>