

<?php $__env->startSection('title','Manage Requisition - Purcahse Requisition'); ?>

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

    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">

            </div>
        </div><!-- /.container-fluid -->
    </section>
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>Pending Purchases</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active">Manage Requisition</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>


    <!-- Main content -->
    <section class="content">
        <div class="col-lg-12">

            <div class="card"><br>
                <div class="card-body">
                    <div class="row">
                        <div class="form-group col-md-3">
                            <input type="text" id="requistion_no" onkeyup="myTableSearch('requisitions')" class="form-control" name="style" placeholder="Enter Requisition No">
                        </div>
                        
                        <div class="col-lg-12 table-responsive">

                            <table id="searchTable" class="table-bordered table-striped table">
                                <thead>
                                    <tr class="bg-info">
                                        <th>#SL</th>
                                        <th>Requisition No</th>
                                        <th>Req. Invoice No</th>
                                        <th>Qty</th>
                                        <th>Total Quotation Taken Yet </th>
                                        <th>Note</th>
                                        <th>Requisition Making Date </th>
                                        <th>Action</th>
                                    </tr>
                                </thead>

                                <tbody>
                                <?php $i=0; ?>
                                <?php if($requisitions->count()>0): ?>
                                    <?php $__currentLoopData = $requisitions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $requisition): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($requisition->new_requisition_products->count() > 0): ?>
                                            <?php $i++; ?>
                                            <tr>
                                                
                                                <td><?php echo e($i); ?></td>
                                                <td width="11%"><?php echo e($requisition->requisition->requisition_id); ?></td>
                                                <td><?php echo e($requisition->invoice_no); ?></td>
                                                <td><?php echo e($requisition->qty); ?></td>
                                                <td>
                                                <?php if($requisition->sent_for == 2 || $requisition->sent_for == 3): ?>
                                                <a class="btn-block btn bg-info" style="border: 2px solid rgba(255,255,255,1);border-radius: 10px 0 10px;font-size: 1.2rem;margin: 0;">  Without Quotation </a>
                                                <?php else: ?>
                                                <a href="<?php echo e(route('quotations.list',$requisition->id)); ?>" class="btn-block btn btn-info" style="border: 2px solid rgba(255,255,255,1);border-radius: 10px 0 10px;font-size: 1.2rem;margin: 0;">  <?php echo e($requisition->quotations->count()); ?> </a>
                                                <?php endif; ?>
                                                 
                                                </td>
                                                <td><?php echo e($requisition->note or 'N/A'); ?></td>
                                                <td>
                                                    <?php echo e(\Carbon\Carbon::parse($requisition->created_at)->format('D-d-M-Y')); ?>  -- <?php echo e($requisition->created_at->diffForHumans()); ?>

                                                </td>
                                                <td>
                                                    <?php if($requisition->sent_for == 1): ?>
                                                    <a class=" btn btn-info" href="<?php echo e(route('inventory.quotation.add',$requisition->id)); ?>"> Quotation Generate</a>
                                                    <?php elseif($requisition->sent_for == 2): ?>
                                                    <a class=" btn btn-warning" href="<?php echo e(route('inventory.po.add',$requisition->id)); ?>"> Make Purchase Order</a>
                                                    <?php elseif($requisition->sent_for == 3): ?>
                                                    <button class=" btn btn-success"> Already Purchased</button>
                                                    <?php endif; ?>
                                                </td>
                                            </tr>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php else: ?>
                                    <tr> <td colspan="8" class="bg-danger text-center">No Pending Requisiton</td> </tr>
                                <?php endif; ?>
                                </tbody>
                            </table>
                            
                        </div>
                        

                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->



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

<?php $__env->startSection('style'); ?>
    <!-- DataTables -->
    <link rel="stylesheet" href="<?php echo e(asset('plugins/datatables/dataTables.bootstrap4.css')); ?>">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('plugin'); ?>
    <!-- DataTables -->
    <script src="<?php echo e(asset('plugins/datatables/jquery.dataTables.js')); ?>"></script>
    <script src="<?php echo e(asset('plugins/datatables/dataTables.bootstrap4.js')); ?>"></script>

    <!-- page script -->
    <script type="text/javascript">

        function myTableSearch(index) {
          // Declare variables 
          var input, filter, table, tr, i, j, column_length, count_td, null_tr = 0;
          column_length = document.getElementById('searchTable').rows[0].cells.length;
          input = document.getElementById("requistion_no");
          filter = input.value.toUpperCase();
          
          j = 1; //second column
          table = document.getElementById("searchTable");
          tr = table.getElementsByTagName("tr");
          for (i = 1; i < tr.length; i++) { // except first(heading) row
            count_td = 0;
            // for(j = 1; j < column_length-1; j++){ // except first column
                td = tr[i].getElementsByTagName("td")[j];
                /* ADD columns here that you want you to filter to be used on */
                if (td) {
                  if ( td.innerHTML.toUpperCase().indexOf(filter) > -1)  {            
                    count_td++;
                  }
                }
            // }
            console.log(count_td)
            if(count_td > 0){
                tr[i].style.display = "";
            } else {
                null_tr++;
                tr[i].style.display = "none";
            }
          }
        }
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.fixed', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/welluugs/purchase.wellgrouperp.com/resources/views/inventory/purchase/pending-purchase-requisition.blade.php ENDPATH**/ ?>