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