| @php $hasSelectable = false; if (!empty($lists)) { foreach ($lists as $l) { $text_status = trim(strip_tags($l['status'])); // ถ้าใน status summary/render แล้วมีคำว่า "รออนุมัติ" ให้ถือว่ามี checkbox if ( (is_string($l['status']) && $text_status == 'รออนุมัติ') || (is_array($l['status_all'] ?? []) && collect($l['status_all'])->contains(function ($val) { return is_string($val) && $text_status == 'รออนุมัติ'; })) ) { $hasSelectable = true; break; } } } @endphp @if ($hasSelectable) @else - @endif | พนักงาน / แผนก | วันที่ | สรุปรายการ | สถานะ | การจัดการ | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @if (!in_array($status[0], $list['status_all'] ?? [])) - @else @if ($text == 'รออนุมัติ') - @else @endif @endif |
{{ $list['name'] ?? '' }}
{{ $list['department'] ?? '' }}
|
{{ $list['submission_date'] ?? '' }} |
{{ count($list['request_list']) ?? '' }} รายการ
รวม
{{ array_sum(array_column($list['request_list'], 'distance_km')) ?? '' }} กม.
|
{!! $list['status'] ?? '' !!} |
@php
$isFirstApprover = isset($member) && !empty($list['member_dt']->approve_by_first_id) && $list['member_dt']->approve_by_first_id == $member->id;
$isSecondApprover = isset($member) && !empty($list['member_dt']->approve_by_second_id) && $list['member_dt']->approve_by_second_id == $member->id;
$hasSecondApprover = !empty($list['member_dt']->approve_by_second_id);
$minStatus = !empty($list['status_all']) ? min($list['status_all']) : 0;
// ผู้อนุมัติที่ 1 อนุมัติแล้ว (status = 3) และมีผู้อนุมัติที่ 2 -> ซ่อนปุ่ม
$hideButtonsForFirstApprover = $isFirstApprover && $hasSecondApprover && $minStatus == 3;
// ผู้อนุมัติที่ 2 ต้องรอผู้อนุมัติที่ 1 ก่อน (status = 2) -> ซ่อนปุ่ม
$hideButtonsForSecondApprover = $isSecondApprover && $minStatus == 2;
$hideButtons = $hideButtonsForFirstApprover || $hideButtonsForSecondApprover;
@endphp
@if (!$hideButtons && (in_array($check_status, $list['status_all'] ?? []) || in_array(3, $list['status_all'] ?? []) || in_array(2, $list['status_all'] ?? [])))
@else
@if ($text == 'รออนุมัติ' )
รอผู้อนุมัติลำดับที่ 1
@endif
@endif
|
||||||||||||||||
|
|||||||||||||||||||||
{{-- เงื่อนไข: ถ้าไม่มีการเลือก checkbox เลย (เลือกได้อย่างน้อย 1 รายการเท่านั้น) --}} {{-- @if (isset($no_checkbox_selected) && $no_checkbox_selected) กรุณาเลือกอย่างน้อย 1 รายการ66 @else --}} @if (in_array($confirm_action_type, ['reject', 'reject_selected']))