<?php
    $status = $record->user->status->value;
    $label = $label ?? 'record';
    $editMessage = $editMessage ?? "Are you sure you want to edit this {$label}?";
    $approveMessage = $approveMessage ?? "Are you sure you want to approve this {$label}?";
    $rejectMessage = $rejectMessage ?? "Are you sure you want to reject this {$label}?";
    $deleteMessage = $deleteMessage ?? "Are you sure you want to delete this {$label}?";
?>
<div class="dropdown ms-auto text-end">
    <a href="javascript:void(0);" class="btn-link" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Actions">
        <svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
            <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                <rect x="0" y="0" width="24" height="24"></rect>
                <circle fill="currentColor" cx="5" cy="12" r="2"></circle>
                <circle fill="currentColor" cx="12" cy="12" r="2"></circle>
                <circle fill="currentColor" cx="19" cy="12" r="2"></circle>
            </g>
        </svg>
    </a>
    <div class="dropdown-menu dropdown-menu-end">
        <a class="dropdown-item" href="<?php echo e(route($resource.'.show', $record)); ?>">View</a>
        <a class="dropdown-item" href="<?php echo e(route($resource.'.edit', $record)); ?>" onclick="return confirm(<?php echo e(json_encode($editMessage)); ?>)">Edit</a>
        <?php if($status !== 'approved'): ?>
            <form action="<?php echo e(route($resource.'.approve', $record)); ?>" method="POST" class="m-0" onsubmit="return confirm(<?php echo e(json_encode($approveMessage)); ?>)">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PATCH'); ?>
                <button type="submit" class="dropdown-item">Approve</button>
            </form>
        <?php endif; ?>
        <?php if($status !== 'rejected'): ?>
            <form action="<?php echo e(route($resource.'.reject', $record)); ?>" method="POST" class="m-0" onsubmit="return confirm(<?php echo e(json_encode($rejectMessage)); ?>)">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PATCH'); ?>
                <button type="submit" class="dropdown-item">Reject</button>
            </form>
        <?php endif; ?>
        <form action="<?php echo e(route($resource.'.destroy', $record)); ?>" method="POST" class="m-0" onsubmit="return confirm(<?php echo e(json_encode($deleteMessage)); ?>)">
            <?php echo csrf_field(); ?>
            <?php echo method_field('DELETE'); ?>
            <button type="submit" class="dropdown-item text-danger">Delete</button>
        </form>
    </div>
</div>
<?php /**PATH /Users/fasil/Sites/iqec/admin/resources/views/iqec/partials/table-actions.blade.php ENDPATH**/ ?>