Added GuardPatrolEntry Dashboard and Added masters with transaction Policy
This commit is contained in:
248
resources/views/livewire/guard-patrol-entry-data-table.blade.php
Normal file
248
resources/views/livewire/guard-patrol-entry-data-table.blade.php
Normal file
@@ -0,0 +1,248 @@
|
||||
<div class="p-4">
|
||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
||||
GUARD PATROL ENTRY STATUS TABLE:
|
||||
</h2>
|
||||
<div class="overflow-x-auto rounded-lg shadow">
|
||||
<table class="w-full w-[600px] divide-y divide-gray-200 text-sm text-center">
|
||||
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
|
||||
<tr>
|
||||
<th rowspan="2" class="border px-4 py-2">Patrol Round</th>
|
||||
{{-- <th class="text-center border px-4 py-2">Created Datetime</th> --}}
|
||||
<th rowspan="2" class="border px-4 py-2">Guard Name</th>
|
||||
<th colspan="3" class="border px-4 py-2">Patrol</th>
|
||||
<th colspan="9" class="border px-4 py-2">Sequences</th>
|
||||
{{-- <th class="text-center border px-4 py-2">Scanned Status</th> --}}
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$seqTitle1 = $startSeqCheckPoint1 ? $startSeqCheckPoint1->checkPointNames1->name . " - " . $startSeqCheckPoint1->checkPointNames2->name : '';
|
||||
$seqTitle2 = $startSeqCheckPoint2 ? $startSeqCheckPoint2->checkPointNames1->name . " - " . $startSeqCheckPoint2->checkPointNames2->name : '';
|
||||
$seqTitle3 = $startSeqCheckPoint3 ? $startSeqCheckPoint3->checkPointNames1->name . " - " . $startSeqCheckPoint3->checkPointNames2->name : '';
|
||||
$seqTitle4 = $startSeqCheckPoint4 ? $startSeqCheckPoint4->checkPointNames1->name . " - " . $startSeqCheckPoint4->checkPointNames2->name : '';
|
||||
$seqTitle5 = $startSeqCheckPoint5 ? $startSeqCheckPoint5->checkPointNames1->name . " - " . $startSeqCheckPoint5->checkPointNames2->name : '';
|
||||
$seqTitle6 = $startSeqCheckPoint6 ? $startSeqCheckPoint6->checkPointNames1->name . " - " . $startSeqCheckPoint6->checkPointNames2->name : '';
|
||||
$seqTitle7 = $startSeqCheckPoint7 ? $startSeqCheckPoint7->checkPointNames1->name . " - " . $startSeqCheckPoint7->checkPointNames2->name : '';
|
||||
$seqTitle8 = $startSeqCheckPoint8 ? $startSeqCheckPoint8->checkPointNames1->name . " - " . $startSeqCheckPoint8->checkPointNames2->name : '';
|
||||
$seqTitle9 = $startSeqCheckPoint9 ? $startSeqCheckPoint9->checkPointNames1->name . " - " . $startSeqCheckPoint9->checkPointNames2->name : '';
|
||||
// if($startSeqCheckPoint1) { $seqTitle1 = $startSeqCheckPoint1->checkPointNames1->name . " - " . $startSeqCheckPoint1->checkPointNames2->name; }
|
||||
@endphp
|
||||
<th class="border px-4 py-2">Start Time</th>
|
||||
<th class="border px-4 py-2">End Time</th>
|
||||
<th class="border px-4 py-2">Lap Time</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle1); ?>">1</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle2); ?>">2</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle3); ?>">3</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle4); ?>">4</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle5); ?>">5</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle6); ?>">6</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle7); ?>">7</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle8); ?>">8</th>
|
||||
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle9); ?>">9</th>
|
||||
{{-- <th class="text-center border px-4 py-2">Scanned Status</th> --}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse ($records as $index => $record)
|
||||
<tr class="hover:bg-gray-50">
|
||||
@php
|
||||
$actualVal1 = $record['Sequence_1'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint1->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint1->max_cushioning;
|
||||
|
||||
if ($actualVal1 == 'X') {
|
||||
$bgStyle1 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal1) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal1 < $minVal) {
|
||||
$bgStyle1 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal1 > $maxVal) {
|
||||
$bgStyle1 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle1 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle1 = '';
|
||||
}
|
||||
|
||||
$actualVal2 = $record['Sequence_2'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint2->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint2->max_cushioning;
|
||||
|
||||
if ($actualVal2 == 'X') {
|
||||
$bgStyle2 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal2) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal2 < $minVal) {
|
||||
$bgStyle2 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal2 > $maxVal) {
|
||||
$bgStyle2 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle2 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle2 = '';
|
||||
}
|
||||
|
||||
$actualVal3 = $record['Sequence_3'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint3->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint3->max_cushioning;
|
||||
|
||||
if ($actualVal3 == 'X') {
|
||||
$bgStyle3 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal3) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal3 < $minVal) {
|
||||
$bgStyle3 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal3 > $maxVal) {
|
||||
$bgStyle3 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle3 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle3 = '';
|
||||
}
|
||||
|
||||
$actualVal4 = $record['Sequence_4'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint4->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint4->max_cushioning;
|
||||
|
||||
if ($actualVal4 == 'X') {
|
||||
$bgStyle4 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal4) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal4 < $minVal) {
|
||||
$bgStyle4 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal4 > $maxVal) {
|
||||
$bgStyle4 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle4 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle4 = '';
|
||||
}
|
||||
|
||||
$actualVal5 = $record['Sequence_5'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint5->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint5->max_cushioning;
|
||||
|
||||
if ($actualVal5 == 'X') {
|
||||
$bgStyle5 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal5) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal5 < $minVal) {
|
||||
$bgStyle5 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal5 > $maxVal) {
|
||||
$bgStyle5 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle5 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle5 = '';
|
||||
}
|
||||
|
||||
$actualVal6 = $record['Sequence_6'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint6->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint6->max_cushioning;
|
||||
|
||||
if ($actualVal6 == 'X') {
|
||||
$bgStyle6 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal6) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal6 < $minVal) {
|
||||
$bgStyle6 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal6 > $maxVal) {
|
||||
$bgStyle6 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle6 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle6 = '';
|
||||
}
|
||||
|
||||
$actualVal7 = $record['Sequence_7'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint7->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint7->max_cushioning;
|
||||
|
||||
if ($actualVal7 == 'X') {
|
||||
$bgStyle7 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal7) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal7 < $minVal) {
|
||||
$bgStyle7 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal7 > $maxVal) {
|
||||
$bgStyle7 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle7 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle7 = '';
|
||||
}
|
||||
|
||||
$actualVal8 = $record['Sequence_8'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint8->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint8->max_cushioning;
|
||||
|
||||
if ($actualVal8 == 'X') {
|
||||
$bgStyle8 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal8) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal8 < $minVal) {
|
||||
$bgStyle8 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal8 > $maxVal) {
|
||||
$bgStyle8 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle8 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle8 = '';
|
||||
}
|
||||
|
||||
$actualVal9 = $record['Sequence_9'] ?? 'X';
|
||||
$minVal = $startSeqCheckPoint9->min_cushioning;
|
||||
$maxVal = $startSeqCheckPoint9->max_cushioning;
|
||||
|
||||
if ($actualVal9 == 'X') {
|
||||
$bgStyle9 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} elseif (is_numeric($actualVal9) && is_numeric($minVal) && is_numeric($maxVal)) {
|
||||
if ($actualVal9 < $minVal) {
|
||||
$bgStyle9 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
|
||||
} elseif ($actualVal9 > $maxVal) {
|
||||
$bgStyle9 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
|
||||
} else {
|
||||
$bgStyle9 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
|
||||
}
|
||||
} else {
|
||||
$bgStyle9 = '';
|
||||
}
|
||||
@endphp
|
||||
<td class="border px-4 py-2" title="Patrol Round">{{ $index + 1 }}</td>
|
||||
{{-- <td class="text-center border px-4 py-2 whitespace-nowrap">{{ $record['created_at'] ?? '' }}</td> --}}
|
||||
<td class="border px-4 py-2" title="Guard Name">{{ $record['guard_name'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2" title="Start Time">{{ $record['start_time'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2" title="End Time">{{ $record['end_time'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2" title="Lap Time">{{ $record['lap_time'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle1 }}" title="<?php echo htmlspecialchars($seqTitle1); ?>">{{ $actualVal1 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle2 }}" title="<?php echo htmlspecialchars($seqTitle2); ?>">{{ $actualVal2 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle3 }}" title="<?php echo htmlspecialchars($seqTitle3); ?>">{{ $actualVal3 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle4 }}" title="<?php echo htmlspecialchars($seqTitle4); ?>">{{ $actualVal4 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle5 }}" title="<?php echo htmlspecialchars($seqTitle5); ?>">{{ $actualVal5 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle6 }}" title="<?php echo htmlspecialchars($seqTitle6); ?>">{{ $actualVal6 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle7 }}" title="<?php echo htmlspecialchars($seqTitle7); ?>">{{ $actualVal7 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle8 }}" title="<?php echo htmlspecialchars($seqTitle8); ?>">{{ $actualVal8 }}</td>
|
||||
<td class="border px-4 py-2" style="{{ $bgStyle9 }}" title="<?php echo htmlspecialchars($seqTitle9); ?>">{{ $actualVal9 }}</td>
|
||||
{{-- <td class="text-center border px-4 py-2">
|
||||
@php
|
||||
$status = $record['scanned_status'] ?? '';
|
||||
@endphp
|
||||
<span @class([
|
||||
'text-green-600 font-semibold' => $status === 'Scanned',
|
||||
'text-yellow-600 font-semibold' => $status === 'Incompleted',
|
||||
'text-red-600 font-semibold' => $status === 'Not Exist',
|
||||
])>
|
||||
{{ $status }}
|
||||
</span>
|
||||
</td> --}}
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="14" class="px-4 py-4 text-center text-gray-500">
|
||||
No records found.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user