Added GuardPatrolEntry Dashboard and Added masters with transaction Policy
This commit is contained in:
108
app/Filament/Pages/GuardPatrolEntryDashboard.php
Normal file
108
app/Filament/Pages/GuardPatrolEntryDashboard.php
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
use App\Models\GuardPatrolEntry;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||||
|
use Filament\Pages\Page;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class GuardPatrolEntryDashboard extends Page
|
||||||
|
{
|
||||||
|
use HasFiltersForm;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Guard DashBoard';
|
||||||
|
|
||||||
|
protected static string $view = 'filament.pages.guard-patrol-entry-dashboard';
|
||||||
|
|
||||||
|
public function mount(): void
|
||||||
|
{
|
||||||
|
session()->forget(['select_guard_plant', 'select_guard_date']);
|
||||||
|
$this->filtersForm->fill([
|
||||||
|
'plant' => null,
|
||||||
|
'date' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function filtersForm(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->statePath('filters') // Explicitly set where to store form data
|
||||||
|
->schema([
|
||||||
|
Select::make('plant')
|
||||||
|
->options(Plant::pluck('name', 'id'))
|
||||||
|
->label('Select Plant')
|
||||||
|
->reactive()
|
||||||
|
->required()
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get){
|
||||||
|
// $this->dispatch('invoiceChart');
|
||||||
|
if(!$state)
|
||||||
|
{
|
||||||
|
$set('date', now()->format('Y-m-d')); // H:i:s
|
||||||
|
session(['select_guard_plant' => $state]);
|
||||||
|
session(['select_guard_date' => $get('date')]);
|
||||||
|
} else {
|
||||||
|
if(!$get('date'))
|
||||||
|
{
|
||||||
|
$set('date', now()->format('Y-m-d'));
|
||||||
|
session(['select_guard_plant' => $state]);
|
||||||
|
session(['select_guard_date' => $get('date')]);
|
||||||
|
} else {
|
||||||
|
session(['select_guard_plant' => $state]);
|
||||||
|
session(['select_guard_date' => $get('date')]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->dispatch('loadGuardData', $state, $get('date')); //->format('Y-m-d')
|
||||||
|
}),
|
||||||
|
DatePicker::make('date')
|
||||||
|
->label('Select Date')
|
||||||
|
->placeholder('Select Date')
|
||||||
|
->reactive()
|
||||||
|
->required()
|
||||||
|
->beforeOrEqual(now())
|
||||||
|
->default(now()->format('Y-m-d'))
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get){
|
||||||
|
if(!$get('plant'))
|
||||||
|
{
|
||||||
|
$set('date', now()->format('Y-m-d'));
|
||||||
|
session(['select_guard_plant' => $get('plant')]);
|
||||||
|
session(['select_guard_date' => $state]);
|
||||||
|
} else {
|
||||||
|
if(!$get('date'))
|
||||||
|
{
|
||||||
|
$set('date', now()->format('Y-m-d'));
|
||||||
|
session(['select_guard_plant' => $get('plant')]);
|
||||||
|
session(['select_guard_date' => $state]);
|
||||||
|
} else {
|
||||||
|
$records = GuardPatrolEntry::whereDate('patrol_time', $state)->where('plant_id', $get('plant'))->orderBy('patrol_time', 'asc')->first(); //desc
|
||||||
|
//dd($get('plant'), $state, $records->patrol_time);//->toTimeString()
|
||||||
|
session(['select_guard_plant' => $get('plant')]);
|
||||||
|
session(['select_guard_date' => $state]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// $this->dispatch('invoiceChart');
|
||||||
|
$this->dispatch('loadGuardData', $get('plant'), $state);//->format('Y-m-d')
|
||||||
|
})
|
||||||
|
])
|
||||||
|
->columns(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
|
{
|
||||||
|
return 'Guard Patrol Entry';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function canAccess(): bool
|
||||||
|
{
|
||||||
|
return Auth::check() && Auth::user()->can('view guard patrol entry dashboard');
|
||||||
|
}
|
||||||
|
}
|
||||||
354
app/Livewire/GuardPatrolEntryDataTable.php
Normal file
354
app/Livewire/GuardPatrolEntryDataTable.php
Normal file
@@ -0,0 +1,354 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\CheckPointTime;
|
||||||
|
use App\Models\GuardPatrolEntry;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class GuardPatrolEntryDataTable extends Component
|
||||||
|
{
|
||||||
|
// public $plantId;
|
||||||
|
// public $date;
|
||||||
|
|
||||||
|
public $newNameFound;
|
||||||
|
public $guardName;
|
||||||
|
public $checkPointName;
|
||||||
|
public $startTime;
|
||||||
|
public $endTime;
|
||||||
|
public $start;
|
||||||
|
public $finish;
|
||||||
|
public $begin;
|
||||||
|
public $end;
|
||||||
|
public $labTime;
|
||||||
|
public $minDiff;
|
||||||
|
public $seqNo;
|
||||||
|
public $isSequenced = true;
|
||||||
|
public $sequence1;
|
||||||
|
public $sequence2;
|
||||||
|
public $sequence3;
|
||||||
|
public $sequence4;
|
||||||
|
public $sequence5;
|
||||||
|
public $sequence6;
|
||||||
|
public $sequence7;
|
||||||
|
public $sequence8;
|
||||||
|
public $sequence9;
|
||||||
|
public $startSeqCheckPoint1;
|
||||||
|
public $startSeqCheckPoint2;
|
||||||
|
public $startSeqCheckPoint3;
|
||||||
|
public $startSeqCheckPoint4;
|
||||||
|
public $startSeqCheckPoint5;
|
||||||
|
public $startSeqCheckPoint6;
|
||||||
|
public $startSeqCheckPoint7;
|
||||||
|
public $startSeqCheckPoint8;
|
||||||
|
public $startSeqCheckPoint9;
|
||||||
|
public $records = [];
|
||||||
|
|
||||||
|
protected $listeners = [
|
||||||
|
'loadGuardData' => 'loadGuardPatrolData',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function loadGuardPatrolData($plantId, $date)
|
||||||
|
{
|
||||||
|
// $this->plantId = $plantId;
|
||||||
|
// $this->date = $date;
|
||||||
|
|
||||||
|
$this->records = [];
|
||||||
|
$this->newNameFound = true;
|
||||||
|
$this->guardName = null;
|
||||||
|
// $this->checkPointName = null;
|
||||||
|
$this->startTime = null;
|
||||||
|
$this->endTime = null;
|
||||||
|
$this->start = null;
|
||||||
|
$this->finish = null;
|
||||||
|
$this->begin = null;
|
||||||
|
$this->end = null;
|
||||||
|
$this->labTime = null;
|
||||||
|
$this->minDiff = 0;
|
||||||
|
$this->seqNo = 0;
|
||||||
|
$this->isSequenced = true;
|
||||||
|
$this->sequence1 = null;
|
||||||
|
$this->sequence2 = null;
|
||||||
|
$this->sequence3 = null;
|
||||||
|
$this->sequence4 = null;
|
||||||
|
$this->sequence5 = null;
|
||||||
|
$this->sequence6 = null;
|
||||||
|
$this->sequence7 = null;
|
||||||
|
$this->sequence8 = null;
|
||||||
|
$this->sequence9 = null;
|
||||||
|
|
||||||
|
if(!$plantId || !$date)
|
||||||
|
{
|
||||||
|
$this->records = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->startSeqCheckPoint1 = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', 1)->where('plant_id', $plantId)->first();
|
||||||
|
$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();
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
$guardName = $record->guardNames ? $record->guardNames->name : null;
|
||||||
|
$checkPointName = $record->checkPointNames ? $record->checkPointNames->name : null;
|
||||||
|
if ($this->guardName != $guardName || $this->newNameFound) {//if ($this->newNameFound) {
|
||||||
|
if($this->guardName)
|
||||||
|
{
|
||||||
|
$this->records[] = [
|
||||||
|
'guard_name' => $this->guardName,
|
||||||
|
// 'check_point_name' => $record->checkPointNames ? $record->checkPointNames->name : "",
|
||||||
|
'start_time' => $this->startTime,
|
||||||
|
'end_time' => $this->endTime,
|
||||||
|
'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
|
||||||
|
//'created_at' => $record->created_at,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->guardName = $guardName;
|
||||||
|
$this->startTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
|
||||||
|
$this->start = Carbon::parse($record->patrol_time);
|
||||||
|
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
|
||||||
|
$this->finish = Carbon::parse($record->patrol_time);
|
||||||
|
$this->begin = Carbon::parse($record->patrol_time);
|
||||||
|
$this->end = Carbon::parse($record->patrol_time);
|
||||||
|
$this->labTime = (int)$this->start->diffInMinutes($this->finish);
|
||||||
|
$this->minDiff = (int)$this->begin->diffInMinutes($this->end);
|
||||||
|
$this->seqNo = 0;
|
||||||
|
$this->newNameFound = false;
|
||||||
|
$this->isSequenced = true;
|
||||||
|
}
|
||||||
|
else if ($this->guardName == $guardName && $this->start && $this->begin)
|
||||||
|
{
|
||||||
|
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
|
||||||
|
$this->finish = Carbon::parse($record->patrol_time);
|
||||||
|
$this->end = Carbon::parse($record->patrol_time);
|
||||||
|
$this->labTime = (int)$this->start->diffInMinutes($this->finish);
|
||||||
|
$this->minDiff = (int)$this->begin->diffInMinutes($this->end);
|
||||||
|
$this->begin = Carbon::parse($record->patrol_time);
|
||||||
|
// $this->seqNo = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->seqNo++;
|
||||||
|
|
||||||
|
if ($this->seqNo == 1) {
|
||||||
|
if ($checkPointName == $this->startSeqCheckPoint1->checkPointNames1->name) {//"STP BACKSIDE"
|
||||||
|
$this->isSequenced = true;
|
||||||
|
$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 {
|
||||||
|
$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 == 2) {
|
||||||
|
if ($checkPointName == $this->startSeqCheckPoint2->checkPointNames1->name) {//"CANTEEN"
|
||||||
|
if ($this->isSequenced) {
|
||||||
|
$this->sequence1 = $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 {
|
||||||
|
$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) {
|
||||||
|
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) {
|
||||||
|
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) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($this->seqNo == 6) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($this->seqNo == 7) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($this->seqNo == 8) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($this->seqNo == 9) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($this->seqNo == 10) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.guard-patrol-entry-data-table');
|
||||||
|
}
|
||||||
|
}
|
||||||
106
app/Policies/CheckPointNamePolicy.php
Normal file
106
app/Policies/CheckPointNamePolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\CheckPointName;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class CheckPointNamePolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, CheckPointName $checkpointname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, CheckPointName $checkpointname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, CheckPointName $checkpointname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, CheckPointName $checkpointname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, CheckPointName $checkpointname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, CheckPointName $checkpointname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete CheckPointName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any CheckPointName');
|
||||||
|
}
|
||||||
|
}
|
||||||
106
app/Policies/CheckPointTimePolicy.php
Normal file
106
app/Policies/CheckPointTimePolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\CheckPointTime;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class CheckPointTimePolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, CheckPointTime $checkpointtime): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, CheckPointTime $checkpointtime): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, CheckPointTime $checkpointtime): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, CheckPointTime $checkpointtime): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, CheckPointTime $checkpointtime): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, CheckPointTime $checkpointtime): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete CheckPointTime');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any CheckPointTime');
|
||||||
|
}
|
||||||
|
}
|
||||||
106
app/Policies/GuardNamePolicy.php
Normal file
106
app/Policies/GuardNamePolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\GuardName;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class GuardNamePolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, GuardName $guardname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, GuardName $guardname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, GuardName $guardname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, GuardName $guardname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, GuardName $guardname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, GuardName $guardname): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete GuardName');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any GuardName');
|
||||||
|
}
|
||||||
|
}
|
||||||
106
app/Policies/GuardPatrolEntryPolicy.php
Normal file
106
app/Policies/GuardPatrolEntryPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\GuardPatrolEntry;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class GuardPatrolEntryPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, GuardPatrolEntry $guardpatrolentry): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, GuardPatrolEntry $guardpatrolentry): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, GuardPatrolEntry $guardpatrolentry): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, GuardPatrolEntry $guardpatrolentry): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, GuardPatrolEntry $guardpatrolentry): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, GuardPatrolEntry $guardpatrolentry): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any GuardPatrolEntry');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<x-filament-panels::page>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{-- Render the Select form fields --}}
|
||||||
|
<div class="space-y-4">
|
||||||
|
{{ $this->filtersForm($this->form) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||||
|
<livewire:guard-patrol-entry-data-table />
|
||||||
|
{{-- @livewire(\App\Filament\Widgets\InvoiceChart::class) --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</x-filament-panels::page>
|
||||||
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