1
0
forked from poc/pds

Added from-to patrol time within sequence title on guard_patrol_entry_data_table

This commit is contained in:
dhanabalan
2025-06-24 17:32:00 +05:30
parent be466cfdc2
commit 97d43ac8cf
2 changed files with 120 additions and 60 deletions

View File

@@ -34,6 +34,16 @@ class GuardPatrolEntryDataTable extends Component
public $sequence7;
public $sequence8;
public $sequence9;
public $seqTime;
public $seqTime1;
public $seqTime2;
public $seqTime3;
public $seqTime4;
public $seqTime5;
public $seqTime6;
public $seqTime7;
public $seqTime8;
public $seqTime9;
public $startSeqCheckPoint1;
public $startSeqCheckPoint2;
public $startSeqCheckPoint3;
@@ -77,6 +87,16 @@ class GuardPatrolEntryDataTable extends Component
$this->sequence7 = null;
$this->sequence8 = null;
$this->sequence9 = null;
$this->seqTime = null;
$this->seqTime1 = null;
$this->seqTime2 = null;
$this->seqTime3 = null;
$this->seqTime4 = null;
$this->seqTime5 = null;
$this->seqTime6 = null;
$this->seqTime7 = null;
$this->seqTime8 = null;
$this->seqTime9 = null;
if(!$plantId || !$date)
{
@@ -115,11 +135,30 @@ class GuardPatrolEntryDataTable extends Component
'Sequence_6' => $this->sequence6,
'Sequence_7' => $this->sequence7,
'Sequence_8' => $this->sequence8,
'Sequence_9' => $this->sequence9
'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,
];
}
$this->seqTime1 = null;
$this->seqTime2 = null;
$this->seqTime3 = null;
$this->seqTime4 = null;
$this->seqTime5 = null;
$this->seqTime6 = null;
$this->seqTime7 = null;
$this->seqTime8 = null;
$this->seqTime9 = null;
$this->guardName = $guardName;
$this->startTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
$this->start = Carbon::parse($record->patrol_time);
@@ -129,6 +168,7 @@ class GuardPatrolEntryDataTable extends Component
$this->end = Carbon::parse($record->patrol_time);
$this->labTime = (int)$this->start->diffInMinutes($this->finish);
$this->minDiff = (int)$this->begin->diffInMinutes($this->end);
$this->seqTime = $this->begin->toTimeString(). " - " . $this->end->toTimeString();
$this->seqNo = 0;
$this->newNameFound = false;
$this->isSequenced = true;
@@ -140,6 +180,7 @@ class GuardPatrolEntryDataTable extends Component
$this->end = Carbon::parse($record->patrol_time);
$this->labTime = (int)$this->start->diffInMinutes($this->finish);
$this->minDiff = (int)$this->begin->diffInMinutes($this->end);
$this->seqTime = $this->begin->toTimeString(). " - " . $this->end->toTimeString();
$this->begin = Carbon::parse($record->patrol_time);
// $this->seqNo = 0;
}
@@ -173,6 +214,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
else if ($this->seqNo == 2) {
$this->seqTime1 = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoint2->checkPointNames1->name) {//"CANTEEN"
if ($this->isSequenced) {
$this->sequence1 = $this->minDiff;
@@ -200,6 +242,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -225,6 +268,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -248,6 +292,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -269,6 +314,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -288,6 +334,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -305,6 +352,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -320,6 +368,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;
@@ -333,6 +382,7 @@ class GuardPatrolEntryDataTable extends Component
}
}
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;

View File

@@ -46,15 +46,16 @@
<tr class="hover:bg-gray-50">
@php
$actualVal1 = $record['Sequence_1'] ?? 'X';
$minVal = $startSeqCheckPoint1->min_cushioning;
$maxVal = $startSeqCheckPoint1->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal1 < $minVal) {
} elseif (is_numeric($actualVal1) && is_numeric($minVal1) && is_numeric($maxVal1)) {
if ($actualVal1 < $minVal1) {
$bgStyle1 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal1 > $maxVal) {
} elseif ($actualVal1 > $maxVal1) {
$bgStyle1 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle1 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -64,15 +65,16 @@
}
$actualVal2 = $record['Sequence_2'] ?? 'X';
$minVal = $startSeqCheckPoint2->min_cushioning;
$maxVal = $startSeqCheckPoint2->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal2 < $minVal) {
} elseif (is_numeric($actualVal2) && is_numeric($minVal2) && is_numeric($maxVal2)) {
if ($actualVal2 < $minVal2) {
$bgStyle2 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal2 > $maxVal) {
} elseif ($actualVal2 > $maxVal2) {
$bgStyle2 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle2 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -82,15 +84,16 @@
}
$actualVal3 = $record['Sequence_3'] ?? 'X';
$minVal = $startSeqCheckPoint3->min_cushioning;
$maxVal = $startSeqCheckPoint3->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal3 < $minVal) {
} elseif (is_numeric($actualVal3) && is_numeric($minVal3) && is_numeric($maxVal3)) {
if ($actualVal3 < $minVal3) {
$bgStyle3 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal3 > $maxVal) {
} elseif ($actualVal3 > $maxVal3) {
$bgStyle3 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle3 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -100,15 +103,16 @@
}
$actualVal4 = $record['Sequence_4'] ?? 'X';
$minVal = $startSeqCheckPoint4->min_cushioning;
$maxVal = $startSeqCheckPoint4->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal4 < $minVal) {
} elseif (is_numeric($actualVal4) && is_numeric($minVal4) && is_numeric($maxVal4)) {
if ($actualVal4 < $minVal4) {
$bgStyle4 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal4 > $maxVal) {
} elseif ($actualVal4 > $maxVal4) {
$bgStyle4 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle4 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -118,15 +122,16 @@
}
$actualVal5 = $record['Sequence_5'] ?? 'X';
$minVal = $startSeqCheckPoint5->min_cushioning;
$maxVal = $startSeqCheckPoint5->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal5 < $minVal) {
} elseif (is_numeric($actualVal5) && is_numeric($minVal5) && is_numeric($maxVal5)) {
if ($actualVal5 < $minVal5) {
$bgStyle5 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal5 > $maxVal) {
} elseif ($actualVal5 > $maxVal5) {
$bgStyle5 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle5 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -136,15 +141,16 @@
}
$actualVal6 = $record['Sequence_6'] ?? 'X';
$minVal = $startSeqCheckPoint6->min_cushioning;
$maxVal = $startSeqCheckPoint6->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal6 < $minVal) {
} elseif (is_numeric($actualVal6) && is_numeric($minVal6) && is_numeric($maxVal6)) {
if ($actualVal6 < $minVal6) {
$bgStyle6 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal6 > $maxVal) {
} elseif ($actualVal6 > $maxVal6) {
$bgStyle6 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle6 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -154,15 +160,16 @@
}
$actualVal7 = $record['Sequence_7'] ?? 'X';
$minVal = $startSeqCheckPoint7->min_cushioning;
$maxVal = $startSeqCheckPoint7->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal7 < $minVal) {
} elseif (is_numeric($actualVal7) && is_numeric($minVal7) && is_numeric($maxVal7)) {
if ($actualVal7 < $minVal7) {
$bgStyle7 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal7 > $maxVal) {
} elseif ($actualVal7 > $maxVal7) {
$bgStyle7 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle7 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -172,15 +179,16 @@
}
$actualVal8 = $record['Sequence_8'] ?? 'X';
$minVal = $startSeqCheckPoint8->min_cushioning;
$maxVal = $startSeqCheckPoint8->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal8 < $minVal) {
} elseif (is_numeric($actualVal8) && is_numeric($minVal8) && is_numeric($maxVal8)) {
if ($actualVal8 < $minVal8) {
$bgStyle8 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal8 > $maxVal) {
} elseif ($actualVal8 > $maxVal8) {
$bgStyle8 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle8 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -190,15 +198,16 @@
}
$actualVal9 = $record['Sequence_9'] ?? 'X';
$minVal = $startSeqCheckPoint9->min_cushioning;
$maxVal = $startSeqCheckPoint9->max_cushioning;
$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($minVal) && is_numeric($maxVal)) {
if ($actualVal9 < $minVal) {
} elseif (is_numeric($actualVal9) && is_numeric($minVal9) && is_numeric($maxVal9)) {
if ($actualVal9 < $minVal9) {
$bgStyle9 = 'background-color: #fde68a;';// 'bg-yellow-300'; // Tailwind yellow
} elseif ($actualVal9 > $maxVal) {
} elseif ($actualVal9 > $maxVal9) {
$bgStyle9 = 'background-color: #f87171;';// 'bg-red-500'; // Tailwind red
} else {
$bgStyle9 = 'background-color: #4ade80;';// 'bg-green-400'; // Tailwind green
@@ -213,15 +222,16 @@
<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="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>
<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
$status = $record['scanned_status'] ?? '';