@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100'])
{{-- section content --}}
@section('content')
@include('layouts.navbars.auth.topnav', ['title' => ''])
@push('css')
@endpush
@if (in_array($dmenu, ['trreq', 'trhis']))
@push('css')
@endpush
@php
// Get data
$items = $table_detail_d ?? collect();
$filterMonth = request()->input('bulan', date('m'));
$filterYear = request()->input('tahun', date('Y'));
// Jika kosong, query langsung dari database
if ($items->isEmpty()) {
$query = \Illuminate\Support\Facades\DB::table('tr_non_periodic')
->leftJoin('ms_area', 'tr_non_periodic.area_id', '=', 'ms_area.id')
->select('tr_non_periodic.*', 'ms_area.nama_area as area_name')
->orderBy('tr_non_periodic.created_at', 'desc');
if ($filterMonth !== 'all') {
$query->whereMonth('tr_non_periodic.created_at', $filterMonth);
}
if ($filterYear !== 'all') {
$query->whereYear('tr_non_periodic.created_at', $filterYear);
}
$items = $query->get();
} else {
if ($filterMonth !== 'all') {
$items = $items->filter(function($item) use ($filterMonth) {
return \Carbon\Carbon::parse($item->created_at ?? $item->tanggal ?? now())->format('m') == str_pad($filterMonth, 2, '0', STR_PAD_LEFT);
});
}
if ($filterYear !== 'all') {
$items = $items->filter(function($item) use ($filterYear) {
return \Carbon\Carbon::parse($item->created_at ?? $item->tanggal ?? now())->format('Y') == $filterYear;
});
}
}
$areaMap = \Illuminate\Support\Facades\DB::table('ms_area')
->pluck('nama_area', 'id');
$displayItems = $items->map(function ($item) use ($areaMap) {
if (empty($item->area_name) && !empty($item->area_id)) {
$item->area_name = $areaMap->get((int) $item->area_id)
?? $areaMap->get((string) $item->area_id);
}
return $item;
});
$statusField = 'request_status';
if ($displayItems->first() && isset($displayItems->first()->status)) {
$statusField = 'status';
}
$hrdUserIds = \Illuminate\Support\Facades\DB::table('users')
->where(function ($q) {
$q->whereRaw("FIND_IN_SET('hrdxxx', REPLACE(LOWER(idroles), ' ', ''))")
->orWhereRaw("FIND_IN_SET('hrd', REPLACE(LOWER(idroles), ' ', ''))");
})
->pluck('id')
->map(fn ($id) => (int) $id)
->all();
$hrdUsernames = \Illuminate\Support\Facades\DB::table('users')
->where(function ($q) {
$q->whereRaw("FIND_IN_SET('hrdxxx', REPLACE(LOWER(idroles), ' ', ''))")
->orWhereRaw("FIND_IN_SET('hrd', REPLACE(LOWER(idroles), ' ', ''))");
})
->pluck('username')
->map(fn ($username) => strtolower((string) $username))
->all();
$isHrdSubmission = function ($item) use ($hrdUserIds, $hrdUsernames) {
$uid = isset($item->user_id) ? (string) $item->user_id : '';
$uidInt = is_numeric($uid) ? (int) $uid : null;
$createdBy = strtolower((string) ($item->user_create ?? ''));
if ($uidInt !== null && in_array($uidInt, $hrdUserIds, true)) {
return true;
}
if ($uid !== '' && !is_numeric($uid) && in_array(strtolower($uid), $hrdUsernames, true)) {
return true;
}
return $createdBy !== '' && in_array($createdBy, $hrdUsernames, true);
};
$currentUserId = $user_login->id ?? null;
$sessionUsername = strtolower(trim((string) (session('username') ?? '')));
$modelUsername = strtolower(trim((string) ($user_login->username ?? '')));
$currentUsername = $sessionUsername !== '' && !is_numeric($sessionUsername)
? $sessionUsername
: $modelUsername;
$isCurrentViewerHrd = ($currentUserId && in_array((int) $currentUserId, $hrdUserIds, true))
|| ($currentUsername !== '' && in_array($currentUsername, $hrdUsernames, true));
$isOwnedByCurrentUser = function ($item) use ($currentUserId, $currentUsername) {
$uid = isset($item->user_id) ? (string) $item->user_id : '';
$createdBy = strtolower((string) ($item->user_create ?? ''));
$byUserId = $currentUserId && $uid !== '' && is_numeric($uid) && (int) $uid === (int) $currentUserId;
$byLegacyUserId = $currentUsername !== '' && $uid !== '' && !is_numeric($uid) && strtolower($uid) === $currentUsername;
$byUserCreate = $currentUsername !== '' && $createdBy === $currentUsername;
return $byUserId || $byLegacyUserId || $byUserCreate;
};
// Filter pending items - status pending atau review yang belum ada head_approval_date
$pendingItems = $displayItems->filter(function ($item) use ($statusField, $isHrdSubmission) {
$statusValue = strtolower($item->{$statusField} ?? '');
return ($statusValue === 'pending' || $statusValue === 'review')
&& empty($item->head_approval_date)
&& !$isHrdSubmission($item);
});
// Approved count
$approvedCount = $displayItems->filter(function ($item) use ($statusField) {
$statusValue = strtolower($item->{$statusField} ?? '');
return !empty($item->head_approval_date) && in_array($statusValue, ['review', 'approved', 'pengadaan', 'pengerjaan', 'completed']);
})->count();
// Rejected count
$rejectedCount = $displayItems->filter(function ($item) use ($statusField) {
$statusValue = strtolower($item->{$statusField} ?? '');
return in_array($statusValue, ['rejected', 'reject']);
})->count();
// Completed count
$completedCount = $displayItems->where($statusField, 'completed')->count();
// History items - only show completed, rejected, cancel (finished work)
$historyItems = $displayItems->filter(function ($item) use ($statusField) {
$statusValue = strtolower($item->{$statusField} ?? '');
// Normalize status
if (in_array($statusValue, ['reject'])) {
$statusValue = 'rejected';
} elseif (in_array($statusValue, ['canceled', 'cancelled'])) {
$statusValue = 'cancel';
}
return in_array($statusValue, ['completed', 'rejected', 'cancel']);
});
// Verifikasi HRD di menu Pengajuan PU (mirip user)
$verifikasiItems = collect();
if ($isCurrentViewerHrd) {
$verifikasiItems = $displayItems->filter(function ($item) use ($statusField, $isOwnedByCurrentUser) {
$statusValue = strtolower($item->{$statusField} ?? '');
return $statusValue === 'verifikasi' && $isOwnedByCurrentUser($item);
})->values();
}
// Tracking items - review, pengadaan, pengerjaan, revisi, verifikasi
$trackingItems = $displayItems->filter(function ($item) use ($statusField) {
$statusValue = strtolower($item->{$statusField} ?? '');
return !empty($item->head_approval_date) && in_array($statusValue, ['review', 'pengadaan', 'pengerjaan', 'revisi', 'verifikasi']);
});
@endphp
@php
// Build a mapping from role code to an example employee full name (if any)
$roleUserMap = [];
$roleUsers = \Illuminate\Support\Facades\DB::table('users')
->where(function ($q) {
$q->whereRaw("FIND_IN_SET('ptgoff', REPLACE(LOWER(idroles), ' ', ''))")
->orWhereRaw("FIND_IN_SET('ptgspu', REPLACE(LOWER(idroles), ' ', ''))");
})->where('isactive', '1')->select('idroles', 'firstname', 'lastname')->get();
foreach ($roleUsers as $ru) {
$roles = array_map('trim', explode(',', ($ru->idroles ?? '')));
foreach ($roles as $r) {
$code = strtolower($r);
if (!isset($roleUserMap[$code]) || empty($roleUserMap[$code])) {
$roleUserMap[$code] = trim(($ru->firstname ?? '') . ' ' . ($ru->lastname ?? ''));
}
}
}
@endphp
{{ $dmenu == 'trreq' ? 'Daftar Pengajuan Pekerjaan PU' : 'Riwayat Pengajuan Pekerjaan PU' }}
{{-- Summary Cards --}}
@if ($dmenu == 'trreq')
{{-- Section Head Approval - Pending Items --}}
@if($pendingItems->count() > 0)
Aksi
Tanggal Pengajuan
Area
Deskripsi
Status
Catatan Head
@forelse ($pendingItems as $detail)
@php
$primary = '';
if (isset($table_primary_d) && count($table_primary_d) > 0) {
foreach ($table_primary_d as $p) {
$primary = $primary == '' ? $detail->{$p->field} : $primary . ':' . $detail->{$p->field};
}
}
if ($primary == '' && isset($detail->id)) {
$primary = $detail->id;
}
$rawStatus = $detail->request_status ?? $detail->status ?? '';
$status = strtolower($rawStatus);
if (in_array($status, ['approved'], true)) {
$status = 'review';
} elseif ($status === 'reject') {
$status = 'rejected';
} elseif (in_array($status, ['canceled', 'cancelled'], true)) {
$status = 'cancel';
}
$badgeClass = 'status-badge status-' . ($status ?: 'pending');
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
@endphp
View
Toggle Dropdown
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
{{ $status ?: 'pending' }}
{{ $detail->head_note ?? '-' }}
@empty
Belum ada pengajuan baru.
@endforelse
@endif
{{-- Section Head Active Items (Draft / In-progress) --}}
@php
$activeHeadItems = $displayItems->filter(function ($item) use ($statusField) {
$s = strtolower($item->{$statusField} ?? '');
if (in_array($s, ['reject'])) $s = 'rejected';
if (in_array($s, ['canceled','cancelled'])) $s = 'cancel';
return !in_array($s, ['completed','rejected','cancel']);
});
@endphp
@if($activeHeadItems->count() > 0)
Tanggal
Area
Deskripsi
Status
Aksi
@foreach($activeHeadItems as $detail)
@php
$rawStatus = $detail->{$statusField} ?? '';
$status = strtolower($rawStatus);
if (in_array($status, ['approved'], true)) $status = 'review';
if ($status === 'reject') $status = 'rejected';
if (in_array($status, ['canceled','cancelled'], true)) $status = 'cancel';
$dateValue = $detail->created_at ?? null;
$displayDate = $dateValue ? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y') : '-';
@endphp
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? '-' }}
{{ Str::limit($detail->job_description ?? $detail->description ?? '-', 80) }}
{{ $status }}
View
@endforeach
@endif
{{-- Section Head Tracking Items --}}
@if($trackingItems->count() > 0)
Aksi
Area
Deskripsi
Progress
@foreach ($trackingItems as $detail)
@php
$primary = '';
if (isset($table_primary_d) && count($table_primary_d) > 0) {
foreach ($table_primary_d as $p) {
$primary = $primary == '' ? $detail->{$p->field} : $primary . ':' . $detail->{$p->field};
}
}
if ($primary == '' && isset($detail->id)) {
$primary = $detail->id;
}
$rawStatus = $detail->request_status ?? $detail->status ?? '';
$status = strtolower($rawStatus);
$datePending = $detail->created_at ? \Illuminate\Support\Carbon::parse($detail->created_at)->format('d/m/Y') : '-';
$dateReview = $detail->head_approval_date ? \Illuminate\Support\Carbon::parse($detail->head_approval_date)->format('d/m/Y') : '-';
$datePengadaan = (!empty($detail->pengadaan_started_at) && $detail->pengadaan_started_at !== '0000-00-00 00:00:00') ? \Illuminate\Support\Carbon::parse($detail->pengadaan_started_at)->format('d/m/Y') : '-';
$datePengerjaan = (!empty($detail->pengerjaan_started_at) && $detail->pengerjaan_started_at !== '0000-00-00 00:00:00') ? \Illuminate\Support\Carbon::parse($detail->pengerjaan_started_at)->format('d/m/Y') : '-';
$isPengadaanDone = in_array($status, ['pengadaan', 'pengerjaan', 'revisi', 'verifikasi', 'completed']) || (!empty($detail->pengadaan_started_at) && $detail->pengadaan_started_at !== '0000-00-00 00:00:00');
$isPengerjaanDone = in_array($status, ['pengerjaan', 'revisi', 'verifikasi', 'completed']) || (!empty($detail->pengerjaan_started_at) && $detail->pengerjaan_started_at !== '0000-00-00 00:00:00');
$isCompleteDone = in_array($status, ['verifikasi', 'completed']);
$isRejected = in_array($status, ['reject', 'rejected', 'cancel', 'canceled', 'cancelled']);
// Determine current status step
$currentStep = 'review';
if ($isRejected) $currentStep = 'rejected';
elseif (in_array($status, ['pengadaan'])) $currentStep = 'pengadaan';
elseif (in_array($status, ['pengerjaan', 'revisi'])) $currentStep = 'pengerjaan';
elseif (in_array($status, ['verifikasi', 'completed'])) $currentStep = 'complete';
@endphp
View
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
@if($isRejected)
Ditolak / Dibatalkan
@else
Pending
{{ $datePending }}
Pengadaan
{{ $datePengadaan !== '-' ? $datePengadaan : ($currentStep == 'pengadaan' ? 'Proses...' : '-') }}
Pengerjaan
{{ $datePengerjaan !== '-' ? $datePengerjaan : ($currentStep == 'pengerjaan' ? 'Proses...' : '-') }}
@endif
@endforeach
@endif
@if($verifikasiItems->count() > 0)
Aksi
Tanggal Pengajuan
Area
Deskripsi
Dokumentasi
@foreach ($verifikasiItems as $detail)
@php
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
$docCount = \Illuminate\Support\Facades\DB::table('tr_documentation')
->where('non_periodic_id', $detail->id)
->where('is_active', '1')
->whereNotNull('file')
->whereNotIn('file', ['', '0', 'null'])
->count();
@endphp
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
@if ($docCount > 0)
{{ $docCount }} Lampiran
@else
Belum ada
@endif
@endforeach
@endif
@endif
Tanggal Pengajuan
Area
Deskripsi
Status
Catatan Head
@forelse ($historyItems as $detail)
@php
$rawStatus = $detail->request_status ?? $detail->status ?? '';
$status = strtolower($rawStatus);
if (in_array($status, ['approved'], true)) {
$status = 'review';
} elseif ($status === 'reject') {
$status = 'rejected';
} elseif (in_array($status, ['canceled', 'cancelled'], true)) {
$status = 'cancel';
}
$badgeClass = 'status-badge status-' . ($status ?: 'pending');
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
@endphp
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
{{ $status ?: 'pending' }}
{{ $detail->head_note ?? '-' }}
@empty
@endforelse
@endif
@push('js')
@endpush
@if ($dmenu == 'trhrd')
@push('css')
@endpush
@php
// Get real data untuk HRD approval
$items = $table_detail_d ?? collect();
// Jika kosong, query langsung dari database
if ($items->isEmpty()) {
$items = \Illuminate\Support\Facades\DB::table('tr_non_periodic')
->leftJoin('ms_area', 'tr_non_periodic.area_id', '=', 'ms_area.id')
->leftJoin('users as worker', 'tr_non_periodic.worker_id', '=', 'worker.id')
->select(
'tr_non_periodic.*',
'ms_area.nama_area as area_name',
\Illuminate\Support\Facades\DB::raw("CONCAT(COALESCE(worker.firstname, ''), ' ', COALESCE(worker.lastname, '')) as worker_name")
)
->orderBy('tr_non_periodic.created_at', 'desc')
->get();
}
// Pastikan area_name selalu tersedia untuk tampilan tabel
$areaMap = \Illuminate\Support\Facades\DB::table('ms_area')
->pluck('nama_area', 'id');
// Query petugas untuk dropdown - prefer ms_employee.nama, fallback to users.firstname/lastname
$workers = \Illuminate\Support\Facades\DB::table('users')
->leftJoin('ms_employee as emp', 'users.id', '=', 'emp.user_id')
->where(function ($q) {
$q->whereRaw("FIND_IN_SET('ptgoff', REPLACE(LOWER(users.idroles), ' ', ''))")
->orWhereRaw("FIND_IN_SET('ptgspu', REPLACE(LOWER(users.idroles), ' ', ''))");
})
->where('users.isactive', '1')
->select('users.id', 'users.idroles', 'users.firstname', 'users.lastname', 'emp.nama as emp_name')
->orderBy('emp.nama')
->orderBy('users.firstname')
->get()
->map(function ($worker) {
$worker->display_name = trim(($worker->emp_name ?? '') ?: trim(($worker->firstname ?? '') . ' ' . ($worker->lastname ?? ''))) ?: ($worker->idroles ?? '');
return $worker;
})
->unique('display_name')
->values();
$displayItems = $items->map(function ($item) use ($areaMap) {
if (empty($item->area_name) && !empty($item->area_id)) {
$item->area_name = $areaMap->get((int) $item->area_id)
?? $areaMap->get((string) $item->area_id);
}
return $item;
});
// Step 1: approval items dari head (status review dan belum di-approval HRD)
$approvalItems = $displayItems->filter(function ($item) {
$statusValue = strtolower($item->request_status ?? '');
return in_array($statusValue, ['review', 'pending', 'approved']) && !empty($item->head_approval_date) && empty($item->hrd_approval_date);
});
// Step 2: in-progress items setelah HRD approve
$pendingItems = $displayItems->filter(function ($item) {
$statusValue = strtolower($item->request_status ?? '');
return !empty($item->hrd_approval_date) && in_array($statusValue, ['review', 'pengadaan', 'pengerjaan']);
});
// History items - status yang sudah selesai atau ditolak
$historyItems = $displayItems->filter(function ($item) {
$statusValue = strtolower($item->request_status ?? '');
return in_array($statusValue, ['completed', 'rejected', 'reject', 'cancel', 'cancelled', 'canceled']);
});
@endphp
Aksi
No
Tanggal Pengajuan
Area
Deskripsi
Status
Catatan HRD
@forelse ($approvalItems as $detail)
@php
$primary = '';
if (isset($table_primary_d) && count($table_primary_d) > 0) {
foreach ($table_primary_d as $p) {
$primary = $primary == '' ? $detail->{$p->field} : $primary . ':' . $detail->{$p->field};
}
}
if ($primary == '' && isset($detail->id)) {
$primary = $detail->id;
}
$rawStatus = $detail->request_status ?? 'review';
$status = strtolower($rawStatus);
if (in_array($status, ['approved'], true)) {
$status = 'review';
} elseif ($status === 'reject') {
$status = 'rejected';
} elseif (in_array($status, ['canceled', 'cancelled'], true)) {
$status = 'cancel';
}
$statusText = $status === 'review' ? 'review' : $status;
$badgeClass = 'status-badge status-' . ($statusText ?: 'review');
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
$displayNote = $detail->hrd_note ?? '-';
@endphp
Detail
Proses
{{ $loop->iteration }}
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
{{ $statusText ?: 'approved' }}
{{ $displayNote }}
@empty
@endforelse
Aksi
No
Tanggal Pengajuan
Area
Deskripsi
Pelaksana
Status
Catatan HRD
@forelse ($pendingItems as $detail)
@php
$primary = '';
if (isset($table_primary_d) && count($table_primary_d) > 0) {
foreach ($table_primary_d as $p) {
$primary = $primary == '' ? $detail->{$p->field} : $primary . ':' . $detail->{$p->field};
}
}
if ($primary == '' && isset($detail->id)) {
$primary = $detail->id;
}
$rawStatus = $detail->request_status ?? '';
$status = strtolower($rawStatus);
if (in_array($status, ['approved'], true)) {
$status = 'review';
} elseif ($status === 'reject') {
$status = 'rejected';
} elseif (in_array($status, ['canceled', 'cancelled'], true)) {
$status = 'cancel';
}
$badgeClass = 'status-badge status-' . ($status ?: 'pending');
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
$displayNote = $detail->hrd_note ?? '-';
@endphp
View
Toggle Dropdown
{{ $loop->iteration }}
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
@if (($detail->request_status ?? '') !== 'pengadaan' && $detail->work_type === 'vendor')
{{ $detail->vendor_name ?? '-' }}
@elseif (($detail->request_status ?? '') !== 'pengadaan' && $detail->work_type === 'internal')
Petugas PU
@else
-
@endif
{{ $status ?: 'pending' }}
{{ $displayNote }}
@empty
@endforelse
Tanggal Pengajuan
Area
Deskripsi
Pelaksana
Waktu Pengadaan
Waktu Pengerjaan
@forelse ($historyItems as $detail)
@php
$rawStatus = $detail->request_status ?? '';
$status = strtolower($rawStatus);
if (in_array($status, ['pending', 'approved'], true)) {
$status = 'review';
} elseif ($status === 'reject') {
$status = 'rejected';
} elseif (in_array($status, ['canceled', 'cancelled'], true)) {
$status = 'cancel';
}
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
// Format Waktu Pengadaan sebagai range
if ($detail->pengadaan_started_at) {
$startPengadaan = \Illuminate\Support\Carbon::parse($detail->pengadaan_started_at)->format('d-m-Y');
if ($detail->pengadaan_ended_at) {
$endPengadaan = \Illuminate\Support\Carbon::parse($detail->pengadaan_ended_at)->format('d-m-Y');
$displayPengadaan = $startPengadaan . ' s/d ' . $endPengadaan;
} else {
$displayPengadaan = $startPengadaan . ' s/d -';
}
} else {
$displayPengadaan = '-';
}
// Format Waktu Pengerjaan sebagai range
if ($detail->pengerjaan_started_at) {
$startPengerjaan = \Illuminate\Support\Carbon::parse($detail->pengerjaan_started_at)->format('d-m-Y');
if ($detail->pengerjaan_ended_at) {
$endPengerjaan = \Illuminate\Support\Carbon::parse($detail->pengerjaan_ended_at)->format('d-m-Y');
$displayPengerjaan = $startPengerjaan . ' s/d ' . $endPengerjaan;
} else {
$displayPengerjaan = $startPengerjaan . ' s/d -';
}
} else {
$displayPengerjaan = '-';
}
@endphp
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
@if (($detail->request_status ?? '') !== 'pengadaan' && $detail->work_type === 'vendor')
{{ $detail->vendor_name ?? '-' }}
@elseif (($detail->request_status ?? '') !== 'pengadaan' && $detail->work_type === 'internal')
Petugas PU
@else
-
@endif
{{ $displayPengadaan }}
{{ $displayPengerjaan }}
@empty
@endforelse
@csrf
Status
- Pilih Status -
Pengadaan
Pengerjaan
Reject
Catatan HRD
@csrf
Status
- Pilih Status -
Pengadaan
Pengerjaan
Cancel
Catatan HRD
@push('js')
@endpush
@elseif ($dmenu == 'trdper')
Action
Tahun
Keterangan
@php
// Get all periodic headers from database
$periodicHeaders = \Illuminate\Support\Facades\DB::table('tr_periodic_header')
->where('is_active', '1')
->orderBy('tahun', 'desc')
->get();
@endphp
@forelse ($periodicHeaders as $header)
View
Toggle Dropdown
@if ($authorize->delete == '1')
@endif
{{ $header->tahun }}
{{ $header->keterangan ?? '-' }}
@empty
Data tidak ditemukan
@endforelse
@push('js')
@endpush
@elseif ($dmenu == 'trpetp')
@push('css')
@endpush
@php
// Use $user_login from controller (already passed to all views)
$currentUser = $user_login ?? auth()->user();
if (!$currentUser && session()->has('username')) {
$currentUser = \Illuminate\Support\Facades\DB::table('users')
->where('username', session('username'))
->first();
}
$currentUserId = $currentUser ? $currentUser->id : null;
$currentUserRoles = $currentUser ? (string) ($currentUser->idroles ?? '') : '';
$normalizedRoles = ',' . str_replace(' ', '', strtolower($currentUserRoles)) . ',';
$isPetugas = str_contains($normalizedRoles, ',ptgoff,') || str_contains($normalizedRoles, ',ptgspu,');
// Get all user IDs with the same role as current user for role-based filtering
$roleGroupUserIds = [];
if ($isPetugas && $currentUser) {
$currentUserRole = str_contains($normalizedRoles, ',ptgoff,') ? 'ptgoff' : 'ptgspu';
$roleGroupUserIds = \Illuminate\Support\Facades\DB::table('users')
->whereRaw("FIND_IN_SET(?, REPLACE(idroles, ' ', ''))", [$currentUserRole])
->where('isactive', '1')
->pluck('id')
->toArray();
}
// Get filter values from request, default periode = bulan_ini
$filterPeriode = request('periode', 'bulan_ini');
$filterArea = request('area', '');
// Calculate date range based on periode filter
$dateStart = null;
$dateEnd = null;
$today = \Illuminate\Support\Carbon::today();
switch ($filterPeriode) {
case 'hari_ini':
$dateStart = $today->format('Y-m-d');
$dateEnd = $today->format('Y-m-d');
break;
case 'minggu_ini':
$dateStart = $today->copy()->startOfWeek()->format('Y-m-d');
$dateEnd = $today->copy()->endOfWeek()->format('Y-m-d');
break;
case 'bulan_ini':
$dateStart = $today->copy()->startOfMonth()->format('Y-m-d');
$dateEnd = $today->copy()->endOfMonth()->format('Y-m-d');
break;
case 'semua':
default:
// No date filter
break;
}
// Get all areas for filter dropdown
$allAreas = \Illuminate\Support\Facades\DB::table('ms_area')
->where('is_active', '1')
->orderBy('nama_area', 'asc')
->get();
// Query periodic items with filters
$query = \Illuminate\Support\Facades\DB::table('tr_periodic_items')
->join('tr_periodic_detail', 'tr_periodic_items.detail_id', '=', 'tr_periodic_detail.id')
->join('ms_periodic', 'tr_periodic_detail.periodic_id', '=', 'ms_periodic.id')
->leftJoin('ms_area', 'tr_periodic_detail.area_id', '=', 'ms_area.id')
->leftJoin('users as worker', 'tr_periodic_detail.worker_id', '=', 'worker.id')
->select(
'tr_periodic_items.id as periodic_item_id',
'tr_periodic_items.planned_date',
'tr_periodic_items.realization_date',
'tr_periodic_items.is_finished',
'tr_periodic_items.created_at',
'ms_periodic.job_description',
'tr_periodic_detail.periode',
'tr_periodic_detail.area_id',
'ms_area.nama_area as area_name',
\Illuminate\Support\Facades\DB::raw("CONCAT(COALESCE(worker.firstname, ''), ' ', COALESCE(worker.lastname, '')) as worker_name")
)
->where('tr_periodic_items.is_active', '1')
->where('tr_periodic_detail.is_active', '1')
->whereNotNull('tr_periodic_items.planned_date')
->orderBy('tr_periodic_items.planned_date', 'asc')
->orderBy('tr_periodic_items.id', 'asc');
// Apply role-based filter for petugas
if ($isPetugas && !empty($roleGroupUserIds)) {
$query->whereIn('tr_periodic_detail.worker_id', $roleGroupUserIds);
}
// Apply date filter
if ($dateStart && $dateEnd) {
$query->whereBetween('tr_periodic_items.planned_date', [$dateStart, $dateEnd]);
}
// Apply area filter
if ($filterArea) {
$query->where('tr_periodic_detail.area_id', $filterArea);
}
// Batas max input tanggal realisasi: akhir bulan saat ini
$periodicRealizationMaxDate = \Illuminate\Support\Carbon::today()->endOfMonth()->format('Y-m-d');
$periodicRealizationOldestDate = \Illuminate\Support\Carbon::today()->startOfMonth()->format('Y-m-d');
$totalItems = (clone $query)->count();
$periodicItems = $query->get();
@endphp
Pekerjaan Periodic
Daftar pekerjaan periodic berdasarkan tanggal rencana dari HRD.
@if (session('message'))
{{ session('class') === 'danger' ? 'Gagal!' : 'Berhasil!' }} {{ session('message') }}
×
@endif
@if ($errors->any())
Gagal!
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
×
@endif
{{-- Filter Section --}}
Periode
Hari Ini
Minggu Ini
Bulan Ini
Semua
Area
Semua Area
@foreach ($allAreas as $area)
id ? 'selected' : '' }}>
{{ $area->nama_area }}
@endforeach
@if ($totalItems > 0)
Menampilkan {{ $periodicItems->count() }} dari {{ $totalItems }} pekerjaan
@endif
Aksi
Periode
Area
Deskripsi
Rencana
Realisasi
@forelse ($periodicItems as $detail)
@php
$plannedDateValue = $detail->planned_date ? \Illuminate\Support\Carbon::parse($detail->planned_date)->startOfDay() : null;
// Enable tombol: planned_date harus dalam bulan yang sama atau sebelum bulan ini
$todayMonthKey = \Illuminate\Support\Carbon::today()->format('Y-m');
$plannedMonthKey = $plannedDateValue ? $plannedDateValue->format('Y-m') : null;
$canInputRealization = $plannedDateValue && $plannedMonthKey <= $todayMonthKey;
// Min date untuk input: awal bulan dari planned_date
$minRealizationDate=$plannedDateValue
? $plannedDateValue->copy()->startOfMonth()->format('Y-m-d')
: $periodicRealizationOldestDate;
// Max date untuk input: akhir bulan dari planned_date
$maxRealizationDateForItem = $plannedDateValue
? $plannedDateValue->copy()->endOfMonth()->format('Y-m-d')
: $periodicRealizationMaxDate;
// Decode realization_date JSON jika ada
$realizationDates = [];
if (!empty($detail->realization_date)) {
$decoded = json_decode($detail->realization_date, true);
if (is_array($decoded)) {
$realizationDates = $decoded;
} else {
// Legacy: single date string
$realizationDates = [$detail->realization_date];
}
}
$hasRealization = !empty($realizationDates);
$documentations = \Illuminate\Support\Facades\DB::table('tr_documentation')
->where('periodic_item_id', $detail->periodic_item_id)
->where('is_active', '1')
->select('id', 'file')
->get()
->toArray();
@endphp
@if ($detail->is_finished == '1')
{{-- Sudah final selesai --}}
Selesai
@elseif ($hasRealization)
{{-- Sudah ada realisasi, tampilkan Update + Tandai Selesai --}}
Update Realisasi
@csrf
Tandai Selesai
@elseif ($canInputRealization)
{{-- Belum ada realisasi, bisa input --}}
Input Realisasi
@else
{{-- Belum waktunya --}}
Input Realisasi
@endif
{{ ucfirst($detail->periode ?? '-') }}
@if (strtolower($detail->periode ?? '') === 'mingguan' && $detail->planned_date)
(Ke-{{ ceil(\Illuminate\Support\Carbon::parse($detail->planned_date)->day / 7) }})
@endif
{{ $detail->area_name ?? '-' }}
{{ $detail->job_description ?? '-' }}
{{ $detail->planned_date ? \Illuminate\Support\Carbon::parse($detail->planned_date)->format('d-m-Y') : '-' }}
@if (!empty($realizationDates))
@foreach ($realizationDates as $rDate)
{{ \Illuminate\Support\Carbon::parse($rDate)->format('d-m-Y') }}
@endforeach
@else
-
@endif
@empty
@endforelse
@push('js')
@endpush
@elseif ($dmenu == 'trpetn')
@push('css')
@endpush
@php
// Use $user_login from controller (already passed to all views)
$currentUser = $user_login ?? auth()->user();
if (!$currentUser && session()->has('username')) {
$currentUser = \Illuminate\Support\Facades\DB::table('users')
->where('username', session('username'))
->first();
}
$currentUserId = $currentUser ? $currentUser->id : null;
$currentUserRoles = $currentUser ? (string) ($currentUser->idroles ?? '') : '';
$normalizedRoles = ',' . str_replace(' ', '', strtolower($currentUserRoles)) . ',';
$isPetugasOffice = str_contains($normalizedRoles, ',ptgoff,');
$isPetugasPU = str_contains($normalizedRoles, ',ptgspu,');
// Get all user IDs with ptgoff role for Office filtering
$officeRoleUserIds = [];
if ($isPetugasOffice) {
$officeRoleUserIds = \Illuminate\Support\Facades\DB::table('users')
->whereRaw("FIND_IN_SET('ptgoff', REPLACE(idroles, ' ', ''))")
->where('isactive', '1')
->pluck('id')
->toArray();
}
$nonPeriodicItems = \Illuminate\Support\Facades\DB::table('tr_non_periodic')
->leftJoin('ms_area', 'tr_non_periodic.area_id', '=', 'ms_area.id')
->select(
'tr_non_periodic.id',
'tr_non_periodic.request_status',
'tr_non_periodic.job_description',
'tr_non_periodic.work_type',
'tr_non_periodic.*',
'ms_area.nama_area as area_name'
)
->whereIn('tr_non_periodic.request_status', ['pengadaan', 'pengerjaan', 'revisi'])
->where('tr_non_periodic.is_active', '1');
// Apply role-based filter: Petugas Office only sees assigned tasks, Petugas PU sees all
if ($isPetugasOffice && !empty($officeRoleUserIds)) {
$nonPeriodicItems->whereIn('tr_non_periodic.worker_id', $officeRoleUserIds);
}
$nonPeriodicItems = $nonPeriodicItems->orderBy('tr_non_periodic.created_at', 'desc')->get();
// Parse attachment files from each item
$nonPeriodicItems = $nonPeriodicItems->map(function ($item) {
$attachments = [];
if (!empty($item->attachment)) {
$rawAttachment = $item->attachment;
// Try JSON decode first
$decoded = json_decode($rawAttachment, true);
if (is_array($decoded)) {
$attachments = $decoded;
} else {
// Fallback: treat as comma-separated or single path
$parts = array_map('trim', explode(',', $rawAttachment));
$attachments = array_filter($parts);
}
}
$revisionAttachments = [];
if (!empty($item->revision_attachment)) {
$rawRevisionAttachment = $item->revision_attachment;
$decodedRevision = json_decode($rawRevisionAttachment, true);
if (is_array($decodedRevision)) {
$revisionAttachments = $decodedRevision;
} else {
$partsRevision = array_map('trim', explode(',', $rawRevisionAttachment));
$revisionAttachments = array_filter($partsRevision);
}
}
$item->attachments = array_values($attachments);
$item->revision_attachments = array_values($revisionAttachments);
return $item;
});
$getPelaksanaLabel = function ($item) {
$workType = strtolower(trim((string) ($item->work_type ?? '')));
if ($workType === 'internal') {
return 'Internal';
}
if ($workType === 'vendor') {
return 'Vendor';
}
return '-';
};
$getPelaksanaClass = function ($item) {
$workType = strtolower(trim((string) ($item->work_type ?? '')));
if ($workType === 'internal') {
return 'background-color:#1d4ed8;color:#ffffff;';
}
if ($workType === 'vendor') {
return 'background-color:#f59e0b;color:#ffffff;';
}
return 'background-color:#6b7280;color:#ffffff;';
};
@endphp
Pekerjaan Non-Periodic
Daftar pekerjaan non-periodic untuk petugas.
@include('components.alert')
Aksi
No
ID Trans
Tanggal Pengajuan
Area
Deskripsi
Pelaksana
Status
Catatan Revisi
@forelse ($nonPeriodicItems as $detail)
@php
$rawStatus = $detail->request_status ?? '';
$status = strtolower($rawStatus);
if (in_array($status, ['approved'], true)) {
$status = 'review';
} elseif ($status === 'reject') {
$status = 'rejected';
} elseif (in_array($status, ['canceled', 'cancelled'], true)) {
$status = 'cancel';
}
$dateValue = $detail->created_at ?? $detail->tanggal ?? $detail->date ?? null;
$displayDate = $dateValue
? \Illuminate\Support\Carbon::parse($dateValue)->format('d-m-Y')
: '-';
@endphp
Detail
@if ($status !== 'pengadaan')
Selesai
@else
Selesai
@endif
{{ $loop->iteration }}
{{ $detail->id_trans ?: '-' }}
{{ $displayDate }}
{{ $detail->area_name ?? $detail->area ?? $detail->area_id ?? '-' }}
{{ $detail->job_description ?? $detail->description ?? '-' }}
{{ $getPelaksanaLabel($detail) }}
@php
$statusNormalized = strtolower(trim($status ?? ''));
$badgeClass = 'status-badge status-' . ($statusNormalized ?: 'pending');
$statusLabel = $statusNormalized ? ucfirst($statusNormalized) : 'Pending';
@endphp
{{ $statusLabel }}
@php
$requesterNote = data_get($detail, 'requester_note');
@endphp
@if($status === 'revisi' && !empty($requesterNote))
{{ $requesterNote }}
@else
-
@endif
@empty
@endforelse
@push('js')
@endpush
@elseif ($dmenu == 'trpetd')
@php
// Use $user_login from controller (already passed to all views)
$currentUser = $user_login ?? auth()->user();
if (!$currentUser && session()->has('username')) {
$currentUser = \Illuminate\Support\Facades\DB::table('users')
->where('username', session('username'))
->first();
}
$currentUserId = $currentUser ? $currentUser->id : null;
$today = \Illuminate\Support\Carbon::today()->toDateString();
$isDailyInputClosed = now()->greaterThanOrEqualTo(\Illuminate\Support\Carbon::today()->setTime(19, 0));
$todayCompletedCount = 0;
$totalTodayCount = 0;
// Get current user role for assigned_role based filtering
$assignedRoleFilter = null;
if ($currentUser) {
$normalizedRoles = array_values(array_filter(explode(',', str_replace(' ', '', strtolower((string) ($currentUser->idroles ?? ''))))));
foreach ($normalizedRoles as $roleCode) {
if (str_starts_with($roleCode, 'ptg')) {
$assignedRoleFilter = $roleCode;
break;
}
}
}
$dailyTasksQuery = \Illuminate\Support\Facades\DB::table('ms_daily')
->where('is_active', '1');
// Apply role-based filter using assigned_role column
if ($assignedRoleFilter) {
$dailyTasksQuery->where('assigned_role', $assignedRoleFilter);
}
$dailyTasks = $dailyTasksQuery->orderBy('id')->get();
$taskIds = $dailyTasks->pluck('id');
// Always load today's logs for the visible tasks so we can detect completed items
$todayLogs = collect();
if ($taskIds->isNotEmpty()) {
$todayLogs = \Illuminate\Support\Facades\DB::table('rp_daily_log')
->where('work_date', $today)
->whereIn('daily_task_id', $taskIds)
->get()
->keyBy('daily_task_id');
}
$todayCompletedCount = $todayLogs->filter(function ($log) {
return strtolower($log->job_status ?? '') === 'completed';
})->count();
$totalTodayCount = $dailyTasks->count();
$progressPercent = $totalTodayCount > 0 ? round(($todayCompletedCount / $totalTodayCount) * 100) : 0;
@endphp
Pekerjaan Daily
Checklist harian petugas.
{{ $todayCompletedCount }}/{{ $totalTodayCount }}
Selesai
@if (session('message'))
{{ session('class') === 'danger' ? 'Gagal!' : 'Berhasil!' }}
{{ session('message') }}
@endif
@csrf
Progress Hari Ini
{{ $todayCompletedCount }}/{{ $totalTodayCount }}
Selesai
@if ($isDailyInputClosed)
Checklist hari ini sudah ditutup pada jam 19:00. Pekerjaan yang belum dicentang dianggap tidak dikerjakan.
@endif
@forelse ($dailyTasks as $task)
@php
$log = $todayLogs->get($task->id);
$isCompleted = $log && strtolower($log->job_status ?? '') === 'completed';
@endphp
@if (! $isCompleted)
{{ $task->job_description }}
Status: pending
Selesai
@endif
@empty
Belum ada daily checklist.
@endforelse
@if (false)
@foreach ($backlogEntries as $entry)
@php
$entryDateLabel = \Illuminate\Support\Carbon::parse($entry->work_date)->format('d M');
$statusLabel = $entry->status_label ?? 'pending';
@endphp
{{ $entry->job_description }}
Tanggal: {{ $entryDateLabel }} · Status: {{ $statusLabel }}
@endforeach
@endif
@if ($dailyTasks->isNotEmpty() && ! $isDailyInputClosed)
Simpan Checklist
@endif
{{-- Modal Update Late Completion --}}
@push('js')
@endpush
@elseif ($dmenu == 'trhdly')
@push('css')
@endpush
@php
$today = $today ?? \Illuminate\Support\Carbon::today()->toDateString();
$tasks = $tasks ?? collect();
$todayLogs = $todayLogs ?? collect();
$lastCompleted = $lastCompleted ?? collect();
$historyLogs = $historyLogs ?? collect();
$historyDays = $historyDays ?? collect();
$totalTodayCount = $tasks->count();
$todayCompletedCount = $todayLogs->filter(function ($log) {
return strtolower($log->job_status ?? '') === 'completed';
})->count();
$progressPercent = $totalTodayCount > 0 ? round(($todayCompletedCount / $totalTodayCount) * 100) : 0;
$historyCompletedCount = $historyDays->sum('completed_count');
$historyNotCompletedCount = $historyDays->sum('not_completed_count');
@endphp
{{-- Filter Petugas --}}
Petugas
-- Semua Petugas --
Petugas Office
Petugas PU
Filter
Reset
Progress Hari Ini
{{ $todayCompletedCount }}/{{ $totalTodayCount }} selesai
{{ \Illuminate\Support\Carbon::parse($today)->format('d-m-Y') }}
{{ $progressPercent }}%
Deskripsi
Petugas
Status Hari Ini
Terakhir Selesai
@forelse ($tasks as $task)
@php
$log = $todayLogs->get($task->id);
$isCompleted = $log && strtolower($log->job_status ?? '') === 'completed';
$last = data_get($lastCompleted->get($task->id), 'last_done');
// Prefer showing an employee full name for the role if available
$assignedRoleCode = strtolower(trim((string) ($task->assigned_role ?? '')));
$roleLabelFallback = [
'ptgoff' => 'Petugas Office',
'ptgspu' => 'Petugas PU',
];
$petugasName = $roleUserMap[$assignedRoleCode] ?? ($roleLabelFallback[$assignedRoleCode] ?? ($task->assigned_role ?? '-'));
@endphp
{{ $task->job_description }}
{{ $petugasName }}
{{ $isCompleted ? 'Selesai' : 'Tidak Selesai' }}
{{ $last ? \Illuminate\Support\Carbon::parse($last)->format('d-m-Y H:i:s') : '-' }}
@empty
@endforelse
Riwayat Pekerjaan Daily
Riwayat pekerjaan daily 7 hari terakhir sampai hari sebelumnya
{{ $historyCompletedCount }} Selesai
{{ $historyNotCompletedCount }} Tidak Selesai
{{-- Filter Section --}}
@forelse ($historyDays as $day)
Deskripsi
Petugas
Status
@forelse ($day->items as $history)
@php
$assignedRoleCode = strtolower(trim((string) ($history->assigned_role ?? '')));
$roleLabelFallback = [
'ptgoff' => 'Petugas Office',
'ptgspu' => 'Petugas PU',
];
$petugasName = $roleUserMap[$assignedRoleCode] ?? ($roleLabelFallback[$assignedRoleCode] ?? ($history->assigned_role ?? '-'));
$isHistoryCompleted = $history->status === 'completed';
@endphp
{{ $history->job_description }}
{{ $petugasName }}
{{ $isHistoryCompleted ? 'Selesai' : 'Tidak Selesai' }}
@empty
Tidak ada tugas daily.
@endforelse
@empty
Belum ada riwayat pekerjaan.
@endforelse
@else
@if ($dmenu != 'trhis')
{{-- alert --}}
@include('components.alert')
Action
{{-- retrieve table header --}}
@foreach ($table_header_d as $header_d)
{{ $header_d->alias }}
@endforeach
{{-- retrieve table detail --}}
@foreach ($table_detail_d as $detail)
@php
$primary = '';
foreach ($table_primary_h as $h) {
$primary == ''
? ($primary = $detail->{$h->field})
: ($primary = $primary . ':' . $detail->{$h->field});
}
foreach ($table_primary_d as $p) {
$primary == ''
? ($primary = $detail->{$p->field})
: ($primary = $primary . ':' . $detail->{$p->field});
}
@endphp
isactive ?? $detail->is_active ?? '1') == '0' ? 'style=background-color:#ffe9ed;' : '' }}>
{{-- check authorize edit --}}
@if ($authorize->edit == '1')
{{-- button edit --}}
@endif
{{-- check authorize delete --}}
@if ($authorize->delete == '1')
@csrf
@method('DELETE')
{{-- button delete --}}
@endif
{{-- retrieve table detail --}}
@foreach ($table_header_d as $field)
@php
$string = $field->field;
@endphp
{{-- field type enum --}}
@if ($field->type == 'enum')
@if ($field->query != '')
@php
$data_query = DB::select($field->query);
@endphp
@foreach ($data_query as $q)
Warning : Undefined variable $q in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5130
{{ $detail->$string == $sAsArray[0] ? $sAsArray[1] : '' }}
@endforeach
@endif
{{-- field type file --}}
@elseif ($field->type == 'file')
@if ($detail->$string)
{{ $field->alias }}
@endif
{{-- field type image --}}
@elseif($field->type == 'image')
{{ asset('/storage' . '/' . $detail->$string) }}
{{-- field type join --}}
@elseif($field->type == 'join')
@if ($field->query != '')
@php
$query =
$field->query . "'" . $detail->$string . "'";
$data_query = DB::select($query);
@endphp
@foreach ($data_query as $q)
Warning : Undefined variable $q in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5199
@if ($field->default != 'image')
{{ $sAsArray[0] != '' ? $sAsArray[0] : '' }}
@else
{{ asset('/storage' . '/' . $sAsArray[0]) }}
@endif
@endforeach
@endif
{{-- field type currency --}}
@elseif ($field->type == 'currency')
{{ $format->CurrencyFormat($detail->$string, $field->decimals, $field->sub) }}
@else
{{ $detail->$string }}
@endif
@endforeach
@endforeach
@endif
@endif
{{-- check flag js on dmenu --}}
@if ($jsmenu == '1')
@if (view()->exists("js.{$dmenu}"))
@push('addjs')
{{-- file js in folder (resources/views/js) --}}
@include('js.' . $dmenu);
@endpush
@else
@push('addjs')
@endpush
@endif
@endif
@endsection
@push('js')
@endif
@endpush
{
extend: 'print',
text: ' Print',
exportOptions: {
columns: ':visible:not(:last-child)'
},
},
]
}).draw();
//set color button datatables
$('.dt-button').addClass('btn btn-secondary');
$('.dt-button').removeClass('dt-button');
//setting button add
var btnadd = $('.btn-add').parents('.btn-secondary');
btnadd.removeClass('btn-secondary');
btnadd.addClass('btn btn-primary');
btnadd.attr('onclick', "window.location='{{ URL::to($url_menu . '/add/') }}" + "/" +
id +
"'");
//check authorize button datatables
Warning : Undefined variable $authorize in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5643
Warning : Attempt to read property "add" on null in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5643
Warning : Undefined variable $authorize in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5644
Warning : Attempt to read property "excel" on null in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5644
Warning : Undefined variable $authorize in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5645
Warning : Attempt to read property "pdf" on null in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5645
Warning : Undefined variable $authorize in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5646
Warning : Attempt to read property "print" on null in /opt/lampp/htdocs/tsipu/resources/views/transc/auto/list.blade.php on line 5646
},
error: function(jqXHR, textStatus, errorThrown) {
Swal.fire({
title: 'Sorry!',
text: 'Error Get data!',
icon: 'error',
confirmButtonColor: '#3085d6'
});
}
});
}
//function delete
function deleteData(event, name, msg) {
event.preventDefault(); // Prevent default form submission
Swal.fire({
title: 'Konfirmasi',
text: `Apakah Anda Yakin ${msg} Data ${name} ini?`,
icon: 'warning',
showCancelButton: true,
confirmButtonText: `Ya, ${msg}`,
cancelButtonText: 'Batal',
confirmButtonColor: '#028284'
}).then((result) => {
if (result.isConfirmed) {
// Find the closest form element and submit it manually
event.target.closest('form').submit();
}
});
}
// function currency
function currencyFormat(nominal, decimal = 0, prefix = 'Rp.') {
return prefix + ' ' + parseFloat(nominal).toFixed(decimal).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
@endpush