<?php $__env->startSection('page_title'); ?>
  Manage Purchase Order
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page_header_title'); ?>
	Manage Purchase Order
<?php $__env->stopSection(); ?>
<?php ($label_list = EF::getWhiteLabel()); ?>

<?php $__env->startSection('page_body'); ?>
<?php echo e(Breadcrumbs::render('purchaseorder')); ?>


	<div class="row row-cards row-deck">
              <div class="col-12">
                <div class="card">
                	  <div class="card-header">

					     <h3 class="card-title">Purchase Orders</h3>
					  </div>
                	<div class="card-status card-status-left bg-blue"></div>
                  <div class="table-responsive table-height">
                    <table class="table table-hover table-outline table-vcenter text-nowrap card-table cls_datatable">
                      <thead>
                        <tr>

                          <th>#</th>
                          <th>PO No.</th>
                          <th>PR No.</th>
                          <th>BOQ Entry No.</th>
                          <th>Project</th>
                          <th>Status</th>

                   <th style="text-align: center;"><i class="dropdown-icon fa fa-cogs"></i></th>
                        </tr>
                      </thead>
                      <tbody>
                        <?php if(isset($purchase_order_list)): ?>
                        <?php $__currentLoopData = $purchase_order_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                       <?php ($total_amount = $rows->boqitem->quantity * $rows->unit_price); ?>
                        <tr>
                        <td><?php echo e($loop->iteration); ?></td>
                        <td><?php echo e($rows->p_number); ?></td>
                        <td>SL/PR/000<?php echo e($rows->boq->id); ?></td>
                        <td><?php echo e($rows->boq->sr_no); ?></td>
                        <td><?php echo e($rows->boq->branch->name); ?></td>
                        <td>
                          <?php if($rows->status == "Approved"): ?>
                            <span class="badge badge-success"> <?php echo e($rows->status); ?></span>
                          <?php elseif($rows->status == "Pending"): ?>
                            <span class="badge badge-primary"> <?php echo e($rows->status); ?></span>
                          <?php else: ?>
                            <span class="badge badge-danger"> <?php echo e($rows->status); ?></span>
                          <?php endif; ?>
                        </td>
                     <td class="text-center">
                                  <div class="item-action dropdown">
                                    <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fa fa-list-ul"></i></a>
                                    <div class="dropdown-menu dropdown-menu-right">
                                <?php if(Auth::user()->hasAnyPermission(['All','Without Rate PO Document'])): ?>
                                <?php if($rows->status == "Approved"): ?>
                                  <a  href="<?php echo e(route('downloadPDF.po',['id' => Crypt::encrypt($rows->p_number)])); ?>"  class="dropdown-item"><i class="dropdown-icon fa fa-download "></i> Without Rate PO</a>
                                  <?php endif; ?>
                                  <?php endif; ?>
                                    <?php if(Auth::user()->hasAnyPermission(['All','With Rate PO Document'])): ?>
                                    <?php if($rows->status == "Approved"): ?>
                                    <a  href="<?php echo e(route('downloadPDF.porate',['id' => Crypt::encrypt($rows->p_number)])); ?>"  class="dropdown-item"><i class="dropdown-icon fa fa-download "></i> With Rate PO</a>
                                    <?php endif; ?>
                                    <?php endif; ?>
                                      <?php if(Auth::user()->hasAnyPermission(['All','PO Details'])): ?>
                                   <a  href="<?php echo e(route('po.detail',['id' => Crypt::encrypt($rows->p_number)])); ?>"  class="dropdown-item" content="accept boq"><i class="dropdown-icon fa fa-eye "></i> Details</a>
                                   <?php endif; ?>


                                    </div>
                                  </div>
                               </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                      <?php endif; ?>
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
          </div>
          <?php
            $mydate = date('Y-m-d');
          ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_modal'); ?>
<?php if(count($alerts) > 0): ?>
  <!-- Position it -->
  <div style="position: fixed; top: 50px; right: 20px;">

    <!-- Then put toasts within -->

    <?php $__currentLoopData = $alerts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ra): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

<div class="alert alert-danger alert-dismissible">
<a href="#" class="close" data-dismiss="alert" aria-label="close"></a>
<strong>Alert!</strong> Purchase Order with # "<?php echo e($ra->p_number); ?>" is delayed for GRN.
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

</div>
<?php endif; ?>

<div class="modal fade" id="md_accept_po" tabindex="-1" role="dialog" aria-labelledby="exampleModallabel" aria-hidden="true">
  <div class="modal-dialog modal-lg" role="document">
    <?php echo e(Form::open(array('route' => 'po.accept', 'id' => 'form_md_accept_po', 'class' => 'cls_from ', 'enctype' => 'multipart/form-data'))); ?>

    <div class="modal-content">
      <div class="modal-header header-margin">
        <h5 class="modal-title" id="exampleModallabel">Accept PO</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true"></span>
        </button>
      </div>
      <div class="modal-body">
        <div class="card">

         <div class="card-body form-fieldset">
          <div class="row">

            <div class="col-sm-12">
            <label class="label-color">Delivery Date:<i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"></small>
            <input type="date" class="form-control" min="<?php echo e($mydate); ?>" name="po_date"/>
          </div>

          <input type="hidden"  value="" id="modal_id_po" name="po_id"/>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button  type="submit"  class="btn btn-primary cls_submit" content="Accept PO">Accept PO</button>
      </div>
    </div>

  </div>

</div>
</div>
<?php echo e(Form::close()); ?>

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

<?php $__env->startSection('page_script'); ?>
<script>
  function acceptpofun(id)
  {
    $("#modal_id_po").val(id);
    $("#md_accept_po").modal('show');
  }
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/inventory_module/purchase_order/manage_purchase_order.blade.php ENDPATH**/ ?>