1
0
forked from poc/pds

Updated dynamic sequence minutes calculation functionality and table design load functionality from fixed sequence

This commit is contained in:
dhanabalan
2025-06-26 16:25:56 +05:30
parent 934d449a6b
commit f9a0aa9fa0
2 changed files with 238 additions and 499 deletions

View File

@@ -23,36 +23,13 @@ class GuardPatrolEntryDataTable extends Component
public $end; public $end;
public $labTime; public $labTime;
public $minDiff; public $minDiff;
public $seqNo; public $seqNoCnt = 0;
public $seqNo = 0;
public $isSequenced = true; public $isSequenced = true;
public $sequence1; public $sequences = [];
public $sequence2;
public $sequence3;
public $sequence4;
public $sequence5;
public $sequence6;
public $sequence7;
public $sequence8;
public $sequence9;
public $seqTime; public $seqTime;
public $seqTime1; public $seqTimes = [];
public $seqTime2; public $startSeqCheckPoints = [];
public $seqTime3;
public $seqTime4;
public $seqTime5;
public $seqTime6;
public $seqTime7;
public $seqTime8;
public $seqTime9;
public $startSeqCheckPoint1;
public $startSeqCheckPoint2;
public $startSeqCheckPoint3;
public $startSeqCheckPoint4;
public $startSeqCheckPoint5;
public $startSeqCheckPoint6;
public $startSeqCheckPoint7;
public $startSeqCheckPoint8;
public $startSeqCheckPoint9;
public $records = []; public $records = [];
protected $listeners = [ protected $listeners = [
@@ -67,7 +44,7 @@ class GuardPatrolEntryDataTable extends Component
$this->records = []; $this->records = [];
$this->newNameFound = true; $this->newNameFound = true;
$this->guardName = null; $this->guardName = null;
// $this->checkPointName = null; $this->checkPointName = null;
$this->startTime = null; $this->startTime = null;
$this->endTime = null; $this->endTime = null;
$this->start = null; $this->start = null;
@@ -76,27 +53,13 @@ class GuardPatrolEntryDataTable extends Component
$this->end = null; $this->end = null;
$this->labTime = null; $this->labTime = null;
$this->minDiff = 0; $this->minDiff = 0;
$this->seqNoCnt = 0;
$this->seqNo = 0; $this->seqNo = 0;
$this->isSequenced = true; $this->isSequenced = true;
$this->sequence1 = null; $this->sequences = [];
$this->sequence2 = null;
$this->sequence3 = null;
$this->sequence4 = null;
$this->sequence5 = null;
$this->sequence6 = null;
$this->sequence7 = null;
$this->sequence8 = null;
$this->sequence9 = null;
$this->seqTime = null; $this->seqTime = null;
$this->seqTime1 = null; $this->seqTimes = [];
$this->seqTime2 = null; $this->startSeqCheckPoints = [];
$this->seqTime3 = null;
$this->seqTime4 = null;
$this->seqTime5 = null;
$this->seqTime6 = null;
$this->seqTime7 = null;
$this->seqTime8 = null;
$this->seqTime9 = null;
if (!$plantId || !$date) if (!$plantId || !$date)
{ {
@@ -104,60 +67,42 @@ class GuardPatrolEntryDataTable extends Component
return; return;
} }
$this->startSeqCheckPoint1 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 1)->where('plant_id', $plantId)->first(); $this->seqNoCnt = CheckPointTime::where('plant_id', $plantId)->count('sequence_number');
$this->startSeqCheckPoint2 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 2)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint3 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 3)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint4 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 4)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint5 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 5)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint6 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 6)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint7 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 7)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint8 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 8)->where('plant_id', $plantId)->first();
$this->startSeqCheckPoint9 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 9)->where('plant_id', $plantId)->first();
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$this->startSeqCheckPoints[$i] = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', $i)->where('plant_id', $plantId)->first();
}
$this->sequences = array_fill(1, $this->seqNoCnt, "X");
$this->seqTimes = array_fill(1, $this->seqNoCnt, null);
$hasSingleGuard = GuardPatrolEntry::whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get();
$checking = 0;
$records = GuardPatrolEntry::with('guardNames')->with('checkPointNames')->whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get(); //desc Carbon::parse($record->patrol_time)->toTimeString() $records = GuardPatrolEntry::with('guardNames')->with('checkPointNames')->whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get(); //desc Carbon::parse($record->patrol_time)->toTimeString()
foreach ($records as $record) { foreach ($records as $index => $record) { //foreach ($startSeqCheckPoints as $seq => $checkpoint)
$checking++;
$guardName = $record->guardNames ? $record->guardNames->name : null; $guardName = $record->guardNames ? $record->guardNames->name : null;
$checkPointName = $record->checkPointNames ? $record->checkPointNames->name : null; $checkPointName = $record->checkPointNames ? $record->checkPointNames->name : null;
if ($this->guardName != $guardName || $this->newNameFound) {//if ($this->newNameFound) { if ($this->guardName != $guardName || $this->newNameFound) {//if ($this->newNameFound) {
if ($this->guardName) if ($this->guardName)
{ {
$this->records[] = [ $recordData = [
'guard_name' => $this->guardName, 'guard_name' => $this->guardName,
// 'check_point_name' => $record->checkPointNames ? $record->checkPointNames->name : "",
'start_time' => $this->startTime, 'start_time' => $this->startTime,
'end_time' => $this->endTime, 'end_time' => $this->endTime,
'lap_time' => $this->labTime, 'lap_time' => $this->labTime,
'Sequence_1' => $this->sequence1,
'Sequence_2' => $this->sequence2,
'Sequence_3' => $this->sequence3,
'Sequence_4' => $this->sequence4,
'Sequence_5' => $this->sequence5,
'Sequence_6' => $this->sequence6,
'Sequence_7' => $this->sequence7,
'Sequence_8' => $this->sequence8,
'Sequence_9' => $this->sequence9,
'Sequence_Time_1' => $this->seqTime1,
'Sequence_Time_2' => $this->seqTime2,
'Sequence_Time_3' => $this->seqTime3,
'Sequence_Time_4' => $this->seqTime4,
'Sequence_Time_5' => $this->seqTime5,
'Sequence_Time_6' => $this->seqTime6,
'Sequence_Time_7' => $this->seqTime7,
'Sequence_Time_8' => $this->seqTime8,
'Sequence_Time_9' => $this->seqTime9
//'created_at' => $record->created_at,
]; ];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
} }
$this->seqTime1 = null; $this->records[] = $recordData;
$this->seqTime2 = null; }
$this->seqTime3 = null;
$this->seqTime4 = null; $this->seqTimes = array_fill(1, $this->seqNoCnt, null);
$this->seqTime5 = null;
$this->seqTime6 = null;
$this->seqTime7 = null;
$this->seqTime8 = null;
$this->seqTime9 = null;
$this->guardName = $guardName; $this->guardName = $guardName;
$this->startTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12" $this->startTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
@@ -188,211 +133,182 @@ class GuardPatrolEntryDataTable extends Component
$this->seqNo++; $this->seqNo++;
if ($this->seqNo == 1) { if ($this->seqNo == 1) {
if ($checkPointName == $this->startSeqCheckPoint1->checkPointNames1->name) {//"STP BACKSIDE" if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {//"STP BACKSIDE"
$this->isSequenced = true; $this->isSequenced = true;
$this->sequence1 = "X"; $this->sequences = array_fill(1, $this->seqNoCnt, "X");
$this->sequence2 = "X";
$this->sequence3 = "X";
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
} }
else { else {
$this->isSequenced = false; $this->isSequenced = false;
$this->sequence1 = "X"; $this->sequences = array_fill(1, $this->seqNoCnt, "X");
$this->sequence2 = "X"; }
$this->sequence3 = "X";
$this->sequence4 = "X"; if (($index+1) == count($hasSingleGuard))
$this->sequence5 = "X"; {
$this->sequence6 = "X"; if ($this->guardName)
$this->sequence7 = "X"; {
$this->sequence8 = "X"; $recordData = [
$this->sequence9 = "X"; 'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
} }
} }
else if ($this->seqNo == 2) { }
$this->seqTime1 = $this->seqTime; else if ($this->seqNo >= ($this->seqNoCnt+1)) {
if ($checkPointName == $this->startSeqCheckPoint2->checkPointNames1->name) {//"CANTEEN" $this->seqTimes[$this->seqNo-1] = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo-1]->checkPointNames2->name) {//"D 72 END"
if ($this->isSequenced) { if ($this->isSequenced) {
$this->sequence1 = $this->minDiff; $this->sequences[$this->seqNo-1] = $this->minDiff;
$this->sequence2 = "X";
$this->sequence3 = "X";
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
} }
} }
else { else {
$this->isSequenced = false; $this->isSequenced = false;
$this->sequence1 = "X";
$this->sequence2 = "X";
$this->sequence3 = "X";
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 3) {
$this->seqTime2 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint3->checkPointNames1->name) {//"D BLOCK BACK GATE"
if ($this->isSequenced) {
$this->sequence2 = $this->minDiff;
$this->sequence3 = "X";
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence2 = "X";
$this->sequence3 = "X";
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 4) {
$this->seqTime3 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint4->checkPointNames1->name) {//"C BLOCK PACKING END"
if ($this->isSequenced) {
$this->sequence3 = $this->minDiff;
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence3 = "X";
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 5) {
$this->seqTime4 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint5->checkPointNames1->name) {//"EXPORT WINDING FRONT"
if ($this->isSequenced) {
$this->sequence4 = $this->minDiff;
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence4 = "X";
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 6) {
$this->seqTime5 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint6->checkPointNames1->name) {//"DOMESTIC WINDING FRONT"
if ($this->isSequenced) {
$this->sequence5 = $this->minDiff;
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence5 = "X";
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 7) {
$this->seqTime6 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint7->checkPointNames1->name) {//"POWER HOUSE FRONT"
if ($this->isSequenced) {
$this->sequence6 = $this->minDiff;
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence6 = "X";
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 8) {
$this->seqTime7 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint8->checkPointNames1->name) {//"B BLOCK BUFFING FRONT"
if ($this->isSequenced) {
$this->sequence7 = $this->minDiff;
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence7 = "X";
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 9) {
$this->seqTime8 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint9->checkPointNames1->name) {//"D BLOCK DESPATCH FRONT"
if ($this->isSequenced) {
$this->sequence8 = $this->minDiff;
$this->sequence9 = "X";
}
}
else {
$this->isSequenced = false;
$this->sequence8 = "X";
$this->sequence9 = "X";
}
}
else if ($this->seqNo == 10) {
$this->seqTime9 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint9->checkPointNames2->name) {//"D 72 END"
if ($this->isSequenced) {
$this->sequence9 = $this->minDiff;
}
}
else {
$this->isSequenced = false;
$this->sequence9 = "X";
} }
$this->newNameFound = true; $this->newNameFound = true;
if ($hasSingleGuard->unique('guard_name_id')->count() == 1)
{
if (($this->seqNoCnt+1) == count($hasSingleGuard))
{
//dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
}
else // if ($this->seqNo >= 2) {
{
$this->seqTimes[$this->seqNo-1] = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {//"CANTEEN"
if ($this->isSequenced) {
$this->sequences[$this->seqNo-1] = $this->minDiff;
}
}
else {
$this->isSequenced = false;
}
if ($hasSingleGuard->unique('guard_name_id')->count() == 1)
{
if ($this->seqNo == count($hasSingleGuard))
{
//dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
} }
} }
} }

View File

@@ -6,216 +6,32 @@
<table class="w-full w-[600px] divide-y divide-gray-200 text-sm text-center"> <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"> <thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
<tr> <tr>
<th rowspan="2" class="border px-4 py-2">Patrol Round</th> <th rowspan="2" class="border px-4 py-2" style="width: 60px;">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 rowspan="2" class="border px-4 py-2">Guard Name</th>
<th colspan="3" class="border px-4 py-2">Patrol</th> <th colspan="3" class="border px-4 py-2">Patrol</th>
<th colspan="9" class="border px-4 py-2">Sequences</th> <th colspan="{{ $seqNoCnt }}" class="border px-4 py-2">Sequences</th>
{{-- <th class="text-center border px-4 py-2">Scanned Status</th> --}}
</tr> </tr>
<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">Start Time</th>
<th class="border px-4 py-2">End 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">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($seqTitle1); ?>">1</th> --}}
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle2); ?>">2</th> @forelse($startSeqCheckPoints as $seq => $checkpoint)
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle3); ?>">3</th> @php
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle4); ?>">4</th> $seqTitle = '';
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle5); ?>">5</th> if ($checkpoint && $checkpoint->checkPointNames1 && $checkpoint->checkPointNames2) {
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle6); ?>">6</th> $seqTitle = $checkpoint->checkPointNames1->name . " - " . $checkpoint->checkPointNames2->name;
<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> @endphp
<th class="border px-4 py-2" title="<?php echo htmlspecialchars($seqTitle9); ?>">9</th> <th class="border px-4 py-2" title="{{ $seqTitle }}">{{ $seq }}</th>
{{-- <th class="text-center border px-4 py-2">Scanned Status</th> --}} @empty
<th class="border px-4 py-2" title="Sequences not found!">0</th>
@endforelse
</tr> </tr>
</thead> </thead>
<tbody class="divide-y divide-gray-100"> <tbody class="divide-y divide-gray-100">
@forelse ($records as $index => $record) @forelse ($records as $index => $record)
<tr class="hover:bg-gray-50"> <tr class="hover:bg-gray-50">
@php
$actualVal1 = $record['Sequence_1'] ?? 'X';
$minVal1 = $startSeqCheckPoint1->min_cushioning;
$maxVal1 = $startSeqCheckPoint1->max_cushioning;// . "\n"
$seqTitTime1 = $seqTitle1 . "\n". $record['Sequence_Time_1'] ?? '';
if ($actualVal1 == 'X') {
$bgStyle1 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal1) && is_numeric($minVal1) && is_numeric($maxVal1)) {
if ($actualVal1 < $minVal1) {
$bgStyle1 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal1 > $maxVal1) {
$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';
$minVal2 = $startSeqCheckPoint2->min_cushioning;
$maxVal2 = $startSeqCheckPoint2->max_cushioning;
$seqTitTime2 = $seqTitle2 . "\n". $record['Sequence_Time_2'] ?? '';
if ($actualVal2 == 'X') {
$bgStyle2 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal2) && is_numeric($minVal2) && is_numeric($maxVal2)) {
if ($actualVal2 < $minVal2) {
$bgStyle2 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal2 > $maxVal2) {
$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';
$minVal3 = $startSeqCheckPoint3->min_cushioning;
$maxVal3 = $startSeqCheckPoint3->max_cushioning;
$seqTitTime3 = $seqTitle3 . "\n". $record['Sequence_Time_3'] ?? '';
if ($actualVal3 == 'X') {
$bgStyle3 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal3) && is_numeric($minVal3) && is_numeric($maxVal3)) {
if ($actualVal3 < $minVal3) {
$bgStyle3 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal3 > $maxVal3) {
$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';
$minVal4 = $startSeqCheckPoint4->min_cushioning;
$maxVal4 = $startSeqCheckPoint4->max_cushioning;
$seqTitTime4 = $seqTitle4 . "\n". $record['Sequence_Time_4'] ?? '';
if ($actualVal4 == 'X') {
$bgStyle4 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal4) && is_numeric($minVal4) && is_numeric($maxVal4)) {
if ($actualVal4 < $minVal4) {
$bgStyle4 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal4 > $maxVal4) {
$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';
$minVal5 = $startSeqCheckPoint5->min_cushioning;
$maxVal5 = $startSeqCheckPoint5->max_cushioning;
$seqTitTime5 = $seqTitle5 . "\n". $record['Sequence_Time_5'] ?? '';
if ($actualVal5 == 'X') {
$bgStyle5 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal5) && is_numeric($minVal5) && is_numeric($maxVal5)) {
if ($actualVal5 < $minVal5) {
$bgStyle5 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal5 > $maxVal5) {
$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';
$minVal6 = $startSeqCheckPoint6->min_cushioning;
$maxVal6 = $startSeqCheckPoint6->max_cushioning;
$seqTitTime6 = $seqTitle6 . "\n". $record['Sequence_Time_6'] ?? '';
if ($actualVal6 == 'X') {
$bgStyle6 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal6) && is_numeric($minVal6) && is_numeric($maxVal6)) {
if ($actualVal6 < $minVal6) {
$bgStyle6 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal6 > $maxVal6) {
$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';
$minVal7 = $startSeqCheckPoint7->min_cushioning;
$maxVal7 = $startSeqCheckPoint7->max_cushioning;
$seqTitTime7 = $seqTitle7 . "\n". $record['Sequence_Time_7'] ?? '';
if ($actualVal7 == 'X') {
$bgStyle7 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal7) && is_numeric($minVal7) && is_numeric($maxVal7)) {
if ($actualVal7 < $minVal7) {
$bgStyle7 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal7 > $maxVal7) {
$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';
$minVal8 = $startSeqCheckPoint8->min_cushioning;
$maxVal8 = $startSeqCheckPoint8->max_cushioning;
$seqTitTime8 = $seqTitle8 . "\n". $record['Sequence_Time_8'] ?? '';
if ($actualVal8 == 'X') {
$bgStyle8 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal8) && is_numeric($minVal8) && is_numeric($maxVal8)) {
if ($actualVal8 < $minVal8) {
$bgStyle8 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal8 > $maxVal8) {
$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';
$minVal9 = $startSeqCheckPoint9->min_cushioning;
$maxVal9 = $startSeqCheckPoint9->max_cushioning;
$seqTitTime9 = $seqTitle9 . "\n". $record['Sequence_Time_9'] ?? '';
if ($actualVal9 == 'X') {
$bgStyle9 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal9) && is_numeric($minVal9) && is_numeric($maxVal9)) {
if ($actualVal9 < $minVal9) {
$bgStyle9 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal9 > $maxVal9) {
$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="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="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="Guard Name">{{ $record['guard_name'] ?? '' }}</td>
@@ -223,27 +39,34 @@
<td class="border px-4 py-2" title="End Time">{{ $record['end_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" 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="{{ $bgStyle1 }}" title="<?php echo htmlspecialchars($seqTitle1); ?>">{{ $actualVal1 }}</td> --}}
<td class="border px-4 py-2" style="{{ $bgStyle1 }}" title="{{ $seqTitTime1 }}">{{ $actualVal1 }}</td> @foreach($startSeqCheckPoints as $seq => $checkpoint)
<td class="border px-4 py-2" style="{{ $bgStyle2 }}" title="{{ $seqTitTime2 }}">{{ $actualVal2 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle3 }}" title="{{ $seqTitTime3 }}">{{ $actualVal3 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle4 }}" title="{{ $seqTitTime4 }}">{{ $actualVal4 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle5 }}" title="{{ $seqTitTime5 }}">{{ $actualVal5 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle6 }}" title="{{ $seqTitTime6 }}">{{ $actualVal6 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle7 }}" title="{{ $seqTitTime7 }}">{{ $actualVal7 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle8 }}" title="{{ $seqTitTime8 }}">{{ $actualVal8 }}</td>
<td class="border px-4 py-2" style="{{ $bgStyle9 }}" title="{{ $seqTitTime9 }}">{{ $actualVal9 }}</td>
{{-- <td class="text-center border px-4 py-2">
@php @php
$status = $record['scanned_status'] ?? ''; $seqTitle = '';
if ($checkpoint && $checkpoint->checkPointNames1 && $checkpoint->checkPointNames2) {
$seqTitle = $checkpoint->checkPointNames1->name . " - " . $checkpoint->checkPointNames2->name;
}
$actualVal = $record["Sequence_$seq"] ?? 'X';
$minVal = $checkpoint->min_cushioning;
$maxVal = $checkpoint->max_cushioning;// . "\n"
$seqTitTime = $seqTitle . "\n". $record["Sequence_Time_$seq"] ?? '';
if ($actualVal == 'X') {
$bgStyle = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} elseif (is_numeric($actualVal) && is_numeric($minVal) && is_numeric($maxVal)) {
if ($actualVal < $minVal) {
$bgStyle = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal > $maxVal) {
$bgStyle = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
}
} else {
$bgStyle = '';
}
@endphp @endphp
<span @class([ <td class="border px-4 py-2" style="{{ $bgStyle }}" title="{{ $seqTitTime }}">{{ $actualVal }}</td>
'text-green-600 font-semibold' => $status === 'Scanned', @endforeach
'text-yellow-600 font-semibold' => $status === 'Incompleted',
'text-red-600 font-semibold' => $status === 'Not Exist',
])>
{{ $status }}
</span>
</td> --}}
</tr> </tr>
@empty @empty
<tr> <tr>