  <?php $__env->startSection('content'); ?>
 <?php Fun::lang() ?>
 <div class="title-page">
     <div class="page-bar">
         <ul class="page-breadcrumb">
             <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
             <li><a href="#">Manage Agency Wallet</a></li>
             <li><a href="#">Request Deposit</a></li>
         </ul>
     </div>
 </div>
 <div class="page">
     <div class="top-content">
         <div class="row">
             <div class="col-sm-12 col-xs-12">
                 <div class="title-add">
                     <div class="pull-left">
                         <h3>Request Deposit</h3>
                     </div>
                 </div>
             </div>
         </div>
     </div>
     <form action="<?php echo e(url('/realty/funds-requested-deposite-print')); ?>" method="POST">
         <?php echo csrf_field(); ?>
         <div class="form-search">
             <div class="row">
                 <div class="col-xs-12 col-sm-4 col-md-4">
                     <div class="form-group">
                         <strong>Start Date</strong> <?php echo Form::text('start_date', null, array('placeholder' => 'Start Date','class' => 'form-control date_picker start_date','autocomplete' => 'off')); ?>

                     </div>
                 </div>
                 <div class="col-xs-12 col-sm-4 col-md-4">
                     <div class="form-group">
                         <strong>End Date</strong> <?php echo Form::text('end_date', null, array('placeholder' => 'End Date','class' => 'form-control date_picker end_date','autocomplete' => 'off')); ?>

                     </div>
                 </div>
                 <div class="col-xs-12 col-sm-4 col-md-4">
                     <div class="form-group">
                         <strong>Status</strong>
                         <select class="form-control select2" name="action">
                             <option value="0">Please Select</option>
                             <option value="1">Approve</option>
                             <option value="2">Reject</option>
                             <option value="3">Request</option>
                         </select>
                     </div>
                 </div>
                 <div class="col-xs-12 col-sm-12 col-md-12 text-right">
                     <button type="button" class="button_primary btn-sm search" onclick="searching()"><span class="fa fa-search"> Search</span></button>&nbsp
                     ​​​​​​​​​​​​​​​​ <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Deposit-Report-Print')): ?>
                     <button type="submit" class="button_primary btn-sm search"><span class="fa fa-print"> Print</span></button>
                     <?php endif; ?>
                 </div>
             </div>
         </div>
         <div class="box-body table-responsive">
             <table id="datatable_item" class="table table-striped table-bordered table-hover nowrap">
                 <thead>
                     <tr>
                         <th>No</th>
                         <th>Requested Date</th>
                         <th>Transaction</th>
                         <th>Account Name</th>
                         <th>Reference</th>
                         <th>Amount</th>
                         <th>Status / Action</th>
                     </tr>
                 </thead>
                 <tbody class="tbody"></tbody>
                 <tfoot class="tfoot">
                 </tfoot>
             </table>
         </div>
     </form>
 </div>

 <!--  <div class="modal fade" id="popUpApprove" role="dialog">
     <div class="modal-dialog">
         <div class="modal-content custom-pupup">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">
                     <span aria-hidden="true">&times;</span>
                     <span class="sr-only">Close</span>
                 </button>
                 <h4 class="modal-title" id="myModalLabel">Are you sure?</h4>
             </div>
             <div class="modal-body">
                 <div>
                     It will be approved!
                 </div>
                 <p class="statusMsg"></p>
                 <form role="form" method="POST" id="form_update_approve">
                     <?php echo e(csrf_field()); ?>

                     <input type="text" name="status" id="status" hidden>
                     <div class="modal-footer">
                         <button type="button" class="fa fa-reply button_danger" data-dismiss="modal"> Cancel</button>
                         <button type="submit" class="fa fa-check button_primary"> Approve</button>

                     </div>
                 </form>
             </div>
         </div>
     </div>
 </div> -->

 <!-- 
 <div class="modal fade" id="popUpReject" role="dialog">
     <div class="modal-dialog">
         <div class="modal-content custom-pupup">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">
                     <span aria-hidden="true">&times;</span>
                     <span class="sr-only">Close</span>
                 </button>
                 <h4 class="modal-title" id="myModalLabel">Are you sure?</h4>
             </div>
             <div class="modal-body">
                 <div>
                     It will be rejected!
                 </div>
                 <p class="statusMsg"></p>
                 <form role="form" method="POST" id="form_update_reject">
                     <?php echo e(csrf_field()); ?>

                     <input type="text" name="status" id="status" hidden>
                     <div class="modal-footer">
                         <button type="button" class="fa fa-reply button_danger" data-dismiss="modal"> Cancel</button>
                         <button type="submit" class="fa fa-check button_primary"> Reject</button>

                     </div>
                 </form>
             </div>
         </div>
     </div>
 </div> -->

 <div class="modal fade bs-modal-lg" id="popUpApprove" tabindex="-1" role="dialog" aria-hidden="true">
     <div class="modal-dialog modal-dm">
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                 <h3 class="modal-title">Are you sure?</h3>
             </div>
             <br />
             <form role="form" method="POST" id="form_update_approve">
                 <?php echo e(csrf_field()); ?>

                 <div class="row">
                     <div class="col-md-12">
                         <div class="col-md-10">
                             <h4>It will be approved!</h4>
                             <input type="text" name="status" id="status" hidden>
                         </div>
                     </div>
                 </div>
                 <div class="modal-footer">
                     <button type="button" data-dismiss="modal" class="button_danger"><i class="fa fa-close"></i> No</button>
                     <button type="submit" class="button_success" data-toggle="modal"><i class="fa fa-save"></i> OK</button>
                 </div>
             </form>
         </div>
         <!-- /.modal-content -->
     </div>
     <!-- /.modal-dialog -->
 </div>
 <div class="modal fade bs-modal-lg" id="popUpEditAmount" tabindex="-1" role="dialog" aria-hidden="true">
     <div class="modal-dialog modal-dm">
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                 <h3 class="modal-title">Edit Approve</h3>
             </div>
             <br />
             <form role="form" method="POST" id="form_update_edit">
                 <?php echo e(csrf_field()); ?>

                 <div class="row">
                     <div class="col-md-12">
                         <div class="col-md-10">
                             <input type="text" name="status" id="status" hidden>
                             <input type="hidden" name="con" value="1">
                             <div class="col-md-2"><label for="">Amount:</label></div>
                             <div class="col-md-10">
                                 <input type="text" name="amount" id="amount-edit" class="form-control" required>
                                 <br />
                             </div>

                         </div>
                     </div>
                     <div class="col-md-12">
                         <div class="col-md-10">
                             <div class="col-md-2"><label for="">Remark:</label></div>
                             <div class="col-md-10">
                                 <textarea name="remark" id="remark-edit" class="form-control"></textarea>
                                 <br />
                             </div>
                         </div>
                     </div>
                 </div>
                 <div class="modal-footer">
                     <button type="button" data-dismiss="modal" class="button_danger"><i class="fa fa-close"></i> No</button>
                     <button type="submit" class="button_success" data-toggle="modal"><i class="fa fa-save"></i> OK</button>
                 </div>
             </form>
         </div>
         <!-- /.modal-content -->
     </div>
     <!-- /.modal-dialog -->
 </div>
 <div class="modal fade bs-modal-lg" id="popUpReject" tabindex="-1" role="dialog" aria-hidden="true">
     <div class="modal-dialog modal-dm">
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                 <h3 class="modal-title">Are you sure?</h3>
             </div>
             <br />
             <form role="form" method="POST" id="form_update_reject">
                 <?php echo e(csrf_field()); ?>

                 <div class="row">
                     <div class="col-md-12">
                         <div class="col-md-10">
                             <h4>It will be approved!</h4>
                             <input type="text" name="status" id="status" hidden>
                         </div>
                     </div>
                 </div>
                 <div class="modal-footer">
                     <button type="button" data-dismiss="modal" class="button_danger"><i class="fa fa-close"></i> No</button>
                     <button type="submit" class="button_success" data-toggle="modal"><i class="fa fa-save"></i> OK</button>
                 </div>
             </form>
         </div>
         <!-- /.modal-content -->
     </div>
     <!-- /.modal-dialog -->
 </div>
 <div class="modal fade" id="popUpImage" role="dialog">
     <div class="modal-dialog modal-sm">
         <div class="modal-content custom-pupup">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">
                     <span aria-hidden="true">&times;</span>
                     <span class="sr-only">Close</span>
                 </button>
             </div>
             <div class="modal-body">
                 <div id="show_image">
                 </div>
             </div>
         </div>
     </div>
 </div>
 <?php $__env->stopSection(); ?> <?php $__env->startSection('js'); ?>
 <script type="text/javascript" src="<?php echo e(asset('assets/controller/request-deposit.js')); ?>"></script>
 <script type="text/javascript">
     $(document).on("click", ".EditAmountFund", function() {
         $("#amount-edit").val($(this).data('amount'));
         var id = $(this).data('id');
         var to_account = $(this).data('to_account');
         var amount = $(this).data('amount');
         var url = "/realty/approve-funds-request-add";
         $('#form_update_edit').attr('action', url + '/' + id + '/' + amount + '/' + to_account);
         $('#popUpEditAmount').modal('show');
     });

     $(document).on('click', '.viewPopLinkApprove', function() {
         var id = $(this).data('id');
         var amount = $(this).data('amount');
         var to_account = $(this).data('to_account');
         var url = "/realty/approve-funds-request-add";
         $('#form_update_approve').attr('action', url + '/' + id + '/' + amount + '/' + to_account);
         $('#popUpApprove').modal('show');

     });

     $(document).on('click', '.viewPopLinkReject', function() {
         var id = $(this).data('id');
         var url = "/realty/reject-funds-request-add";
         $('#form_update_reject').attr('action', url + '/' + id);
         $('#popUpReject').modal('show');
     });

     $(document).on('click', '.viewPopLinkImage', function() {
         var img = $(this).data('img');
         var url = "<?php echo asset('assets/images/resize/300x300/'); ?>";
         var image = '<img src="' + url + '/' + img + '" width="100%">';
         $('#show_image').append(image);
         $('#popUpImage').modal('show');
     });

     $(document).on('click', '.close', function() {
         $('#show_image > img').remove();
     });

     $('body').on('click', function() {
         $('#show_image > img').remove();
     });


     function searching() {
         var start_date = $('input[name="start_date"]').val();
         var end_date   = $('input[name="end_date"]').val();
         var action     = $('select[name="action"]').val();
         $('#datatable_item').DataTable().destroy();
         $('#datatable_item').DataTable({
             ordering: false,
             serverSide: true,
             "lengthMenu": [
                 [20, 30, 50, 100, -1],
                 [20, 30, 50, 100, "All"]
             ],
             ajax: {
                 method: 'POST',
                 url: '/realty/datatable_get_funds_request_add',
                 async: false,
                 data: {
                     _token: '<?php echo e(csrf_token()); ?>',
                     start_date: start_date,
                     end_date: end_date,
                     action: action,
                 },
             },
             columns: [
                 {
                     data: 'DT_RowIndex'
                 },
                 {
                     data: 'request_date'
                 },
                 {
                     data: 'operation_type'
                 },
                 {
                     data: 'account_number'
                 },
                 {
                     data: 'reference'
                 },
                 {
                     data: 'amount',
                     "className": 'text-right'
                 },
                 {
                     data: 'status'
                 },
             ],
             "initComplete": function(settings, json) {
                 $('.main-spinner').hide();
             },
         });
         $.fn.dataTable.ext.errMode = 'throw';
     }
 </script>
 <?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>