Upgrading to Angular 20:
Replaced checked in package-lock.json by regenerated one. Ran ng update @angular/core@20 @angular/cli@20 Ran npm install @angular-builders/jest@^20.0.0 @fortawesome/angular-fontawesome@^3.0.0 @swimlane/ngx-graph@^11 Ran npm install ngx-mat-select-search@^8.0.2. Ran ng update @angular/material@20. Updated all eslint and typescript to the latest versions. Removed @angular-devkit/schematics. Updated fontawesome. Updated rxjs and tslib. Moved required node version from 16 to 20. Updated jest-preset-angular. Set preserveWhitespaces to false. Corrected two type declarations in two typescript files to make ng serve run without errors. Removed unused angular-devkit/schematics from view-user.component.ts . Updated list of supported browsers. Upgraded prettier. Ran prettier . --write the first time. Ran prettier . --write the second time. Ran ng generate @angular/core:inject with defaults, excepted a handful of files. Fixed remaining eslint problems. Added dist directory to ignores in eslint.config.js. Let prettier fix formatting, almost everything is just line breaks. Made htmlhint ignore @if and @for Angular constructs. Updated node version in Github workflow to 22.12.0 (build.yml). Updated .env.ts. Updated Angular datetime format strings from YYYY-MM-DD to yyyy-MM-dd. Merged changes from dev into angular20 branch.
This commit is contained in:
@@ -6,129 +6,131 @@
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Office' | translate }}</mat-label>
|
||||
<mat-select required formControlName="officeId">
|
||||
<mat-option *ngFor="let office of officeData" [value]="office.id">
|
||||
{{ office.name }}
|
||||
</mat-option>
|
||||
@for (office of officeData; track office) {
|
||||
<mat-option [value]="office.id">
|
||||
{{ office.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-error *ngIf="journalEntryForm.controls.officeId.hasError('required')">
|
||||
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
@if (journalEntryForm.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-24">
|
||||
<mat-label>{{ 'labels.inputs.Currency' | translate }}</mat-label>
|
||||
<mat-select required formControlName="currencyCode">
|
||||
<mat-option *ngFor="let currency of currencyData" [value]="currency.code">
|
||||
{{ currency.displayLabel }}
|
||||
</mat-option>
|
||||
@for (currency of currencyData; track currency) {
|
||||
<mat-option [value]="currency.code">
|
||||
{{ currency.displayLabel }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-error *ngIf="journalEntryForm.controls.currencyCode.hasError('required')">
|
||||
{{ 'labels.inputs.Currency' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
@if (journalEntryForm.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>
|
||||
|
||||
<mat-form-field class="flex-24" *ngIf="assetExternalizationEnabled">
|
||||
<mat-label>{{ 'labels.inputs.External Asset Owner' | translate }}</mat-label>
|
||||
<input matInput formControlName="externalAssetOwner" />
|
||||
</mat-form-field>
|
||||
@if (assetExternalizationEnabled) {
|
||||
<mat-form-field class="flex-24">
|
||||
<mat-label>{{ 'labels.inputs.External Asset Owner' | translate }}</mat-label>
|
||||
<input matInput formControlName="externalAssetOwner" />
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
<div
|
||||
class="flex-fill layout-row-wrap responsive-column"
|
||||
formArrayName="debits"
|
||||
*ngFor="let debit of debits.controls; let i = index"
|
||||
>
|
||||
<div class="flex-fill layout-row-wrap gap-2percent responsive-column" [formGroupName]="i">
|
||||
<mifosx-gl-account-selector
|
||||
class="flex-48"
|
||||
[inputFormControl]="debits.at(i).controls.glAccountId"
|
||||
[glAccountList]="glAccountData"
|
||||
[required]="true"
|
||||
[inputLabel]="'Affected GL Entry (Debit)'"
|
||||
>
|
||||
</mifosx-gl-account-selector>
|
||||
|
||||
<mat-form-field class="flex-43">
|
||||
<mat-label>{{ 'labels.inputs.Debit Amount' | translate }}</mat-label>
|
||||
<input
|
||||
type="number"
|
||||
matInput
|
||||
required
|
||||
formControlName="amount"
|
||||
min="1"
|
||||
(input)="onAmountInput($event)"
|
||||
/>
|
||||
<mat-error *ngIf="debits.at(i).controls.amount.hasError('required')">
|
||||
{{ 'labels.inputs.Debit Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<span class="flex-fill">
|
||||
<button *ngIf="i !== 0" type="button" mat-icon-button (click)="removeAffectedGLEntry(debits, i)">
|
||||
<fa-icon icon="minus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
<button
|
||||
*ngIf="i === 0"
|
||||
type="button"
|
||||
mat-icon-button
|
||||
color="primary"
|
||||
(click)="addAffectedGLEntry(debits)"
|
||||
@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">
|
||||
<mifosx-gl-account-selector
|
||||
class="flex-48"
|
||||
[inputFormControl]="debits.at(i).controls.glAccountId"
|
||||
[glAccountList]="glAccountData"
|
||||
[required]="true"
|
||||
[inputLabel]="'Affected GL Entry (Debit)'"
|
||||
>
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
</span>
|
||||
</mifosx-gl-account-selector>
|
||||
<mat-form-field class="flex-43">
|
||||
<mat-label>{{ 'labels.inputs.Debit Amount' | translate }}</mat-label>
|
||||
<input
|
||||
type="number"
|
||||
matInput
|
||||
required
|
||||
formControlName="amount"
|
||||
min="1"
|
||||
(input)="onAmountInput($event)"
|
||||
/>
|
||||
@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) {
|
||||
<button type="button" mat-icon-button color="primary" (click)="addAffectedGLEntry(debits)">
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div
|
||||
class="flex-fill layout-row-wrap responsive-column"
|
||||
formArrayName="credits"
|
||||
*ngFor="let credit of credits.controls; let i = index"
|
||||
>
|
||||
<div class="flex-fill layout-row-wrap gap-2percent responsive-column" [formGroupName]="i">
|
||||
<mifosx-gl-account-selector
|
||||
class="flex-48"
|
||||
[inputFormControl]="credits.at(i).controls.glAccountId"
|
||||
[glAccountList]="glAccountData"
|
||||
[required]="true"
|
||||
[inputLabel]="'Affected GL Entry (Credit)'"
|
||||
>
|
||||
</mifosx-gl-account-selector>
|
||||
|
||||
<mat-form-field class="flex-43">
|
||||
<mat-label>{{ 'labels.inputs.Credit Amount' | translate }}</mat-label>
|
||||
<input
|
||||
type="number"
|
||||
matInput
|
||||
required
|
||||
formControlName="amount"
|
||||
min="1"
|
||||
(input)="onAmountInput($event)"
|
||||
/>
|
||||
<mat-error *ngIf="credits.at(i).controls.amount.hasError('required')">
|
||||
{{ 'labels.inputs.Credit Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<span class="flex-fill">
|
||||
<button *ngIf="i !== 0" type="button" mat-icon-button (click)="removeAffectedGLEntry(credits, i)">
|
||||
<fa-icon icon="minus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
<button
|
||||
*ngIf="i === 0"
|
||||
type="button"
|
||||
mat-icon-button
|
||||
color="primary"
|
||||
(click)="addAffectedGLEntry(credits)"
|
||||
@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">
|
||||
<mifosx-gl-account-selector
|
||||
class="flex-48"
|
||||
[inputFormControl]="credits.at(i).controls.glAccountId"
|
||||
[glAccountList]="glAccountData"
|
||||
[required]="true"
|
||||
[inputLabel]="'Affected GL Entry (Credit)'"
|
||||
>
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
</span>
|
||||
</mifosx-gl-account-selector>
|
||||
<mat-form-field class="flex-43">
|
||||
<mat-label>{{ 'labels.inputs.Credit Amount' | translate }}</mat-label>
|
||||
<input
|
||||
type="number"
|
||||
matInput
|
||||
required
|
||||
formControlName="amount"
|
||||
min="1"
|
||||
(input)="onAmountInput($event)"
|
||||
/>
|
||||
@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) {
|
||||
<button type="button" mat-icon-button color="primary" (click)="addAffectedGLEntry(credits)">
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Reference Number' | translate }}</mat-label>
|
||||
@@ -147,18 +149,22 @@
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="transactionDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #transactionDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="journalEntryForm.controls.transactionDate.hasError('required')">
|
||||
{{ 'labels.inputs.Transaction Date' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
@if (journalEntryForm.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">
|
||||
<mat-option *ngFor="let paymentType of paymentTypeData" [value]="paymentType.id">
|
||||
{{ paymentType.name }}
|
||||
</mat-option>
|
||||
@for (paymentType of paymentTypeData; track paymentType) {
|
||||
<mat-option [value]="paymentType.id">
|
||||
{{ paymentType.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit, inject } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormArray, UntypedFormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
@@ -34,6 +34,16 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
]
|
||||
})
|
||||
export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private accountingService = inject(AccountingService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private dialog = inject(MatDialog);
|
||||
private configurationWizardService = inject(ConfigurationWizardService);
|
||||
private popoverService = inject(PopoverService);
|
||||
|
||||
onCreditAmountInput(event: any) {
|
||||
if (event.target.value < 1) {
|
||||
event.target.value = 1;
|
||||
@@ -72,17 +82,7 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
constructor() {
|
||||
this.assetExternalizationEnabled = false;
|
||||
this.route.data.subscribe(
|
||||
(data: { offices: any; currencies: any; paymentTypes: any; glAccounts: any; globalConfig: any }) => {
|
||||
@@ -147,7 +147,8 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.min(1)]
|
||||
Validators.min(1)
|
||||
]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user