@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
List {{ $title_menu }}
{{-- alert --}} @include('components.alert')

@if($dmenu) {{-- Checkbox Column --}} {{-- Action Column First --}} {{-- Vendor Information --}} {{-- Contact Persons --}} {{-- Directors --}} {{-- Bank Accounts --}} {{-- Quality Environment --}} {{-- Agreement Document --}} {{-- Note --}} {{-- Status & Approver --}} @if(auth()->user()->idroles == 'msjits') @endif @else {{-- For other menus, use default header --}} @foreach ($table_header as $header) @endforeach @endif @php $recentUpdateLogs = (auth()->user()->idroles == 'msjits') ? DB::table('rp_vendor_log as r') ->leftJoin('users as u', 'r.username', '=', 'u.username') ->where('r.action', 'Update') ->orderBy('r.id', 'desc') ->limit(50) ->select('r.old_code_vendor', 'r.sap_code_vendor', 'r.name', 'r.username', 'r.created_at', 'u.firstname') ->get() : collect(); @endphp {{-- retrieve table detail --}} @foreach ($table_detail as $detail) @php $primary = ''; foreach ($table_primary as $p) { $primary == '' ? ($primary = $detail->{$p->field}) : ($primary = $primary . ':' . $detail->{$p->field}); } // For trvndr, use id directly since it has no sys_table primary key mapping if($dmenu) { $primary = $detail->id; } $vcount = $loop->iteration; // Get related data for trvndr if($dmenu) { $contacts = DB::table('tr_contact_person')->where('vendor_id', $detail->id)->get(); $directors = DB::table('tr_director')->where('vendor_id', $detail->id)->get(); $banks = DB::table('tr_bank')->where('vendor_id', $detail->id)->get(); $qualityEnvs = DB::table('tr_vendor_quality_environment')->where('vendor_id', $detail->id)->get(); $rejected_by = DB::table('users')->where('username', $detail->rejected_by)->first(); $approver = DB::table('users')->where('username', $detail->approver)->first(); } @endphp @if($dmenu) {{-- Checkbox per row --}} {{-- Action Dropdown Column First --}} {{-- Vendor Information --}} {{-- Contact Persons --}} {{-- Directors --}} {{-- Bank Accounts --}} {{-- Quality Environment --}} {{-- Agreement Document --}} {{-- Note --}} {{-- Status --}} {{-- SAP Status --}} {{-- User Pengaju & Waktu Pengajuan (role msjits) --}} @if(auth()->user()->idroles == 'msjits') @php $matchedLog = $recentUpdateLogs->first(function($log) use ($detail) { if (!empty($detail->old_code_vendor) && $log->old_code_vendor === $detail->old_code_vendor) return true; if (!empty($detail->sap_code_vendor) && $log->sap_code_vendor === $detail->sap_code_vendor) return true; if (!empty($detail->name) && $log->name === $detail->name) return true; return false; }); $pengajuUpdate = $matchedLog ? ($matchedLog->firstname ?: $matchedLog->username) : '-'; $waktuUpdate = ($matchedLog && !empty($matchedLog->created_at)) ? \Carbon\Carbon::parse($matchedLog->created_at)->format('d/m/Y H:i') : '-'; @endphp @endif @else {{-- For other menus, use default foreach --}} @foreach ($table_header as $field) @php $string = $field->field; @endphp {{-- Keep existing logic for other menus --}} @if ($field->type == 'enum') @elseif ($field->type == 'file') @else @endif @endforeach @endif @endforeach
Action No SAP Code VendorCorporation Vendor Name Address 1 Address 2 Address 3 CityContact PersonsNoteStatus Status UploadUser Pengaju Waktu PengajuanNo{{ $header->alias }}
@php $isCheckable = in_array($detail->id, $sapCheckVendorIds ?? []); @endphp @php $isProcessed = in_array($detail->id, $processedVendorIds ?? []) || (!empty($detail->sap_code_vendor) && in_array($detail->sap_code_vendor, $processedVendorCodes ?? [])); @endphp @if($isProcessed) @else
@csrf
@endif
{{ $table_detail->firstItem() + $loop->index }} {{ $detail->sap_code_vendor ?? '-' }}{{ $detail->corp }} {{ $detail->name }} {{ $detail->office_address1 }} {{ $detail->office_address2 ?? '-' }} {{ $detail->office_address3 ?? '-' }} {{ $detail->city_name ?? '-' }} @if($contacts->count() > 0) @else No Data @endif {{ $detail->note }} @if($detail->status == 'Pending') Pending @elseif($detail->status == 'Proposed') Proposed @elseif($detail->status == 'Approved') Approved @elseif($detail->status == 'Rejected') Rejected @elseif($detail->status == 'Finish') Finish @endif @if($detail->sap_status == 'Belum Upload') Belum Upload @elseif($detail->sap_status == 'Proses') Proses @elseif($detail->sap_status == 'Sudah Upload') Sudah Upload @elseif($detail->sap_status == 'Update PPN') Update PPN @elseif($detail->sap_status == 'Update') Update @endif {{ $pengajuUpdate }} {{ $waktuUpdate }}{{ $table_detail->firstItem() + $loop->index }} {{-- Existing enum logic --}} {{-- Existing file logic --}} {{ $detail->$string }}
Data {{ $table_detail->firstItem() }} - {{ $table_detail->lastItem() }} dari {{ $table_detail->total() }} data.
{{ $table_detail->appends(request()->query())->links('pagination::bootstrap-4') }}
{{-- Modal Cek SAP --}} {{-- 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') @endpush