Files
prn2026/resources/views/ppm/attendance/show.blade.php
2026-06-03 08:51:22 +08:00

93 lines
4.8 KiB
PHP

@extends('layouts.app')
@section('title', 'Rekod Kehadiran')
@section('content')
<div class="page-heading">
<div class="eyebrow">PPM</div>
<div class="d-flex justify-content-between flex-column flex-lg-row gap-3">
<div>
<h1 class="h3 mb-1">Rekod Kehadiran</h1>
<p class="text-secondary mb-0">{{ $pusat->code }} - {{ $pusat->name }}</p>
</div>
<div><a class="btn btn-outline-secondary" href="{{ route('ppm.attendance.index') }}">Kembali</a></div>
</div>
</div>
<div class="row g-3 mb-4">
@foreach ([
['label' => 'Staf', 'value' => $summary['total_staff'], 'tone' => 'primary'],
['label' => 'Hadir', 'value' => $summary['present'], 'tone' => 'success'],
['label' => 'Tidak hadir', 'value' => $summary['absent'], 'tone' => 'danger'],
['label' => 'Belum rekod', 'value' => $summary['not_recorded'], 'tone' => 'warning'],
] as $card)
<div class="col-6 col-xl-3">
<div class="stat-card h-100">
<div class="text-secondary small">{{ $card['label'] }}</div>
<div class="fs-3 fw-bold mt-2 text-{{ $card['tone'] }}">{{ $card['value'] }}</div>
</div>
</div>
@endforeach
</div>
@if (! $pusat->election?->settings?->is_attendance_active)
<div class="alert alert-warning">
Modul kehadiran belum diaktifkan untuk pilihanraya ini.
</div>
@endif
<form method="POST" action="{{ route('ppm.attendance.store', $pusat) }}">
@csrf
<div class="content-panel p-0 overflow-hidden">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th>Staf</th>
<th>Jawatan</th>
<th>Saluran</th>
<th>Status</th>
<th>Masa Check-in</th>
<th>Catatan</th>
</tr>
</thead>
<tbody>
@forelse ($assignments as $assignment)
@php($attendance = $assignment->attendance)
<tr>
<td>
<div class="fw-semibold">{{ $assignment->application?->name ?: $assignment->user?->name ?: 'Tanpa nama' }}</div>
<div class="small text-secondary">{{ $assignment->application?->ic_number ?: $assignment->user?->email ?: '-' }}</div>
</td>
<td>{{ $assignment->position?->code }}</td>
<td>{{ $assignment->saluranMengundi?->number ?: '-' }}</td>
<td style="min-width: 160px;">
<select class="form-select form-select-sm" name="attendance[{{ $assignment->id }}][status]">
@foreach (['not_recorded' => 'Belum rekod', 'present' => 'Hadir', 'absent' => 'Tidak hadir'] as $value => $label)
<option value="{{ $value }}" @selected(old("attendance.{$assignment->id}.status", $attendance?->status ?? 'not_recorded') === $value)>{{ $label }}</option>
@endforeach
</select>
</td>
<td style="min-width: 190px;">
<input class="form-control form-control-sm" type="datetime-local" name="attendance[{{ $assignment->id }}][check_in_time]" value="{{ old("attendance.{$assignment->id}.check_in_time", $attendance?->check_in_time?->format('Y-m-d\TH:i')) }}">
</td>
<td style="min-width: 220px;">
<input class="form-control form-control-sm" name="attendance[{{ $assignment->id }}][note]" value="{{ old("attendance.{$assignment->id}.note", $attendance?->note) }}">
</td>
</tr>
@empty
<tr><td colspan="6" class="text-center text-secondary py-4">Tiada staf aktif untuk Pusat Mengundi ini.</td></tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="d-flex justify-content-end mt-3">
<button class="btn btn-primary" type="submit" @disabled(! $pusat->election?->settings?->is_attendance_active)>
<i class="bi bi-save me-1"></i>Simpan Kehadiran
</button>
</div>
</form>
@endsection