<?php $__env->startSection('title', 'Notifications'); ?>
<?php $__env->startSection('crumbs', '<b>🔔 Notifications</b>'); ?>
<?php $__env->startSection('content'); ?>
<div class="card">
  <div class="card-h"><b>📌 My Tasks (<?php echo e(count($tasks)); ?>)</b><span class="muted small" style="margin-left:auto">live · approvals + overdue + expiries</span></div>
  <?php if(!count($tasks)): ?><div class="empty-state">Nothing needs you right now. ✅</div><?php endif; ?>
  <?php $__currentLoopData = $tasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <a href="<?php echo e($t['url']); ?>" class="hrow" style="text-decoration:none;border-bottom:1px solid var(--border)">
      <span class="nm" style="font-size:18px"><?php echo e($t['icon']); ?></span>
      <b><?php echo e($t['label']); ?></b>
      <span class="muted small" style="margin-left:auto;white-space:nowrap"><?php echo e($t['sub']); ?></span>
    </a>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<div class="card">
  <div class="card-h"><b>Unread (<?php echo e($unread->count()); ?>)</b>
    <span style="margin-left:auto">
      <?php if($unread->count()): ?>
      <form method="POST" action="<?php echo e(route('notifications.read-all')); ?>" style="display:inline"><?php echo csrf_field(); ?><button class="btn btn-sm">Mark all read</button></form>
      <?php endif; ?>
    </span>
  </div>
  <?php if(!$unread->count()): ?><div class="empty-state">All caught up. 🎉</div><?php endif; ?>
  <?php $__currentLoopData = $unread; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $n): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <a href="<?php echo e(route('notifications.open', $n->id)); ?>" class="hrow" style="text-decoration:none;border-bottom:1px solid var(--border)">
      <span class="nm" style="font-size:18px"><?php echo e($n->data['icon'] ?? '🔔'); ?></span>
      <b><?php echo e($n->data['title'] ?? $n->type); ?></b>
      <span class="muted small"><?php echo e($n->data['body'] ?? ''); ?></span>
      <span class="muted small" style="margin-left:auto;white-space:nowrap"><?php echo e($n->created_at->diffForHumans()); ?></span>
    </a>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php if($read->count()): ?>
<div class="card">
  <div class="card-h"><b>Recently read</b></div>
  <?php $__currentLoopData = $read; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $n): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <a href="<?php echo e(route('notifications.open', $n->id)); ?>" class="hrow" style="text-decoration:none;border-bottom:1px solid var(--border);opacity:.65">
      <span class="nm" style="font-size:18px"><?php echo e($n->data['icon'] ?? '🔔'); ?></span>
      <b><?php echo e($n->data['title'] ?? $n->type); ?></b>
      <span class="muted small" style="margin-left:auto;white-space:nowrap"><?php echo e($n->created_at->diffForHumans()); ?></span>
    </a>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
<?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/notifications/index.blade.php ENDPATH**/ ?>