<?php $__env->startSection('title'); ?>
   Customer Management
<?php $__env->stopSection(); ?>
<?php $__env->startPush('css'); ?>
    <link rel="stylesheet" href="<?php echo e(asset('backend/plugins/select2.min.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('myfile/backend/assets/datepicker/zebra_datepicker.min.css')); ?>" type="text/css">
	<link rel="stylesheet" href="<?php echo e(asset('myfile/backend/assets/datepicker/examples.css')); ?>" type="text/css">
	<style>
		#search-btn{
			margin-top:24px;
		}
	</style>
<?php $__env->stopPush(); ?>
<!-- page content -->
<?php $__env->startSection('content'); ?>
    <div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
             <?php if(Session::has('success')): ?>
                <div class="alert alert-success">
                    <?php echo e(Session::get('success')); ?>

                </div>
            <?php endif; ?>
            <?php if(Session::has('error')): ?>
                <div class="alert alert-danger">
                    <?php echo e(Session::get('error')); ?>

                </div>
            <?php endif; ?>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Manage Customer
                                 <a href="<?php echo e(route('account.cpi')); ?>" class="btn btn-xs btn-primary"> Payment</a>
                                  <a href="<?php echo e(route('customer.create')); ?>" class="btn btn-xs btn-primary">New Customer</a>
                             </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="">
                            <form id="demo-form2" action="<?php echo e(route('customer.customer-records')); ?>" method="post" data-parsley-validate class="form" autocomplete="off" >
								<?php echo e(csrf_field()); ?>

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

								<div class="row">
									<div class="col-sm-1"></div>
									<div class="col-sm-3">
										<div class="form-group">
											<label>Customer List </label>
											<select name="customer" id="customer_id" class="form-control input-sm select2">
												<option value="All">All</option>
												<?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
													<option value="<?php echo e($pr->id); ?>" <?php echo e(request()->customer == $pr->id ? 'selected' : ''); ?> ><?php echo e($pr->name); ?> </option>
												<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
											</select>
										</div>
									</div>
									<div class="col-sm-2">
										<div class="form-group">
											<label>From</label>
											<input id="datepicker-range-start" type="text" name="from_date"  class="form-control" data-zdp_readonly_element="false" value="<?php echo e(request()->from_date != '' ? date('d-m-Y',strtotime(request()->from_date)) : ''); ?>" >
										</div>
									</div>
									<div class="col-sm-2">
										<div class="form-group">
											<label>To</label>
											<input id="datepicker-range-end" type="text" name="to_date"  class="form-control" data-zdp_readonly_element="false" value="<?php echo e(request()->to_date != '' ? date('d-m-Y',strtotime(request()->to_date)) : ''); ?>">
										</div>
									</div>
									<div class="col-sm-1">
										<div class="form-group">
											<button class="btn btn-primary btn-xs" id="search-btn">
												<i class="ace-icon fa fa-search fa-2x icon-only"></i>
											</button>
										</div>
									</div>
								</div>
							</form>
							<div class="text-center">
							    <p>From: <?php echo e(date('d-m-Y',strtotime($from_date))); ?> To <?php echo e(date('d-m-Y',strtotime($to_date))); ?></p>
							</div>
							<hr/>
                            <div class="x_content table-responsive">
                                <table class="table table-condensed table-bordered " id="">
                                    <thead>
                                    <tr class="bg-primary">
                                        <th>SL</th>
                                        <th>Customer</th>
                                        <th>Phone</th>
                                        <th>Date</th>
                                        <th>Total Price</th>
                                        <th>Payment</th>
                                        <th>Due</th>
                                        <th>Previous Due</th>
                                        <th>Total Due</th>
                                        <th>Send</th>
                                        <th>Print</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $__currentLoopData = $records; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i=>$pc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td> <?php echo e($i+1); ?></td>
                                            <td> <?php echo e($pc->customer->name); ?></td>
                                            <td> <?php echo e($pc->customer->phone); ?></td>
                                            <td> <?php echo e(date('d-m-Y',strtotime($pc->transaction_date))); ?></td>
                                            <td> <?php echo e($pc->total_price); ?></td>
                                            <td> <?php echo e($pc->payment_amount); ?></td>
                                            <td> <?php echo e($pc->due_amount); ?></td>
                                            <td> <?php echo e($pc->previous_due); ?></td>
                                            <td> <?php echo e($pc->total_due); ?></td>
                                            <td>
                                                <form action="<?php echo e(route('customer.record_send',$pc->id)); ?>" method="Get">
                                                    <button type="submit" class="btn btn-xs btn-primary" onclick="return confirm('do you want to send sms ?')" ><i class="fa fa-envelope-o"></i>  Send</button>
                                                </form>
                                            </td>
                                            <td>
                                                <a href="<?php echo e(route('customer.record_print',$pc->id)); ?>" class="btn-xs btn-primary printPage" target="_blank" ><i class="fa fa-print fa-x"></i></a>  
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
   <script src="<?php echo e(asset('backend/plugins/select2.min.js')); ?>"></script>
    <!-- Jquery Plugin For Date Calender-->
    <script type="text/javascript" src="<?php echo e(asset('myfile/backend/assets/datepicker/zebra_datepicker.src.js')); ?>"></script>
    <script type="text/javascript" src="<?php echo e(asset('myfile/backend/assets/datepicker/examples.js')); ?>"></script>
    <script src="<?php echo e(asset('myfile/backend/assets/js/print-page.js')); ?>"></script>
   <script>
       $(document).ready(function() {
	        // select2 section
            $('.select2').select2()	;
            $('.printPage').printPage();
       })
   </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>