@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')

@php $showSapColumn = $table_detail->contains(function($item) { return in_array($item->sap_status, ['Update PPN']); }); @endphp @if($dmenu) {{-- Checkbox Column --}} @if(auth()->user()->idroles != 'msjits') @endif {{-- Action Column First --}} @if($showSapColumn) @endif {{-- Vendor Information --}} {{-- Note --}} {{-- Contact Persons --}} {{-- Directors --}} {{-- Bank Accounts --}} {{-- Quality Environment --}} {{-- Agreement Document --}} {{-- Status & Approver --}} @if(auth()->user()->idroles == 'msjits') @endif @else {{-- For other menus, use default header --}} @foreach ($table_header as $header) @endforeach @endif {{-- 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(); } $canDelete = !( in_array($detail->status, ['Proposed', 'Approved']) && in_array($detail->sap_status, ['Belum Upload', 'Proses', 'Update PPN', 'Update']) ); $isCheckable = ($detail->status != 'Proposed') && ($detail->status == 'Pending' || $canDelete); @endphp @if($dmenu) {{-- Checkbox Column --}} @if(auth()->user()->idroles != 'msjits') @endif {{-- Action Dropdown Column First --}} @if($showSapColumn) @endif {{-- Vendor Information --}} {{-- Note --}} {{-- Contact Persons --}} {{-- Directors --}} {{-- Bank Accounts --}} {{-- Quality Environment --}} {{-- Agreement Document --}} {{-- Status --}} {{-- SAP Status --}} {{-- User Pengaju & Waktu Pengajuan (role msjits) --}} @if(auth()->user()->idroles == 'msjits') @php $pengajuFirstname = !empty($detail->proposed_by) ? DB::table('users')->where('username', $detail->proposed_by)->value('firstname') : null; $waktuPengajuan = !empty($detail->approved_at) ? \Carbon\Carbon::parse($detail->approved_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 NoSAP Code VendorCorporation Vendor NameNote Address 1 CityContact PersonsStatus Status UploadUser Pengaju Waktu PengajuanNo{{ $header->alias }}
{{ $table_detail->firstItem() + $loop->index }}{{ $detail->sap_code_vendor ?? '-' }}{{ $detail->corp }} {{ $detail->name }}{{ $detail->note }} {{ $detail->office_address1 }} {{ $detail->city_name ?? '-' }} @if($contacts->count() > 0) @else No Data @endif @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 {{ $pengajuFirstname ?: ($detail->proposed_by ?: '-') }} {{ $waktuPengajuan }}{{ $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 {{-- ===== MASS ACTION MODAL (trvndr) ===== --}} {{-- Hidden form untuk mass action trvndr --}}
@csrf
@endsection @push('js') @endpush