Updated alignment on livewire
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
This commit is contained in:
@@ -13,23 +13,41 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
// public $date;
|
// public $date;
|
||||||
|
|
||||||
public $newNameFound;
|
public $newNameFound;
|
||||||
|
|
||||||
public $guardName;
|
public $guardName;
|
||||||
|
|
||||||
public $checkPointName;
|
public $checkPointName;
|
||||||
|
|
||||||
public $startTime;
|
public $startTime;
|
||||||
|
|
||||||
public $endTime;
|
public $endTime;
|
||||||
|
|
||||||
public $start;
|
public $start;
|
||||||
|
|
||||||
public $finish;
|
public $finish;
|
||||||
|
|
||||||
public $begin;
|
public $begin;
|
||||||
|
|
||||||
public $end;
|
public $end;
|
||||||
|
|
||||||
public $labTime;
|
public $labTime;
|
||||||
|
|
||||||
public $minDiff;
|
public $minDiff;
|
||||||
|
|
||||||
public $seqNoCnt = 0;
|
public $seqNoCnt = 0;
|
||||||
|
|
||||||
public $seqNo = 0;
|
public $seqNo = 0;
|
||||||
|
|
||||||
public $isSequenced = true;
|
public $isSequenced = true;
|
||||||
|
|
||||||
public $sequences = [];
|
public $sequences = [];
|
||||||
|
|
||||||
public $seqTime;
|
public $seqTime;
|
||||||
|
|
||||||
public $seqTimes = [];
|
public $seqTimes = [];
|
||||||
|
|
||||||
public $startSeqCheckPoints = [];
|
public $startSeqCheckPoints = [];
|
||||||
|
|
||||||
public $records = [];
|
public $records = [];
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
@@ -61,9 +79,9 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->seqTimes = [];
|
$this->seqTimes = [];
|
||||||
$this->startSeqCheckPoints = [];
|
$this->startSeqCheckPoints = [];
|
||||||
|
|
||||||
if (!$plantId || !$date)
|
if (! $plantId || ! $date) {
|
||||||
{
|
|
||||||
$this->records = [];
|
$this->records = [];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +91,7 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->startSeqCheckPoints[$i] = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', $i)->where('plant_id', $plantId)->first();
|
$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->sequences = array_fill(1, $this->seqNoCnt, 'X');
|
||||||
$this->seqTimes = array_fill(1, $this->seqNoCnt, null);
|
$this->seqTimes = array_fill(1, $this->seqNoCnt, null);
|
||||||
|
|
||||||
$hasSingleGuard = GuardPatrolEntry::whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get();
|
$hasSingleGuard = GuardPatrolEntry::whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get();
|
||||||
@@ -85,8 +103,7 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$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) {
|
||||||
{
|
|
||||||
$recordData = [
|
$recordData = [
|
||||||
'guard_name' => $this->guardName,
|
'guard_name' => $this->guardName,
|
||||||
'start_time' => $this->startTime,
|
'start_time' => $this->startTime,
|
||||||
@@ -113,19 +130,17 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->end = Carbon::parse($record->patrol_time);
|
$this->end = Carbon::parse($record->patrol_time);
|
||||||
$this->labTime = (int) $this->start->diffInMinutes($this->finish);
|
$this->labTime = (int) $this->start->diffInMinutes($this->finish);
|
||||||
$this->minDiff = (int) $this->begin->diffInMinutes($this->end);
|
$this->minDiff = (int) $this->begin->diffInMinutes($this->end);
|
||||||
$this->seqTime = $this->begin->toTimeString(). " - " . $this->end->toTimeString();
|
$this->seqTime = $this->begin->toTimeString().' - '.$this->end->toTimeString();
|
||||||
$this->seqNo = 0;
|
$this->seqNo = 0;
|
||||||
$this->newNameFound = false;
|
$this->newNameFound = false;
|
||||||
$this->isSequenced = true;
|
$this->isSequenced = true;
|
||||||
}
|
} elseif ($this->guardName == $guardName && $this->start && $this->begin) {
|
||||||
else if ($this->guardName == $guardName && $this->start && $this->begin)
|
|
||||||
{
|
|
||||||
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); // "2025-06-01 00:07:12"
|
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); // "2025-06-01 00:07:12"
|
||||||
$this->finish = Carbon::parse($record->patrol_time);
|
$this->finish = Carbon::parse($record->patrol_time);
|
||||||
$this->end = Carbon::parse($record->patrol_time);
|
$this->end = Carbon::parse($record->patrol_time);
|
||||||
$this->labTime = (int) $this->start->diffInMinutes($this->finish);
|
$this->labTime = (int) $this->start->diffInMinutes($this->finish);
|
||||||
$this->minDiff = (int) $this->begin->diffInMinutes($this->end);
|
$this->minDiff = (int) $this->begin->diffInMinutes($this->end);
|
||||||
$this->seqTime = $this->begin->toTimeString(). " - " . $this->end->toTimeString();
|
$this->seqTime = $this->begin->toTimeString().' - '.$this->end->toTimeString();
|
||||||
$this->begin = Carbon::parse($record->patrol_time);
|
$this->begin = Carbon::parse($record->patrol_time);
|
||||||
// $this->seqNo = 0;
|
// $this->seqNo = 0;
|
||||||
}
|
}
|
||||||
@@ -135,17 +150,14 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
if ($this->seqNo == 1) {
|
if ($this->seqNo == 1) {
|
||||||
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {// "STP BACKSIDE"
|
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {// "STP BACKSIDE"
|
||||||
$this->isSequenced = true;
|
$this->isSequenced = true;
|
||||||
$this->sequences = array_fill(1, $this->seqNoCnt, "X");
|
$this->sequences = array_fill(1, $this->seqNoCnt, 'X');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->isSequenced = false;
|
$this->isSequenced = false;
|
||||||
$this->sequences = array_fill(1, $this->seqNoCnt, "X");
|
$this->sequences = array_fill(1, $this->seqNoCnt, 'X');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($index+1) == count($hasSingleGuard))
|
if (($index + 1) == count($hasSingleGuard)) {
|
||||||
{
|
if ($this->guardName) {
|
||||||
if ($this->guardName)
|
|
||||||
{
|
|
||||||
$recordData = [
|
$recordData = [
|
||||||
'guard_name' => $this->guardName,
|
'guard_name' => $this->guardName,
|
||||||
'start_time' => $this->startTime,
|
'start_time' => $this->startTime,
|
||||||
@@ -161,26 +173,37 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->records[] = $recordData;
|
$this->records[] = $recordData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} elseif ($this->seqNo >= ($this->seqNoCnt + 1)) {
|
||||||
else if ($this->seqNo >= ($this->seqNoCnt+1)) {
|
|
||||||
$this->seqTimes[$this->seqNo - 1] = $this->seqTime;
|
$this->seqTimes[$this->seqNo - 1] = $this->seqTime;
|
||||||
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo - 1]->checkPointNames2->name) {// "D 72 END"
|
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo - 1]->checkPointNames2->name) {// "D 72 END"
|
||||||
if ($this->isSequenced) {
|
if ($this->isSequenced) {
|
||||||
$this->sequences[$this->seqNo - 1] = $this->minDiff;
|
$this->sequences[$this->seqNo - 1] = $this->minDiff;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->isSequenced = false;
|
$this->isSequenced = false;
|
||||||
}
|
}
|
||||||
$this->newNameFound = true;
|
$this->newNameFound = true;
|
||||||
|
|
||||||
if ($hasSingleGuard->unique('guard_name_id')->count() == 1)
|
if ($hasSingleGuard->unique('guard_name_id')->count() == 1) {
|
||||||
{
|
if (($this->seqNoCnt + 1) == count($hasSingleGuard)) {
|
||||||
if (($this->seqNoCnt+1) == count($hasSingleGuard))
|
|
||||||
{
|
|
||||||
// dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
|
// dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
|
||||||
if ($this->guardName)
|
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;
|
||||||
|
}
|
||||||
|
} elseif (($index + 1) == count($hasSingleGuard)) {
|
||||||
|
if ($this->guardName) {
|
||||||
$recordData = [
|
$recordData = [
|
||||||
'guard_name' => $this->guardName,
|
'guard_name' => $this->guardName,
|
||||||
'start_time' => $this->startTime,
|
'start_time' => $this->startTime,
|
||||||
@@ -196,10 +219,8 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->records[] = $recordData;
|
$this->records[] = $recordData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (($index+1) == count($hasSingleGuard))
|
} elseif (($index + 1) == count($hasSingleGuard)) {
|
||||||
{
|
if ($this->guardName) {
|
||||||
if ($this->guardName)
|
|
||||||
{
|
|
||||||
$recordData = [
|
$recordData = [
|
||||||
'guard_name' => $this->guardName,
|
'guard_name' => $this->guardName,
|
||||||
'start_time' => $this->startTime,
|
'start_time' => $this->startTime,
|
||||||
@@ -215,46 +236,36 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->records[] = $recordData;
|
$this->records[] = $recordData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else { // if ($this->seqNo >= 2) {
|
||||||
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;
|
$this->seqTimes[$this->seqNo - 1] = $this->seqTime;
|
||||||
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {// "CANTEEN"
|
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {// "CANTEEN"
|
||||||
if ($this->isSequenced) {
|
if ($this->isSequenced) {
|
||||||
$this->sequences[$this->seqNo - 1] = $this->minDiff;
|
$this->sequences[$this->seqNo - 1] = $this->minDiff;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->isSequenced = false;
|
$this->isSequenced = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasSingleGuard->unique('guard_name_id')->count() == 1)
|
if ($hasSingleGuard->unique('guard_name_id')->count() == 1) {
|
||||||
{
|
if ($this->seqNo == count($hasSingleGuard)) {
|
||||||
if ($this->seqNo == count($hasSingleGuard))
|
|
||||||
{
|
|
||||||
// dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
|
// dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
|
||||||
if ($this->guardName)
|
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;
|
||||||
|
}
|
||||||
|
} elseif (($index + 1) == count($hasSingleGuard)) {
|
||||||
|
if ($this->guardName) {
|
||||||
$recordData = [
|
$recordData = [
|
||||||
'guard_name' => $this->guardName,
|
'guard_name' => $this->guardName,
|
||||||
'start_time' => $this->startTime,
|
'start_time' => $this->startTime,
|
||||||
@@ -270,30 +281,8 @@ class GuardPatrolEntryDataTable extends Component
|
|||||||
$this->records[] = $recordData;
|
$this->records[] = $recordData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (($index+1) == count($hasSingleGuard))
|
} elseif (($index + 1) == count($hasSingleGuard)) {
|
||||||
{
|
if ($this->guardName) {
|
||||||
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 = [
|
$recordData = [
|
||||||
'guard_name' => $this->guardName,
|
'guard_name' => $this->guardName,
|
||||||
'start_time' => $this->startTime,
|
'start_time' => $this->startTime,
|
||||||
|
|||||||
Reference in New Issue
Block a user