<?php $__env->startSection('content'); ?>
    <div class="main-panel">

        <?php echo $__env->make('layouts.component.navbar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

        <div class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header card-header-primary">

                                <h4 class="card-title ">View Data <?php if($dat->count() > 0 ): ?><a href="<?php echo e(route('download.data')); ?>"><button class="btn btn-warning">Download</button></a><?php endif; ?></h4>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table">
                                        <thead class=" text-primary">
                                        <th>
                                            #
                                        </th>
                                        <th>
                                            Date Of Purchase
                                        </th>
                                        <th>
                                            Name
                                        </th>
                                        <th>
                                            User
                                        </th>
                                        <th>
                                            Id
                                        </th>
                                        <th>
                                            Type
                                        </th>
                                        <th>
                                            Action
                                        </th>
                                        </thead>
                                        <tbody>
                                        <?php $__empty_1 = true; $__currentLoopData = $dat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <tr>
                                            <td><?php echo e($loop->index + 1); ?></td>
                                            <td><?php echo e($data->dateOfPurchase); ?></td>
                                            <td><?php echo e($data->name); ?></td>
                                            <td><?php echo e($data->user); ?></td>
                                            <td><?php echo e($data->idSecond); ?></td>
                                            <td><?php echo e($data->type); ?></td>
                                            <?php
                                                $dataForCode = 'Date Of Purchase: ' . $data->dateOfPurchase . ' | ' . "Name: ". $data->name . ' | ' .  'User : ' . $data->user . ' | Id:' . $data->id;
                                            ?>
                                            <td>
                                                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#barCode<?php echo e($data->id); ?>">
                                                    View Bar Code
                                                </button>
                                                <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#cancelBarCode<?php echo e($data->id); ?>">
                                                    Cancel
                                                </button>
                                                <div class="modal fade" id="cancelBarCode<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                                    <div class="modal-dialog" role="document">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h5 class="modal-title" id="exampleModalLabel">Cancel</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(route('cancel.data',['id'=>$data->id])); ?>" method="post">
                                                            <div class="modal-body text-center" >
                                                              <h3>Are You sure you want to cancel</h3>
                                                                    <?php echo csrf_field(); ?>
                                                                    <input type="hidden" name="dataId">
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">No</button>
                                                                <button type="submit" class="btn btn-danger">Yes</button>
                                                            </div>
                                                                </form>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="modal fade" id="barCode<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                                    <div class="modal-dialog" role="document">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h5 class="modal-title" id="exampleModalLabel">Barcode</h5>
                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                    <span aria-hidden="true">&times;</span>
                                                                </button>
                                                            </div>
                                                            <div class="modal-body text-center" >

                                                                <?php echo barCode($dataForCode,'2d'); ?>



                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                            <tr>
                                                <td colspan="7" class="text-center"><h3>No Data Found</h3></td>
                                            </tr>
                                        <?php endif; ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php echo $__env->make('layouts.component.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <?php $__env->startSection('page-script'); ?>
            <?php $__env->stopSection(); ?>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\MSI GL63 9SDK\Documents\barcode-app\resources\views/list.blade.php ENDPATH**/ ?>