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

<main id="main" class="main">
    <?php echo $__env->make('cdn', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
     <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
     <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
     <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
     <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
    <div class="container mt-2" style="margin-top: 100px; height: 550px;">
        
        <h3 class="card-title d-flex justify-content-center">Invoice</h3>
         <?php if($message = Session::get('success')): ?>
         <div class="alert alert-success" id="alert">
            <button type="button" class="close" data-dismiss="alert">x</button>
         <p><?php echo e($message); ?></p>
        </div>
         <?php endif; ?>
        <form action="<?php echo e(url('components-invoice')); ?>" method="post">
                         <?php echo csrf_field(); ?>
           <div class=" row form-outline " style="width:px; margin-left:600px; margin-bottom:15px;">
            
               <div class="col-md-9">
                     <strong>Cutomer Name:</strong>
                     <select name="cust_id" class="form-control myselect" id="customer-dropdown">
                     <option value="" >Select  Customer</option>
                     <?php $__currentLoopData = $company; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $comp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                         <?php if($comp->id==$cust_id): ?>
                            <option value="<?php echo e($comp->id); ?>" selected><?php echo e($comp->name); ?></option>
                         <?php else: ?>
                            <option value="<?php echo e($comp->id); ?>"><?php echo e($comp->name); ?></option>
                         <?php endif; ?>
                     <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 

                    </select>
                         
              </div>
              <div class="col-md-2" style="margin-top:23px;">
                  <button type="submit" class="btn btn-info">Click</button>
              </div> 
            </div> 
         </form> 
        <table class="table table-striped display nowrap " id="tabl">
            <thead>
                <tr>
                    <th>S.No</th>
                    <th>Name</th>
                    <th>Final Amt.</th>
                    <th>Tax</th>
                    <th>OrderDate</th>
                    <th>Action</th>  
                </tr>
            </thead>
            <tbody>
              <?php $__currentLoopData = $invoice; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inv): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($inv->id); ?></td>
                        <td><?php echo e($inv->cust_name->name); ?></td>
                        <td><?php echo e($inv->currency); ?> <?php echo e($inv->finalamt); ?></td>
                        <td><?php echo e($inv->tax); ?>%</td>
                        <td><?php echo e($inv->created_at->todatestring()); ?></td>
                        <td><a href="<?php echo e(url('/showInvoice'.'/'.$inv->id.'/'.$inv->cust_id)); ?>"><button type="button" class="btn btn-info">Invoice</button>
                        </a>
                        <?php if(Auth::user()->usertype=='admin'): ?>
                        <a class="btn btn-info" role="button" data-toggle="modal" data-target="#assigninvoice-<?php echo e($inv->id); ?>" style="color: white;">Assign</a>

                         <!-- Modal -->
                            <div class="modal fade" id="assigninvoice-<?php echo e($inv->id); ?>" tabindex="-1" role="dialog" aria-labelledby="assignModalLabel" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                            <div class="modal-content">
                              <div class="modal-header">
                                <h5 class="modal-title" id="assignModalLabel">Modal title</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                  <span aria-hidden="true">&times;</span>
                                </button>
                              </div>
                             
                               <form action="<?php echo e(url('assign-invoice/'.$inv->id)); ?>" method="post">
                                <?php echo e(csrf_field()); ?>

                              
                              <div class="modal-body">
                                <div class="row mb-3">
                                          <div class="col-sm-7">
                                            <strong>User Name: </strong>
                                                 <select name="u_name" class="form-control" id="customer-dropdown">
                                                 <option value="">Select User</option>
                                                 <?php $__currentLoopData = $user; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $use): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                 <option value="<?php echo e($use->id); ?>"><?php echo e($use->name); ?></option>  
                                                 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                                                </select>
                                          </div>          
                                </div>  
                              </div>
                              <div class="modal-footer">
                                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                <button type="submit" class="btn btn-primary">Assign</button>
                              </div>
                            </form>
                            </div>
                            </div>
                            </div>
                        <?php endif; ?>
                           

                        </td>      

                    </tr>
               <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
         </table>   
    </div>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.3.2/js/dataTables.buttons.min.js
"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js
"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.print.min.js"></script>
<script type="text/javascript">  
    $(document).ready(function() {
    $('#tabl').DataTable( {
        dom: 'Bfrtip',
        ordering:false,
        buttons: [
             'pdf', 'print'
        ]
    } );
} );
    $(document).ready(function () {
    $('#tabl').DataTable();
});
</script> 
<script type="text/javascript">
       $("document").ready(function(){
        setTimeout(function()
        {
            $("div.alert").remove();

        }, 3000);

       });
</script>
<script type="text/javascript">
$(document).ready(function() {
    $('.myselect').select2();
});
</script>

</main>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('frontend.layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\CRM\resources\views/frontend/invoice-manage.blade.php ENDPATH**/ ?>