Skip to content

Commit

Permalink
Share Product and Share Account views updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Alberto Hernandez authored and alberto-art3ch committed May 19, 2024
1 parent fafdd0d commit a41df49
Show file tree
Hide file tree
Showing 83 changed files with 1,017 additions and 544 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ <h3>{{"labels.inputs.Shares Accounts" | translate}}</h3>

<tr mat-header-row *matHeaderRowDef="openSharesColumns"></tr>
<tr mat-row *matRowDef="let row; columns: openSharesColumns;"
[routerLink]="['../', 'shares-accounts', row.id, 'transactions']"></tr>
[routerLink]="['../', 'shares-accounts', row.id, 'general']"></tr>

</table>

Expand Down Expand Up @@ -640,7 +640,7 @@ <h3>{{"labels.inputs.Shares Accounts" | translate}}</h3>
</ng-container>

<tr mat-header-row *matHeaderRowDef="closedSharesColumns"></tr>
<tr mat-row *matRowDef="let row; columns: closedSharesColumns;" [routerLink]="['../', 'shares-accounts', row.id, 'transactions']"></tr>
<tr mat-row *matRowDef="let row; columns: closedSharesColumns;" [routerLink]="['../', 'shares-accounts', row.id, 'general']"></tr>

</table>

Expand Down
8 changes: 6 additions & 2 deletions src/app/core/utils/accounting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import { OptionData } from 'app/shared/models/option-data.model';

@Injectable({
providedIn: 'root'
})
export class Accounting {
})
export class Accounting {

public getAccountingRulesForShares(): string[] {
return ['NONE', 'Cash'];
}

public getAccountingRulesForSavings(): string[] {
return ['NONE', 'Cash', 'Accrual (periodic)'];
Expand Down
19 changes: 19 additions & 0 deletions src/app/core/utils/charges.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Injectable } from '@angular/core';
import { OptionData } from 'app/shared/models/option-data.model';


@Injectable({
providedIn: 'root'
})
export class Charges {

public getChargeAppliesToOptions(): OptionData[] {
return [
{ 'id': 1, 'code': 'chargeAppliesTo.loan', 'value': 'Loan' },
{ 'id': 2, 'code': 'chargeAppliesTo.savings', 'value': 'Savings' },
{ 'id': 3, 'code': 'chargeAppliesTo.client', 'value': 'Client' },
{ 'id': 4, 'code': 'chargeAppliesTo.shares', 'value': 'Shares' }
];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h4 class="table-headers">{{"labels.inputs.Account Details" | translate }}</h4>
</span></td>
</tr>
<tr *ngIf="recurringDepositsAccountData.minBalanceForInterestCalculation">
<td> {{"labels.inputs.Balance Required For Interest Calculation" | translate }}</td>
<td> {{"labels.inputs.Balance Required for Interest Calculation" | translate }}</td>
<td><span>{{recurringDepositsAccountData.minBalanceForInterestCalculation}}</span></td>
</tr>
<tr *ngIf="recurringDepositsAccountData.witdHoldTax">
Expand Down Expand Up @@ -166,7 +166,7 @@ <h4 class="table-headers">{{"labels.heading.Performance History" | translate }}<
</td>
</tr>
<tr *ngIf="recurringDepositsAccountData.minBalanceForInterestCalculation">
<td> {{"labels.inputs.Balance Required For Interest Calculation" | translate }} </td>
<td> {{"labels.inputs.Balance Required for Interest Calculation" | translate }} </td>
<td class="r-amount">
<span>{{ recurringDepositsAccountData.minBalanceForInterestCalculation | number }}</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ <h3 class="mat-h3" fxFlexFill>{{"labels.heading.Terms" | translate}}</h3>
fxFlex="60%">{{ loansAccount.transactionProcessingStrategyCode | find:loansAccountProductTemplate.transactionProcessingStrategyOptions:'code':'name' }}</span>
</div>

<div fxFlexFill>
<span fxFlex="40%"> {{"labels.inputs.Installment Amount" | translate}} </span>
<span fxFlex="60%"> {{ loansAccount.fixedEmiAmount | formatNumber }} </span>
</div>

<div fxFlexFill>
<span fxFlex="40%"> {{"labels.inputs.Balloon Repayment Amount" | translate}} </span>
<span fxFlex="60%"> {{ loansAccount.balloonRepaymentAmount | formatNumber }} </span>
</div>

<h3 class="mat-h3" fxFlexFill>{{"labels.heading.Moratorium" | translate}}</h3>

<mat-divider fxFlexFill></mat-divider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ <h4 fxFlex="98%" class="mat-h4">{{"labels.inputs.Loan Schedule" | translate}}</h
</mat-error>
</mat-form-field>

<mat-form-field fxFlex="48%" *ngIf="loansAccountTermsData?.canDefineInstallmentAmount">
<mat-label>{{"labels.inputs.Installment Amount" | translate}}</mat-label>
<input type="number" matInput formControlName="fixedEmiAmount">
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Balloon Repayment Amount" | translate}}</mat-label>
<input type="number" matInput formControlName="balloonRepaymentAmount">
</mat-form-field>

<h4 fxFlex="98%" class="mat-h4">{{"labels.heading.Interest Calculations" | translate}}</h4>

<mat-form-field fxFlex="48%">
Expand Down Expand Up @@ -280,11 +290,6 @@ <h4 fxFlex="98%" class="mat-h4">{{"labels.heading.Moratorium" | translate}} <i c

</ng-container>

<mat-form-field fxFlex="48%" *ngIf="loansAccountTermsData?.canDefineInstallmentAmount">
<mat-label>{{"labels.inputs.Installment Amount" | translate}}</mat-label>
<input type="number" matInput formControlName="fixedEmiAmount">
</mat-form-field>

<mat-divider fxFlex="98%"></mat-divider>

<div fxFlexFill>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
'transactionProcessingStrategyCode': this.loansAccountTermsData.transactionProcessingStrategyCode,
'interestRateDifferential': this.loansAccountTermsData.interestRateDifferential,
'multiDisburseLoan': this.loansAccountTermsData.multiDisburseLoan,
'interestRateFrequencyType': this.loansAccountTermsData.interestRateFrequencyType.id
'interestRateFrequencyType': this.loansAccountTermsData.interestRateFrequencyType.id,
'balloonRepaymentAmount': this.loansAccountTermsData.balloonRepaymentAmount,
});

this.setAdvancedPaymentStrategyControls();
Expand Down Expand Up @@ -237,7 +238,8 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
'transactionProcessingStrategyCode': this.loansAccountTermsData.transactionProcessingStrategyCode,
'interestRateDifferential': this.loansAccountTermsData.interestRateDifferential,
'multiDisburseLoan': this.loansAccountTermsData.multiDisburseLoan,
'interestRateFrequencyType': this.loansAccountTermsData.interestRateFrequencyType.id
'interestRateFrequencyType': this.loansAccountTermsData.interestRateFrequencyType.id,
'balloonRepaymentAmount': this.loansAccountTermsData.balloonRepaymentAmount
});
}
this.createloansAccountTermsForm();
Expand Down Expand Up @@ -357,7 +359,8 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
'interestRateDifferential': [''],
'transactionProcessingStrategyCode': ['', Validators.required],
'multiDisburseLoan': [false],
'interestRateFrequencyType': ['']
'interestRateFrequencyType': [''],
'balloonRepaymentAmount': ['']
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ <h3> {{"labels.heading.Loan Purpose" | translate}} </h3>
<span fxFlex="50%">{{ loanDetails.principal | currency:currencyCode:'symbol-narrow':'1.2-2' }}</span>
</div>

<div fxFlexFill *ngIf="loanDetails.balloonRepaymentAmount > 0">
<span fxFlex="50%">{{"labels.inputs.Balloon Repayment Amount" | translate}}:</span>
<span fxFlex="50%">{{ loanDetails.balloonRepaymentAmount | currency:currencyCode:'symbol-narrow':'1.2-2' }}</span>
</div>

<div fxFlexFill>
<span fxFlex="50%">{{"labels.inputs.Arrears By" | translate}}:</span>
<span fxFlex="50%">{{"labels.inputs.Not Provided" | translate}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
h3 {
margin: 1% auto;
}

.performance-history-container {
border: 1px solid;
padding: 1%;
Expand All @@ -19,4 +20,4 @@

span {
margin: 0.5em 0;
}
}
50 changes: 35 additions & 15 deletions src/app/products/charges/charges.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@
<div class="container">

<div #filter fxLayout="row" fxLayoutGap="20px">
<mat-form-field fxFlex>
<mat-form-field fxFlex fxFlex="68%">
<mat-label>{{'labels.inputs.Filter' | translate}}</mat-label>
<input matInput (keyup)="applyFilter($event.target.value)">
</mat-form-field>
<mat-form-field fxFlex fxFlex="28%">
<mat-select placeholder="{{'labels.inputs.Filter' | translate}}" (selectionChange)="filterByAppliesTo($event.value)">
<mat-option *ngFor="let chargeAppliesTo of chargeAppliesToOptions" [value]="chargeAppliesTo.id">
{{ chargeAppliesTo.value | translateCatalog }}
</mat-option>
</mat-select>
</mat-form-field>
</div>

<div #chargesTable class="mat-elevation-z8">
Expand Down Expand Up @@ -46,18 +53,23 @@
</ng-container>

<ng-container matColumnDef="penalty">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.commons.Is" | translate}} {{"labels.inputs.Penalty" | translate}}? </th>
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.commons.Is" | translate}}
{{"labels.inputs.Penalty" | translate}}? </th>
<td mat-cell *matCellDef="let charge" class="center">
<fa-icon *ngIf="charge.penalty" icon="check-circle" size="lg" class="ispenalty" matTooltip="Yes" matTooltipPosition="right"></fa-icon>
<fa-icon *ngIf="!charge.penalty" icon="times-circle" size="lg" class="nopenalty" matTooltip="No" matTooltipPosition="right"></fa-icon>
<fa-icon *ngIf="charge.penalty" icon="check-circle" size="lg" class="ispenalty" matTooltip="Yes"
matTooltipPosition="right"></fa-icon>
<fa-icon *ngIf="!charge.penalty" icon="times-circle" size="lg" class="nopenalty" matTooltip="No"
matTooltipPosition="right"></fa-icon>
</td>
</ng-container>

<ng-container matColumnDef="active">
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.commons.Is" | translate}} {{"labels.status.Active" | translate}}? </th>
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.commons.Is" | translate}}
{{"labels.status.Active" | translate}}? </th>
<td mat-cell *matCellDef="let charge" class="center">
<div [className]="charge.active === true ? 'true' : 'false'">
<fa-icon matTooltip="{{ charge.active === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
<fa-icon matTooltip="{{ charge.active === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right"
icon="circle" size="lg"></fa-icon>
</div>
</td>
</ng-container>
Expand All @@ -77,26 +89,34 @@
<h2>{{"labels.text.Create Charge" | translate}}</h2>
<p class="mw300">{{"labels.text.Supports Loan charges, Savings & deposits" | translate}}</p>
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="warn"
(click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary" (click)="popover.close();previousStep()">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateFilter,filter, 'bottom', true)">Next</button>
<button mat-raised-button color="primary"
(click)="popover.close();showPopover(templateFilter,filter, 'bottom', true)">Next</button>
</div>
</ng-template>

<ng-template #templateFilter let-popover="popover">
<h4>{{"labels.heading.Search bar to filter charges." | translate}}</h4>
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateButtonCreateCharge,buttonCreateCharge , 'bottom', true)">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateChargesTable,chargesTable, 'top', true)">Next</button>
<button mat-raised-button color="warn"
(click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary"
(click)="popover.close();showPopover(templateButtonCreateCharge,buttonCreateCharge , 'bottom', true)">Back</button>
<button mat-raised-button color="primary"
(click)="popover.close();showPopover(templateChargesTable,chargesTable, 'top', true)">Next</button>
</div>
</ng-template>

<ng-template #templateChargesTable let-popover="popover">
<h4 class="mw300">{{"labels.heading.List of charges in the organization. For more details click" | translate}}: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/72908813/Charges" target="_blank">Charges</a></h4>
<h4 class="mw300">{{"labels.heading.List of charges in the organization. For more details click" | translate}}: <a
href="https://mifosforge.jira.com/wiki/spaces/docs/pages/72908813/Charges" target="_blank">Charges</a></h4>
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateFilter,filter, 'bottom', true)">Back</button>
<button mat-raised-button color="warn"
(click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary"
(click)="popover.close();showPopover(templateFilter,filter, 'bottom', true)">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
</div>
</ng-template>
</ng-template>
20 changes: 18 additions & 2 deletions src/app/products/charges/charges.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { of } from 'rxjs';
/** Custom Services */
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
import { Charges } from 'app/core/utils/charges';
import { OptionData } from 'app/shared/models/option-data.model';
import { Charge } from './models/charge.model';

/**
* Charges component.
Expand All @@ -23,7 +26,7 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
export class ChargesComponent implements OnInit, AfterViewInit {

/** Charge data. */
chargeData: any;
chargeData: Charge[] = [];
/** Columns to be displayed in charges table. */
displayedColumns: string[] = ['name', 'chargeAppliesTo', 'chargeTimeType', 'chargeCalculationType', 'amount', 'penalty', 'active'];
/** Data source for charges table. */
Expand All @@ -43,6 +46,8 @@ export class ChargesComponent implements OnInit, AfterViewInit {
/* Template for popover on charges table */
@ViewChild('templateChargesTable') templateChargesTable: TemplateRef<any>;

chargeAppliesToOptions: OptionData[] = [];

/**
* Retrieves the charges data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
Expand All @@ -53,10 +58,12 @@ export class ChargesComponent implements OnInit, AfterViewInit {
constructor(private route: ActivatedRoute,
private router: Router,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService) {
private popoverService: PopoverService,
private charges: Charges) {
this.route.data.subscribe(( data: { charges: any }) => {
this.chargeData = data.charges;
});
this.chargeAppliesToOptions = this.charges.getChargeAppliesToOptions();
}

/**
Expand Down Expand Up @@ -136,4 +143,13 @@ export class ChargesComponent implements OnInit, AfterViewInit {
this.configurationWizardService.showCharges = true;
this.router.navigate(['/products']);
}

filterByAppliesTo(chargeAppliesTo: number) {
console.log(chargeAppliesTo);
const filteredCharges: Charge[] = this.chargeData.filter((charge: Charge) => {
return (charge.chargeAppliesTo.id === chargeAppliesTo);
});
this.dataSource = new MatTableDataSource(filteredCharges);
}

}
52 changes: 52 additions & 0 deletions src/app/products/charges/models/charge.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Currency, PaymentTypeOption } from 'app/shared/models/general.model';
import { OptionData } from 'app/shared/models/option-data.model';

export interface Charge {
id: number;
name: string;
active: boolean;
penalty: boolean;
freeWithdrawal: boolean;
freeWithdrawalChargeFrequency: number;
restartFrequency: number;
restartFrequencyEnum: number;
isPaymentType: boolean;
currency: Currency;
amount: number;
chargeTimeType: OptionData;
chargeAppliesTo: OptionData;
chargeCalculationType: OptionData;
chargePaymentMode: OptionData;
feeInterval?: number;
feeFrequency?: OptionData;
feeOnMonthDay?: number[];
paymentTypeOptions?: PaymentTypeOption;
}

export enum ChargeAppliesToCode {
ChargeAppliesToClient = 'chargeAppliesTo.client',
ChargeAppliesToLoan = 'chargeAppliesTo.loan',
ChargeAppliesToSavings = 'chargeAppliesTo.savings',
ChargeAppliesToShares = 'chargeAppliesTo.shares',
ChargeCalculationTypeFlat = 'chargeCalculationType.flat',
ChargeCalculationTypePercentOfAmount = 'chargeCalculationType.percent.of.amount',
ChargeCalculationTypePercentOfAmountAndInterest = 'chargeCalculationType.percent.of.amount.and.interest',
ChargeCalculationTypePercentOfInterest = 'chargeCalculationType.percent.of.interest',
ChargeTimeTypeActivation = 'chargeTimeType.activation',
ChargeTimeTypeAnnualFee = 'chargeTimeType.annualFee',
ChargeTimeTypeDisbursement = 'chargeTimeType.disbursement',
ChargeTimeTypeInstalmentFee = 'chargeTimeType.instalmentFee',
ChargeTimeTypeMonthlyFee = 'chargeTimeType.monthlyFee',
ChargeTimeTypeOverdueInstallment = 'chargeTimeType.overdueInstallment',
ChargeTimeTypeSavingsActivation = 'chargeTimeType.savingsActivation',
ChargeTimeTypeSavingsNoActivityFee = 'chargeTimeType.savingsNoActivityFee',
ChargeTimeTypeSharespurchase = 'chargeTimeType.sharespurchase',
ChargeTimeTypeSharesredeem = 'chargeTimeType.sharesredeem',
ChargeTimeTypeSolidarityFund = 'chargeTimeType.solidarityFund',
ChargeTimeTypeSpecifiedDueDate = 'chargeTimeType.specifiedDueDate',
ChargeTimeTypeWeeklyFee = 'chargeTimeType.weeklyFee',
ChargeTimeTypeWithdrawalFee = 'chargeTimeType.withdrawalFee',
ChargepaymentmodeAccounttransfer = 'chargepaymentmode.accounttransfer',
ChargepaymentmodeRegular = 'chargepaymentmode.regular',
FeeFrequencyperiodFrequencyTypeMonths = 'feeFrequencyperiodFrequencyType.months',
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ <h3 class="mat-h3" fxFlexFill>{{'labels.heading.Settings' | translate}}</h3>
</div>

<div fxFlexFill *ngIf="fixedDepositProductData.minBalanceForInterestCalculation">
<span fxFlex="40%">{{'labels.inputs.Balance Required For Interest Calculation' | translate}}:</span>
<span fxFlex="40%">{{'labels.inputs.Balance Required for Interest Calculation' | translate}}:</span>
<span fxFlex="60%">{{ fixedDepositProductData.minBalanceForInterestCalculation | formatNumber }}</span>
</div>

Expand Down
Loading

0 comments on commit a41df49

Please sign in to comment.