From 2f575aa7ebd3987fffdf7137f3b25b9e534d9845 Mon Sep 17 00:00:00 2001 From: Jose Alberto Hernandez Date: Thu, 19 Jun 2025 17:30:51 -0500 Subject: [PATCH] Extend Manual Journal entry to support Asset Externalization --- .../accounting/accounting-routing.module.ts | 7 ++-- .../external-asset-configuration.resolver.ts | 27 ++++++++++++++ .../create-journal-entry.component.html | 7 +++- .../create-journal-entry.component.ts | 36 +++++++++++-------- ...w-journal-entry-transaction.component.html | 18 +++++++++- ...w-journal-entry-transaction.component.scss | 7 ++++ ...iew-journal-entry-transaction.component.ts | 14 +++++++- src/app/system/system.service.ts | 2 ++ src/assets/styles/_colours.scss | 2 ++ src/assets/translations/cs-CS.json | 1 + src/assets/translations/de-DE.json | 1 + src/assets/translations/en-US.json | 1 + src/assets/translations/es-CL.json | 1 + src/assets/translations/es-MX.json | 1 + src/assets/translations/fr-FR.json | 1 + src/assets/translations/it-IT.json | 1 + src/assets/translations/ko-KO.json | 1 + src/assets/translations/lt-LT.json | 1 + src/assets/translations/lv-LV.json | 1 + src/assets/translations/ne-NE.json | 1 + src/assets/translations/pt-PT.json | 1 + src/assets/translations/sw-SW.json | 1 + 22 files changed, 114 insertions(+), 19 deletions(-) create mode 100644 src/app/accounting/common-resolvers/external-asset-configuration.resolver.ts diff --git a/src/app/accounting/accounting-routing.module.ts b/src/app/accounting/accounting-routing.module.ts index cc2b004dd..171796946 100644 --- a/src/app/accounting/accounting-routing.module.ts +++ b/src/app/accounting/accounting-routing.module.ts @@ -62,6 +62,7 @@ import { ProvisioningJournalEntriesResolver } from './provisioning-entries/view- import { ViewJournalEntryTransactionComponent } from 'app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component'; import { JournalEntryTransactionResolver } from './common-resolvers/journal-entry-transaction.resolver'; import { ExternalAssetOwnerJournalEntryResolver } from 'app/loans/common-resolvers/external-asset-owner-journal-entry.resolver'; +import { ExternalAssetConfigurationResolver } from './common-resolvers/external-asset-configuration.resolver'; /** Accounting Routes */ const routes: Routes = [ @@ -105,7 +106,8 @@ const routes: Routes = [ offices: OfficesResolver, currencies: CurrenciesResolver, paymentTypes: PaymentTypesResolver, - glAccounts: GlAccountsResolver + glAccounts: GlAccountsResolver, + globalConfig: ExternalAssetConfigurationResolver } }, { @@ -419,7 +421,8 @@ const routes: Routes = [ ProvisioningEntryEntriesResolver, LoanProductsResolver, ProvisioningCategoriesResolver, - ProvisioningJournalEntriesResolver + ProvisioningJournalEntriesResolver, + ExternalAssetConfigurationResolver ] }) export class AccountingRoutingModule {} diff --git a/src/app/accounting/common-resolvers/external-asset-configuration.resolver.ts b/src/app/accounting/common-resolvers/external-asset-configuration.resolver.ts new file mode 100644 index 000000000..8d395e137 --- /dev/null +++ b/src/app/accounting/common-resolvers/external-asset-configuration.resolver.ts @@ -0,0 +1,27 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { SystemService } from 'app/system/system.service'; + +/** + * Offices data resolver. + */ +@Injectable() +export class ExternalAssetConfigurationResolver { + /** + * @param {AccountingService} accountingService Accounting service. + */ + constructor(private systemService: SystemService) {} + + /** + * Returns the offices data. + * @returns {Observable} + */ + resolve(): Observable { + return this.systemService.getConfigurationByName(SystemService.CONFIG_ASSET_EXTERNALIZATION); + } +} diff --git a/src/app/accounting/create-journal-entry/create-journal-entry.component.html b/src/app/accounting/create-journal-entry/create-journal-entry.component.html index 789cb35ba..5fcc8121c 100644 --- a/src/app/accounting/create-journal-entry/create-journal-entry.component.html +++ b/src/app/accounting/create-journal-entry/create-journal-entry.component.html @@ -16,7 +16,7 @@ - + {{ 'labels.inputs.Currency' | translate }} @@ -29,6 +29,11 @@ + + {{ 'labels.inputs.External Asset Owner' | translate }} + + +
; @@ -81,12 +78,16 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit { private configurationWizardService: ConfigurationWizardService, private popoverService: PopoverService ) { - this.route.data.subscribe((data: { offices: any; currencies: any; paymentTypes: any; glAccounts: any }) => { - this.officeData = data.offices; - this.currencyData = data.currencies.selectedCurrencyOptions; - this.paymentTypeData = data.paymentTypes; - this.glAccountData = data.glAccounts; - }); + this.assetExternalizationEnabled = false; + this.route.data.subscribe( + (data: { offices: any; currencies: any; paymentTypes: any; glAccounts: any; globalConfig: any }) => { + this.officeData = data.offices; + this.currencyData = data.currencies.selectedCurrencyOptions; + this.paymentTypeData = data.paymentTypes; + this.glAccountData = data.glAccounts; + this.assetExternalizationConfig = data.globalConfig; + } + ); } /** @@ -192,6 +193,9 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit { this.settingsService.dateFormat ); } + if (!journalEntry['externalAssetOwner']) { + delete journalEntry['externalAssetOwner']; + } this.accountingService.createJournalEntry(journalEntry).subscribe((response) => { this.router.navigate( [ @@ -228,6 +232,10 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit { this.showPopover(this.templateCreateJournalFormRef, this.createJournalFormRef.nativeElement, 'top', true); }); } + this.assetExternalizationEnabled = this.assetExternalizationConfig.enabled; + if (this.assetExternalizationEnabled) { + this.journalEntryForm.addControl('externalAssetOwner', new UntypedFormControl()); + } } /** diff --git a/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.html b/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.html index bcec18189..29a2051fe 100644 --- a/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.html +++ b/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.html @@ -15,7 +15,7 @@
- +
@@ -49,6 +49,22 @@
{{ dataSource.data[0].submittedOnDate | datetimeFormat }}
+ +
+ {{ 'labels.inputs.Manual Journal Entry' | translate }} +
+ +
+ {{ dataSource.data[0].manualEntry | yesNo }} +
+ +
+ {{ 'labels.inputs.External Asset Owner' | translate }} +
+ +
+ {{ dataSource.data[0].externalAssetOwner }} +
diff --git a/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.scss b/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.scss index 24edb63bb..613e12eee 100644 --- a/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.scss +++ b/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.scss @@ -1,3 +1,6 @@ +@use 'assets/styles/helper'; +@use 'assets/styles/colours' as *; + table { width: 100%; @@ -5,3 +8,7 @@ table { cursor: pointer; } } + +.manual-entry { + background-color: $manual-entry; +} diff --git a/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.ts b/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.ts index 57f838dce..57436d9cf 100644 --- a/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.ts +++ b/src/app/shared/accounting/view-journal-entry-transaction/view-journal-entry-transaction.component.ts @@ -25,6 +25,7 @@ import { DateFormatPipe } from '../../../pipes/date-format.pipe'; import { DatetimeFormatPipe } from '../../../pipes/datetime-format.pipe'; import { FormatNumberPipe } from '../../../pipes/format-number.pipe'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; +import { YesnoPipe } from '@pipes/yesno.pipe'; @Component({ selector: 'mifosx-view-journal-entry-transaction', @@ -47,7 +48,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; MatRow, DateFormatPipe, DatetimeFormatPipe, - FormatNumberPipe + FormatNumberPipe, + YesnoPipe ] }) export class ViewJournalEntryTransactionComponent implements OnInit { @@ -76,6 +78,8 @@ export class ViewJournalEntryTransactionComponent implements OnInit { isJournalEntryLoaded = false; + isManualJournalEntry = false; + /** * @param {AccountingService} accountingService Accounting Service. * @param {ActivatedRoute} route Activated Route. @@ -102,6 +106,7 @@ export class ViewJournalEntryTransactionComponent implements OnInit { if (data.transaction.pageItems.length > 0) { this.isJournalEntryLoaded = true; this.transactionId = data.transaction.pageItems[0].transactionId; + this.isManualJournalEntry = data.transaction.pageItems[0].manualEntry; } } else if (this.isViewTransfer()) { this.journalEntriesData = data.transferJournalEntryData.journalEntryData.content; @@ -185,4 +190,11 @@ export class ViewJournalEntryTransactionComponent implements OnInit { goBack(): void { this.location.back(); } + + journalEntryColor(): string { + if (this.isManualJournalEntry) { + return 'manual-entry'; + } + return ''; + } } diff --git a/src/app/system/system.service.ts b/src/app/system/system.service.ts index 48e01bda0..2e62da272 100644 --- a/src/app/system/system.service.ts +++ b/src/app/system/system.service.ts @@ -13,6 +13,8 @@ import { RunJobWithParamPayloadType } from './manage-jobs/scheduler-jobs/custom- providedIn: 'root' }) export class SystemService { + public static CONFIG_ASSET_EXTERNALIZATION = 'asset-externalization-of-non-active-loans'; + emptyPayload: any = {}; /** diff --git a/src/assets/styles/_colours.scss b/src/assets/styles/_colours.scss index 7906ebd23..1fb3a9423 100644 --- a/src/assets/styles/_colours.scss +++ b/src/assets/styles/_colours.scss @@ -84,6 +84,8 @@ $subStatus-contract-termination: #b3b3b3; $error-log: #ffa726; +$manual-entry: #d7e3ff; + .column-mandatory { color: $status-active; text-align: center; diff --git a/src/assets/translations/cs-CS.json b/src/assets/translations/cs-CS.json index ae194fd8b..6a940970c 100644 --- a/src/assets/translations/cs-CS.json +++ b/src/assets/translations/cs-CS.json @@ -1877,6 +1877,7 @@ "Mandatory": "Povinné", "Mandatory Guarantee(%)": "Povinná záruka (%)", "Manual Entries Allowed": "Ruční vkládání povoleno", + "Manual Journal Entry": "Ruční zápis do deníku", "Mapper Key": "Mapper Key", "Mapper Value": "Hodnota mapovače", "Mapping id": "ID mapování", diff --git a/src/assets/translations/de-DE.json b/src/assets/translations/de-DE.json index 8c78abdce..888819366 100644 --- a/src/assets/translations/de-DE.json +++ b/src/assets/translations/de-DE.json @@ -1877,6 +1877,7 @@ "Mandatory": "Obligatorisch", "Mandatory Guarantee(%)": "Obligatorische Garantie (%)", "Manual Entries Allowed": "Manuelle Eingaben erlaubt", + "Manual Journal Entry": "Manuelle Journalbuchung", "Mapper Key": "Mapper-Schlüssel", "Mapper Value": "Mapper-Wert", "Mapping id": "Zuordnungs-ID", diff --git a/src/assets/translations/en-US.json b/src/assets/translations/en-US.json index 4e0f62d82..d82f412a7 100644 --- a/src/assets/translations/en-US.json +++ b/src/assets/translations/en-US.json @@ -1882,6 +1882,7 @@ "Mandatory": "Mandatory", "Mandatory Guarantee(%)": "Mandatory Guarantee(%)", "Manual Entries Allowed": "Manual Entries Allowed", + "Manual Journal Entry": "Manual Journal Entry", "Mapper Key": "Mapper Key", "Mapper Value": "Mapper Value", "Mapping id": "Mapping id", diff --git a/src/assets/translations/es-CL.json b/src/assets/translations/es-CL.json index e18c308e3..98dbd0875 100644 --- a/src/assets/translations/es-CL.json +++ b/src/assets/translations/es-CL.json @@ -1876,6 +1876,7 @@ "Mandatory": "Obligatorio", "Mandatory Guarantee(%)": "Garantía obligatoria(%)", "Manual Entries Allowed": "Permitir Entradas manuales", + "Manual Journal Entry": "Entrada de diario manual", "Mapper Key": "Clave del asignador", "Mapper Value": "Valor del asignador", "Mapping id": "Identificación de mapeo", diff --git a/src/assets/translations/es-MX.json b/src/assets/translations/es-MX.json index 7e9132143..5b624f67f 100644 --- a/src/assets/translations/es-MX.json +++ b/src/assets/translations/es-MX.json @@ -1876,6 +1876,7 @@ "Mandatory": "Obligatorio", "Mandatory Guarantee(%)": "Garantía obligatoria(%)", "Manual Entries Allowed": "Permitir Entradas manuales", + "Manual Journal Entry": "Entrada de diario manual", "Mapper Key": "Clave del asignador", "Mapper Value": "Valor del asignador", "Mapping id": "Identificación de mapeo", diff --git a/src/assets/translations/fr-FR.json b/src/assets/translations/fr-FR.json index 896ca0bf4..1d3b1c92a 100644 --- a/src/assets/translations/fr-FR.json +++ b/src/assets/translations/fr-FR.json @@ -1877,6 +1877,7 @@ "Mandatory": "Obligatoire", "Mandatory Guarantee(%)": "Garantie obligatoire (%)", "Manual Entries Allowed": "Entrées manuelles autorisées", + "Manual Journal Entry": "Écriture de journal manuelle", "Mapper Key": "Clé du mappeur", "Mapper Value": "Valeur du mappeur", "Mapping id": "Identifiant de mappage", diff --git a/src/assets/translations/it-IT.json b/src/assets/translations/it-IT.json index d034232c6..ef9379fdb 100644 --- a/src/assets/translations/it-IT.json +++ b/src/assets/translations/it-IT.json @@ -1877,6 +1877,7 @@ "Mandatory": "Obbligatorio", "Mandatory Guarantee(%)": "Garanzia Obbligatoria(%)", "Manual Entries Allowed": "Inserimenti manuali consentiti", + "Manual Journal Entry": "Registrazione manuale del giornale", "Mapper Key": "Chiave del mappatore", "Mapper Value": "Valore del mappatore", "Mapping id": "ID mappatura", diff --git a/src/assets/translations/ko-KO.json b/src/assets/translations/ko-KO.json index 71f02a4c8..5675821ff 100644 --- a/src/assets/translations/ko-KO.json +++ b/src/assets/translations/ko-KO.json @@ -1878,6 +1878,7 @@ "Mandatory": "필수적인", "Mandatory Guarantee(%)": "의무보증(%)", "Manual Entries Allowed": "수동 입력이 허용됨", + "Manual Journal Entry": "수동 저널 입력", "Mapper Key": "매퍼 키", "Mapper Value": "매퍼 값", "Mapping id": "매핑 ID", diff --git a/src/assets/translations/lt-LT.json b/src/assets/translations/lt-LT.json index 1f7abe192..0076aa65e 100644 --- a/src/assets/translations/lt-LT.json +++ b/src/assets/translations/lt-LT.json @@ -1877,6 +1877,7 @@ "Mandatory": "Privaloma", "Mandatory Guarantee(%)": "Privaloma garantija (%)", "Manual Entries Allowed": "Leidžiami rankiniai įvedimai", + "Manual Journal Entry": "Rankinis žurnalo įrašas", "Mapper Key": "Žemėlapio kūrėjo raktas", "Mapper Value": "Žemėlapio vertė", "Mapping id": "Atvaizdavimo ID", diff --git a/src/assets/translations/lv-LV.json b/src/assets/translations/lv-LV.json index e6257b2d5..41109f1fa 100644 --- a/src/assets/translations/lv-LV.json +++ b/src/assets/translations/lv-LV.json @@ -1877,6 +1877,7 @@ "Mandatory": "Obligāts", "Mandatory Guarantee(%)": "Obligātā garantija (%)", "Manual Entries Allowed": "Manuālas ievades ir atļautas", + "Manual Journal Entry": "Manuālais žurnāla ieraksts", "Mapper Key": "Mapper Key", "Mapper Value": "Kartētāja vērtība", "Mapping id": "Kartēšanas ID", diff --git a/src/assets/translations/ne-NE.json b/src/assets/translations/ne-NE.json index 383bde32b..a19547ae7 100644 --- a/src/assets/translations/ne-NE.json +++ b/src/assets/translations/ne-NE.json @@ -1877,6 +1877,7 @@ "Mandatory": "अनिवार्य", "Mandatory Guarantee(%)": "अनिवार्य ग्यारेन्टी (%)", "Manual Entries Allowed": "म्यानुअल प्रविष्टिहरूलाई अनुमति दिइएको छ", + "Manual Journal Entry": "म्यानुअल जर्नल प्रविष्टि", "Mapper Key": "म्यापर कुञ्जी", "Mapper Value": "म्यापर मान", "Mapping id": "म्यापिङ आईडी", diff --git a/src/assets/translations/pt-PT.json b/src/assets/translations/pt-PT.json index 857f7618b..c907f3f33 100644 --- a/src/assets/translations/pt-PT.json +++ b/src/assets/translations/pt-PT.json @@ -1877,6 +1877,7 @@ "Mandatory": "Obrigatório", "Mandatory Guarantee(%)": "Garantia Obrigatória(%)", "Manual Entries Allowed": "Entradas manuais permitidas", + "Manual Journal Entry": "Lançamento Manual de Diário", "Mapper Key": "Chave do mapeador", "Mapper Value": "Valor do mapeador", "Mapping id": "ID de mapeamento", diff --git a/src/assets/translations/sw-SW.json b/src/assets/translations/sw-SW.json index a4ccaca67..eb82db30e 100644 --- a/src/assets/translations/sw-SW.json +++ b/src/assets/translations/sw-SW.json @@ -1877,6 +1877,7 @@ "Mandatory": "Lazima", "Mandatory Guarantee(%)": "Dhamana ya Lazima(%)", "Manual Entries Allowed": "Maingizo Mwongozo Yanaruhusiwa", + "Manual Journal Entry": "Kuingia kwa Jarida kwa Mwongozo", "Mapper Key": "Ufunguo wa ramani", "Mapper Value": "Thamani ya ramani", "Mapping id": "Kitambulisho cha ramani",