


<?php $__env->startSection('title'); ?>
Dashboard 
<?php $__env->stopSection(); ?>

<?php $__env->startSection('css'); ?>
    <link href="<?php echo e(asset('plugins/components/chartist-js/dist/chartist.min.css')); ?>" rel="stylesheet">
    <style>
         .graphbox{
            position: relative;
            width: 100%;
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr;
            grid-gap: 10px;
            margin-bottom: 13px;
        }
        .graphbox .box{
            position: relative;
            background: #fff;
            width: 100%;
            box-shadow: 0 7px 25px rgba(0, 0, 0, 0.08);
            border-radius: 5px;
            margin-top: 60px;
        }
        #myChart{
            margin-left: 60px;
        }
        #FirstChart{
            margin-left: 22px;
        }
        #SecondChart{
            margin-left: 23px;
        }
        #ThirdChart{
            margin-top: 30px;
        }
        #FourthChart{
            margin-left: 25px;
        }
        /* Responsivness */
        @media (max-width: 991px){
            .graphbox{
                grid-template-columns: 1fr;
                height: auto;
            }
        }
        

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


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

<div class=" container-fluid">
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('isSuperAdmin')): ?>
    <?php echo $__env->make('partial.multiproject_select', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    
    <?php endif; ?>
<br>

<div id='updatecontent'>
<?php if (\Illuminate\Support\Facades\Blade::check('role', 'admin')): ?>

 
<input type='hidden' id='received_amount' value="<?php echo e($stats['received-amount']); ?>">
<input type='hidden' id='current_received_amount' value="<?php echo e($stats['current-received-amount']); ?>">
<input type='hidden' id='month_val' value="<?php echo e($stats['month']); ?>">
 
           



   <div class="row colorbox-group-widget" style="margin-top: 50px;">
                    <div class="col-md-3 col-sm-6 info-color-box">
                        <div class="white-box">
                            <div class="media bg-primary">
                                <div class="media-body">
                                    
                                        <a style="color: white" href="#" target="_blank">
                                        <h3 class="info-count"><?php echo e(number_format($stats['received-amount'])); ?> <span class="pull-right"><i class="mdi mdi-checkbox-marked-circle-outline"></i></span></h3>
                                    <p class="info-text font-12">Received Amount</p>
                                    <p class="info-ot font-15"><?php echo e($stats['month']); ?><span class="label label-rounded"><?php echo e(number_format($stats['current-received-amount'])); ?></span></p>
                                </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3 col-sm-6 info-color-box">
                        <div class="white-box">
                            <div class="media bg-success">
                                <div class="media-body">
                                    
                                        <a style="color: white" href="#" target="_blank">
                                        <h3 class="info-count"><?php echo e(number_format($stats['open_inventory_cost'])); ?> <span class="pull-right"><i class="mdi mdi-comment-text-outline"></i></span></h3>
                                    <p class="info-text font-12">Open Inventory</p>
                                    <p class="info-ot font-15">Count :<span class="label label-rounded"><?php echo e(number_format($stats['open_inventory_count'])); ?></span></p>
                                </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3 col-sm-6 info-color-box">
                        <div class="white-box">
                            <div class="media bg-danger">
                                <div class="media-body">
                                      
                                        <a style="color: white" href="#" target="_blank">
                                    <h3 class="info-count"><?php echo e(number_format($stats['sold_inventory_paid'])); ?> <span class="pull-right"><i class="mdi mdi-coin"></i></span></h3>
                                    <p class="info-text font-12">Sold Inventory</p>
                                    <p class="info-ot font-15">Count :<span class="label label-rounded"><?php echo e(number_format($stats['sold_inventory_count'])); ?></span></p>
                                </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3 col-sm-6 info-color-box">
                        <div class="white-box">
                            <div class="media bg-warning">
                                <div class="media-body">
                                    
                                        <a style="color: white" href="#" target="_blank">
                                    <h3 class="info-count"><?php echo e(number_format($stats['earning'])); ?> <span class="pull-right"><i class="mdi mdi-coin"></i></span></h3>
                                    <p class="info-text font-12">Net Income</p>
                                    <p class="info-ot font-15"><?php echo e($stats['month']); ?><span class="label label-rounded"></span></p>
                                </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> 

               
                  


<br>
<?php endif; ?>

 <!--.row-->
 <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'list-membership')): ?>
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-info">
                            <div class="panel-heading">Search Statements</div>
                            <div class="panel-wrapper collapse in" aria-expanded="true">
                                <div class="panel-body">
                                    <form >
                                        <div class="form-body">
                                            <div class="row">
                                                
                                                <!--/span-->
                                                <div class="col-md-3">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By Unit No.</label>
                                                        
                                                        <select id="unit" class="form-control chosen-select">
                                                        <option  value="0">None</option>
                                                        <?php $__currentLoopData = $unitNumbers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($p->id); ?>"><?php echo e($p->unit_number); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select> </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By Size</label>
                                                        
                                                        <select id="size" class="form-control chosen-select">
                                                            <option value="0">None</option>
                                                            <?php $__currentLoopData = $sizes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                <option value="<?php echo e($s->id); ?>">
                                                                    <?php echo e($s->name); ?> </option>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select> </div>
                                                </div>
                                                <!--/span-->
                                                <!--/span-->
                                                <div class="col-md-3">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By Customer</label>
                                                        
                                                        <select id="customer" class="form-control chosen-select">
                                                        <option  value="0">None</option>
                                                        <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($c->id); ?>"><?php echo e($c->name); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select> </div>
                                                </div>
                                                <!--/span-->

                                                <!--/span-->
                                                <div class="col-md-3">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By Dealer</label>
                                                        
                                                        <select id="dealer" class="form-control chosen-select">
                                                        <option  value="0">None</option>
                                                        <?php $__currentLoopData = $dealers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($d->id); ?>"><?php echo e($d->name); ?>-<?php echo e($d->code); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select> </div>
                                                </div>
                                                <!--/span-->

                                                <!--/span-->
                                                <div class="col-md-3">
                                                    <div class="form-group has-success" style="margin-bottom: 15px">
                                                        <label class="control-label">By status</label>
                                                        <select id="status" class="form-control chosen-select">
                                                        <option  value="0">None</option>
                                                            
                                                        <option  value="<?php echo e(\App\CustomerProperty::approved); ?>">Approved</option>
                                                        <option  value="<?php echo e(\App\CustomerProperty::pending); ?>">Pending</option>
                                                        <option value="<?php echo e(\App\CustomerProperty::cancel); ?>">Cancelled</option>
                                                        
                                                        </select> </div>
                                                </div>
                                                <!--/span-->
                                                <div class="col-md-3">
                                                    <div class="form-actions" style="margin-top: 26px">
                                            <button type="button" class="btn btn-success search-customer"> <i class="fa fa-check" ></i> Search</button>
                                            
                                        </div>
                                                </div>
                                            </div>
                                            
                                            
                                        </div>
                                        
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--./row-->

                <div class="row" id="update-table">
                    
                </div>
                <!-- /.row -->

        <?php endif; ?>

<?php if (\Illuminate\Support\Facades\Blade::check('permission', 'due-payments')): ?>



      <div class="row">

                    <div class="col-sm-12">
                        <div class="white-box">

                            <h3 class="box-title">Current Month Due Amounts <a href="<?php echo e(route('properties.due')); ?>" style="float: right;font-size: 12px"><u>View All</u></a></h3>


                            <div class="table-responsive">
                                <table id="myTable1" class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>Sr No.</th>
                                            <th>Unit No.</th>
                                            <th>Member Name</th>
                                            <th>Dealer</th>
                                            <th>Net Amount</th>
                                            <th class="text-center">Received Amount</th>
                                            <th class="text-center">Due Amount</th>
                                            <th>Due Date</th>
                                            <th>Number</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $count =1;?>
                                        <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-membership')): ?>
                                        <?php $view_membership = true;?>
                                        <?php else: ?>
                                        <?php $view_membership = false;?>
                                        <?php endif; ?>

                                        <?php $__currentLoopData = $due['properties']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $statement): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                      <?php if($due['dueAmt'][$statement->id] > 0): ?>
                                          <?php if($due['color'][$statement->id] == 'red'): ?>
                                              <tr style="color:red;">
                                          <?php elseif($due['color'][$statement->id] == 'orange'): ?>
                                              <tr style="color:orange;">
                                          <?php else: ?>
                                              <tr style="color:black;">
                                                  <?php endif; ?>
                                            <td><?php echo e($count++); ?></td>
                                            
                                            <td>
                                            <?php echo e($statement->inventory ? $statement->inventory->unit_number : ''); ?></td>

                                            
                                            

                                            <td><?php echo e($statement->customer ? $statement->customer->name: ''); ?></td>
                                            <td>
                                                <?php $__currentLoopData = $statement->dealerTransaction; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($loop->last): ?>
                                                        <?php echo e($d->dealer->name); ?>

                                                    <?php else: ?>
                                                        <?php echo e($d->dealer->name); ?>,
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>                                                
                                            </td>

                                            <td class="text-right"><?php echo e(number_format($statement->net_pay)); ?> PKR</td>


                                            <td class="text-right"><?php echo e(number_format($due['receivedAmt'][$statement->id])); ?> PKR</td>

                                             <td class="text-right"><?php echo e(number_format($due['dueAmt'][$statement->id])); ?> PKR</td>
                                            <td><?php echo e($due['dueDate'][$statement->id] ? date('d-m-Y', strtotime($due['dueDate'][$statement->id]->due_date)) : ''); ?>

                                             <br><?php $__currentLoopData = $due['dueMonth'][$statement->id]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php if($loop->last): ?><?php echo e(date('M', strtotime($s->due_date))); ?> <?php else: ?><?php echo e(date('M', strtotime($s->due_date))); ?> - <?php endif; ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                        </td>
                                        <td><?php echo e($statement->customer->mobile_number); ?></td>
                                        <td>
                                            <?php if($view_membership): ?>
                                                <a href="<?php echo e(route('statement.detail',['id'=>$statement->id])); ?>" data-toggle="tooltip" data-original-title="View"> <i class="fa fa-eye text-inverse m-r-10"></i>&nbsp;&nbsp;</a>
                                            <?php endif; ?>
                                        </td>

                                        </tr>
                                       <?php endif; ?>

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

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

</div>
                <!-- /row -->

               
             
            <!-- /.container-fluid -->

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

<?php $__env->startSection('js'); ?>
<script src="<?php echo e(asset('plugins/components/chartist-js/dist/chartist.min.js')); ?>"></script>
<script src="<?php echo e(asset('plugins/components/chartist-plugin-tooltip-master/dist/chartist-plugin-tooltip.min.js')); ?>"></script>
<script src="<?php echo e(asset('plugins/components/knob/jquery.knob.js')); ?>"></script>
<script src="<?php echo e(asset('plugins/components/custom-chart/chart.js')); ?>"></script>
<script src="<?php echo e(asset('js/db3.js')); ?>"></script>
 

<script>

    function callItBack(){
        $(function() {
        $('#myTable1').DataTable({
            'pageLength':25,
            'paging':false,
            'info':false,
            'searching':false
        });
        });

            $('.search-customer').on('click',function(){
            $('.preloader').fadeIn();
            unit = $('#unit').val();
            size = $('#size').val();
            customer = $('#customer').val();
            dealer = $('#dealer').val();
            status = $('#status').val();

            if(unit == 0 && customer== 0 && status == 0 && dealer == 0 && size == 0) {
                toastr.warning("please select any option.");
				 $('.preloader').fadeOut();
                return false;
            }

            var data = {'unit':unit,'customer':customer,'dealer':dealer,'status':status,'unit_size':size};
            $.get('/statement/updateTable',data,function(data){
                document.getElementById('update-table').innerHTML = data;

                $('#myTable').DataTable({
                    'pageLength':50,
                    'paging':false,
                    'searching':false,
                    'info':true
                });
                toastr.success("Search updated.");

                
                $('.preloader').fadeOut();
            });
        });
    }
    callItBack();

        function updateStatus(value) {
            $('.preloader').fadeIn();

            if (value === 'search') {

                $('.preloader').fadeOut();
                return false;
            }
            var data = {
                'multipro_id': value,
            };
           
            $.get('<?php echo e(route('home')); ?>', data, function(data) {
                $('.preloader').fadeOut();
                $('#myTable tbody').empty();
                document.getElementById('updatecontent').innerHTML = data;
                callItBack();
            $('#multipro_id_input').val(value);
                toastr.success("Search updated.");
                $('.preloader').fadeOut();
            });

        }
</script>

 
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app' , \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\akram-city.projecterp.net\resources\views/home.blade.php ENDPATH**/ ?>