MIF_E31221353/resources/views/admin/notifications/index.blade.php

376 lines
12 KiB
PHP

@extends('layouts.app')
@push('head')
<style>
.admin-notif-card {
position: relative;
display: flex;
flex-direction: column;
gap: 28px;
padding: 34px 36px 32px;
border-radius: 28px;
background: linear-gradient(150deg, rgba(13, 23, 50, 0.95), rgba(8, 16, 36, 0.88));
border: 1px solid rgba(148, 163, 184, 0.18);
box-shadow: 0 28px 56px rgba(3, 7, 18, 0.62);
overflow: hidden;
}
.admin-notif-card::before,
.admin-notif-card::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.admin-notif-card::before {
background:
radial-gradient(circle at 12% 18%, rgba(56, 189, 248, 0.28), transparent 55%),
radial-gradient(circle at 88% -10%, rgba(129, 140, 248, 0.32), transparent 60%);
opacity: 0.85;
}
.admin-notif-card::after {
background: linear-gradient(140deg, transparent 40%, rgba(59, 130, 246, 0.18));
opacity: 0.75;
}
.admin-notif-card > * { position: relative; z-index: 1; }
.admin-notif-hero {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 24px;
flex-wrap: wrap;
}
.admin-notif-hero__info {
display: flex;
flex-direction: column;
gap: 12px;
max-width: 540px;
}
.admin-notif-hero__tagline {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
border-radius: 999px;
background: rgba(129, 140, 248, 0.18);
border: 1px solid rgba(129, 140, 248, 0.38);
color: #e0e7ff;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: 600;
}
.admin-notif-hero h2 {
margin: 0;
font-size: 30px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.admin-notif-hero p {
margin: 0;
color: rgba(226, 232, 240, 0.76);
font-size: 15px;
line-height: 1.6;
}
.admin-notif-hero__actions {
display: inline-flex;
gap: 12px;
}
.admin-notif-add {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 10px 20px;
border-radius: 14px;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.32), rgba(99, 102, 241, 0.48));
border: 1px solid rgba(129, 140, 248, 0.55);
color: #e0f2fe;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
text-decoration: none;
box-shadow: 0 22px 32px rgba(6, 15, 38, 0.5);
transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.admin-notif-add:hover {
transform: translateY(-1px);
border-color: rgba(165, 180, 252, 0.75);
background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(99, 102, 241, 0.5));
}
.notif-tabs {
display: inline-flex;
gap: 8px;
padding: 8px;
border-radius: 18px;
border: 1px solid rgba(148, 163, 184, 0.24);
background: rgba(7, 16, 36, 0.82);
box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
flex-wrap: wrap;
}
.notif-tab {
padding: 10px 20px;
border-radius: 14px;
border: none;
background: transparent;
color: #94a3b8;
font-weight: 600;
letter-spacing: 0.04em;
cursor: pointer;
transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.notif-tab:hover {
color: #e2e8f0;
transform: translateY(-1px);
}
.notif-tab.is-active {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(14, 165, 233, 0.32));
color: #f8fafc;
box-shadow: 0 16px 28px rgba(14, 165, 233, 0.25);
}
.notif-wrapper {
display: flex;
flex-direction: column;
gap: 18px;
}
.notif-section {
animation: fadeIn 0.25s ease;
}
.notif-section.is-hidden {
display: none;
}
.notif-card {
display: grid;
grid-template-columns: minmax(220px, 320px) 1fr;
gap: 20px;
padding: 22px 24px;
border-radius: 20px;
background: rgba(9, 18, 40, 0.9);
border: 1px solid rgba(148, 163, 184, 0.22);
box-shadow: 0 20px 36px rgba(5, 12, 28, 0.45);
}
.notif-image {
border-radius: 16px;
overflow: hidden;
background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(37, 99, 235, 0.48));
border: 1px solid rgba(59, 130, 246, 0.32);
display: flex;
align-items: center;
justify-content: center;
padding: 14px;
color: #94a3b8;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.notif-image img {
width: 100%;
max-height: 260px;
object-fit: cover;
border-radius: 12px;
}
.notif-content {
display: flex;
flex-direction: column;
gap: 12px;
}
.notif-title {
font-size: 20px;
font-weight: 700;
letter-spacing: -0.015em;
color: #38bdf8;
}
.notif-message {
color: #e2e8f0;
line-height: 1.6;
font-size: 15px;
}
.notif-meta {
display: flex;
flex-wrap: wrap;
gap: 16px;
font-size: 13px;
color: rgba(148, 163, 184, 0.8);
}
.notif-empty {
padding: 24px;
text-align: center;
border-radius: 18px;
border: 1px dashed rgba(148, 163, 184, 0.32);
background: rgba(9, 17, 36, 0.75);
color: rgba(148, 163, 184, 0.78);
font-size: 14px;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 1200px) {
.admin-notif-card {
padding: 30px 28px;
}
.notif-card {
grid-template-columns: minmax(180px, 260px) 1fr;
}
}
@media (max-width: 960px) {
.admin-notif-card {
padding: 28px 24px;
}
.admin-notif-hero {
flex-direction: column;
}
.admin-notif-hero__actions {
width: 100%;
justify-content: flex-start;
}
.notif-card {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
.admin-notif-card {
padding: 24px 20px;
}
.notif-tabs {
width: 100%;
justify-content: center;
}
.notif-tab {
flex: 1 1 160px;
text-align: center;
}
.notif-card {
padding: 20px;
}
.notif-image {
padding: 12px;
}
}
@media (max-width: 620px) {
.admin-notif-card {
padding: 22px 18px;
border-radius: 22px;
}
.admin-notif-hero__actions,
.notif-tabs {
width: 100%;
}
.notif-tab {
flex: 1 1 140px;
padding: 9px 14px;
}
.notif-meta {
flex-direction: column;
gap: 10px;
}
}
</style>
@endpush
@section('content')
<div class="admin-notif-card">
<div class="admin-notif-hero">
<div class="admin-notif-hero__info">
<span class="admin-notif-hero__tagline">Pusat Informasi</span>
<h2>Daftar Pemberitahuan</h2>
<p>Kelola pembaruan penting untuk pegawai dan admin melalui panel notifikasi yang kaya visual ini.</p>
</div>
<div class="admin-notif-hero__actions">
<a href="{{ route('admin.notifications.create') }}" class="admin-notif-add">+ Kirim Pemberitahuan</a>
</div>
</div>
<div class="notif-tabs" role="tablist">
<button class="notif-tab is-active" data-target="absensi" role="tab" aria-selected="true">Pemberitahuan Absensi</button>
<button class="notif-tab" data-target="admin" role="tab" aria-selected="false">Pemberitahuan Umum</button>
</div>
<div class="notif-section" data-section="absensi">
@if($absensiNotifications->isEmpty())
<div class="notif-empty">Belum ada pemberitahuan absensi.</div>
@else
<div class="notif-wrapper">
@foreach($absensiNotifications as $notif)
<div class="notif-card">
@if($notif->image)
<div class="notif-image">
<img src="{{ asset('storage/'.$notif->image) }}" alt="{{ $notif->title }}">
</div>
@else
<div class="notif-image">Tidak ada gambar</div>
@endif
<div class="notif-content">
<div class="notif-title">{{ $notif->title }}</div>
<div class="notif-message">{{ $notif->message }}</div>
<div class="notif-meta">
<span>Untuk: {{ $notif->user->name }} ({{ $notif->user->username }})</span>
<span>Dikirim: {{ $notif->created_at->format('d/m/Y H:i') }}</span>
</div>
</div>
</div>
@endforeach
</div>
@endif
</div>
<div class="notif-section is-hidden" data-section="admin">
@if($adminNotifications->isEmpty())
<div class="notif-empty">Belum ada pemberitahuan umum.</div>
@else
<div class="notif-wrapper">
@foreach($adminNotifications as $notif)
<div class="notif-card">
@if($notif->image)
<div class="notif-image">
<img src="{{ asset('storage/'.$notif->image) }}" alt="{{ $notif->title }}">
</div>
@else
<div class="notif-image">Tidak ada gambar</div>
@endif
<div class="notif-content">
<div class="notif-title">{{ $notif->title }}</div>
<div class="notif-message">{{ $notif->message }}</div>
<div class="notif-meta">
<span>Untuk: {{ $notif->user->name }} ({{ $notif->user->username }})</span>
<span>Dikirim: {{ $notif->created_at->format('d/m/Y H:i') }}</span>
</div>
</div>
</div>
@endforeach
</div>
@endif
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('.notif-tab');
const sections = document.querySelectorAll('.notif-section');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
const target = tab.dataset.target;
tabs.forEach(btn => {
const isActive = btn === tab;
btn.classList.toggle('is-active', isActive);
btn.setAttribute('aria-selected', isActive ? 'true' : 'false');
});
sections.forEach(section => {
section.classList.toggle('is-hidden', section.dataset.section !== target);
});
});
});
});
</script>
@endsection