<?php $__env->startSection('title','Approval Inbox'); ?>
<?php $__env->startSection('crumbs','<b>Approval Inbox</b>'); ?>
<?php $__env->startSection('content'); ?>
<div class="card"><div class="card-h"><h2>⏳ Pending approvals</h2></div><div class="card-b">
<div class="twrap"><table class="tbl"><thead><tr><th>Document</th><th>No.</th><th>Requested by</th><th>When</th><th class="no-print">Actions</th></tr></thead>
<tbody><?php $__empty_1 = true; $__currentLoopData = $pending; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr>
<td><?php echo e($types[$a->document_type]['label'] ?? $a->document_type); ?></td>
<td><b><?php echo e($a->document_no); ?></b></td><td><?php echo e($a->requester->name ?? ''); ?></td><td class="small"><?php echo e($a->created_at->format('d M Y H:i')); ?></td>
<td class="no-print"><div class="row-actions">
<a class="btn btn-sm btn-ghost" href="<?php echo e(crud_url($types[$a->document_type]['key'],'show',$a->document_id)); ?>">Open</a>
<form method="POST" action="<?php echo e(route('approvals.decide',$a->id)); ?>" style="display:inline"><?php echo csrf_field(); ?><input type="hidden" name="decision" value="approved"><button class="btn btn-sm btn-ok">Approve</button></form>
<form method="POST" action="<?php echo e(route('approvals.decide',$a->id)); ?>" style="display:inline" data-confirm="Reject this document?"><?php echo csrf_field(); ?><input type="hidden" name="decision" value="rejected"><button class="btn btn-sm btn-danger">Reject</button></form>
</div></td></tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="5" class="muted c">Inbox zero. Nothing awaiting approval. ✓</td></tr><?php endif; ?></tbody></table></div>
<?php echo e($pending->links()); ?>

</div></div>
<div class="card"><div class="card-h"><h2>Recent decisions</h2></div><div class="card-b">
<div class="twrap"><table class="tbl"><thead><tr><th>Document</th><th>No.</th><th>Decision</th><th>By</th><th>When</th><th>Remarks</th></tr></thead>
<tbody><?php $__empty_1 = true; $__currentLoopData = $history; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($types[$a->document_type]['label'] ?? $a->document_type); ?></td><td><?php echo e($a->document_no); ?></td>
<td><span class="bdg b-<?php echo e($a->status==='approved'?'ok':'bad'); ?>"><?php echo e($a->status); ?></span></td><td><?php echo e($a->decider->name ?? ''); ?></td>
<td class="small"><?php echo e($a->decided_at?->format('d M Y H:i')); ?></td><td class="small"><?php echo e($a->remarks); ?></td></tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="6" class="muted c">No history yet.</td></tr><?php endif; ?></tbody></table></div>
</div></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/user/nowills-sqc-erp/resources/views/approvals/index.blade.php ENDPATH**/ ?>