cms-frontend/resources/views/pages/notification.blade.php

44 lines
2.2 KiB
PHP

@extends('layouts.app')
@section('page_title', 'Notification')
@section('content')
@php
$notifications = [
['id' => 1, 'subject' => 'Welcome Message', 'content' => 'Welcome to our platform! Get started today.', 'isScheduled' => 'Scheduled', 'schedule' => '2025-04-16 10:00', 'expiration' => '2025-04-30 23:59'],
['id' => 2, 'subject' => 'System Update', 'content' => 'Scheduled maintenance on April 20th.', 'isScheduled' => 'Scheduled', 'schedule' => '2025-04-20 02:00', 'expiration' => '2025-04-21 02:00'],
['id' => 3, 'subject' => 'Promotion Offer', 'content' => '50% off your next purchase this week!', 'isScheduled' => 'Not Scheduled', 'schedule' => '', 'expiration' => '2025-04-22 23:59'],
['id' => 4, 'subject' => 'Account Reminder', 'content' => 'Please update your profile details.', 'isScheduled' => 'Scheduled', 'schedule' => '2025-04-18 09:00', 'expiration' => '2025-04-25 23:59']
];
@endphp
@include('components.table-component', [
'pageTitle' => 'Notification',
'data' => $notifications,
'columns' => [
['name' => 'ID', 'key' => 'id', 'sortable' => true],
['name' => 'Subject', 'key' => 'subject', 'sortable' => true],
['name' => 'Content', 'key' => 'content', 'sortable' => true],
['name' => 'Is Scheduled', 'key' => 'isScheduled', 'sortable' => true],
['name' => 'Schedule', 'key' => 'schedule', 'sortable' => true],
['name' => 'Expiration', 'key' => 'expiration', 'sortable' => true]
],
'showAddButton' => true,
'addButtonUrl' => '/add-notification',
'showCheckboxes' => false,
'showBatchDelete' => false,
'showEditModal' => false,
'showViewModal' => true
])
<script>
const storedNotifications = JSON.parse(sessionStorage.getItem('notifications') || '[]');
if (storedNotifications.length > 0) {
const tableConfig = window.tableConfig || {};
tableConfig.data = [...tableConfig.data, ...storedNotifications];
window.renderTable();
window.renderPagination();
}
</script>
@endsection