@extends('layouts.app') @section('title', 'Transaction Details - Cash Book') @section('content')

Transaction Details

Transaction ID
{{ $transaction->trx_id }}
Business
{{ $transaction->business->name ?? 'N/A' }}
Branch
{{ $transaction->branch->name ?? 'N/A' }}
Category
{{ $transaction->category->name ?? 'N/A' }}
Transaction Type
{{ ucfirst($transaction->transaction_type) }}
Transaction Method
{{ ucfirst($transaction->transaction_method) }}
Amount
SAR {{ number_format($transaction->amount, 2) }}
Transaction Date
{{ $transaction->transaction_date->format('Y-m-d') }}
{{-- Agent display commented out
Agent
{{ $transaction->agent->name ?? 'N/A' }}
--}}
Description
{{ $transaction->description ?? 'N/A' }}
Reference
{{ $transaction->reference ?? 'N/A' }}
Created At
{{ $transaction->created_at->format('Y-m-d H:i') }}
Created By
{{ $transaction->user->name ?? 'N/A' }}
Updated At
{{ $transaction->updated_at->format('Y-m-d H:i') }}
@if($transaction->editHistory->isNotEmpty())

Edit History

@foreach($transaction->editHistory as $edit)

Edited by {{ $edit->user->name ?? 'Unknown' }} on {{ $edit->created_at->format('Y-m-d H:i') }}

    @foreach($edit->changes as $field => $change)
  • {{ $field }}: @if(is_array($change) && isset($change['old'])) {{ $change['old'] ?? '(empty)' }} → {{ $change['new'] ?? '(empty)' }} @else {{ $change }} @endif
  • @endforeach
@endforeach
@endif
@if( !in_array(auth()->user()->role, ['auditor']) && ( in_array(auth()->user()->role, ['super_admin', 'accountant']) || (auth()->user()->role === 'branch_admin' && $transaction->branch_id === auth()->user()->branch_id && \App\Services\TransactionService::isBusinessDay($transaction->transaction_date)) ) ) Edit @endif
@endsection