Merge pull request #2526 from alberto-art3ch/enhancement/manual_journal_entry_with_asset_external_owner
WEB-220: Extend Manual Journal entry to support Asset Externalization
This commit is contained in:
@@ -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 {}
|
||||
|
||||
@@ -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<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getConfigurationByName(SystemService.CONFIG_ASSET_EXTERNALIZATION);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-48">
|
||||
<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">
|
||||
@@ -29,6 +29,11 @@
|
||||
</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>
|
||||
|
||||
<div
|
||||
class="flex-fill layout-row-wrap responsive-column"
|
||||
formArrayName="debits"
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import {
|
||||
UntypedFormGroup,
|
||||
UntypedFormBuilder,
|
||||
Validators,
|
||||
UntypedFormArray,
|
||||
ReactiveFormsModule
|
||||
} from '@angular/forms';
|
||||
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormArray, UntypedFormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Services */
|
||||
@@ -54,6 +48,9 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
paymentTypeData: any;
|
||||
/** Gl Account data. */
|
||||
glAccountData: any;
|
||||
/** Asset Externalization */
|
||||
assetExternalizationConfig: any;
|
||||
assetExternalizationEnabled = false;
|
||||
|
||||
/* Reference of create journal form */
|
||||
@ViewChild('createJournalFormRef') createJournalFormRef: ElementRef<any>;
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+17
-1
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
|
||||
<div class="container m-b-20" *ngIf="isViewTransaction()">
|
||||
<mat-card class="mat-elevation-z8" *ngIf="dataSource">
|
||||
<mat-card class="mat-elevation-z8" ngClass="{{ journalEntryColor() }}" *ngIf="dataSource">
|
||||
<mat-card-content>
|
||||
<div class="layout-row-wrap">
|
||||
<div class="flex-25 header">
|
||||
@@ -49,6 +49,22 @@
|
||||
<div class="flex-25">
|
||||
{{ dataSource.data[0].submittedOnDate | datetimeFormat }}
|
||||
</div>
|
||||
|
||||
<div class="flex-25 header">
|
||||
{{ 'labels.inputs.Manual Journal Entry' | translate }}
|
||||
</div>
|
||||
|
||||
<div class="flex-25">
|
||||
{{ dataSource.data[0].manualEntry | yesNo }}
|
||||
</div>
|
||||
|
||||
<div class="flex-25 header" *ngIf="dataSource.data[0].externalAssetOwner">
|
||||
{{ 'labels.inputs.External Asset Owner' | translate }}
|
||||
</div>
|
||||
|
||||
<div class="flex-25" *ngIf="dataSource.data[0].externalAssetOwner">
|
||||
{{ dataSource.data[0].externalAssetOwner }}
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
+7
@@ -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;
|
||||
}
|
||||
|
||||
+13
-1
@@ -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 '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user