<?php if(isset($NotifMessages) && $NotifMessages->isNotEmpty()): ?>
<?php
$NotifText = '<div class="d-block">';
    foreach($NotifMessages as $MessageInfo)
    {
    $NotifText .= '<div style="border-bottom: 1px solid #000000; padding-bottom: 10px; margin-bottom: 10px; text-align: right;">
        <div><strong>'.jdate($MessageInfo->created_at)->format('Y/m/d').'</strong></div>
        <div>'.e($MessageInfo->message).'</div>
    </div>';
    }
    $NotifText .= "</div>";
?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
    Swal.fire({
        title: 'توجه !',
        html: `<?php echo $NotifText; ?>`,
        icon: 'info',
        confirmButtonText: 'متوجه شدم'
    }).then((result) => {
        if (result.isConfirmed) {

            fetch('<?php echo e(route("message.seen")); ?>', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                        'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'
                    },
                    body: JSON.stringify({
                        id: <?php echo e(auth()->id()); ?>

                    })
                })
                .then(response => response.json())
                .then(data => {
                    if (data.success) {
                        console.log('Success');
                        
                    }
                });
        }
    });
</script>
<?php endif; ?><?php /**PATH /home1/zarborji/public_html/resources/views/layouts/notification/message.blade.php ENDPATH**/ ?>