|
|
@@ -63,7 +63,7 @@ export class DAP implements InstrumentComponent {
|
|
|
11: "Nov",
|
|
|
12: "Dic"
|
|
|
};
|
|
|
- instrument_exists: boolean;
|
|
|
+ instrument_null: boolean;
|
|
|
instrument_work: any = [];
|
|
|
investmentProposalForm: FormGroup;
|
|
|
myDpOptions: IAngularMyDpOptions = {
|
|
|
@@ -103,7 +103,7 @@ export class DAP implements InstrumentComponent {
|
|
|
public datepipe: DatePipe
|
|
|
) {
|
|
|
this.instrument_work = this.formDataService.getWork();
|
|
|
- this.instrument_exists = this.instrument_work == undefined;
|
|
|
+ this.instrument_null = this.instrument_work == undefined;
|
|
|
this.general = this.formDataService.getGeneralInfo();
|
|
|
|
|
|
if (
|
|
|
@@ -121,7 +121,7 @@ export class DAP implements InstrumentComponent {
|
|
|
|
|
|
this.investmentProposalForm = this.formBuilder.group({
|
|
|
monto_inversion: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.monto_inversion,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.monto_inversion,
|
|
|
[
|
|
|
Validators.required,
|
|
|
Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
|
|
|
@@ -129,28 +129,30 @@ export class DAP implements InstrumentComponent {
|
|
|
],
|
|
|
|
|
|
renta_porcentaje: [
|
|
|
- this.instrument_exists ? 10 : this.instrument_work.renta_porcentaje,
|
|
|
+ this.instrument_null || this.instrument_work.renta_porcentaje == null
|
|
|
+ ? 10
|
|
|
+ : this.instrument_work.renta_porcentaje,
|
|
|
[Validators.required]
|
|
|
],
|
|
|
tasa_porcentaje: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.tasa_porcentaje,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.tasa_porcentaje,
|
|
|
[
|
|
|
Validators.required,
|
|
|
Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
|
|
|
]
|
|
|
],
|
|
|
plazo: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.plazo,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.plazo,
|
|
|
[Validators.required]
|
|
|
],
|
|
|
|
|
|
numero_certificado: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.numero_certificado,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.numero_certificado,
|
|
|
[]
|
|
|
],
|
|
|
|
|
|
fecha_operacion: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: {
|
|
|
isRange: false,
|
|
|
@@ -182,8 +184,7 @@ export class DAP implements InstrumentComponent {
|
|
|
|
|
|
getCalculations(form: any, saveForm: boolean) {
|
|
|
this.submitted = true;
|
|
|
- console.log("formulario");
|
|
|
- console.log(form);
|
|
|
+
|
|
|
if (!form.valid) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -246,7 +247,8 @@ export class DAP implements InstrumentComponent {
|
|
|
proyecciones: this.proyecciones,
|
|
|
|
|
|
fecha_operacion: this.investmentProposalForm.value.fecha_operacion
|
|
|
- .singleDate.formatted
|
|
|
+ .singleDate.formatted,
|
|
|
+ fecha_vencimiento: this.fecha_vencimiento
|
|
|
};
|
|
|
this.formDataService.setWork(this.dapObject);
|
|
|
Swal.close();
|