<?php $__env->startSection('title', 'Purchase Invoice'); ?>

<?php $__env->startPush('css'); ?>
    <!-- data tables -->
    <link href="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css')); ?> " rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-12">
            <div class="state-overview">
                <div class="row">
                    <div class="col-lg-3 col-sm-6">
                        <div class="overview-panel purple">
                            <div class="symbol">
                                <i class="fa fa-ticket usr-clr"></i>
                            </div>
                            <div class="value white">
                                <p class="sbold addr-font-h1" data-counter="counterup" data-value="<?php echo e($invoices->sum('sub_total')); ?>"><?php echo e($invoices->sum('sub_total')); ?></p>
                                <p>Invoice Amount</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-3 col-sm-6">
                        <div class="overview-panel deepPink-bgcolor">
                            <div class="symbol">
                                <i class="fa fa-reply"></i>
                            </div>
                            <div class="value white">
                                <p class="sbold addr-font-h1" data-counter="counterup" data-value="<?php echo e($invoices->sum('discount')); ?>"><?php echo e($invoices->sum('discount')); ?></p>
                                <p>Discount</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-3 col-sm-6">
                        <div class="overview-panel orange">
                            <div class="symbol">
                                <i class="fa fa-handshake-o"></i>
                            </div>
                            <div class="value white">
                                <p class="sbold addr-font-h1" data-counter="counterup" data-value="<?php echo e($invoices->sum('grand_total')); ?>"><?php echo e($invoices->sum('grand_total')); ?></p>
                                <p>Grand Total</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-3 col-sm-6">
                        <div class="overview-panel blue-bgcolor">
                            <div class="symbol">
                                <i class="fa fa-clock-o"></i>
                            </div>
                            <div class="value white">
                                <p class="sbold addr-font-h1" data-counter="counterup" data-value="<?php echo e($invoicePayments->sum('payment')); ?>"><?php echo e($invoicePayments->sum('payment')); ?></p>
                                <p>Paid</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="btn-group">
                <a href="<?php echo e(route('admin.purchases.create')); ?>" id="addRow1" class="btn btn-primary"
                   style="font-size:14px; padding: 6px 12px;">
                    Purchase Invoice <i style="color:white;" class="fa fa-plus"></i>
                </a>

            </div>
            <div class="card card-topline-red">
                <div class="card-head" style="text-align: center;">
                    <header>
                        Purchase Invoices - (<?php echo e(\DB::table('purchases')->count()); ?>)
                    </header>
                </div>
                <div class="card-body">
                     <div class="col-6 my-4 d-flex align-items-center">
                        <span class="mx-2">Select Range</span>
                        <input type="text" class="form-control" style="width: 300px;" name="datetimes" />
                    </div>
                    <?php echo $dataTable->table(); ?>

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


<?php $__env->stopSection(); ?>
<?php $__env->startPush('js'); ?>
    <!-- data tables -->
    <script src="<?php echo e(asset('admin/assets/plugins/datatables/jquery.dataTables.min.js')); ?>" ></script>
    <script src="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.js')); ?>" ></script>
    <script src="<?php echo e(asset('admin/assets/js/buttons/dataTables.buttons.min.js')); ?>"></script>
    <script src="<?php echo e(asset('/vendor/datatables/buttons.server-side.js')); ?>"></script>
    <?php echo $dataTable->scripts(); ?>



    <!-- sweet aleart -->
  <script src="<?php echo e(asset('admin/assets/js/sweetalert.min.js')); ?>"></script>
     <script>
        jQuery(function($) {
            let url = new URL('<?php echo request()->fullUrl(); ?>')
            $('input[name="datetimes"]').daterangepicker({
                timePicker: false,
                startDate: moment().startOf('hour'),
                endDate: moment().startOf('hour').add(32, 'hour'),
                locale: {
                    format: 'DD MMMM YYYY'
                }
            });
            $('input[name="datetimes"]').on('apply.daterangepicker', function(ev, picker) {
                let start = picker.startDate.format('YYYY-MM-DD');
                let end   = picker.endDate.format('YYYY-MM-DD');
                url.searchParams.set('from', start);
                url.searchParams.set('to', end);
                window.location.href = `${url.href}`;
            });

            $('#tnx-status').change(function(){
                url.searchParams.set('status', $(this).val());
                window.location.href = `${url.href}`;
            });
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/forazitradersbd/public_html/resources/views/admin/purchaseinvocie/index.blade.php ENDPATH**/ ?>