refractor:update dateformats and language (#1292)
This commit is contained in:
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Create charge component.
|
||||
@@ -43,12 +44,14 @@ export class CreateChargeComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe) {
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { chargesTemplate: any }) => {
|
||||
this.chargesTemplateData = data.chargesTemplate;
|
||||
this.incomeAndLiabilityAccountData = data.chargesTemplate.incomeOrLiabilityAccountOptions.incomeAccountOptions
|
||||
@@ -216,7 +219,7 @@ export class CreateChargeComponent implements OnInit {
|
||||
});
|
||||
const charge = this.chargeForm.getRawValue();
|
||||
// TODO: Update once language and date settings are setup
|
||||
charge.locale = 'en';
|
||||
charge.locale = this.settingsService.language.code;
|
||||
charge.monthDayFormat = monthDayFormat;
|
||||
delete charge.addFeeFrequency;
|
||||
if (!charge.taxGroupId) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
|
||||
/**
|
||||
* Edit Charge component.
|
||||
@@ -43,19 +45,19 @@ export class EditChargeComponent implements OnInit {
|
||||
/** Show Fee Options. */
|
||||
showFeeOptions = false;
|
||||
|
||||
/**
|
||||
* Retrieves the charge data from `resolve`.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(
|
||||
private productsService: ProductsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
) {
|
||||
/**
|
||||
* Retrieves the charge data from `resolve`.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private productsService: ProductsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { chargesTemplate: any }) => {
|
||||
this.chargeData = data.chargesTemplate;
|
||||
});
|
||||
@@ -71,7 +73,7 @@ export class EditChargeComponent implements OnInit {
|
||||
editChargeForm() {
|
||||
this.chargeForm = this.formBuilder.group({
|
||||
'name': [this.chargeData.name, Validators.required],
|
||||
'chargeAppliesTo': [{value: this.chargeData.chargeAppliesTo.id, disabled: true}, Validators.required],
|
||||
'chargeAppliesTo': [{ value: this.chargeData.chargeAppliesTo.id, disabled: true }, Validators.required],
|
||||
'currencyCode': [this.chargeData.currency.code, Validators.required],
|
||||
'amount': [this.chargeData.amount, Validators.required],
|
||||
'active': [this.chargeData.active],
|
||||
@@ -112,9 +114,9 @@ export class EditChargeComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
if (this.chargeData.taxGroup) {
|
||||
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({value: this.chargeData.taxGroup.id, disabled: true}, Validators.required));
|
||||
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: this.chargeData.taxGroup.id, disabled: true }, Validators.required));
|
||||
} else {
|
||||
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({value: '?', disabled: true}));
|
||||
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: '?', disabled: true }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,12 +139,12 @@ export class EditChargeComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const charges = this.chargeForm.value;
|
||||
charges.locale = 'en';
|
||||
charges.locale = this.settingsService.language.code;
|
||||
charges.chargePaymentMode = this.chargeData.chargePaymentMode.id;
|
||||
this.productsService.updateCharge(this.chargeData.id.toString(), charges)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { FixedDepositProductDetailsStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-details-step/fixed-deposit-product-details-step.component';
|
||||
import { FixedDepositProductCurrencyStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-currency-step/fixed-deposit-product-currency-step.component';
|
||||
import { FixedDepositProductTermsStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-terms-step/fixed-deposit-product-terms-step.component';
|
||||
@@ -9,7 +11,9 @@ import { FixedDepositProductInterestRateChartStepComponent } from '../fixed-depo
|
||||
import { FixedDepositProductChargesStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-charges-step/fixed-deposit-product-charges-step.component';
|
||||
import { FixedDepositProductAccountingStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-accounting-step/fixed-deposit-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-fixed-deposit-product',
|
||||
@@ -29,9 +33,17 @@ export class CreateFixedDepositProductComponent implements OnInit {
|
||||
fixedDepositProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { fixedDepositProductsTemplate: any }) => {
|
||||
this.fixedDepositProductsTemplate = data.fixedDepositProductsTemplate;
|
||||
});
|
||||
@@ -92,13 +104,13 @@ export class CreateFixedDepositProductComponent implements OnInit {
|
||||
const fixedDepositProduct = {
|
||||
...this.fixedDepositProduct,
|
||||
charges: this.fixedDepositProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for depositAmount
|
||||
locale: this.settingsService.language.code // locale required for depositAmount
|
||||
};
|
||||
delete fixedDepositProduct.advancedAccountingRules;
|
||||
this.productsService.createFixedDepositProduct(fixedDepositProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { FixedDepositProductDetailsStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-details-step/fixed-deposit-product-details-step.component';
|
||||
import { FixedDepositProductCurrencyStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-currency-step/fixed-deposit-product-currency-step.component';
|
||||
import { FixedDepositProductTermsStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-terms-step/fixed-deposit-product-terms-step.component';
|
||||
@@ -9,7 +11,9 @@ import { FixedDepositProductInterestRateChartStepComponent } from '../fixed-depo
|
||||
import { FixedDepositProductChargesStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-charges-step/fixed-deposit-product-charges-step.component';
|
||||
import { FixedDepositProductAccountingStepComponent } from '../fixed-deposit-product-stepper/fixed-deposit-product-accounting-step/fixed-deposit-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-edit-fixed-deposit-product',
|
||||
@@ -29,9 +33,17 @@ export class EditFixedDepositProductComponent implements OnInit {
|
||||
fixedDepositProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { fixedDepositProductAndTemplate: any }) => {
|
||||
this.fixedDepositProductsTemplate = data.fixedDepositProductAndTemplate;
|
||||
});
|
||||
@@ -100,7 +112,7 @@ export class EditFixedDepositProductComponent implements OnInit {
|
||||
const fixedDepositProduct = {
|
||||
...this.fixedDepositProduct,
|
||||
charges: this.fixedDepositProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for depositAmount
|
||||
locale: this.settingsService.language.code // locale required for depositAmount
|
||||
};
|
||||
if (!fixedDepositProduct.description) {
|
||||
fixedDepositProduct.description = '';
|
||||
|
||||
+18
-4
@@ -1,17 +1,23 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
|
||||
/** Custom Components */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { DepositProductIncentiveFormDialogComponent } from 'app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/** Dialog Components */
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
|
||||
/** Custom Services */
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-fixed-deposit-product-interest-rate-chart-step',
|
||||
templateUrl: './fixed-deposit-product-interest-rate-chart-step.component.html',
|
||||
@@ -50,9 +56,17 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
chartDetailData: any = [];
|
||||
chartsDetail: any[] = [];
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private datePipe: DatePipe) {
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.createFixedDepositProductInterestRateChartForm();
|
||||
}
|
||||
|
||||
@@ -284,7 +298,7 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
getData(formType: string, values?: any) {
|
||||
switch (formType) {
|
||||
case 'Slab': return { title: 'Slab', formfields: this.getSlabFormfields(values) };
|
||||
case 'Slab': return { title: 'Slab', formfields: this.getSlabFormfields(values) };
|
||||
case 'Incentive': return { values, chartTemplate: this.fixedDepositProductsTemplate.chartTemplate };
|
||||
}
|
||||
}
|
||||
@@ -349,8 +363,8 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
get fixedDepositProductInterestRateChart() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const locale = 'en';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const fixedDepositProductInterestRateChart = this.fixedDepositProductInterestRateChartForm.value;
|
||||
for (const chart of fixedDepositProductInterestRateChart.charts) {
|
||||
chart.dateFormat = dateFormat;
|
||||
|
||||
+7
-4
@@ -10,6 +10,7 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { FloatingRatePeriodDialogComponent } from '../floating-rate-period-dialog/floating-rate-period-dialog.component';
|
||||
@@ -36,7 +37,7 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
/** Data source for floating rate periods table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Date Format. */
|
||||
dateFormat = 'dd MMMM yyyy';
|
||||
dateFormat = this.settingsService.dateFormat;
|
||||
|
||||
/** Paginator for floating rate periods table. */
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
@@ -50,13 +51,15 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private router: Router,
|
||||
private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dialog: MatDialog) { }
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService) { }
|
||||
|
||||
/**
|
||||
* Sets the floating rate periods table.
|
||||
@@ -111,7 +114,7 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
fromDate: this.datePipe.transform(response.fromDate, this.dateFormat),
|
||||
interestRate: response.interestRate,
|
||||
isDifferentialToBaseLendingRate: response.isDifferentialToBaseLendingRate,
|
||||
locale: 'en',
|
||||
locale: this.settingsService.language.code,
|
||||
dateFormat: this.dateFormat
|
||||
});
|
||||
this.dataSource.connect().next(this.floatingRatePeriodsData);
|
||||
@@ -137,7 +140,7 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
fromDate: this.datePipe.transform(response.fromDate, this.dateFormat),
|
||||
interestRate: response.interestRate,
|
||||
isDifferentialToBaseLendingRate: response.isDifferentialToBaseLendingRate,
|
||||
locale: 'en',
|
||||
locale: this.settingsService.language.code,
|
||||
dateFormat: this.dateFormat
|
||||
};
|
||||
this.dataSource.connect().next(this.floatingRatePeriodsData);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { FloatingRatePeriodDialogComponent } from '../floating-rate-period-dialog/floating-rate-period-dialog.component';
|
||||
@@ -38,7 +39,7 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
/** Data source for floating rate periods table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Date Format. */
|
||||
dateFormat = 'dd MMMM yyyy';
|
||||
dateFormat = this.settingsService.dateFormat;
|
||||
/** Floating Rate Period Data. */
|
||||
floatingRatePeriodsData: any[] = [];
|
||||
|
||||
@@ -55,13 +56,15 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private router: Router,
|
||||
private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private dialog: MatDialog) {
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { floatingRate: any }) => {
|
||||
this.floatingRateData = data.floatingRate;
|
||||
this.floatingRatePeriodsData = data.floatingRate.ratePeriods ? data.floatingRate.ratePeriods : [];
|
||||
@@ -109,7 +112,7 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
fromDate: this.datePipe.transform(response.fromDate, this.dateFormat),
|
||||
interestRate: response.interestRate,
|
||||
isDifferentialToBaseLendingRate: response.isDifferentialToBaseLendingRate,
|
||||
locale: 'en',
|
||||
locale: this.settingsService.language.code,
|
||||
dateFormat: this.dateFormat
|
||||
});
|
||||
this.dataSource.connect().next(this.floatingRatePeriodsData);
|
||||
@@ -136,7 +139,7 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
fromDate: this.datePipe.transform(response.fromDate, this.dateFormat),
|
||||
interestRate: response.interestRate,
|
||||
isDifferentialToBaseLendingRate: response.isDifferentialToBaseLendingRate,
|
||||
locale: 'en',
|
||||
locale: this.settingsService.language.code,
|
||||
dateFormat: this.dateFormat
|
||||
};
|
||||
this.dataSource.connect().next(this.floatingRatePeriodsData);
|
||||
@@ -174,7 +177,7 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
floatingRatePeriod.modifiedBy = undefined;
|
||||
floatingRatePeriod.createdBy = undefined;
|
||||
floatingRatePeriod.isActive = undefined;
|
||||
floatingRatePeriod.locale = 'en';
|
||||
floatingRatePeriod.locale = this.settingsService.language.code;
|
||||
floatingRatePeriod.dateFormat = this.dateFormat;
|
||||
floatingRatePeriod.fromDate = this.datePipe.transform(floatingRatePeriod.fromDate, this.dateFormat);
|
||||
});
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { LoanProductDetailsStepComponent } from '../loan-product-stepper/loan-product-details-step/loan-product-details-step.component';
|
||||
import { LoanProductCurrencyStepComponent } from '../loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component';
|
||||
import { LoanProductTermsStepComponent } from '../loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component';
|
||||
@@ -8,7 +10,9 @@ import { LoanProductSettingsStepComponent } from '../loan-product-stepper/loan-p
|
||||
import { LoanProductChargesStepComponent } from '../loan-product-stepper/loan-product-charges-step/loan-product-charges-step.component';
|
||||
import { LoanProductAccountingStepComponent } from '../loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-loan-product',
|
||||
@@ -27,8 +31,16 @@ export class CreateLoanProductComponent implements OnInit {
|
||||
loanProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash', 'Accrual (periodic)', 'Accrual (upfront)'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Product Service.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { loanProductsTemplate: any }) => {
|
||||
this.loanProductsTemplate = data.loanProductsTemplate;
|
||||
@@ -81,19 +93,19 @@ export class CreateLoanProductComponent implements OnInit {
|
||||
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const loanProduct = {
|
||||
...this.loanProduct,
|
||||
charges: this.loanProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
dateFormat,
|
||||
locale: 'en'
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
delete loanProduct.allowAttributeConfiguration;
|
||||
delete loanProduct.advancedAccountingRules;
|
||||
this.productsService.createLoanProduct(loanProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { LoanProductDetailsStepComponent } from '../loan-product-stepper/loan-product-details-step/loan-product-details-step.component';
|
||||
import { LoanProductCurrencyStepComponent } from '../loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component';
|
||||
import { LoanProductTermsStepComponent } from '../loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component';
|
||||
@@ -8,7 +10,9 @@ import { LoanProductSettingsStepComponent } from '../loan-product-stepper/loan-p
|
||||
import { LoanProductChargesStepComponent } from '../loan-product-stepper/loan-product-charges-step/loan-product-charges-step.component';
|
||||
import { LoanProductAccountingStepComponent } from '../loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-edit-loan-product',
|
||||
@@ -27,8 +31,16 @@ export class EditLoanProductComponent implements OnInit {
|
||||
loanProductAndTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash', 'Accrual (periodic)', 'Accrual (upfront)'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Product Service.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { loanProductAndTemplate: any }) => {
|
||||
this.loanProductAndTemplate = data.loanProductAndTemplate;
|
||||
@@ -89,19 +101,19 @@ export class EditLoanProductComponent implements OnInit {
|
||||
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const loanProduct = {
|
||||
...this.loanProduct,
|
||||
charges: this.loanProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
dateFormat,
|
||||
locale: 'en'
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
delete loanProduct.allowAttributeConfiguration;
|
||||
delete loanProduct.advancedAccountingRules;
|
||||
this.productsService.updateLoanProduct(this.loanProductAndTemplate.id, loanProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-2
@@ -1,7 +1,11 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loan-product-details-step',
|
||||
templateUrl: './loan-product-details-step.component.html',
|
||||
@@ -18,8 +22,15 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
||||
minDate = new Date(2000, 0, 1);
|
||||
maxDate = new Date(new Date().setFullYear(new Date().getFullYear() + 10));
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private datePipe: DatePipe) {
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.createLoanProductDetailsForm();
|
||||
}
|
||||
|
||||
@@ -53,7 +64,7 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
||||
const prevStartDate: Date = this.loanProductDetailsForm.value.startDate;
|
||||
const prevCloseDate: Date = this.loanProductDetailsForm.value.closeDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.loanProductDetailsForm.patchValue({
|
||||
startDate: this.datePipe.transform(prevStartDate, dateFormat) || '',
|
||||
closeDate: this.datePipe.transform(prevCloseDate, dateFormat) || ''
|
||||
|
||||
+7
-4
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Create Tax Component component.
|
||||
@@ -41,13 +42,15 @@ export class CreateTaxComponentComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe) {
|
||||
this.route.data.subscribe(( data: { taxComponentTemplate: any }) => {
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { taxComponentTemplate: any }) => {
|
||||
this.taxComponentTemplateData = data.taxComponentTemplate;
|
||||
});
|
||||
}
|
||||
@@ -114,12 +117,12 @@ export class CreateTaxComponentComponent implements OnInit {
|
||||
submit() {
|
||||
const prevStartDate: Date = this.taxComponentForm.value.startDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.taxComponentForm.patchValue({
|
||||
startDate: this.datePipe.transform(prevStartDate, dateFormat)
|
||||
});
|
||||
const taxComponent = this.taxComponentForm.value;
|
||||
taxComponent.locale = 'en';
|
||||
taxComponent.locale = this.settingsService.language.code;
|
||||
taxComponent.dateFormat = dateFormat;
|
||||
this.productsService.createTaxComponent(taxComponent).subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
|
||||
+8
-5
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Edit tax component.
|
||||
@@ -31,12 +32,14 @@ export class EditTaxComponentComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe) {
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { taxComponent: any }) => {
|
||||
this.taxComponentData = data.taxComponent;
|
||||
});
|
||||
@@ -57,8 +60,8 @@ export class EditTaxComponentComponent implements OnInit {
|
||||
'name': [this.taxComponentData.name, [Validators.required]],
|
||||
'percentage': [this.taxComponentData.percentage, [Validators.required, Validators.pattern('^(0*[1-9][0-9]*(\\.[0-9]+)?|0+\\.[0-9]*[1-9][0-9]*)$'), Validators.max(100)]],
|
||||
'startDate': [this.taxComponentData.startDate && new Date(this.taxComponentData.startDate)],
|
||||
'creditAccountType': [{value: this.taxComponentData.creditAccountType.value, disabled: true}],
|
||||
'creditAccount': [{value: this.taxComponentData.creditAccount.name, disabled: true}]
|
||||
'creditAccountType': [{ value: this.taxComponentData.creditAccountType.value, disabled: true }],
|
||||
'creditAccount': [{ value: this.taxComponentData.creditAccount.name, disabled: true }]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,12 +72,12 @@ export class EditTaxComponentComponent implements OnInit {
|
||||
submit() {
|
||||
const prevStartDate: Date = this.taxComponentForm.value.startDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.taxComponentForm.patchValue({
|
||||
startDate: this.datePipe.transform(prevStartDate, dateFormat)
|
||||
});
|
||||
const taxComponent = this.taxComponentForm.value;
|
||||
taxComponent.locale = 'en';
|
||||
taxComponent.locale = this.settingsService.language.code;
|
||||
taxComponent.dateFormat = dateFormat;
|
||||
this.productsService.updateTaxComponent(this.taxComponentData.id, taxComponent).subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
|
||||
@@ -7,6 +7,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Dialog Components */
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
@@ -48,13 +49,16 @@ export class CreateTaxGroupComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
public dialog: MatDialog) {
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
public dialog: MatDialog,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { taxGroupTemplate: any }) => {
|
||||
this.taxGroupTemplateData = data.taxGroupTemplate;
|
||||
this.taxComponentOptions = this.taxGroupTemplateData.taxComponents;
|
||||
@@ -163,8 +167,8 @@ export class CreateTaxGroupComponent implements OnInit {
|
||||
* if successful redirects to Tax Groups.
|
||||
*/
|
||||
submit() {
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const locale = 'en';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const taxGroup = {
|
||||
...this.taxGroupForm.value,
|
||||
taxComponents: this.taxComponentsDataSource,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Dialog Components */
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
@@ -48,13 +49,16 @@ export class EditTaxGroupComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
public dialog: MatDialog) {
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
public dialog: MatDialog,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { taxGroup: any }) => {
|
||||
this.taxGroupData = data.taxGroup;
|
||||
this.taxComponentOptions = this.taxGroupData.taxComponents;
|
||||
@@ -193,8 +197,8 @@ export class EditTaxGroupComponent implements OnInit {
|
||||
* if successful redirects to Tax Groups.
|
||||
*/
|
||||
submit() {
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const locale = 'en';
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const taxGroup = {
|
||||
...this.taxGroupForm.value,
|
||||
taxComponents: this.taxComponentsDataSource,
|
||||
|
||||
@@ -5,6 +5,9 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Products service.
|
||||
*/
|
||||
@@ -15,8 +18,10 @@ export class ProductsService {
|
||||
|
||||
/**
|
||||
* @param {HttpClient} http Http Client to send requests.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient,
|
||||
private settingsService: SettingsService) { }
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Loan products data
|
||||
@@ -105,10 +110,10 @@ export class ProductsService {
|
||||
}
|
||||
|
||||
getDividendData(shareProductId: any, dividendId: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('dateFormat', 'dd MMMM yyyy')
|
||||
.set('limit', '10')
|
||||
.set('locale', 'en')
|
||||
.set('offset', '0');
|
||||
const httpParams = new HttpParams().set('dateFormat', this.settingsService.dateFormat)
|
||||
.set('limit', '10')
|
||||
.set('locale', this.settingsService.language.code)
|
||||
.set('offset', '0');
|
||||
return this.http.get(`/shareproduct/${shareProductId}/dividend/${dividendId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
@@ -394,7 +399,7 @@ export class ProductsService {
|
||||
*/
|
||||
getAllInterestRateCharts(productId: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('productId', productId);
|
||||
return this.http.get(`/interestratecharts`, {params: httpParams});
|
||||
return this.http.get(`/interestratecharts`, { params: httpParams });
|
||||
}
|
||||
|
||||
createRecurringDepositProduct(recurringDepositProduct: any): Observable<any> {
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { RecurringDepositProductDetailsStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-details-step/recurring-deposit-product-details-step.component';
|
||||
import { RecurringDepositProductCurrencyStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-currency-step/recurring-deposit-product-currency-step.component';
|
||||
import { RecurringDepositProductTermsStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-terms-step/recurring-deposit-product-terms-step.component';
|
||||
@@ -9,7 +11,9 @@ import { RecurringDepositProductInterestRateChartStepComponent } from '../recurr
|
||||
import { RecurringDepositProductChargesStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-charges-step/recurring-deposit-product-charges-step.component';
|
||||
import { RecurringDepositProductAccountingStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-accounting-step/recurring-deposit-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-recurring-deposit-product',
|
||||
@@ -29,9 +33,17 @@ export class CreateRecurringDepositProductComponent implements OnInit {
|
||||
recurringDepositProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { recurringDepositProductsTemplate: any }) => {
|
||||
this.recurringDepositProductsTemplate = data.recurringDepositProductsTemplate;
|
||||
});
|
||||
@@ -92,7 +104,7 @@ export class CreateRecurringDepositProductComponent implements OnInit {
|
||||
const recurringDepositProduct = {
|
||||
...this.recurringDepositProduct,
|
||||
charges: this.recurringDepositProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for depositAmount
|
||||
locale: this.settingsService.language.code // locale required for depositAmount
|
||||
};
|
||||
if (!recurringDepositProduct.description) {
|
||||
recurringDepositProduct.description = '';
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { RecurringDepositProductDetailsStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-details-step/recurring-deposit-product-details-step.component';
|
||||
import { RecurringDepositProductCurrencyStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-currency-step/recurring-deposit-product-currency-step.component';
|
||||
import { RecurringDepositProductTermsStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-terms-step/recurring-deposit-product-terms-step.component';
|
||||
@@ -9,7 +11,9 @@ import { RecurringDepositProductInterestRateChartStepComponent } from '../recurr
|
||||
import { RecurringDepositProductChargesStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-charges-step/recurring-deposit-product-charges-step.component';
|
||||
import { RecurringDepositProductAccountingStepComponent } from '../recurring-deposit-product-stepper/recurring-deposit-product-accounting-step/recurring-deposit-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-edit-recurring-deposit-product',
|
||||
@@ -29,9 +33,17 @@ export class EditRecurringDepositProductComponent implements OnInit {
|
||||
recurringDepositProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { recurringDepositProductAndTemplate: any }) => {
|
||||
this.recurringDepositProductsTemplate = data.recurringDepositProductAndTemplate;
|
||||
});
|
||||
@@ -100,7 +112,7 @@ export class EditRecurringDepositProductComponent implements OnInit {
|
||||
const recurringDepositProduct = {
|
||||
...this.recurringDepositProduct,
|
||||
charges: this.recurringDepositProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for depositAmount
|
||||
locale: this.settingsService.language.code // locale required for depositAmount
|
||||
};
|
||||
if (!recurringDepositProduct.description) {
|
||||
recurringDepositProduct.description = '';
|
||||
|
||||
+18
-4
@@ -1,17 +1,23 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
|
||||
/** Custom Components */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { DepositProductIncentiveFormDialogComponent } from 'app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/** Dialog Components */
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-recurring-deposit-product-interest-rate-chart-step',
|
||||
templateUrl: './recurring-deposit-product-interest-rate-chart-step.component.html',
|
||||
@@ -50,9 +56,17 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
|
||||
chartDetailData: any = [];
|
||||
chartsDetail: any[] = [];
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private datePipe: DatePipe) {
|
||||
public dialog: MatDialog,
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.createrecurringDepositProductInterestRateChartForm();
|
||||
}
|
||||
|
||||
@@ -350,8 +364,8 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
|
||||
|
||||
get recurringDepositProductInterestRateChart() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const locale = 'en';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
const recurringDepositProductInterestRateChart = this.recurringDepositProductInterestRateChartForm.value;
|
||||
for (const chart of recurringDepositProductInterestRateChart.charts) {
|
||||
chart.dateFormat = dateFormat;
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { SavingProductDetailsStepComponent } from '../saving-product-stepper/saving-product-details-step/saving-product-details-step.component';
|
||||
import { SavingProductCurrencyStepComponent } from '../saving-product-stepper/saving-product-currency-step/saving-product-currency-step.component';
|
||||
import { SavingProductTermsStepComponent } from '../saving-product-stepper/saving-product-terms-step/saving-product-terms-step.component';
|
||||
@@ -8,7 +10,9 @@ import { SavingProductSettingsStepComponent } from '../saving-product-stepper/sa
|
||||
import { SavingProductChargesStepComponent } from '../saving-product-stepper/saving-product-charges-step/saving-product-charges-step.component';
|
||||
import { SavingProductAccountingStepComponent } from '../saving-product-stepper/saving-product-accounting-step/saving-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-saving-product',
|
||||
@@ -27,9 +31,17 @@ export class CreateSavingProductComponent implements OnInit {
|
||||
savingProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { savingProductsTemplate: any }) => {
|
||||
this.savingProductsTemplate = data.savingProductsTemplate;
|
||||
});
|
||||
@@ -84,13 +96,13 @@ export class CreateSavingProductComponent implements OnInit {
|
||||
const savingProduct = {
|
||||
...this.savingProduct,
|
||||
charges: this.savingProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for nominalAnnualInterestRate
|
||||
locale: this.settingsService.language.code // locale required for nominalAnnualInterestRate
|
||||
};
|
||||
delete savingProduct.advancedAccountingRules;
|
||||
this.productsService.createSavingProduct(savingProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { SavingProductDetailsStepComponent } from '../saving-product-stepper/saving-product-details-step/saving-product-details-step.component';
|
||||
import { SavingProductCurrencyStepComponent } from '../saving-product-stepper/saving-product-currency-step/saving-product-currency-step.component';
|
||||
import { SavingProductTermsStepComponent } from '../saving-product-stepper/saving-product-terms-step/saving-product-terms-step.component';
|
||||
@@ -8,7 +10,10 @@ import { SavingProductSettingsStepComponent } from '../saving-product-stepper/sa
|
||||
import { SavingProductChargesStepComponent } from '../saving-product-stepper/saving-product-charges-step/saving-product-charges-step.component';
|
||||
import { SavingProductAccountingStepComponent } from '../saving-product-stepper/saving-product-accounting-step/saving-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-edit-saving-product',
|
||||
@@ -27,9 +32,17 @@ export class EditSavingProductComponent implements OnInit {
|
||||
savingProductAndTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { savingProductAndTemplate: any }) => {
|
||||
this.savingProductAndTemplate = data.savingProductAndTemplate;
|
||||
});
|
||||
@@ -92,13 +105,13 @@ export class EditSavingProductComponent implements OnInit {
|
||||
const savingProduct = {
|
||||
...this.savingProduct,
|
||||
charges: this.savingProduct.charges.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for nominalAnnualInterestRate
|
||||
locale: this.settingsService.language.code // locale required for nominalAnnualInterestRate
|
||||
};
|
||||
delete savingProduct.advancedAccountingRules;
|
||||
this.productsService.updateSavingProduct(this.savingProductAndTemplate.id, savingProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services. */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
|
||||
/**
|
||||
* Create Dividend component.
|
||||
@@ -30,13 +32,17 @@ export class CreateDividendComponent implements OnInit {
|
||||
* Get Share Product data from `Resolver`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private productService: ProductsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { shareProduct: any }) => {
|
||||
this.shareProductData = data.shareProduct;
|
||||
});
|
||||
@@ -61,7 +67,7 @@ export class CreateDividendComponent implements OnInit {
|
||||
* Submits Create Dividend form.
|
||||
*/
|
||||
submit() {
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const startDate = this.createDividendForm.value.dividendPeriodStartDate;
|
||||
const endDate = this.createDividendForm.value.dividendPeriodEndDate;
|
||||
this.createDividendForm.patchValue({
|
||||
@@ -69,7 +75,7 @@ export class CreateDividendComponent implements OnInit {
|
||||
'dividendPeriodEndDate': this.datePipe.transform(endDate, dateFormat)
|
||||
});
|
||||
const dividendForm = this.createDividendForm.value;
|
||||
dividendForm.locale = 'en';
|
||||
dividendForm.locale = this.settingsService.language.code;
|
||||
dividendForm.dateFormat = dateFormat;
|
||||
this.productService.createDividend(this.shareProductData.id, dividendForm).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
|
||||
+15
-3
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { ShareProductDetailsStepComponent } from '../share-product-stepper/share-product-details-step/share-product-details-step.component';
|
||||
import { ShareProductCurrencyStepComponent } from '../share-product-stepper/share-product-currency-step/share-product-currency-step.component';
|
||||
import { ShareProductTermsStepComponent } from '../share-product-stepper/share-product-terms-step/share-product-terms-step.component';
|
||||
@@ -9,7 +11,9 @@ import { ShareProductMarketPriceStepComponent } from '../share-product-stepper/s
|
||||
import { ShareProductChargesStepComponent } from '../share-product-stepper/share-product-charges-step/share-product-charges-step.component';
|
||||
import { ShareProductAccountingStepComponent } from '../share-product-stepper/share-product-accounting-step/share-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-share-product',
|
||||
@@ -29,9 +33,17 @@ export class CreateShareProductComponent implements OnInit {
|
||||
shareProductsTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { shareProductsTemplate: any }) => {
|
||||
this.shareProductsTemplate = data.shareProductsTemplate;
|
||||
});
|
||||
@@ -92,12 +104,12 @@ export class CreateShareProductComponent implements OnInit {
|
||||
const shareProduct = {
|
||||
...this.shareProduct,
|
||||
chargesSelected: this.shareProduct.chargesSelected.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for digitsAfterDecimal
|
||||
locale: this.settingsService.language.code // locale required for digitsAfterDecimal
|
||||
};
|
||||
this.productsService.createShareProduct(shareProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components */
|
||||
import { ShareProductDetailsStepComponent } from '../share-product-stepper/share-product-details-step/share-product-details-step.component';
|
||||
import { ShareProductCurrencyStepComponent } from '../share-product-stepper/share-product-currency-step/share-product-currency-step.component';
|
||||
import { ShareProductTermsStepComponent } from '../share-product-stepper/share-product-terms-step/share-product-terms-step.component';
|
||||
@@ -9,7 +11,9 @@ import { ShareProductMarketPriceStepComponent } from '../share-product-stepper/s
|
||||
import { ShareProductChargesStepComponent } from '../share-product-stepper/share-product-charges-step/share-product-charges-step.component';
|
||||
import { ShareProductAccountingStepComponent } from '../share-product-stepper/share-product-accounting-step/share-product-accounting-step.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-edit-share-product',
|
||||
@@ -29,9 +33,17 @@ export class EditShareProductComponent implements OnInit {
|
||||
shareProductAndTemplate: any;
|
||||
accountingRuleData = ['None', 'Cash'];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Products Service.
|
||||
* @param {Router} router Router.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { shareProductAndTemplate: any }) => {
|
||||
this.shareProductAndTemplate = data.shareProductAndTemplate;
|
||||
});
|
||||
@@ -101,12 +113,12 @@ export class EditShareProductComponent implements OnInit {
|
||||
const shareProduct = {
|
||||
...this.shareProduct,
|
||||
chargesSelected: this.shareProduct.chargesSelected.map((charge: any) => ({ id: charge.id })),
|
||||
locale: 'en' // locale required for digitsAfterDecimal
|
||||
locale: this.settingsService.language.code // locale required for digitsAfterDecimal
|
||||
};
|
||||
this.productsService.updateShareProduct(this.shareProductAndTemplate.id, shareProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-5
@@ -1,15 +1,19 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Dialog Components */
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
|
||||
/** Custom Services */
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-share-product-market-price-step',
|
||||
templateUrl: './share-product-market-price-step.component.html',
|
||||
@@ -21,11 +25,20 @@ export class ShareProductMarketPriceStepComponent implements OnInit {
|
||||
|
||||
shareProductMarketPriceForm: FormGroup;
|
||||
|
||||
/** For displaying required columns */
|
||||
displayedColumns: string[] = ['fromDate', 'shareValue', 'actions'];
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {DatePipe} datePipe Date Pipe to format date.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private datePipe: DatePipe) {
|
||||
private datePipe: DatePipe,
|
||||
private settingsService: SettingsService) {
|
||||
this.createShareProductMarketPriceForm();
|
||||
}
|
||||
|
||||
@@ -37,7 +50,7 @@ export class ShareProductMarketPriceStepComponent implements OnInit {
|
||||
|
||||
createShareProductMarketPriceForm() {
|
||||
this.shareProductMarketPriceForm = this.formBuilder.group({
|
||||
'marketPricePeriods': this.formBuilder.array([])
|
||||
'marketPricePeriods': this.formBuilder.array([])
|
||||
});
|
||||
}
|
||||
|
||||
@@ -113,14 +126,15 @@ export class ShareProductMarketPriceStepComponent implements OnInit {
|
||||
|
||||
get shareProductMarketPrice() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
const marketPricePeriods = [];
|
||||
for (const marketPricePeriod of this.marketPricePeriods.value) {
|
||||
marketPricePeriods.push({
|
||||
...marketPricePeriod,
|
||||
fromDate: this.datePipe.transform(marketPricePeriod.fromDate, dateFormat),
|
||||
dateFormat,
|
||||
locale: 'en'
|
||||
locale
|
||||
});
|
||||
}
|
||||
return { marketPricePeriods };
|
||||
|
||||
Reference in New Issue
Block a user