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

<?php $__env->startPush('css'); ?>
<style>
.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {width: auto;}
.count-title {margin-top: 15px}
.dashboard-counts strong {font-size: .9rem;margin-top: 5px}
</style>
<?php $__env->stopPush(); ?>

    <?php if (isset($component)) { $__componentOriginala5e77f3594f8b6318da2dcd4db70cfc8 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala5e77f3594f8b6318da2dcd4db70cfc8 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.success-message','data' => ['key' => 'message']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('success-message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['key' => 'message']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala5e77f3594f8b6318da2dcd4db70cfc8)): ?>
<?php $attributes = $__attributesOriginala5e77f3594f8b6318da2dcd4db70cfc8; ?>
<?php unset($__attributesOriginala5e77f3594f8b6318da2dcd4db70cfc8); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala5e77f3594f8b6318da2dcd4db70cfc8)): ?>
<?php $component = $__componentOriginala5e77f3594f8b6318da2dcd4db70cfc8; ?>
<?php unset($__componentOriginala5e77f3594f8b6318da2dcd4db70cfc8); ?>
<?php endif; ?>
    <?php if (isset($component)) { $__componentOriginal292f56c7d55035d9ce06be27ba7a6275 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal292f56c7d55035d9ce06be27ba7a6275 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.error-message','data' => ['key' => 'not_permitted']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('error-message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['key' => 'not_permitted']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal292f56c7d55035d9ce06be27ba7a6275)): ?>
<?php $attributes = $__attributesOriginal292f56c7d55035d9ce06be27ba7a6275; ?>
<?php unset($__attributesOriginal292f56c7d55035d9ce06be27ba7a6275); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal292f56c7d55035d9ce06be27ba7a6275)): ?>
<?php $component = $__componentOriginal292f56c7d55035d9ce06be27ba7a6275; ?>
<?php unset($__componentOriginal292f56c7d55035d9ce06be27ba7a6275); ?>
<?php endif; ?>

    <?php
        if ($general_setting->theme == 'default.css') {
            $color = '#733686';
            $color_rgba = 'rgba(115, 54, 134, 0.8)';
        } elseif ($general_setting->theme == 'green.css') {
            $color = '#2ecc71';
            $color_rgba = 'rgba(46, 204, 113, 0.8)';
        } elseif ($general_setting->theme == 'blue.css') {
            $color = '#3498db';
            $color_rgba = 'rgba(52, 152, 219, 0.8)';
        } elseif ($general_setting->theme == 'dark.css') {
            $color = '#34495e';
            $color_rgba = 'rgba(52, 73, 94, 0.8)';
        }
    ?>
    <div class="row">

        <div class="container-fluid">
            <?php
                $lims_warehouse_list = App\Models\Warehouse::where('is_active', true)->get();
            ?>

            <?php if(!config('database.connections.saleprosaas_landlord') && \Auth::user()->role_id <= 2): ?>
                <?php if(isset($versionUpgradeData['alert_version_upgrade_enable']) &&
                        $versionUpgradeData['alert_version_upgrade_enable'] == true): ?>
                    <div id="alertSection" class="alert not-slide alert-primary alert-dismissible fade show" role="alert">
                        <p id="announce"><strong>Announce !!!</strong> A new version
                            <?php echo e($versionUpgradeData['demo_version']); ?> has been released. Please <i><b><a
                                        href="<?php echo e(route('new-release')); ?>">Click here</a></b></i> to check upgrade details.
                        </p>
                        <button type="button" id="closeButtonUpgrade" class="close" data-dismiss="alert"
                            aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                <?php endif; ?>
            <?php endif; ?>
            <div class="col-md-12 mt-2">
                <div class="brand-text float-left mt-4">
                    <h3 style="font-size:1em"><?php echo e(__('db.welcome')); ?> <span><?php echo e(Auth::user()->name); ?></span></h3>
                </div>
                <?php if(in_array('restaurant', explode(',', cache()->get('general_setting')->modules))): ?>
                    <?php if(Auth::user()->role_id > 2 && isset(Auth::user()->service_staff)): ?>
                        <?php
                            $cooked = DB::table('sales')
                                ->where('waiter_id', Auth::user()->id)
                                ->where('sale_status', 5)
                                ->orWhere('sale_status', 6)
                                ->where('sales.created_at', '>=', now()->subDay())
                                ->count();
                        ?>
                    <?php elseif(Auth::user()->role_id <= 2): ?>
                        <?php
                            $cooked = DB::table('sales')
                                ->where('sale_status', 6)
                                ->where('sales.created_at', '>=', now()->subDay())
                                ->count();
                        ?>
                    <?php endif; ?>
                <?php endif; ?>
                <?php if(in_array('restaurant', explode(',', cache()->get('general_setting')->modules))): ?>
                    <a href="<?php echo e(route('kitchen.dashboard')); ?>">
                        <div class="alert alert-warning alert-dismissible text-center mb-2">
                            <strong><?php echo e($cooked); ?> <?php echo e(__('db.Orders to serve')); ?></strong>
                        </div>
                    </a>
                <?php endif; ?>

                <?php
                    $revenue_profit_summary = $role_has_permissions_list
                        ->where('name', 'revenue_profit_summary')
                        ->first();
                ?>
                <?php if($revenue_profit_summary): ?>
                    <div class="filter-toggle btn-group d-inline-block">
                        <div class="btn-group" role="group" style="max-width:180px">
                            <div class="d-flex align-items-center">
                                <i class="dripicons-location text-primary"></i>
                                <?php if(\Auth::user()->role_id <= 2): ?>
                                <select name="warehouse_id" class="selectpicker" id="warehouse_btn" data-live-search="true"
                                    data-live-search-style="begins">
                                    <option value="0"> <?php echo e(__('db.All Warehouse')); ?>

                                    </option>
                                    <?php $__currentLoopData = $lims_warehouse_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $warehouse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($warehouse->id); ?>"><?php echo e($warehouse->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <?php endif; ?>
                            </div>
                        </div>

                        <div class="dropdown d-inline">
                            <button type="button" class="btn btn-defualt dropdown-toggle" data-toggle="dropdown">
                                <i class="dripicons-calendar"></i> <?php echo e(__('db.Date Range')); ?>

                            </button>
                            <div class="dropdown-menu">
                                <button class="btn btn-default date-btn w-100" style="border:none"
                                    data-start_date="<?php echo e(date('Y-m-d')); ?>"
                                    data-end_date="<?php echo e(date('Y-m-d')); ?>"><?php echo e(__('db.Today')); ?></button>
                                <button class="btn btn-default date-btn w-100" style="border:none"
                                    data-start_date="<?php echo e(date('Y-m-d', strtotime(' -7 day'))); ?>"
                                    data-end_date="<?php echo e(date('Y-m-d')); ?>"><?php echo e(__('db.Last 7 Days')); ?></button>
                                <button class="btn btn-default date-btn w-100 active" style="border:none"
                                    data-start_date="<?php echo e(date('Y') . '-' . date('m') . '-' . '01'); ?>"
                                    data-end_date="<?php echo e(date('Y-m-d')); ?>"><?php echo e(__('db.This Month')); ?></button>
                                <button class="btn btn-default date-btn w-100" style="border:none"
                                    data-start_date="<?php echo e(date('Y') . '-01' . '-01'); ?>"
                                    data-end_date="<?php echo e(date('Y') . '-12' . '-31'); ?>"><?php echo e(__('db.This Year')); ?></button>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
    <!-- Counts Section -->
    <section class="dashboard-counts pt-0">
        <div class="container-fluid">
            <div class="row">
                <?php if($revenue_profit_summary): ?>
                    <div class="col-md-12 form-group">
                        <div class="row">
                            <!-- Count item widget-->
                            <!-- <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon">
                                         <i class="dripicons-cart" style="color: #863636"></i>
                                    </div>
                                    <div>
                                        <div class="count-number total_sale-data">
                                            <?php echo e(number_format((float) $total_sale, $general_setting->decimal, '.', '')); ?></div>
                                        <div class="name">
                                            <strong style="color: #863636"><?php echo e(__('db.Total Sale')); ?>

                                                <?php if (isset($component)) { $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.info','data' => ['title' => 'Grand Total - Shipping Cost = Total Sale','type' => 'info']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('info'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Grand Total - Shipping Cost = Total Sale','type' => 'info']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $attributes = $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $component = $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
                                            </strong>
                                        </div>
                                    </div>
                                </div>
                            </div> -->
                            <!-- Count item widget-->
                            <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon"><i class="dripicons-graph-bar" style="color: #733686"></i></div>
                                    <div>
                                        <div class="count-number revenue-data">
                                            <?php echo e(number_format((float) $revenue, $general_setting->decimal, '.', '')); ?></div>
                                        <div class="name"><strong style="color: #733686"><?php echo e(__('db.revenue')); ?>

                                            <?php if (isset($component)) { $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.info','data' => ['title' => '(grand_total - shipping_cost) - Return +income  =  Revenue','type' => 'info']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('info'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => '(grand_total - shipping_cost) - Return +income  =  Revenue','type' => 'info']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $attributes = $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $component = $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
                                            </strong></div>
                                    </div>
                                </div>
                            </div>

                            <!-- Count item widget invoice due-->
                            <!-- <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon">
                                        <i class="dripicons-document" style="color: #0584a0"></i>
                                    </div>
                                    <div>
                                        <div class="count-number invoice-due-data">
                                            <?php echo e(number_format((float) $invoice_due, $general_setting->decimal, '.', '')); ?></div>
                                        <div class="name"><strong style="color: #0584a0"><?php echo e(__('db.Invoice Due')); ?>

                                                <?php if (isset($component)) { $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.info','data' => ['title' => 'Graned Total - Paid Amount = Invoice Due','type' => 'info']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('info'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Graned Total - Paid Amount = Invoice Due','type' => 'info']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $attributes = $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $component = $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
                                            </strong></div>
                                    </div>
                                </div>
                            </div> -->
                            <!-- Count item widget-->
                            <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon"><i class="dripicons-return" style="color: #ff8952"></i></div>
                                    <div>
                                        <div class="count-number return-data">
                                            <?php echo e(number_format((float) $return, $general_setting->decimal, '.', '')); ?></div>
                                        <div class="name"><strong style="color: #ff8952"><?php echo e(__('db.Sale Return')); ?>

                                                <?php if (isset($component)) { $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.info','data' => ['title' => 'Total Sale Return Amount','type' => 'info']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('info'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Total Sale Return Amount','type' => 'info']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $attributes = $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $component = $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?></strong></div>
                                    </div>
                                </div>
                            </div>

                            <!-- Count item widget-->
                            <!-- <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon"><i class="dripicons-download" aria-hidden="true" style="color:#c60031; "></i></div>
                                    <div>
                                        <div class="count-number total_purchase-data">
                                            <?php echo e(number_format((float) $purchase - $purchase_return, $general_setting->decimal, '.', '')); ?>

                                        </div>
                                        <div class="name"><strong
                                                style="color: #c60031"><?php echo e(__('db.Total Purchase')); ?></strong></div>
                                    </div>
                                </div>
                            </div> -->


                            <!-- Count item widget-->
                            <!-- <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon"><i class="dripicons-warning" style="color: #bdbb39"></i></div>
                                    <div>
                                        <div class="count-number purchase_due-data">
                                            <?php echo e(number_format((float) $purchase_due, $general_setting->decimal, '.', '')); ?>

                                        </div>
                                        <div class="name"><strong
                                                style="color: #bdbb39"><?php echo e(__('db.Purchase Due')); ?></strong></div>
                                    </div>
                                </div>
                            </div> -->

                            <!-- Count item widget-->
                            <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon"><i class="dripicons-return" style="color: #00c689"></i></div>
                                    <div>
                                        <div class="count-number purchase_return-data">
                                            <?php echo e(number_format((float) $purchase_return, $general_setting->decimal, '.', '')); ?>

                                        </div>
                                        <div class="name"><strong
                                                style="color: #00c689"><?php echo e(__('db.Purchase Return')); ?></strong></div>
                                    </div>
                                </div>
                            </div>
                            <!-- Count item widget-->
                            <div class="col-sm-3">
                                <div class="wrapper count-title">
                                    <div class="icon"><i class="dripicons-trophy" style="color: #297ff9"></i></div>
                                    <div>
                                        <div class="count-number profit-data">
                                            <?php echo e(number_format((float) $profit, $general_setting->decimal, '.', '')); ?></div>
                                        <div class="name"><strong style="color: #297ff9"><?php echo e(__('db.profit')); ?> <?php if (isset($component)) { $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.info','data' => ['title' => 'Revenue + Purchase Return - Product Cost - Expense','type' => 'info']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('info'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Revenue + Purchase Return - Product Cost - Expense','type' => 'info']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $attributes = $__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__attributesOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c)): ?>
<?php $component = $__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c; ?>
<?php unset($__componentOriginalcc3646f272fffe9fa9c1a8c2c788b35c); ?>
<?php endif; ?></strong>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
                <?php
                    $cash_flow = $role_has_permissions_list->where('name', 'cash_flow')->first();
                ?>
                <?php if($cash_flow): ?>
                    <div class="col-md-7 mt-4">
                        <div class="card line-chart-example">
                            <div class="card-header d-flex align-items-center">
                                <h4><?php echo e(__('db.Cash Flow')); ?></h4>
                            </div>
                            <div class="card-body">
                                <canvas id="cashFlow" data-color = "<?php echo e($color); ?>"
                                    data-color_rgba = "<?php echo e($color_rgba); ?>"
                                    data-recieved = "<?php echo e(json_encode($payment_recieved)); ?>"
                                    data-sent = "<?php echo e(json_encode($payment_sent)); ?>"
                                    data-month = "<?php echo e(json_encode($month)); ?>"
                                    data-label1="<?php echo e(__('db.Payment Recieved')); ?>"
                                    data-label2="<?php echo e(__('db.Payment Sent')); ?>"></canvas>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
                <?php
                    $monthly_summary = $role_has_permissions_list->where('name', 'monthly_summary')->first();
                ?>
                <?php if($monthly_summary): ?>
                    <div class="col-md-5 mt-4">
                        <div class="card">
                            <div class="card-header d-flex justify-content-between align-items-center">
                                <h4><?php echo e(date('F')); ?> <?php echo e(date('Y')); ?></h4>
                            </div>
                            <div class="pie-chart mb-2">
                                <canvas id="transactionChart" data-color = "<?php echo e($color); ?>"
                                    data-color_rgba = "<?php echo e($color_rgba); ?>" data-revenue=<?php echo e($revenue); ?>

                                    data-purchase=<?php echo e($purchase); ?> data-expense=<?php echo e($expense); ?>

                                    data-label1="<?php echo e(__('db.Purchase')); ?>" data-label2="<?php echo e(__('db.revenue')); ?>"
                                    data-label3="<?php echo e(__('db.Expense')); ?>" width="100" height="95"> </canvas>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
            </div>
        </div>

        <div class="container-fluid">
            <div class="row">
                <?php
                    $yearly_report = $role_has_permissions_list->where('name', 'yearly_report')->first();
                ?>
                <?php if($yearly_report): ?>
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header d-flex align-items-center">
                                <h4><?php echo e(__('db.yearly report')); ?></h4>
                            </div>
                            <div class="card-body">
                                <canvas id="saleChart" data-sale_chart_value = "<?php echo e(json_encode($yearly_sale_amount)); ?>"
                                    data-purchase_chart_value = "<?php echo e(json_encode($yearly_purchase_amount)); ?>"
                                    data-label1="<?php echo e(__('db.Purchased Amount')); ?>"
                                    data-label2="<?php echo e(__('db.Sold Amount')); ?>"></canvas>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
                <div class="col-md-7">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <h4><?php echo e(__('db.Recent Transaction')); ?></h4>
                            <div class="right-column">
                                <div class="badge badge-primary"><?php echo e(__('db.latest')); ?> 5</div>
                            </div>
                        </div>
                        <ul class="nav nav-tabs" role="tablist">
                            <li class="nav-item">
                                <a class="nav-link active" href="#sale-latest" role="tab"
                                    data-toggle="tab"><?php echo e(__('db.Sale')); ?></a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#purchase-latest" role="tab"
                                    data-toggle="tab"><?php echo e(__('db.Purchase')); ?></a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#quotation-latest" role="tab"
                                    data-toggle="tab"><?php echo e(__('db.Quotation')); ?></a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#payment-latest" role="tab"
                                    data-toggle="tab"><?php echo e(__('db.Payment')); ?></a>
                            </li>
                        </ul>

                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane fade show active" id="sale-latest">
                                <div class="table-responsive">
                                    <table id="recent-sale" class="table">
                                        <thead>
                                            <tr>
                                                <th><?php echo e(__('db.date')); ?></th>
                                                <th><?php echo e(__('db.reference')); ?></th>
                                                <th><?php echo e(__('db.customer')); ?></th>
                                                <th><?php echo e(__('db.status')); ?></th>
                                                <th><?php echo e(__('db.grand total')); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div role="tabpanel" class="tab-pane fade" id="purchase-latest">
                                <div class="table-responsive">
                                    <table id="recent-purchase" class="table">
                                        <thead>
                                            <tr>
                                                <th><?php echo e(__('db.date')); ?></th>
                                                <th><?php echo e(__('db.reference')); ?></th>
                                                <th><?php echo e(__('db.Supplier')); ?></th>
                                                <th><?php echo e(__('db.status')); ?></th>
                                                <th><?php echo e(__('db.grand total')); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div role="tabpanel" class="tab-pane fade" id="quotation-latest">
                                <div class="table-responsive">
                                    <table id="recent-quotation" class="table">
                                        <thead>
                                            <tr>
                                                <th><?php echo e(__('db.date')); ?></th>
                                                <th><?php echo e(__('db.reference')); ?></th>
                                                <th><?php echo e(__('db.customer')); ?></th>
                                                <th><?php echo e(__('db.status')); ?></th>
                                                <th><?php echo e(__('db.grand total')); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div role="tabpanel" class="tab-pane fade" id="payment-latest">
                                <div class="table-responsive">
                                    <table id="recent-payment" class="table">
                                        <thead>
                                            <tr>
                                                <th><?php echo e(__('db.date')); ?></th>
                                                <th><?php echo e(__('db.reference')); ?></th>
                                                <th><?php echo e(__('db.Amount')); ?></th>
                                                <th><?php echo e(__('db.Paid By')); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-5">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <h4><?php echo e(__('db.Best Seller') . ' ' . date('F')); ?></h4>
                            <div class="right-column">
                                <div class="badge badge-primary"><?php echo e(__('db.top')); ?> 5</div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table id="monthly-best-selling-qty" class="table">
                                <thead>
                                    <tr>
                                        <th><?php echo e(__('db.Product Details')); ?></th>
                                        <th><?php echo e(__('db.qty')); ?></th>
                                    </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <h4><?php echo e(__('db.Best Seller') . ' ' . date('Y') . '(' . __('db.qty') . ')'); ?></h4>
                            <div class="right-column">
                                <div class="badge badge-primary"><?php echo e(__('db.top')); ?> 5</div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table id="yearly-best-selling-qty" class="table">
                                <thead>
                                    <tr>
                                        <th><?php echo e(__('db.Product Details')); ?></th>
                                        <th><?php echo e(__('db.qty')); ?></th>
                                    </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <h4><?php echo e(__('db.Best Seller') . ' ' . date('Y') . '(' . __('db.Price') . ')'); ?></h4>
                            <div class="right-column">
                                <div class="badge badge-primary"><?php echo e(__('db.top')); ?> 5</div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table id="yearly-best-selling-price" class="table">
                                <thead>
                                    <tr>
                                        <th><?php echo e(__('db.Product Details')); ?></th>
                                        <th><?php echo e(__('db.grand total')); ?></th>
                                    </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>


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

<?php $__env->startPush('scripts'); ?>
    <script type="text/javascript">
        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/yearly-best-selling-price')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    var url = '<?php echo e(url('/images/product')); ?>';
                    data.forEach(function(item) {
                        if (item.product_images)
                            var images = item.product_images.split(',');
                        else
                            var images = ['zummXD2dvAtI.png'];
                        $('#yearly-best-selling-price').find('tbody').append(
                            '<tr><td><div class="d-flex align-items-center"><img src="' +
                            url + '/' + images[0] +
                            '" width="30" height="25" class="ml-3 mr-3"> ' + item
                            .product_name + ' [' + item.product_code + ']</div></td><td>' +
                            (item.total_price / item.exchange_rate).toFixed(<?php echo e($general_setting->decimal); ?>) + '</td></tr>');
                    })
                }
            });
        });

        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/yearly-best-selling-qty')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    var url = '<?php echo e(url('/images/product')); ?>';
                    data.forEach(function(item) {
                        if (item.product_images)
                            var images = item.product_images.split(',');
                        else
                            var images = ['zummXD2dvAtI.png'];
                        $('#yearly-best-selling-qty').find('tbody').append(
                            '<tr><td><div class="d-flex align-items-center"><img src="' +
                            url + '/' + images[0] +
                            '" width="30" height="25" class="ml-3 mr-3"> ' + item
                            .product_name + ' [' + item.product_code + ']</div></td><td>' +
                            item.sold_qty + '</td></tr>');
                    })
                }
            });
        });

        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/monthly-best-selling-qty')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    var url = '<?php echo e(url('/images/product')); ?>';
                    data.forEach(function(item) {
                        if (item.product_images)
                            var images = item.product_images.split(',');
                        else
                            var images = ['zummXD2dvAtI.png'];
                        $('#monthly-best-selling-qty').find('tbody').append(
                            '<tr><td><div class="d-flex align-items-center"><img src="' +
                            url + '/' + images[0] +
                            '" width="30" height="25" class="ml-3 mr-3"> ' + item
                            .product_name + ' [' + item.product_code + ']</div></td><td>' +
                            item.sold_qty + '</td></tr>');
                    })
                }
            });
        });

        $(document).ready(function() {
            $.ajax({
                url: "<?php echo e(url('/recent-sale')); ?>",
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    data.forEach(function(item) {
                        var sale_date = item.created_at ? dateFormat(item.created_at.split('T')[0],
                            '<?php echo e($general_setting->date_format); ?>') : '';
                        if (item.sale_status == 1) {
                            var status =
                                '<div class="badge badge-success"><?php echo e(__('db.Completed')); ?></div>';
                        } else if (item.sale_status == 2) {
                            var status =
                                '<div class="badge badge-danger"><?php echo e(__('db.Pending')); ?></div>';
                        } else {
                            var status =
                                '<div class="badge badge-warning"><?php echo e(__('db.Draft')); ?></div>';
                        }
                        $('#recent-sale').find('tbody').append('<tr><td>' + sale_date +
                            '</td><td>' + item.reference_no + '</td><td>' + item.name +
                            '</td><td>' + status + '</td><td>' + (item.grand_total/item.exchange_rate).toString()
                            .replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</td></tr>');
                    })
                }
            });
        });

        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/recent-purchase')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    data.forEach(function(item) {
                        var payment_date = item.created_at ? dateFormat(item.created_at.split('T')[0],
                            '<?php echo e($general_setting->date_format); ?>') : '';
                        if (item.status == 1) {
                            var status =
                                '<div class="badge badge-success"><?php echo e(__('db.Recieved')); ?></div>';
                        } else if (item.status == 2) {
                            var status =
                                '<div class="badge badge-danger"><?php echo e(__('db.Partial')); ?></div>';
                        } else if (item.status == 3) {
                            var status =
                                '<div class="badge badge-danger"><?php echo e(__('db.Pending')); ?></div>';
                        } else {
                            var status =
                                '<div class="badge badge-warning"><?php echo e(__('db.Ordered')); ?></div>';
                        }
                        $('#recent-purchase').find('tbody').append('<tr><td>' + payment_date +
                            '</td><td>' + item.reference_no + '</td><td>' + item.name +
                            '</td><td>' + status + '</td><td>' + (item.grand_total/item.exchange_rate).toString()
                            .replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</td></tr>');
                    })
                }
            });
        });

        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/recent-quotation')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    data.forEach(function(item) {
                        var quotation_date = item.created_at ? dateFormat(item.created_at.split('T')[0],
                            '<?php echo e($general_setting->date_format); ?>') : '';
                        if (item.quotation_status == 1) {
                            var status =
                                '<div class="badge badge-success"><?php echo e(__('db.Pending')); ?></div>';
                        } else if (item.quotation_status == 2) {
                            var status =
                                '<div class="badge badge-danger"><?php echo e(__('db.Sent')); ?></div>';
                        }
                        $('#recent-quotation').find('tbody').append('<tr><td>' +
                            quotation_date + '</td><td>' + item.reference_no + '</td><td>' +
                            item.name + '</td><td>' + status + '</td><td>' + item
                            .grand_total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") +
                            '</td></tr>');
                    })
                }
            });
        });

        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/recent-payment')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    data.forEach(function(item) {
                        var payment_date = item.created_at ? dateFormat(item.created_at.split('T')[0],
                            '<?php echo e($general_setting->date_format); ?>') : '';
                        $('#recent-payment').find('tbody').append('<tr><td>' + payment_date +
                            '</td><td>' + item.payment_reference + '</td><td>' + (item.amount/item.exchange_rate)
                            .toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") +
                            '</td><td>' + item.paying_method + '</td></tr>');
                    })
                }
            });
        });

        function dateFormat(inputDate, format) {
            const date = new Date(inputDate);
            //extract the parts of the date
            const day = date.getDate();
            const month = date.getMonth() + 1;
            const year = date.getFullYear();
            //replace the month
            format = format.replace("m", month.toString().padStart(2, "0"));
            //replace the year
            format = format.replace("Y", year.toString());
            //replace the day
            format = format.replace("d", day.toString().padStart(2, "0"));
            return format;
        }


        $(document).ready(function() {
            $.ajax({
                url: '<?php echo e(url('/')); ?>',
                type: 'GET',
                dataType: 'json',
                success: function(data) {
                    $('#userShowModal').modal('show');
                    $('#user-id').text(data.id);
                    $('#user-name').text(data.name);
                    $('#user-email').text(data.email);
                }
            });
        })
        // Show and hide color-switcher
        $(".color-switcher .switcher-button").on('click', function() {
            $(".color-switcher").toggleClass("show-color-switcher", "hide-color-switcher", 300);
        });

        // Color Skins
        $('a.color').on('click', function() {
            /*var title = $(this).attr('title');
            $('#style-colors').attr('href', 'css/skin-' + title + '.css');
            return false;*/
            $.get('setting/general_setting/change-theme/' + $(this).data('color'), function(data) {});
            var style_link = $('#custom-style').attr('href').replace(/([^-]*)$/, $(this).data('color'));
            $('#custom-style').attr('href', style_link);
        });

        $(".date-btn").on("click", function() {
            $(".date-btn").removeClass("active");
            $(this).addClass("active");
            var start_date = $(this).data('start_date');
            var end_date = $(this).data('end_date');
            var warehouse_id = $("#warehouse_btn").val();
            $.get('dashboard-filter/' + start_date + '/' + end_date + '/' + warehouse_id, function(data) {
                dashboardFilter(data);
            });
        });

        $("#warehouse_btn").on("change", function() {
            var warehouse_id = $(this).val();
            var start_date = $('.date-btn.active').data('start_date');
            var end_date = $('.date-btn.active').data('end_date');
            //console.log(start_date);
            //console.log(end_date);
            $.get('dashboard-filter/' + start_date + '/' + end_date + '/' + warehouse_id, function(data) {
                dashboardFilter(data);
            });
        });

        function dashboardFilter(data) {
            // data is an array:
            // [revenue, sale_return, profit, purchase_return, total_sale, invoice_due, total_purchase, purchase_due]

            $('.total_sale-data').hide();
            $('.total_sale-data').html(parseFloat(data[4] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.total_sale-data').show(500);

            $('.revenue-data').hide();
            $('.revenue-data').html(parseFloat(data[0] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.revenue-data').show(500);

            $('.invoice-due-data').hide();
            $('.invoice-due-data').html(parseFloat(data[5] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.invoice-due-data').show(500);

            $('.return-data').hide();
            $('.return-data').html(parseFloat(data[1] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.return-data').show(500);

            $('.total_purchase-data').hide();
            $('.total_purchase-data').html(parseFloat(data[6] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.total_purchase-data').show(500);

            $('.purchase_due-data').hide();
            $('.purchase_due-data').html(parseFloat(data[7] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.purchase_due-data').show(500);

            $('.purchase_return-data').hide();
            $('.purchase_return-data').html(parseFloat(data[3] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.purchase_return-data').show(500);

            $('.profit-data').hide();
            $('.profit-data').html(parseFloat(data[2] ?? 0).toFixed(<?php echo e($general_setting->decimal); ?>));
            $('.profit-data').show(500);
        }
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.layout.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\internal\resources\views/backend/index.blade.php ENDPATH**/ ?>