<?php $__env->startSection('content'); ?>
    <section class="inner_header">
        <img src="<?php echo e(asset('assets/web/images/icons/inner.svg')); ?>" alt="" class="inner_shap">
        <div class="container">
            <ul class="links">
                <li>
                    <a href="<?php echo e(LaravelLocalization::getLocalizedURL($lang, route('home'), [], true)); ?>"><?php echo e(__('main.home')); ?></a>
                </li>
                <li>
                    <a href="#"> <?php echo e(__('members.notifications')); ?> </a>
                </li>
            </ul>
            <h4><?php echo e(__('members.notifications')); ?></h4>
        </div>
    </section>

    <section class="notifications-pg section_padding">
        <div class="container">
            <div class="row justify-content-center">
                <?php if(count($notifications)): ?>
                    <div class="col-md-10 d-flex justify-content-end mb-3"><a href="<?php echo e(route('user.makeNotificationAsRead').'?make_all_as_read=true'); ?>" class="make_as_read_link"><?php echo e(__('members.mark_as_read')); ?></a></div>
                <?php endif; ?>
                <div class="col-lg-10 notification_container">
                    <?php if(count($notifications)): ?>
                        <?php $__currentLoopData = $notifications; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $notification): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="noti_box notification_item_<?php echo e($loop->iteration); ?>">



                                <div class="icon me-4">
                                    <img src="<?php echo e(asset('assets/web/images/icons/ringing.png')); ?>" alt="">
                                </div>
                                <div class="info">
                                    <div class="title">
                                        <h5><?php echo e(wordLimit($notification->title, 5)); ?></h5>
                                        <span class="date">
                                            <i class="bi bi-calendar2 me-2"></i>
                                            <small><?php echo e(date('d M Y/ h:i A', strtotime($notification->created_at))); ?></small>
                                        </span>
                                    </div>
                                    <div class="text"><?php echo e($notification->message); ?></div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php else: ?>
                        <div class="noti_box">
                            <div class="info d-flex justify-content-center align-items-center">
                                <div class="icon bg-warning">
                                    <img src="<?php echo e(asset('assets/web/images/icons/ringing.png')); ?>" alt="">
                                </div>
                                <div class="title">
                                    <h5 class="text-danger m-2"><?php echo e(__('usersNotifications.no_notifications')); ?></h5>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                </div>
            </div>
        </div>
    </section>

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

<?php $__env->startSection('inner_js'); ?>
    <script>
        let noNotification = "<?php echo e(__('usersNotifications.no_notifications')); ?>",
            notificationImage = "<?php echo e(asset('assets/web/images/icons/ringing.png')); ?>";

        $('.make_as_read_link').click(async function (e) {
            e.preventDefault();
            $(this).attr('disabled', true);
            let url = $(this).attr('href'),
                method = 'get';

            const response=await ajax({
                url,
                dataType: 'json',
                method,
                contentType: false,
                processData: false,
            });

            if (response.errors) {
                $(this).attr('disabled', false);
                toasterError(response.errors);
            }
            if (response.message) {
                // $($(this).data('target')).remove();
                $(this).remove();
                toasterSuccess(response.message);

                let notificationCounter = $('.notification_counter'),
                    counter = parseInt(notificationCounter.html());

                if($(this).data('target') !== undefined){
                    notificationCounter.html(counter-1);
                }

                if($(this).data('target') === undefined){
                    $('.notification_container').html('');
                    notificationCounter.html(0)
                }

                notiBox = $('.notification_container').find('.noti_box');
                if(!notiBox.length){
                    $('.notification_container').html(`
                        <div class="noti_box">
                            <div class="info d-flex justify-content-center align-items-center">
                                <div class="icon bg-warning">
                                    <img src="${notificationImage}" alt="">
                                </div>
                                <div class="title">
                                    <h5 class="text-danger m-2">${noNotification}</h5>
                                </div>
                            </div>
                        </div>`);
                }
            }
        });

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

<?php echo $__env->make('web.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/balyomhost/public_html/legal/resources/views/web/users/notifications/index.blade.php ENDPATH**/ ?>