{{-- Journal entry read-only detail modal. --}}
<div class="modal-dialog modal-lg" role="document">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title">@lang('medaccounting::lang.view_entry') — {{ $entry->entry_no }}</h4>
    </div>
    <div class="modal-body">
      <div class="row">
        <div class="col-md-4"><strong>@lang('medaccounting::lang.date'):</strong> {{ optional($entry->date)->format('Y-m-d') }}</div>
        <div class="col-md-4"><strong>@lang('medaccounting::lang.reference'):</strong> @lang('medaccounting::lang.ref_' . ($entry->reference_type ?: 'manual'))</div>
        <div class="col-md-4"><strong>@lang('medaccounting::lang.status'):</strong> @lang('medaccounting::lang.je_status_' . $entry->status)</div>
      </div>
      @if($entry->description)
        <p style="margin-top:8px;"><em>{{ $entry->description }}</em></p>
      @endif
      <table class="table table-bordered table-striped" style="margin-top:10px;">
        <thead><tr>
          <th>@lang('medaccounting::lang.account')</th>
          <th>@lang('medaccounting::lang.cost_center')</th>
          <th>@lang('medaccounting::lang.description')</th>
          <th class="text-right">@lang('medaccounting::lang.debit')</th>
          <th class="text-right">@lang('medaccounting::lang.credit')</th>
        </tr></thead>
        <tbody>
        @foreach($entry->lines as $line)
          <tr>
            <td>{{ optional($line->account)->code }} — {{ optional($line->account)->name }}</td>
            <td>{{ optional($line->costCenter)->name }}</td>
            <td>{{ $line->description }}</td>
            <td class="text-right">{{ (float) $line->debit > 0 ? number_format($line->debit, 2) : '' }}</td>
            <td class="text-right">{{ (float) $line->credit > 0 ? number_format($line->credit, 2) : '' }}</td>
          </tr>
        @endforeach
        </tbody>
        <tfoot><tr>
          <th colspan="3" class="text-right">@lang('medaccounting::lang.totals')</th>
          <th class="text-right">{{ number_format($entry->total_debit, 2) }}</th>
          <th class="text-right">{{ number_format($entry->total_credit, 2) }}</th>
        </tr></tfoot>
      </table>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal">@lang('medaccounting::lang.cancel')</button>
    </div>
  </div>
</div>
