Files
cbsnexora/src/app/accounting/frequent-postings/frequent-postings.component.html
T

241 lines
11 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="container">
<mat-card>
<form [formGroup]="frequentPostingsForm" (ngSubmit)="submit()">
<mat-card-content>
<div class="layout-row-wrap gap-2px responsive-column">
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Office' | translate }}</mat-label>
<mat-select required formControlName="officeId">
@for (office of officeData; track office) {
<mat-option [value]="office.id">
{{ office.name }}
</mat-option>
}
</mat-select>
@if (frequentPostingsForm.controls.officeId.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Accounting Rule' | translate }}</mat-label>
<mat-select required formControlName="accountingRule">
@for (accountingRule of accountingRuleData; track accountingRule) {
<mat-option [value]="accountingRule">
{{ accountingRule.name }}
</mat-option>
}
</mat-select>
@if (frequentPostingsForm.controls.accountingRule.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Accounting Rule' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Currency' | translate }}</mat-label>
<mat-select required formControlName="currencyCode">
@for (currency of currencyData; track currency) {
<mat-option [value]="currency.code">
{{ currency.displayLabel }}
</mat-option>
}
</mat-select>
@if (frequentPostingsForm.controls.currencyCode.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Currency' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<span class="flex-48 hide-lt-md"></span>
@for (debit of debits.controls; track debit; let i = $index) {
<div class="flex-fill layout-row-wrap responsive-column" formArrayName="debits">
<div class="flex-fill layout-row-wrap gap-2percent responsive-column" [formGroupName]="i">
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Affected GL Entry (Debit)' | translate }}</mat-label>
<mat-select required formControlName="glAccountId">
@for (affectedGLEntryDebit of debitAccountData; track affectedGLEntryDebit) {
<mat-option [value]="affectedGLEntryDebit.id">
{{ affectedGLEntryDebit.name }}
</mat-option>
}
</mat-select>
@if (debits.at(i).controls.glAccountId.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Affected GL Entry (Debit)' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field class="flex-43">
<mat-label>{{ 'labels.inputs.Debit Amount' | translate }}</mat-label>
<input type="number" matInput required formControlName="amount" />
@if (debits.at(i).controls.amount.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Debit Amount' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<span class="flex-fill">
@if (i !== 0) {
<button type="button" mat-icon-button (click)="removeAffectedGLEntry(debits, i)">
<fa-icon icon="minus-circle" size="lg"></fa-icon>
</button>
}
@if (i === 0 && allowMultipleDebitEntries) {
<button type="button" mat-icon-button color="primary" (click)="addAffectedGLEntry(debits)">
<fa-icon icon="plus-circle" size="lg"></fa-icon>
</button>
}
</span>
</div>
</div>
}
@for (credit of credits.controls; track credit; let i = $index) {
<div class="flex-fill layout-row-wrap responsive-column" formArrayName="credits">
<div class="flex-fill layout-row-wrap gap-2percent responsive-column" [formGroupName]="i">
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Affected GL Entry (Credit)' | translate }}</mat-label>
<mat-select required formControlName="glAccountId">
@for (affectedGLEntryCredit of creditAccountData; track affectedGLEntryCredit) {
<mat-option [value]="affectedGLEntryCredit.id">
{{ affectedGLEntryCredit.name }}
</mat-option>
}
</mat-select>
@if (credits.at(i).controls.glAccountId.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Affected GL Entry (Credit)' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field class="flex-43">
<mat-label>{{ 'labels.inputs.Credit Amount' | translate }}</mat-label>
<input type="number" matInput required formControlName="amount" />
@if (credits.at(i).controls.amount.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Credit Amount' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<span class="flex-fill">
@if (i !== 0) {
<button type="button" mat-icon-button (click)="removeAffectedGLEntry(credits, i)">
<fa-icon icon="minus-circle" size="lg"></fa-icon>
</button>
}
@if (i === 0 && allowMultipleCreditEntries) {
<button type="button" mat-icon-button color="primary" (click)="addAffectedGLEntry(credits)">
<fa-icon icon="plus-circle" size="lg"></fa-icon>
</button>
}
</span>
</div>
</div>
}
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Reference Number' | translate }}</mat-label>
<input matInput formControlName="referenceNumber" />
</mat-form-field>
<mat-form-field class="flex-48" (click)="transactionDatePicker.open()">
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
<input
matInput
[min]="minDate"
[max]="maxDate"
[matDatepicker]="transactionDatePicker"
required
formControlName="transactionDate"
/>
<mat-datepicker-toggle matSuffix [for]="transactionDatePicker"></mat-datepicker-toggle>
<mat-datepicker #transactionDatePicker></mat-datepicker>
@if (frequentPostingsForm.controls.transactionDate.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Transaction Date' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Payment Type' | translate }}</mat-label>
<mat-select formControlName="paymentTypeId">
@for (paymentType of paymentTypeData; track paymentType) {
<mat-option [value]="paymentType.id">
{{ paymentType.name }}
</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Account Number' | translate }}</mat-label>
<input matInput formControlName="accountNumber" />
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Cheque Number' | translate }}</mat-label>
<input matInput formControlName="checkNumber" />
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Routing Code' | translate }}</mat-label>
<input matInput formControlName="routingCode" />
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Receipt Number' | translate }}</mat-label>
<input matInput formControlName="receiptNumber" />
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Bank Number' | translate }}</mat-label>
<input matInput formControlName="bankNumber" />
</mat-form-field>
<mat-form-field class="flex-98">
<mat-label>{{ 'labels.inputs.Comments' | translate }}</mat-label>
<textarea matInput formControlName="comments" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
</mat-form-field>
</div>
</mat-card-content>
<mat-card-actions class="layout-row align-center gap-5px responsive-column">
<button type="button" mat-raised-button [routerLink]="['../../']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button
mat-raised-button
color="primary"
[disabled]="!frequentPostingsForm.valid"
*mifosxHasPermission="'CREATE_JOURNALENTRY'"
>
{{ 'labels.buttons.Submit' | translate }}
</button>
</mat-card-actions>
</form>
</mat-card>
</div>