@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 == 'trapvn') {{-- Checkbox Column --}} {{-- Action Column First --}} {{-- Vendor Information --}} {{-- Contact Persons --}} {{-- Status & Approver --}} @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 trapvn, use id directly since it has no sys_table primary key mapping if($dmenu == 'trapvn') { $primary = $detail->id; } $vcount = $loop->iteration; // Get related data for trapvn if($dmenu == 'trapvn') { $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(); $approver = DB::table('users')->where('username', $detail->approver)->first(); } // Tentukan warna background row $rowStyle = ''; $rowClass = ''; if ($detail->isactive == '0') { $rowClass = 'not'; } elseif ($dmenu == 'trapvn' && isset($approver_colors[$detail->approver]) && count($approver_colors) > 1) { // Buat class name dari index approver $approverIndex = array_search($detail->approver, array_keys($approver_colors)); $rowClass = 'approver-color-' . $approverIndex; } @endphp @if($dmenu == 'trapvn') {{-- Checkbox Column --}} {{-- Action Dropdown Column First --}} {{-- Vendor Information --}} {{-- Contact Persons --}} {{-- Status --}} {{-- Approver --}} @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 NoCorporation Vendor Name Address 1 Address 2 Address 3 CityContact PersonsStatus ApproverNo{{ $header->alias }}
{{ $table_detail->firstItem() + $loop->index }} {{ $detail->corp }} @if($detail->corp == 'Lainnya' && $detail->other_corporation)
({{ $detail->other_corporation }}) @endif
{{ $detail->name }} {{ $detail->office_address1 ?? '-' }} {{ $detail->office_address2 ?? '-' }} {{ $detail->office_address3 ?? '-' }} {{ $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 {{ $approver->firstname ?? '-' }}{{ $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') }}
{{-- 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 (trapvn) ===== --}} {{-- Hidden form untuk mass action trapvn --}}
@csrf
@endsection @push('js') @endpush