LocalGovIMS_localgov-ims/src/Admin/Views/Transaction/_TransferList.cshtml
@model Admin.Models.Transaction.DetailsViewModel

@if (!Model.IsRefund)
{

    if ((Model.Transaction.Transfers == null || !Model.Transaction.Transfers.Any()))
    {
        <div class="alert alert-info mb-3">
            <div class="fw-bold pb-1">
                No journals found
            </div>
            <p class="mb-0">There are no journals found against this transaction.</p>
        </div>
    }
    else
    {
        <div class="table-responsive">
            <table class="table table-striped table-bordered mt-2">
                <thead>
                    <tr>
                        <th scope="col">Details</th>
                        <th scope="col">From</th>
                        <th scope="col">To</th>
                        <th scope="col">Narrative</th>
                        <th scope="col">Amount (£)</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model.Transaction.Transfers != null && Model.Transaction.FormattedTransfers.Any())
                    {
                        foreach (var transfer in Model.Transaction.FormattedTransfers)
                        {
                            <tr>
                                <td>
                                    @Html.ActionLink(transfer.PspReference, "Details", new { id = transfer.PspReference })
                                    <br />
                                    @transfer.EntryDate
                                    <br />
                                    @(transfer.User != null ? transfer.User.DisplayName : transfer.UserCode.ToString())
                                </td>
                                <td>
                                    @(transfer.Debit.FundCode != null ? string.Format("{0} ({1})", transfer.Debit.Fund.FundName, transfer.Debit.FundCode) : "")
                                    <br />
                                    @transfer.Debit.AccountReference
                                </td>
                                <td>
                                    @(transfer.Credit.FundCode != null ? string.Format("{0} ({1})", transfer.Credit.Fund.FundName, transfer.Credit.FundCode) : "")
                                    <br />
                                    @transfer.Credit.AccountReference
                                </td>
                                <td>@transfer.Narrative</td>
                                <td class="text-end">@Html.ToCurrency(transfer.Amount)</td>
                            </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    }
}
