|
@@ -4,7 +4,8 @@ import {
|
|
|
OnChanges,
|
|
OnChanges,
|
|
|
ViewChild,
|
|
ViewChild,
|
|
|
ComponentRef,
|
|
ComponentRef,
|
|
|
- Type
|
|
|
|
|
|
|
+ Type,
|
|
|
|
|
+ ElementRef
|
|
|
} from "@angular/core";
|
|
} from "@angular/core";
|
|
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
|
|
import Swal from "sweetalert2";
|
|
import Swal from "sweetalert2";
|
|
@@ -19,6 +20,7 @@ import { IAngularMyDpOptions, IMyDateModel } from "angular-mydatepicker";
|
|
|
import { InvestmentsService } from "@app/services/investments.service";
|
|
import { InvestmentsService } from "@app/services/investments.service";
|
|
|
import { DatePipe } from "@angular/common";
|
|
import { DatePipe } from "@angular/common";
|
|
|
import { parse } from "date-fns";
|
|
import { parse } from "date-fns";
|
|
|
|
|
+import { IOption } from "ng-select";
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: "app-new-investment-proposal",
|
|
selector: "app-new-investment-proposal",
|
|
@@ -73,11 +75,11 @@ export class InvestmentProposalGeneralInfoComponent
|
|
|
rates: any;
|
|
rates: any;
|
|
|
revenues: any;
|
|
revenues: any;
|
|
|
funds: any;
|
|
funds: any;
|
|
|
- instrumentTypes: any;
|
|
|
|
|
|
|
+ instrumentTypes: Array<IOption>;
|
|
|
generalInfoDontExists: boolean;
|
|
generalInfoDontExists: boolean;
|
|
|
plazos: any;
|
|
plazos: any;
|
|
|
base_types: any;
|
|
base_types: any;
|
|
|
- financials: any;
|
|
|
|
|
|
|
+ financials: Array<IOption>;
|
|
|
format_incomes: any;
|
|
format_incomes: any;
|
|
|
|
|
|
|
|
gInfo: any;
|
|
gInfo: any;
|
|
@@ -86,6 +88,17 @@ export class InvestmentProposalGeneralInfoComponent
|
|
|
datez: any;
|
|
datez: any;
|
|
|
instrumentName: any;
|
|
instrumentName: any;
|
|
|
instrumentValue: any;
|
|
instrumentValue: any;
|
|
|
|
|
+
|
|
|
|
|
+ myOptions: Array<IOption> = [
|
|
|
|
|
+ { label: "Belgium", value: "BE" },
|
|
|
|
|
+ { label: "Luxembourg", value: "LU" },
|
|
|
|
|
+ { label: "Netherlands", value: "NL" }
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ @ViewChild("instrumentType", { static: false })
|
|
|
|
|
+ public instrumentType: any;
|
|
|
|
|
+ @ViewChild("casaSelect", { static: false })
|
|
|
|
|
+ public casaSelect: any;
|
|
|
constructor(
|
|
constructor(
|
|
|
private formBuilder: FormBuilder,
|
|
private formBuilder: FormBuilder,
|
|
|
private router: Router,
|
|
private router: Router,
|
|
@@ -197,19 +210,21 @@ export class InvestmentProposalGeneralInfoComponent
|
|
|
this.formDataService.setGeneralInfo(this.gInfo);
|
|
this.formDataService.setGeneralInfo(this.gInfo);
|
|
|
this.general = this.formDataService.getGeneralInfo();
|
|
this.general = this.formDataService.getGeneralInfo();
|
|
|
this.generalInfoDontExists = this.general == undefined;
|
|
this.generalInfoDontExists = this.general == undefined;
|
|
|
- this.investmentProposalForm.setValue({
|
|
|
|
|
|
|
+ this.investmentProposalForm.patchValue({
|
|
|
asunto: this.gInfo.asunto,
|
|
asunto: this.gInfo.asunto,
|
|
|
origenes_fondo: this.gInfo.origenes_fondo,
|
|
origenes_fondo: this.gInfo.origenes_fondo,
|
|
|
name: this.gInfo.name,
|
|
name: this.gInfo.name,
|
|
|
tipo_tasa: this.gInfo.tipo_tasa,
|
|
tipo_tasa: this.gInfo.tipo_tasa,
|
|
|
tipo_renta: this.gInfo.tipo_renta,
|
|
tipo_renta: this.gInfo.tipo_renta,
|
|
|
periodicidad: this.gInfo.periodicidad,
|
|
periodicidad: this.gInfo.periodicidad,
|
|
|
-
|
|
|
|
|
instrumentos: this.gInfo.instrumentos,
|
|
instrumentos: this.gInfo.instrumentos,
|
|
|
base_anual: this.gInfo.base_anual,
|
|
base_anual: this.gInfo.base_anual,
|
|
|
- casa: this.gInfo.casa,
|
|
|
|
|
|
|
+ casa: this.gInfo.casa.toString(),
|
|
|
formato_ingreso: this.gInfo.formato_ingreso
|
|
formato_ingreso: this.gInfo.formato_ingreso
|
|
|
});
|
|
});
|
|
|
|
|
+ if (this.gInfo.casa != "") {
|
|
|
|
|
+ this.casaSelect.select(this.gInfo.casa.toString());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.instrument = this.formDataService.getWork();
|
|
this.instrument = this.formDataService.getWork();
|
|
@@ -249,7 +264,13 @@ export class InvestmentProposalGeneralInfoComponent
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.catalogService.getFinancialEntities().subscribe(res => {
|
|
this.catalogService.getFinancialEntities().subscribe(res => {
|
|
|
- this.financials = res;
|
|
|
|
|
|
|
+ this.financials = [];
|
|
|
|
|
+ for (let property in res) {
|
|
|
|
|
+ this.financials.push({
|
|
|
|
|
+ label: res[property]["nombre"],
|
|
|
|
|
+ value: res[property]["id_entidad_financiera"].toString()
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.catalogService.getBaseTypes().subscribe(res => {
|
|
this.catalogService.getBaseTypes().subscribe(res => {
|
|
@@ -269,8 +290,23 @@ export class InvestmentProposalGeneralInfoComponent
|
|
|
this.funds = res;
|
|
this.funds = res;
|
|
|
});
|
|
});
|
|
|
this.catalogService.getInstrumentTypes().subscribe(res => {
|
|
this.catalogService.getInstrumentTypes().subscribe(res => {
|
|
|
- this.instrumentTypes = res;
|
|
|
|
|
|
|
+ res;
|
|
|
|
|
+ this.instrumentTypes = [];
|
|
|
|
|
+
|
|
|
|
|
+ for (let property in res) {
|
|
|
|
|
+ this.instrumentTypes.push({
|
|
|
|
|
+ label: res[property]["nombre"],
|
|
|
|
|
+ value: res[property]["codigo"]
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
if (this.generalInfoDontExists == false) {
|
|
if (this.generalInfoDontExists == false) {
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.instrumentType != undefined &&
|
|
|
|
|
+ (this.general.instrumentos != "" ||
|
|
|
|
|
+ this.general.instrumentos != undefined)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.instrumentType.select(this.general.instrumentos);
|
|
|
|
|
+ }
|
|
|
this.instrumentName = res.find(
|
|
this.instrumentName = res.find(
|
|
|
e => e.codigo == this.general.instrumentos
|
|
e => e.codigo == this.general.instrumentos
|
|
|
);
|
|
);
|
|
@@ -351,8 +387,8 @@ export class InvestmentProposalGeneralInfoComponent
|
|
|
return this.investmentProposalForm.controls;
|
|
return this.investmentProposalForm.controls;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- pre_filled_fields(event: any) {
|
|
|
|
|
- const selectedInstrument = (event.target as HTMLInputElement).value;
|
|
|
|
|
|
|
+ pre_filled_fields(event: IOption) {
|
|
|
|
|
+ const selectedInstrument = event.value;
|
|
|
switch (selectedInstrument) {
|
|
switch (selectedInstrument) {
|
|
|
case "LETE":
|
|
case "LETE":
|
|
|
this.investmentProposalForm.patchValue({
|
|
this.investmentProposalForm.patchValue({
|