<?php $__env->startSection('title', 'Shipment History'); ?>

<?php $__env->startSection('content'); ?>
<div class="col-12">
    <div class="card">
        <div class="card-header d-flex justify-content-between">
            <h5 class="fw-bold mb-0">Complete Your tracking by Adding Tracking History (if not you will get and error when you track)</h5>
            <a href="<?php echo e(route('admin.shipment.edit', $shipment->code)); ?>" class="btn btn-primary btn-sm">Edit Shipment</a>
        </div>
        <div class="card-body">
            <form action="" class="row" method="POST">
                <?php echo csrf_field(); ?>
                <div class="col-md-4 mb-1">
                    <label class="form-label">Comment/ Remark</label>
                    <input type="text" name="remark" placeholder="Comment and Remarks" class="form-control" required>
                </div>
                <div class="col-md-4 mb-1">
                    <label class="form-label">Event Location</label>
                    <input type="text" name="location" placeholder="Event Location" class="form-control" required>
                </div>
                <div class="col-md-4 mb-1">
                    <label class="form-label">Date</label>
                    <input type="datetime-local" name="date" placeholder="Tracking Date" class="form-control" required>
                </div>

                <button class="btn btn-primary w-100 mt-3" type="submit">Add History</button>
            </form>
        </div>

    </div>

    <div class="card">
        <h5 class="card-header td-head">Tracking History</h5>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>Remark</th>
                        <th>Location</th>
                        <th>Date</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $shipment->history; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($item->remark); ?></td>
                            <td><?php echo e($item->location); ?></td>
                            <td><?php echo e(show_datetime($item->date)); ?></td>
                            <td>
                                <div>
                                    <a href="#" data-bs-toggle="modal" data-bs-target="#TrackEdit<?php echo e($item->id); ?>" class="btn btn-primary btn-sm"><i class="fa fa-edit"></i></a>
                                    <a href="<?php echo e(route('admin.shipment.history.delete', $item->id)); ?>" class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></a>
                                </div>
                            </td>
                        </tr>
                        <div class="modal fade" id="TrackEdit<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                              <div class="modal-content">
                                  <div class="modal-header">
                                      <h6 class="modal-title" id="myModalLabel"> Edit Tracking History</h6>
                                      <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"><span aria-hidden="true"></span></button>
                                  </div>
                                  <div class="modal-body">
                                    <form action="<?php echo e(route('admin.shipment.history.update', [$shipment->code, $item->id])); ?>" class="row" method="POST">
                                        <?php echo csrf_field(); ?>
                                        <div class="mb-1">
                                            <label class="form-label">Comment/ Remark</label>
                                            <input type="text" name="remark" value="<?php echo e($item->remark); ?>" placeholder="Comment and Remarks" class="form-control" required>
                                        </div>
                                        <div class="mb-1">
                                            <label class="form-label">Event Location</label>
                                            <input type="text" name="location" value="<?php echo e($item->location); ?>" placeholder="Event Location" class="form-control" required>
                                        </div>
                                        <div class="mb-1">
                                            <label class="form-label">Date</label>
                                            <input type="datetime-local" name="date" value="<?php echo e($item->date); ?>" placeholder="Tracking Date" class="form-control" required>
                                        </div>

                                        <button class="btn btn-primary w-100 mt-3" type="submit">Update History</button>
                                    </form>
                                  </div>
                              </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                          <td colspan="4" class="text-center">  No History Found. Please Add New Tracking History </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<style>
    .d-head{
        padding: 2px 10px;
        border: 1px solid #476ea1
    }
    .td-head{
        background: #2248b8;
        color: white;
    }
    .form-group{margin-bottom: 10px}
</style>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/zpvgxjex/public_html/directexpress.couriers-service.com/resources/views/admin/shipment/history.blade.php ENDPATH**/ ?>