Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@
[inputLabel]="'Discount'"
>
</mifosx-input-amount>

@if (disbursementLoanForm.controls.discountAmount.value > 0) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Discount External Id' | translate }}</mat-label>
<input matInput formControlName="discountExternalId" />
@if (disbursementLoanForm.controls.discountExternalId.hasError('maxlength')) {
<mat-error>{{ 'labels.inputs.External Id is too long' | translate }}</mat-error>
}
</mat-form-field>
@if (disbursementLoanForm.hasError('discountExternalIdEqualsExternalId')) {
<mat-error>
{{ 'labels.inputs.Discount External Id must differ from External Id' | translate }}
</mat-error>
}
}
}

<mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand All @@ -53,6 +55,7 @@ export class DisburseComponent extends LoanAccountActionsBaseComponent implement
/** Disbursement Loan Form */
disbursementLoanForm!: UntypedFormGroup;
currency!: Currency;
readonly maxExternalIdLength = 100;

constructor() {
super();
Expand Down Expand Up @@ -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('');
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
>
</mifosx-input-amount>

<mat-form-field>
<mat-label>{{ 'labels.inputs.External Id' | translate }}</mat-label>
<input matInput formControlName="externalId" />
@if (updateDiscountForm.controls.externalId.hasError('maxlength')) {
<mat-error>{{ 'labels.inputs.External Id is too long' | translate }}</mat-error>
}
</mat-form-field>

<mat-form-field>
<mat-label>{{ 'labels.inputs.Note' | translate }}</mat-label>
<textarea matInput formControlName="note" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -68,6 +69,10 @@ export class UpdateDiscountComponent extends LoanAccountActionsBaseComponent imp
amountValueValidator()
]
],
externalId: [
'',
Validators.maxLength(this.maxExternalIdLength)
],
note: [
'',
Validators.maxLength(this.maxNoteLength)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/app/loans/loans.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/cs-CS.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/es-CL.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/ko-KO.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "이름 표시하기",
Expand Down Expand Up @@ -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": "가족 구성원들",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/lt-LT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/lv-LV.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/ne-NE.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "प्रदर्शन नाम",
Expand Down Expand Up @@ -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": "परिवारका सदस्यहरु",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/translations/sw-SW.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading