125 lines
4.5 KiB
HTML
125 lines
4.5 KiB
HTML
<!--
|
|
Copyright since 2025 Mifos Initiative
|
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
-->
|
|
|
|
<div class="rt">
|
|
<div class="rt-head">
|
|
<h2 class="rt-title">Transfer between reserve accounts</h2>
|
|
<button class="rt-x" (click)="close()" aria-label="Close">
|
|
<fa-icon icon="times"></fa-icon>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- The two accounts, the way a desk thinks about them: money leaves one and arrives in the
|
|
other. The ledger's debit and credit are worked out when the entry posts, because asking a
|
|
treasury user which side to credit in order to move their own money is asking them to do the
|
|
ledger's job. -->
|
|
<div class="rt-from">
|
|
<div class="rt-field-label">From</div>
|
|
<div class="rt-acct">
|
|
<div class="rt-acct-name">{{ from.name }}</div>
|
|
<div class="rt-acct-sub">{{ from.glCode }} · {{ from.item }} {{ from.head }}</div>
|
|
</div>
|
|
<div class="rt-bal">
|
|
<span class="rt-bal-label">Balance</span>
|
|
<span class="rt-bal-val">{{ money(from.balance) }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="rt-arrow"><fa-icon icon="arrow-down"></fa-icon></div>
|
|
|
|
<div class="rt-row">
|
|
<label class="rt-field-label" for="rt-to">To</label>
|
|
<select id="rt-to" class="rt-input" [(ngModel)]="toAccountId">
|
|
<option [ngValue]="null">Choose the account to receive it</option>
|
|
@for (a of destinations; track a.glAccountId) {
|
|
<option [ngValue]="a.glAccountId">{{ a.glCode }} · {{ a.name }} — {{ money(a.balance) }}</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
|
|
<div class="rt-row">
|
|
<label class="rt-field-label" for="rt-amt">Amount to transfer</label>
|
|
<div class="rt-amount-wrap">
|
|
<span class="rt-rupee">₹</span>
|
|
<input
|
|
id="rt-amt"
|
|
class="rt-input rt-amount"
|
|
type="number"
|
|
min="0"
|
|
step="0.01"
|
|
placeholder="0.00"
|
|
[(ngModel)]="amount"
|
|
/>
|
|
</div>
|
|
<!-- An account cannot send more than it holds: the ledger would carry a negative balance on a
|
|
bank account, which is not a position that exists. Said as the amount is typed rather than
|
|
on submit, so the figure is corrected before anyone commits to it. -->
|
|
@if (overdrawn) {
|
|
<div class="rt-warn">More than {{ from.name }} holds. It has {{ money(from.balance) }}.</div>
|
|
}
|
|
</div>
|
|
|
|
<!-- What each account would hold once this posts. A transfer is made to reach a balance, so the
|
|
balance it reaches is the thing worth showing before it is sent. -->
|
|
@if (to && (amount ?? 0) > 0 && !overdrawn) {
|
|
<div class="rt-after">
|
|
<div class="rt-after-row">
|
|
<span>{{ from.name }}</span>
|
|
<span
|
|
>{{ money(from.balance) }} → <strong>{{ money(fromAfter) }}</strong></span
|
|
>
|
|
</div>
|
|
<div class="rt-after-row">
|
|
<span>{{ to.name }}</span>
|
|
<span
|
|
>{{ money(to.balance) }} → <strong>{{ money(toAfter) }}</strong></span
|
|
>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
<div class="rt-row">
|
|
<label class="rt-field-label" for="rt-ref">Reference <span class="rt-opt">optional</span></label>
|
|
<input id="rt-ref" class="rt-input" type="text" placeholder="NEFT / RTGS reference" [(ngModel)]="reference" />
|
|
</div>
|
|
|
|
<div class="rt-row">
|
|
<label class="rt-field-label" for="rt-note">Note <span class="rt-opt">optional</span></label>
|
|
<input
|
|
id="rt-note"
|
|
class="rt-input"
|
|
type="text"
|
|
placeholder="Why the money is being moved"
|
|
[(ngModel)]="comments"
|
|
/>
|
|
</div>
|
|
|
|
<!-- What this does and does not do. The entry is the bank's record of the movement; the money
|
|
reaches the other bank when the desk sends the NEFT or RTGS. A screen that posted silently
|
|
would leave someone believing the funds had moved. -->
|
|
<div class="rt-note">
|
|
<fa-icon icon="info-circle"></fa-icon>
|
|
This records the movement in the ledger and goes for approval. Send the NEFT or RTGS separately — the money
|
|
does not move until you do.
|
|
</div>
|
|
|
|
@if (error) {
|
|
<div class="rt-error">
|
|
<fa-icon icon="exclamation-triangle"></fa-icon>
|
|
{{ error }}
|
|
</div>
|
|
}
|
|
|
|
<div class="rt-actions">
|
|
<button mat-button (click)="close()">Cancel</button>
|
|
<button mat-raised-button color="primary" [disabled]="!canSubmit" (click)="submit()">
|
|
{{ submitting ? 'Posting…' : 'Post transfer' }}
|
|
</button>
|
|
</div>
|
|
</div>
|