Total records
{{ $transits->count() }}
View details
Arrivals
{{ $arrivalCount }}
View details
Departures
{{ $departureCount }}
View details
Did not travel
{{ $issueCount }}
View details
Transit schedule
{{ $transits->count() }} records
| Sort date |
Arrival date |
Name |
Location |
From |
Route |
Transport |
Status |
@foreach ($staff_tranzit as $ourstaff)
@php
$staffRecord = DB::table('ourstaffs')
->select('firstname', 'lastname', 'stat')
->where('id', base64_decode(\App\Http\Controllers\LogController::kodold_ki($ourstaff->staff_id)))
->first();
$firstname = $staffRecord ? base64_decode(\App\Http\Controllers\LogController::kodold_ki($staffRecord->firstname)) : '';
$lastname = $staffRecord ? base64_decode(\App\Http\Controllers\LogController::kodold_ki($staffRecord->lastname)) : 'Unknown worker';
$staffId = $staffRecord->stat ?? $ourstaff->staff_id;
$busRaw = trim((string) ($ourstaff->bus ?? ''));
if ($busRaw === '' || strtolower($busRaw) === 'null') {
$busRaw = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0';
}
if (ctype_digit($busRaw)) {
$bus = array_fill(0, 15, 0);
$bus[0] = (int) $busRaw;
} else {
$bus = array_pad(array_map('intval', explode(',', $busRaw)), 15, 0);
}
$airport = '';
if (!in_array((string) ($ourstaff->airport_from ?? ''), ['', '0'], true)
&& !in_array((string) ($ourstaff->airport_where ?? ''), ['', '0'], true)) {
$airport = $ourstaff->airport_from.' → '.$ourstaff->airport_where;
}
$from = ($ourstaff->from ?? '') === 'Home' ? 'Home' : ($ourstaff->from ?? '—');
$to = ($ourstaff->where ?? '') === 'Home' ? 'Home' : ($ourstaff->where ?? '—');
$location = $from === 'Home' ? $to : ($to === 'Home' ? $from : $to);
$transport = $airport !== '' ? str_replace(' → ', ' – ', $airport) : ($bus[0] === 3 ? 'Own cost' : (in_array($bus[0], [4, 5], true) ? 'Bus' : (in_array($bus[0], [1, 2], true) ? 'Airplane' : 'Not specified')));
$status = (int) ($ourstaff->status ?? 0);
$statusMap = [
0 => ['Draft', 'is-muted'],
1 => ['In progress', 'is-progress'],
2 => ['Travelling', 'is-travelling'],
3 => ['Arrived', 'is-complete'],
4 => ['Did not travel', 'is-danger'],
5 => ['Did not travel', 'is-danger'],
];
[$statusText, $statusClass] = $statusMap[$status] ?? ['Unknown', 'is-muted'];
@endphp
| {{ $ourstaff->arrival_date }} |
{{ $ourstaff->arrival_date }} |
{{ trim($lastname.' '.$firstname) }} |
{{ $location }} |
{{ $from }} |
{{ $from }} {{ $to }} |
{{ $transport }} |
{{ $statusText }} |
@endforeach