<?php $__env->startSection('content'); ?>
    <body class="fix-header fix-sidebar card-no-border">
    <div id="main-wrapper">
        <div class="page-wrapper customWrap">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card notificationCard">
                            <div class="card-header">Notifications</div>
                            <div class="crdBody">
                                <div class="row">
                                    <div class="col-lg-8 col-xlg-9">
                                        <?php $__currentLoopData = $userNotifications; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $notification): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="alert alert-success notif-alert" role="alert"
                                                 aria-live="assertive" aria-atomic="true" data-autohide="false"
                                                 data-notification-id="<?php echo e($notification->id); ?>">
                                                <div class="img-box">
                                                    <img src="<?php echo e($notification->profile_image ? asset('profile_image/'.$notification->profile_image) : asset('profile_image/user.png')); ?>" width="70" class="img-fluid" alt="img"></div>
                                                <div class="img-content">
                                                    <h6><?php echo e($notification->content_body); ?></h6>
                                                    <span><i class="ti-email"></i><?php echo e($notification->updated_at->diffForHumans()); ?></span>
                                                </div>
                                                <button type="button" class="close dismiss-notification"
                                                        aria-label="Close">
                                                    <span aria-hidden="true">×</span>
                                                </button>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
        <script>
            $(document).on('click', '.dismiss-notification', function () {
                var notificationId = $(this).closest('.notif-alert').data('notification-id');
                dismissNotification(notificationId);
            });

            function dismissNotification(notificationId) {
                $.ajax({
                    url: "<?php echo e(route('dismiss-notification')); ?>",
                    method: 'POST',
                    data: {
                        _token: "<?php echo e(csrf_token()); ?>",
                        notification_id: notificationId
                    },
                    success: function (response) {
                        // Remove the notification element from the DOM
                        $('.notif-alert[data-notification-id="' + notificationId + '"]').remove();
                    },
                    error: function (xhr, status, error) {
                        console.log(error);
                    }
                });
            }
        </script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.dashboard-app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/servicedemoweb/public_html/global-man-cave/resources/views/dashboard/notification.blade.php ENDPATH**/ ?>