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

<?php $__env->startSection('sub_title', trans('companies.sub_title', array(
    'system'    => config('insura.name')
))); ?>

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

<?php $__env->startSection('content'); ?>
        @parent
        <?php echo $__env->make('global.status', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<div class="row m-t-30">
            <!-- start current company -->
            <div class="col-md-4">
                <div class="ui segment white company-item">
                    <p class="text-ellipsis company-name"><?php echo e($user->company->name); ?></p>
                    <div class="text-avatar" style="background-color:<?php echo e(collect(config('insura.colors'))->random()); ?>;"><?php echo e(strtoupper($user->company->name[0] . collect(explode(' ', $user->company->name))->get(1, ' ')[0])); ?></div>
                    <h1><?php echo e(collect(config('insura.currencies.list'))->keyBy('code')->get($user->company->currency_code)['symbol']); ?> <?php echo e($user->company->policies->sum('premium')); ?></h1>
                    <span class="company-sales">Total Sales</span>
                    <div class="row company-info">
                        <div class="col-xs-4 col-sm-4 col-md-4">
                            <p><?php echo e($user->company->clients->count()); ?></p>
                            <span><?php echo e(trans('companies.label.client')); ?></span>
                        </div>
                        <div class="col-xs-4 col-sm-4 col-md-4">
                            <p><?php echo e($user->company->policies->count()); ?></p>
                            <span><?php echo e(trans('companies.label.policy')); ?></span>
                        </div>
                        <div class="col-xs-4 col-sm-4 col-md-4">
                            <p><?php echo e($user->company->staff->count()); ?></p>
                            <span><?php echo e(trans('companies.label.staff')); ?></span>
                        </div>
                    </div>
                </div>
            </div>
            <!-- end current company -->

            <!-- start other companies -->
            <?php $__empty_1 = true; foreach($companies as $company): $__empty_1 = false; ?>
            <div class="col-md-4">
                <div class="ui segment white company-item">
                    <p class="text-ellipsis company-name"><?php echo e($company->name); ?></p>
                    <form action="<?php echo e(action('CompanyController@delete', array($company->id))); ?>" class="delete-company" data-position="left center" data-inverted="" data-tooltip="<?php echo e(trans('companies.tooltip.delete')); ?>" method="POST">
                        <?php echo e(csrf_field()); ?>

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

                        <i class="icon ion-ios-trash ui"></i>
                    </form>
                    <div class="text-avatar" style="background-color:<?php echo e(collect(config('insura.colors'))->random()); ?>;"><?php echo e(strtoupper($company->name[0] . collect(explode(' ', $company->name))->get(1, ' ')[0])); ?></div>
                    <h1><?php echo e(collect(config('insura.currencies.list'))->keyBy('code')->get($company->currency_code)['symbol']); ?> <?php echo e($company->policies->sum('premium')); ?></h1>
                    <span class="company-sales">Total Sales</span>
                    <div class="row company-info">
                        <div class="col-xs-4 col-sm-4 col-md-4">
                            <p><?php echo e($company->clients->count()); ?></p>
                            <span><?php echo e(trans('companies.label.client')); ?></span>
                        </div>
                        <div class="col-xs-4 col-sm-4 col-md-4">
                            <p><?php echo e($company->policies->count()); ?></p>
                            <span><?php echo e(trans('companies.label.policy')); ?></span>
                        </div>
                        <div class="col-xs-4 col-sm-4 col-md-4">
                            <p><?php echo e($company->staff->count()); ?></p>
                            <span><?php echo e(trans('companies.label.staff')); ?></span>
                        </div>
                    </div>
                </div>
            </div>
            <?php endforeach; if ($__empty_1): ?>
            <div class="col-xs-4 col-md-offset-3">
                <div class="segment text-center ui white">
                    <i class="huge icon ion-android-alert"></i>
                    <p><?php echo e(trans('companies.message.empty')); ?></p>
                </div>
            </div>
            <?php endif; ?>
            <!-- end other companies -->
        </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extra_scripts'); ?>
    <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() {
                $insura.helpers.initDropdown('div.dropdown');
                $insura.helpers.initScrollbar('div.scrollbar');
                $insura.helpers.initSwal('form i.ion-ios-trash', {
                    confirmButtonText: '<?php echo e(trans('companies.swal.warning.delete.confirm')); ?>',
                    text: '<?php echo e(trans('companies.swal.warning.delete.text')); ?>',
                    title: '<?php echo e(trans('companies.swal.warning.delete.title')); ?>'
                });
                $insura.helpers.listenForChats();
            });
        })(window.insura, window.jQuery);
    </script>
<?php $__env->stopSection(); ?>

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