Use of filter in the GL Account dropdown menus

This commit is contained in:
Jose Alberto Hernandez
2024-01-10 15:02:06 +01:00
committed by Adam Saghy
parent 6edb262028
commit 53d8436875
47 changed files with 807 additions and 626 deletions
@@ -169,7 +169,7 @@ const routes: Routes = [
{
path: 'migrate-opening-balances',
component: MigrateOpeningBalancesComponent,
data: { title: 'Migrate Opening Balances', breadcrumb: 'Migrate Opening Balances' },
data: { title: 'Migrate Opening Balances', breadcrumb: 'Migrate Opening Balances' },
resolve: {
offices: OfficesResolver,
currencies: CurrenciesResolver
@@ -52,14 +52,13 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Parent" | translate}}</mat-label>
<mat-select formControlName="parentId">
<mat-option *ngFor="let parent of parentData" [value]="parent.id">
({{ parent.glCode }}) {{ parent.name }}
</mat-option>
</mat-select>
</mat-form-field>
<mifosx-gl-account-selector fxFlex="48%"
[inputFormControl]="glAccountForm.controls.parentId"
[glAccountList]="parentData"
[required]="false"
[inputLabel]="'Parent'"
>
</mifosx-gl-account-selector>
<mat-form-field fxFlex="28%">
<mat-label>{{"labels.inputs.Tag" | translate}}</mat-label>
@@ -114,4 +113,4 @@
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">{{"labels.buttons.Next" |
translate}}</button>
</div>
</ng-template>
</ng-template>
@@ -11,6 +11,7 @@ import { ConfigurationWizardService } from '../../../configuration-wizard/config
/** Custom Dialog Component */
import { ContinueSetupDialogComponent } from '../../../configuration-wizard/continue-setup-dialog/continue-setup-dialog.component';
import { GLAccount } from 'app/shared/models/general.model';
/**
* Create gl account component.
@@ -31,7 +32,7 @@ export class CreateGlAccountComponent implements OnInit, AfterViewInit {
/** Account usage data. */
accountUsageData: any;
/** Parent data. */
parentData: any;
parentData: GLAccount[] = [];
/** Tag data. */
tagData: any;
/** Account type id. (for creation of sub-ledger account) */
@@ -48,14 +48,13 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Parent" | translate}}</mat-label>
<mat-select formControlName="parentId">
<mat-option *ngFor="let parent of parentData" [value]="parent.id">
({{ parent.glCode }}) {{ parent.name }}
</mat-option>
</mat-select>
</mat-form-field>
<mifosx-gl-account-selector fxFlex="48%"
[inputFormControl]="glAccountForm.controls.parentId"
[glAccountList]="parentData"
[required]="false"
[inputLabel]="'Parent'"
>
</mifosx-gl-account-selector>
<mat-form-field fxFlex="28%">
<mat-label>{{"labels.inputs.Tag" | translate}}</mat-label>
@@ -59,7 +59,7 @@
<div fxFlex="50%" *ngIf="glAccount.parent">
<a class="tab-link" [routerLink]="['/accounting/chart-of-accounts/gl-accounts/view/' + glAccount.parent.id]">
({{ glAccount.parent.glCode }}) {{ glAccount.parent.name }}
<mifosx-gl-account-display [glAccount]="glAccount.parent"></mifosx-gl-account-display>
</a>
</div>
@@ -37,17 +37,13 @@
<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" [formGroupName]="i">
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Affected GL Entry (Debit)" | translate}}</mat-label>
<mat-select required formControlName="glAccountId">
<mat-option *ngFor="let affectedGLEntryDebit of glAccountData" [value]="affectedGLEntryDebit.id">
{{ affectedGLEntryDebit.name + ' (' + affectedGLEntryDebit.glCode + ')' }}
</mat-option>
</mat-select>
<mat-error *ngIf="debits.at(i).controls.glAccountId.hasError('required')">
{{"labels.inputs.Affected GL Entry (Debit)" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-gl-account-selector fxFlex="48%"
[inputFormControl]="debits.at(i).controls.glAccountId"
[glAccountList]="glAccountData"
[required]="true"
[inputLabel]="'Affected GL Entry (Debit)'"
>
</mifosx-gl-account-selector>
<mat-form-field fxFlex="43%">
<mat-label>{{"labels.inputs.Debit Amount" | translate}}</mat-label>
@@ -75,17 +71,13 @@
<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" [formGroupName]="i">
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Affected GL Entry (Credit)" | translate}}</mat-label>
<mat-select required formControlName="glAccountId">
<mat-option *ngFor="let affectedGLEntryCredit of glAccountData" [value]="affectedGLEntryCredit.id">
{{ affectedGLEntryCredit.name + ' (' + affectedGLEntryCredit.glCode + ')' }}
</mat-option>
</mat-select>
<mat-error *ngIf="credits.at(i).controls.glAccountId.hasError('required')">
{{"labels.inputs.Affected GL Entry (Credit)" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-gl-account-selector fxFlex="48%"
[inputFormControl]="credits.at(i).controls.glAccountId"
[glAccountList]="glAccountData"
[required]="true"
[inputLabel]="'Affected GL Entry (Credit)'"
>
</mifosx-gl-account-selector>
<mat-form-field fxFlex="43%">
<mat-label>{{"labels.inputs.Credit Amount"|translate}}</mat-label>
@@ -20,17 +20,13 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Account"|translate}}</mat-label>
<mat-select required formControlName="glAccountId">
<mat-option *ngFor="let glAccount of glAccountData" [value]="glAccount.id">
{{ glAccount.name + ' (' + glAccount.glCode + ')' }}
</mat-option>
</mat-select>
<mat-error *ngIf="financialActivityMappingForm.controls.glAccountId.hasError('required')">
{{"labels.inputs.Account"|translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-gl-account-selector
[inputFormControl]="financialActivityMappingForm.controls.glAccountId"
[glAccountList]="glAccountData"
[required]="true"
[inputLabel]="'Account'"
>
</mifosx-gl-account-selector>
</div>
@@ -5,6 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
/** Custom Services */
import { AccountingService } from '../../accounting.service';
import { GLAccount } from 'app/shared/models/general.model';
/**
* Create financial activity mapping component.
@@ -21,7 +22,7 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
/** GL Account options. */
glAccountOptions: any;
/** GL Account data. */
glAccountData: any;
glAccountData: GLAccount[] = [];
/** Financial activity data. */
financialActivityData: any;
@@ -17,15 +17,13 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Account"|translate}}</mat-label>
<mat-select required formControlName="glAccountId">
<mat-option *ngFor="let glAccount of glAccountData" [value]="glAccount.id">
{{ glAccount.name + ' (' + glAccount.glCode + ')' }}
</mat-option>
</mat-select>
</mat-form-field>
<mifosx-gl-account-selector
[inputFormControl]="financialActivityMappingForm.controls.glAccountId"
[glAccountList]="glAccountData"
[required]="true"
[inputLabel]="'Account'"
>
</mifosx-gl-account-selector>
</div>
</mat-card-content>
@@ -5,6 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
/** Custom Services */
import { AccountingService } from '../../accounting.service';
import { GLAccount } from 'app/shared/models/general.model';
/**
* Edit financial activity mapping component.
@@ -21,7 +22,7 @@ export class EditFinancialActivityMappingComponent implements OnInit {
/** GL Account options. */
glAccountOptions: any;
/** GL Account data. */
glAccountData: any;
glAccountData: GLAccount[] = [];
/** Financial activity data. */
financialActivityData: any;
/** Financial activity account ID. */
@@ -25,13 +25,11 @@
{{ financialActivityAccount?.financialActivityData.name }}
</div>
<div fxFlex="50%" class="header">
{{"labels.inputs.Account Name" | translate}}
</div>
<div fxFlex="50%">
{{ financialActivityAccount?.glAccountData.name }}
</div>
<mifosx-gl-account-display fxFlex="100%"
[glAccount]="financialActivityAccount?.glAccountData"
[accountTitle]="'Account Name'"
>
</mifosx-gl-account-display>
</div>
@@ -5,10 +5,13 @@
<input matInput [formControl]="officeName" [matAutocomplete]="officeNameAutocomplete">
</mat-form-field>
<mat-form-field fxFlex="31%">
<mat-label>{{"labels.inputs.GL Account Name or Code" | translate}}</mat-label>
<input matInput [formControl]="glAccount" [matAutocomplete]="glAccountAutocomplete">
</mat-form-field>
<mifosx-gl-account-selector fxFlex="31%"
[inputFormControl]="glAccount"
[glAccountList]="glAccountData"
[required]="true"
[inputLabel]="'GL Account Name or Code'"
>
</mifosx-gl-account-selector>
<mat-form-field fxFlex="31%">
<mat-label>{{'labels.inputs.Filter' | translate}}</mat-label>
@@ -62,13 +65,6 @@
</mat-option>
</mat-autocomplete>
<mat-autocomplete autoActiveFirstOption #glAccountAutocomplete="matAutocomplete" [displayWith]="displayGLAccount">
<mat-option *ngFor="let glAccount of filteredGLAccountData | async" [value]="{ id: glAccount.id, name: glAccount.name, glCode: glAccount.glCode }">
{{ glAccount.name + ' (' + glAccount.glCode + ')' }}
</mat-option>
</mat-autocomplete>
<div class="mat-elevation-z8 container">
<table mat-table [dataSource]="dataSource" matSort>
@@ -170,7 +170,7 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
this.glAccount.valueChanges
.pipe(
map(value => value.id ? value.id : ''),
map(value => value ? value : ''),
debounceTime(500),
distinctUntilChanged(),
tap((filterValue) => {
@@ -269,15 +269,6 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
return office ? office.name : undefined;
}
/**
* Displays gl account name in form control input.
* @param {any} glAccount Gl Account data.
* @returns {string} Gl Account name if valid otherwise undefined.
*/
displayGLAccount(glAccount?: any): string | undefined {
return glAccount ? glAccount.name + ' (' + glAccount.glCode + ')' : undefined;
}
/**
* Sets filtered offices for autocomplete.
*/