@php $breadcrumbs = [ 'Workflow Manage' => url('/workflow_manage'), 'Documents Pending' => url('/workflow_pending'), 'Workflow Pending' => '', ]; @endphp @extends('layouts.master') @section('title', 'Workflow Pending') @section('style') @endsection @section('script') @endsection @section('content') {{-- @include('layouts.header') --}} {{--

@yield('title')

--}} {{-- @include('layouts.title') --}}
{{--

CCCCCCC

--}}
@yield('title')

{{--  History --}} {{--  Add Student --}}

{{-- --}} @foreach ($workflow_approve_item as $i => $item) @php $workflow_approve = DB::table('workflow_approve')->where('workflow_approve_item',$item->workflow_approve_item)->get(); @endphp {{-- @php $name_type = ''; if($item->workflow_approve_type == '1'){ $name_type = 'loan'; }else{ $name_type = 'scholarship'; } @endphp --}} @endforeach
No. Project Name Quotation No.TypeWorkflow Name Roles Status Detail Manage
{{ ++$i }} {{ $item->quotation_project_name }} {{-- {{ $item->student_name }} --}} {{ $item->quotation_no }} {{ $item->workflow_approve_name_flow }} @foreach($workflow_approve as $wf) {{-- --}} {{ $wf->workflow_approve_who }}
@endforeach
@foreach($workflow_approve as $wf) @if( $wf->workflow_approve_status == 'pending') Pending
@elseif( $wf->workflow_approve_status == 'approved') Approved
@elseif( $wf->workflow_approve_status == 'rejected') Rejected
@elseif( $wf->workflow_approve_status == 'skip') Skip
@endif @endforeach
@php // 1. ดึงข้อมูล User ที่ Login อยู่ (user_id: 1) และ Roles ที่เขามี $currentUser = Auth::user(); $myMeta = DB::table('user_meta')->where('user_userid', $currentUser->id)->first(); // แยก roles ออกมาเป็น array (เช่น [1, 2]) จาก string "1///2" $myRoles = $myMeta ? explode('///', $myMeta->user_role) : []; // 2. หา Step ที่กำลังรออนุมัติ (Pending) ลำดับแรกสุดของ Workflow นี้ $currentPendingStep = DB::table('workflow_approve') ->where('workflow_approve_item', $item->workflow_approve_item) ->where('workflow_approve_status', 'pending') ->orderBy('workflow_approve_order', 'asc') ->first(); // echo $item->workflow_approve_item; @endphp {{-- @if($currentPendingStep && in_array($currentPendingStep->workflow_approve_who_id, $myRoles)) --}} @if($currentPendingStep && (in_array($currentPendingStep->workflow_approve_who_id, $myRoles) || $currentPendingStep->workflow_approve_who === 'Customer')) @endif {{-- @if($workflow_approve_who->pluck('workflow_approve_who_id')->first() == $user_role->pluck('id')->first()) @else @endif --}}
{{-- @include('layouts.footer') --}} @endsection