

<?php $__env->startSection('content'); ?>
    <?php
        $message = 'Commitments'; // default fallback
        if ($type == 1) {
            $message = 'Our Commitments';
        } elseif ($type == 4) {
            $message = 'Our Values';
        }
    ?>

    <div class="card">
        <div class="card-header d-flex justify-content-between align-items-center">
            <h5 class="mb-0"><?php echo e($message); ?></h5>
            <?php if($type == 1): ?>
                <a href="<?php echo e(route('commitment.create')); ?>" class="btn btn-sm btn-primary">
                    <i class="fa fa-plus-circle mr-1"></i> Add Commitment
                </a>
            <?php elseif($type == 4): ?>
                <a href="<?php echo e(route('values.create')); ?>" class="btn btn-sm btn-primary">
                    <i class="fa fa-plus-circle mr-1"></i> Add Value
                </a>
            <?php endif; ?>
        </div>

        <div class="card-body">

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

            <div class="table-responsive">
                <table class="table table-bordered w-100" id="dt-responsive">
                    <thead class="thead-light">
                        <tr>
                            <th>SL</th>
                            <th>Date</th>
                            <th>Name</th>
                            <th>Description</th>
                            <th>Image</th>
                            <th>Action</th>
                        </tr>
                    </thead>

                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $commitments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $commitment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($loop->iteration); ?></td>
                                <td><?php echo e($commitment->created_at->format('Y-m-d')); ?></td>
                                <td><?php echo e($commitment->name); ?></td>
                                <td><?php echo e(Str::limit($commitment->description, 50)); ?></td>
                                <td>
                                    <?php if($commitment->image && file_exists(public_path($commitment->image))): ?>
                                        <img src="<?php echo e(asset($commitment->image)); ?>" width="80" alt="Image">
                                    <?php else: ?>
                                        <img src="<?php echo e(asset('images/no-image.png')); ?>" width="80" alt="No Image">
                                    <?php endif; ?>
                                </td>
                                <?php if($type == 1): ?>
                                    <td>
                                        <a href="<?php echo e(route('commitment.edit', $commitment->id)); ?>"
                                            class="btn btn-sm btn-primary">
                                            <i class="fa fa-edit"></i>
                                        </a>
                                        <form action="<?php echo e(route('commitment.destroy', $commitment->id)); ?>" method="POST"
                                            class="d-inline-block"
                                            onsubmit="return confirm('Are you sure you want to delete this doctor?')">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button class="btn btn-sm btn-danger">
                                                <i class="fa fa-trash"></i>
                                            </button>
                                        </form>
                                    </td>
                                <?php elseif($type == 4): ?>
                                    <td>
                                        <a href="<?php echo e(route('values.edit', $commitment->id)); ?>"
                                            class="btn btn-sm btn-primary">
                                            <i class="fa fa-edit"></i>
                                        </a>
                                        <form action="<?php echo e(route('values.destroy', $commitment->id)); ?>" method="POST"
                                            class="d-inline-block"
                                            onsubmit="return confirm('Are you sure you want to delete this value?')">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button class="btn btn-sm btn-danger">
                                                <i class="fa fa-trash"></i>
                                            </button>
                                        </form>
                                    </td>
                                <?php endif; ?>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="7" class="text-center">No <?php echo e($message); ?> found.</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.masterAdmin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\TGP-hospital-site\resources\views/admin/commitments/commitment.blade.php ENDPATH**/ ?>