diff --git a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html
index 6839cd8fc0..2fe989ca58 100644
--- a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html
+++ b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html
@@ -53,6 +53,21 @@
[inputLabel]="'Discount'"
>
+
+ @if (disbursementLoanForm.controls.discountAmount.value > 0) {
+
+ {{ 'labels.inputs.Discount External Id' | translate }}
+
+ @if (disbursementLoanForm.controls.discountExternalId.hasError('maxlength')) {
+ {{ 'labels.inputs.External Id is too long' | translate }}
+ }
+
+ @if (disbursementLoanForm.hasError('discountExternalIdEqualsExternalId')) {
+
+ {{ 'labels.inputs.Discount External Id must differ from External Id' | translate }}
+
+ }
+ }
}
diff --git a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
index 54b8e65422..89a24d96bb 100644
--- a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
@@ -7,7 +7,8 @@
*/
/** Angular Imports */
-import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core';
+import { ChangeDetectionStrategy, Component, DestroyRef, OnInit, inject } from '@angular/core';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl } from '@angular/forms';
/** Custom Services */
@@ -39,6 +40,7 @@ import { LoanAccountActionsBaseComponent } from '../loan-account-actions-base.co
export class DisburseComponent extends LoanAccountActionsBaseComponent implements OnInit {
private formBuilder = inject(UntypedFormBuilder);
private dateUtils = inject(Dates);
+ private destroyRef = inject(DestroyRef);
/** Payment Type Options */
paymentTypes: any;
@@ -53,6 +55,7 @@ export class DisburseComponent extends LoanAccountActionsBaseComponent implement
/** Disbursement Loan Form */
disbursementLoanForm!: UntypedFormGroup;
currency!: Currency;
+ readonly maxExternalIdLength = 100;
constructor() {
super();
@@ -90,6 +93,23 @@ export class DisburseComponent extends LoanAccountActionsBaseComponent implement
});
if (this.isWorkingCapital) {
this.disbursementLoanForm.addControl('discountAmount', new UntypedFormControl());
+ this.disbursementLoanForm.addControl(
+ 'discountExternalId',
+ new UntypedFormControl('', Validators.maxLength(this.maxExternalIdLength))
+ );
+ this.disbursementLoanForm.setValidators((group) => {
+ const a = group.get('externalId')?.value;
+ const b = group.get('discountExternalId')?.value;
+ return a && b && a === b ? { discountExternalIdEqualsExternalId: true } : null;
+ });
+ this.disbursementLoanForm
+ .get('discountAmount')!
+ .valueChanges.pipe(takeUntilDestroyed(this.destroyRef))
+ .subscribe((value) => {
+ if (value == null || value === '' || Number(value) <= 0) {
+ this.disbursementLoanForm.get('discountExternalId')!.setValue('');
+ }
+ });
}
}
diff --git a/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html b/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html
index 5b842b95db..30a9e766de 100644
--- a/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html
+++ b/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html
@@ -19,6 +19,14 @@
>
+
+ {{ 'labels.inputs.External Id' | translate }}
+
+ @if (updateDiscountForm.controls.externalId.hasError('maxlength')) {
+ {{ 'labels.inputs.External Id is too long' | translate }}
+ }
+
+
{{ 'labels.inputs.Note' | translate }}
diff --git a/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts b/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts
index 6d7ca1ecad..c98e9e94aa 100644
--- a/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts
@@ -43,6 +43,7 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
private translateService = inject(TranslateService);
readonly maxNoteLength = 500;
+ readonly maxExternalIdLength = 100;
currency: Currency | null = null;
disbursementTransactionId: number = 0;
@@ -68,6 +69,10 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
amountValueValidator()
]
],
+ externalId: [
+ '',
+ Validators.maxLength(this.maxExternalIdLength)
+ ],
note: [
'',
Validators.maxLength(this.maxNoteLength)
@@ -86,6 +91,7 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
const payload: WorkingCapitalLoanDiscountUpdateRequest = {
transactionAmount: Number(formValue.transactionAmount),
relatedResourceId: this.disbursementTransactionId,
+ externalId: formValue.externalId,
note: formValue.note,
locale: this.settingsService.language.code,
dateFormat: this.settingsService.dateFormat
diff --git a/src/app/loans/loans.service.ts b/src/app/loans/loans.service.ts
index adf01d36a4..11349e53d8 100644
--- a/src/app/loans/loans.service.ts
+++ b/src/app/loans/loans.service.ts
@@ -19,6 +19,7 @@ import { DisbursementData } from './models/loan-account.model';
export interface WorkingCapitalLoanDiscountUpdateRequest {
transactionAmount: number;
relatedResourceId: number;
+ externalId?: string;
note?: string;
locale: string;
dateFormat: string;
diff --git a/src/assets/translations/cs-CS.json b/src/assets/translations/cs-CS.json
index 5356adaa2d..14bd4ee74a 100644
--- a/src/assets/translations/cs-CS.json
+++ b/src/assets/translations/cs-CS.json
@@ -1958,6 +1958,8 @@
"Disbursement on": "Výplata zapnuta",
"Discount": "Sleva",
"Discount Default": "Výchozí sleva",
+ "Discount External Id": "Externí id slevy",
+ "Discount External Id must differ from External Id": "Externí id slevy se musí lišit od externího id",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Sleva musí být větší nebo rovna 0",
"Display Name": "Zobrazovaný název",
@@ -2052,6 +2054,7 @@
"External ID not found": "Externí ID nenalezeno",
"External ID verified successfully": "Externí ID úspěšně ověřeno",
"External Id": "Externí id",
+ "External Id is too long": "Externí id je příliš dlouhé",
"External Reference ID": "Externí referenční ID",
"External id": "Externí id",
"FAMILY MEMBERS": "ČLENOVÉ RODINY",
diff --git a/src/assets/translations/de-DE.json b/src/assets/translations/de-DE.json
index 0d96e0e1ff..ef3a142573 100644
--- a/src/assets/translations/de-DE.json
+++ b/src/assets/translations/de-DE.json
@@ -1960,6 +1960,8 @@
"Disbursement on": "Auszahlung am",
"Discount": "Rabatt",
"Discount Default": "Standardrabatt",
+ "Discount External Id": "Rabatt externe ID",
+ "Discount External Id must differ from External Id": "Rabatt externe ID muss sich von externer ID unterscheiden",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Der Rabatt muss größer oder gleich 0 sein",
"Display Name": "Anzeigename",
@@ -2054,6 +2056,7 @@
"External ID not found": "Externe ID nicht gefunden",
"External ID verified successfully": "Externe ID erfolgreich verifiziert",
"External Id": "Externe ID",
+ "External Id is too long": "Externe ID ist zu lang",
"External Reference ID": "Externe Referenz-ID",
"External id": "Externe ID",
"FAMILY MEMBERS": "FAMILIENMITGLIEDER",
diff --git a/src/assets/translations/en-US.json b/src/assets/translations/en-US.json
index 23fb742920..3e1c37612d 100644
--- a/src/assets/translations/en-US.json
+++ b/src/assets/translations/en-US.json
@@ -1963,6 +1963,8 @@
"Disbursement on": "Disbursement on",
"Discount": "Discount",
"Discount Default": "Discount Default",
+ "Discount External Id": "Discount External Id",
+ "Discount External Id must differ from External Id": "Discount External Id must differ from External Id",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Discount must be greater than or equal to 0",
"Display Name": "Display Name",
@@ -2054,6 +2056,7 @@
"External ID not found": "External ID not found",
"External ID verified successfully": "External ID verified successfully",
"External Id": "External Id",
+ "External Id is too long": "External Id is too long",
"External Reference ID": "External Reference ID",
"External id": "External id",
"FAMILY MEMBERS": "FAMILY MEMBERS",
diff --git a/src/assets/translations/es-CL.json b/src/assets/translations/es-CL.json
index a1fc839819..fc55c20395 100644
--- a/src/assets/translations/es-CL.json
+++ b/src/assets/translations/es-CL.json
@@ -1958,6 +1958,8 @@
"Disbursement on": "Curso en",
"Discount": "Descuento",
"Discount Default": "Descuento predeterminado",
+ "Discount External Id": "Id externo del descuento",
+ "Discount External Id must differ from External Id": "El Id externo del descuento debe ser distinto del Id externo",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "El descuento debe ser mayor o igual a 0",
"Display Name": "Nombre para mostrar",
@@ -2052,6 +2054,7 @@
"External ID not found": "Id externo no encontrado",
"External ID verified successfully": "Id externo verificado exitosamente",
"External Id": "Id externo",
+ "External Id is too long": "El Id externo es demasiado largo",
"External Reference ID": "ID de Referencia Externa",
"External id": "Id externo",
"FAMILY MEMBERS": "MIEMBROS DE LA FAMILIA",
diff --git a/src/assets/translations/es-MX.json b/src/assets/translations/es-MX.json
index 21b9a02035..38c87b6f68 100644
--- a/src/assets/translations/es-MX.json
+++ b/src/assets/translations/es-MX.json
@@ -1960,6 +1960,8 @@
"Disbursement on": "Fecha de Desembolso",
"Discount": "Descuento",
"Discount Default": "Descuento predeterminado",
+ "Discount External Id": "Id externo del descuento",
+ "Discount External Id must differ from External Id": "El Id externo del descuento debe ser distinto del Id externo",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "El descuento debe ser mayor o igual a 0",
"Display Name": "Nombre para mostrar",
@@ -2050,6 +2052,7 @@
"External ID not found": "Id externo no encontrado",
"External ID verified successfully": "Id externo verificado exitosamente",
"External Id": "Id externo",
+ "External Id is too long": "El Id externo es demasiado largo",
"External Reference ID": "ID de Referencia Externa",
"External id": "Id externo",
"FAMILY MEMBERS": "REFERENCIAS PERSONALES",
diff --git a/src/assets/translations/fr-FR.json b/src/assets/translations/fr-FR.json
index b0eba61a98..ab5ee1eeea 100644
--- a/src/assets/translations/fr-FR.json
+++ b/src/assets/translations/fr-FR.json
@@ -1961,6 +1961,8 @@
"Disbursement on": "Décaissement le",
"Discount": "Rabais",
"Discount Default": "Remise par défaut",
+ "Discount External Id": "Identifiant externe du rabais",
+ "Discount External Id must differ from External Id": "L'identifiant externe du rabais doit être différent de l'identifiant externe",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "La rabais doit être supérieure ou égale à 0",
"Display Name": "Afficher un nom",
@@ -2055,6 +2057,7 @@
"External ID not found": "ID externe introuvable",
"External ID verified successfully": "ID externe vérifié avec succès",
"External Id": "Identifiant externe",
+ "External Id is too long": "L'identifiant externe est trop long",
"External Reference ID": "ID de référence externe",
"External id": "Identifiant externe",
"FAMILY MEMBERS": "MEMBRES DE LA FAMILLE",
diff --git a/src/assets/translations/it-IT.json b/src/assets/translations/it-IT.json
index ff85d0572b..d00d256557 100644
--- a/src/assets/translations/it-IT.json
+++ b/src/assets/translations/it-IT.json
@@ -1958,6 +1958,8 @@
"Disbursement on": "Erogazione in corso",
"Discount": "Sconto",
"Discount Default": "Sconto predefinito",
+ "Discount External Id": "ID esterno dello sconto",
+ "Discount External Id must differ from External Id": "L'ID esterno dello sconto deve essere diverso dall'ID esterno",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Lo sconto deve essere maggiore o uguale a 0",
"Display Name": "Nome da visualizzare",
@@ -2052,6 +2054,7 @@
"External ID not found": "ID esterno non trovato",
"External ID verified successfully": "ID esterno verificato con successo",
"External Id": "ID esterno",
+ "External Id is too long": "L'ID esterno è troppo lungo",
"External Reference ID": "ID di riferimento esterno",
"External id": "Identificativo esterno",
"FAMILY MEMBERS": "MEMBRI DELLA FAMIGLIA",
diff --git a/src/assets/translations/ko-KO.json b/src/assets/translations/ko-KO.json
index 8385f27bc5..16c1132287 100644
--- a/src/assets/translations/ko-KO.json
+++ b/src/assets/translations/ko-KO.json
@@ -1959,6 +1959,8 @@
"Disbursement on": "지불 날짜",
"Discount": "할인",
"Discount Default": "할인 기본값",
+ "Discount External Id": "할인 외부 ID",
+ "Discount External Id must differ from External Id": "할인 외부 ID는 외부 ID와 달라야 합니다",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "할인은 0 이상이어야 합니다",
"Display Name": "이름 표시하기",
@@ -2053,6 +2055,7 @@
"External ID not found": "외부 ID를 찾을 수 없습니다",
"External ID verified successfully": "외부 ID가 성공적으로 확인되었습니다",
"External Id": "외부 ID",
+ "External Id is too long": "외부 ID가 너무 깁니다",
"External Reference ID": "외부 참조 ID",
"External id": "외부 ID",
"FAMILY MEMBERS": "가족 구성원들",
diff --git a/src/assets/translations/lt-LT.json b/src/assets/translations/lt-LT.json
index 4d5fa25a88..9c5557a48a 100644
--- a/src/assets/translations/lt-LT.json
+++ b/src/assets/translations/lt-LT.json
@@ -1957,6 +1957,8 @@
"Disbursement on": "Išmokėjimas įjungtas",
"Discount": "Nuolaida",
"Discount Default": "Numatytoji nuolaida",
+ "Discount External Id": "Nuolaidos išorinis ID",
+ "Discount External Id must differ from External Id": "Nuolaidos išorinis ID turi skirtis nuo išorinio ID",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Nuolaida turi būti didesnė arba lygi 0",
"Display Name": "Rodomas pavadinimas",
@@ -2051,6 +2053,7 @@
"External ID not found": "Išorinis ID nerastas",
"External ID verified successfully": "Išorinis ID sėkmingai patvirtintas",
"External Id": "Išorinis ID",
+ "External Id is too long": "Išorinis ID per ilgas",
"External Reference ID": "Išorinis nuorodos ID",
"External id": "Išorinis id",
"FAMILY MEMBERS": "ŠEIMOS NARIAI",
diff --git a/src/assets/translations/lv-LV.json b/src/assets/translations/lv-LV.json
index 582741b41d..dfcf30bcc4 100644
--- a/src/assets/translations/lv-LV.json
+++ b/src/assets/translations/lv-LV.json
@@ -1958,6 +1958,8 @@
"Disbursement on": "Izmaksa ieslēgta",
"Discount": "Atlaide",
"Discount Default": "Atlaides noklusējuma vērtība",
+ "Discount External Id": "Atlaides ārējais ID",
+ "Discount External Id must differ from External Id": "Atlaides ārējam ID jāatšķiras no ārējā ID",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Atlaidei jābūt lielākai vai vienādai ar 0",
"Display Name": "Parādāmais nosaukums",
@@ -2052,6 +2054,7 @@
"External ID not found": "Ārējais ID nav atrasts",
"External ID verified successfully": "Ārējais ID veiksmīgi verificēts",
"External Id": "Ārējais ID",
+ "External Id is too long": "Ārējais ID ir pārāk garš",
"External Reference ID": "Ārējais atsauces ID",
"External id": "Ārējais id",
"FAMILY MEMBERS": "ĢIMENES LOCEKĻI",
diff --git a/src/assets/translations/ne-NE.json b/src/assets/translations/ne-NE.json
index 08af18fc47..c811f5d638 100644
--- a/src/assets/translations/ne-NE.json
+++ b/src/assets/translations/ne-NE.json
@@ -1957,6 +1957,8 @@
"Disbursement on": "वितरण जारी छ",
"Discount": "छुट",
"Discount Default": "छुट पूर्वनिर्धारित",
+ "Discount External Id": "छुटको बाह्य आईडी",
+ "Discount External Id must differ from External Id": "छुटको बाह्य आईडी बाह्य आईडी भन्दा फरक हुनुपर्छ",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "छुट ० वा त्योभन्दा बढी हुनुपर्छ",
"Display Name": "प्रदर्शन नाम",
@@ -2051,6 +2053,7 @@
"External ID not found": "बाह्य आईडी फेला परेन",
"External ID verified successfully": "बाह्य आईडी सफलतापूर्वक प्रमाणित भयो",
"External Id": "बाह्य आईडी",
+ "External Id is too long": "बाह्य आईडी धेरै लामो छ",
"External Reference ID": "बाह्य सन्दर्भ ID",
"External id": "बाह्य आईडी",
"FAMILY MEMBERS": "परिवारका सदस्यहरु",
diff --git a/src/assets/translations/pt-PT.json b/src/assets/translations/pt-PT.json
index 20be5e4da1..1aa13aeeb8 100644
--- a/src/assets/translations/pt-PT.json
+++ b/src/assets/translations/pt-PT.json
@@ -1957,6 +1957,8 @@
"Disbursement on": "Desembolso em",
"Discount": "Desconto",
"Discount Default": "Desconto padrão",
+ "Discount External Id": "ID externo do desconto",
+ "Discount External Id must differ from External Id": "O ID externo do desconto deve ser diferente do ID externo",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "O desconto deve ser maior ou igual a 0",
"Display Name": "Nome de exibição",
@@ -2051,6 +2053,7 @@
"External ID not found": "ID externo não encontrado",
"External ID verified successfully": "ID externo verificado com sucesso",
"External Id": "ID externo",
+ "External Id is too long": "O ID externo é demasiado longo",
"External Reference ID": "ID de referência externa",
"External id": "ID externo",
"FAMILY MEMBERS": "MEMBROS DA FAMÍLIA",
diff --git a/src/assets/translations/sw-SW.json b/src/assets/translations/sw-SW.json
index fbbaadec20..1f013a09d0 100644
--- a/src/assets/translations/sw-SW.json
+++ b/src/assets/translations/sw-SW.json
@@ -1955,6 +1955,8 @@
"Disbursement on": "Ulipaji umewashwa",
"Discount": "Punguzo",
"Discount Default": "Punguzo Chaguomsingi",
+ "Discount External Id": "Kitambulisho cha Nje cha Punguzo",
+ "Discount External Id must differ from External Id": "Kitambulisho cha Nje cha Punguzo lazima kitofautiane na Kitambulisho cha Nje",
"Discount Factor": "Discount Factor",
"Discount must be greater than or equal to 0": "Punguzo lazima liwe kubwa au sawa na 0",
"Display Name": "Jina la Kuonyesha",
@@ -2049,6 +2051,7 @@
"External ID not found": "Kitambulisho cha Nje hakijapatikana",
"External ID verified successfully": "Kitambulisho cha Nje kimethibitishwa kwa mafanikio",
"External Id": "Kitambulisho cha Nje",
+ "External Id is too long": "Kitambulisho cha Nje ni kirefu mno",
"External Reference ID": "Kitambulisho cha kumbukumbu ya nje",
"External id": "Kitambulisho cha nje",
"FAMILY MEMBERS": "WANAFAMILIA",