@extends('layouts.app') @section('title', __('accounting-reports::lang.cheque_book_details')) @section('content')

@lang('accounting-reports::lang.cheque_book_details') - {{ $chequeBook->book_name }}

@lang('accounting-reports::lang.cheque_book_details')

@lang('accounting-reports::lang.book_name'): {{ $chequeBook->book_name }}
@lang('accounting-reports::lang.bank_account'): {{ $chequeBook->account->name ?? '-' }}
@lang('accounting-reports::lang.cheque_range'): {{ $chequeBook->start_cheque_no }} - {{ $chequeBook->end_cheque_no }}
@lang('accounting-reports::lang.total_cheques'): {{ $chequeBook->total_cheques }}
@lang('accounting-reports::lang.used_cheques'): {{ $chequeBook->used_cheques }}
@lang('accounting-reports::lang.remaining_cheques'): {{ $chequeBook->remaining_cheques }}
@lang('accounting-reports::lang.status'): @if($chequeBook->status == 'active') @lang('accounting-reports::lang.active') @elseif($chequeBook->status == 'completed') Completed @else @lang('accounting-reports::lang.cancelled') @endif
@lang('accounting-reports::lang.issue_date'): {{ $chequeBook->issue_date ? @format_date($chequeBook->issue_date) : '-' }}
@lang('messages.edit')

@lang('accounting-reports::lang.cheque_range')

@foreach($chequeSequence as $chequeNo) @php $chequeNoStr = (string) $chequeNo; // Ensure string type for comparison $isUsed = in_array($chequeNoStr, $usedCheques, true); // Actually used (cleared, bounced, etc.) $isPending = in_array($chequeNoStr, $pendingCheques ?? [], true); // Pending (created but not cleared) $entry = $chequeBook->chequeEntries->firstWhere('cheque_number', $chequeNoStr); // Determine box color and style // Only show as used if explicitly in usedCheques array (cleared, bounced, cancelled, deposited) // Show as pending if in pendingCheques array or entry status is pending // Show as available if no entry exists OR entry status is 'available' if ($isUsed) { $borderColor = '#d9534f'; // Red for used $bgColor = '#f2dede'; } elseif ($isPending || ($entry && $entry->status == 'pending')) { $borderColor = '#f0ad4e'; // Orange for pending $bgColor = '#fcf8e3'; } elseif (!$entry || ($entry && $entry->status == 'available')) { // No entry or entry with status 'available' = available (green) $borderColor = '#5cb85c'; // Green for available $bgColor = '#dff0d8'; } else { // Any other status (shouldn't happen, but fallback to green) $borderColor = '#5cb85c'; // Green for available $bgColor = '#dff0d8'; } @endphp
{{ $chequeNo }} @if($entry)
@if($entry->status == 'cleared') Cleared @elseif($entry->status == 'bounced') Bounced @elseif($entry->status == 'pending') Pending @elseif($entry->status == 'deposited') Deposited @elseif($entry->status == 'cancelled') Cancelled @elseif($entry->status == 'available') Available @else {{ ucfirst($entry->status) }} @endif @if($entry->payee_name)
{{ $entry->payee_name }} @endif @else
@lang('accounting-reports::lang.available') @endif
@endforeach
@endsection @section('javascript') @endsection