@extends('Admin.layout') @section('content') {{-- Select2 CSS --}} {{-- Inlined styling for exact dark theme & gold accent matching your UI screenshot --}} @php // Helper function to render person options and pre-select User, Staff, or Custom text correctly function renderPersonOptions($staffs, $users, $selectedId, $selectedRole) { $selectedVal = ''; $isCustom = false; if ($selectedId !== null && $selectedId !== '') { $roleLower = strtolower($selectedRole ?? ''); $found = false; if ($roleLower === 'user' || $roleLower === 'admin') { foreach ($users as $user) { if ($user->id == $selectedId) { $selectedVal = 'user:' . $user->id; $found = true; break; } } } elseif ($roleLower === 'staff' || $roleLower === '') { foreach ($staffs as $staff) { if ($staff->id == $selectedId) { $selectedVal = 'staff:' . $staff->id; $found = true; break; } } } if (!$found) { if ($roleLower === 'other' || $roleLower === 'others' || !is_numeric($selectedId)) { $selectedVal = 'custom:' . $selectedId; $isCustom = true; } else { foreach ($staffs as $staff) { if ($staff->id == $selectedId) { $selectedVal = 'staff:' . $staff->id; $found = true; break; } } if (!$found) { foreach ($users as $user) { if ($user->id == $selectedId) { $selectedVal = 'user:' . $user->id; $found = true; break; } } } if (!$found) { $selectedVal = 'custom:' . $selectedId; $isCustom = true; } } } } if ($isCustom) { echo ''; } foreach ($staffs as $staff) { $val = 'staff:' . $staff->id; $selected = ($val === $selectedVal) ? 'selected' : ''; $label = $staff->staff_name . ' (' . ($staff->role ?? 'Staff') . ')'; echo ''; } foreach ($users as $user) { $val = 'user:' . $user->id; $selected = ($val === $selectedVal) ? 'selected' : ''; $label = $user->name . ' (Admin)'; echo ''; } } @endphp

Edit Document In/Out Record

@csrf {{-- TRANSACTION DETAILS --}}
Transaction Details
{{-- DOCUMENT OWNER DETAILS --}}
Document Owner Details
@php $isStandardOwnerType = in_array($record->document_owner_type, ['Customer', 'Staff', 'Admin', 'Others']); $currentOwnerType = $isStandardOwnerType ? $record->document_owner_type : 'Others'; $otherOwnerTypeValue = $isStandardOwnerType ? '' : $record->document_owner_type; @endphp
{{-- IN DETAILS --}}
Document In Details
{{-- IN TAKEN BY SELECT2 --}}
{{-- IN GIVEN BY SELECT2 --}}
{{-- OUT DETAILS --}}
Document Out Details
type !== 'Out' ? 'disabled' : '' }}>
type !== 'Out' ? 'disabled' : '' }}>
type !== 'Out' ? 'disabled' : '' }}>
type !== 'Out' ? 'disabled' : '' }}>
{{-- OUT TAKEN BY SELECT2 --}}
type !== 'Out' ? 'disabled' : '' }}> type !== 'Out' ? 'disabled' : '' }}>
{{-- OUT GIVEN BY SELECT2 --}}
type !== 'Out' ? 'disabled' : '' }}> type !== 'Out' ? 'disabled' : '' }}>
{{-- DOCUMENT DETAILS --}}
Document Details
@foreach($record->documents as $index => $doc) @php $standardTypes = ['GA', 'GT', 'BP', 'LC', 'NC']; $isStandardDocType = in_array($doc->document_type, $standardTypes); $currentDocType = $isStandardDocType ? $doc->document_type : 'Others'; $otherDocTypeValue = $isStandardDocType ? '' : $doc->document_type; @endphp @endforeach
SNO Document Type Document Number Document Name Document Status Document Image Action
{{ $index + 1 }}
@if($doc->document_image) @else No image @endif
{{-- ACTION BUTTONS --}}
Cancel
{{-- IMAGE PREVIEW MODAL --}} {{-- jQuery and Select2 JS --}} @endsection