Browse Source

Merge branch 'master' of onunez/frontend-inversiones into development

Oscar José Nuñez Chávez 5 năm trước cách đây
mục cha
commit
dcf9499ef7

+ 2 - 0
src/app/components/instruments/cete/cete.component.ts

@@ -244,6 +244,8 @@ export class CETE implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+    console.log("formulario");
+    console.log(form);
     if (!form.valid) {
       return false;
     }

+ 2 - 0
src/app/components/instruments/dap/dap.component.ts

@@ -198,6 +198,8 @@ export class DAP implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+    console.log("formulario");
+    console.log(form);
     if (!form.valid) {
       return false;
     }

+ 25 - 15
src/app/components/instruments/pbur/pbur.component.ts

@@ -62,7 +62,7 @@ export class PBUR implements InstrumentComponent {
     11: "Nov",
     12: "Dic"
   };
-  instrument_exists: boolean;
+  instrument_null: boolean;
   instrument_work: any = [];
   investmentProposalForm: FormGroup;
   myDpOptions: IAngularMyDpOptions = {
@@ -104,7 +104,7 @@ export class PBUR 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 (
@@ -127,25 +127,32 @@ export class PBUR implements InstrumentComponent {
 
     this.investmentProposalForm = this.formBuilder.group({
       valor_par: [
-        this.instrument_exists ? false : this.instrument_work.valor_par
+        this.instrument_null || this.instrument_work.valor_par == null
+          ? false
+          : this.instrument_work.valor_par
       ],
       valor_nominal: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal,
+        this.instrument_null ? "" : this.instrument_work.valor_nominal,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? 0 : this.instrument_work.otros_costos,
+        this.instrument_null || this.instrument_work.otros_costos == null
+          ? 0
+          : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
+
       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]
       ],
       comision_casa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_casa_porcentaje,
         [
@@ -154,7 +161,7 @@ export class PBUR implements InstrumentComponent {
         ]
       ],
       comision_bolsa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_bolsa_porcentaje,
         [
@@ -163,22 +170,22 @@ export class PBUR implements InstrumentComponent {
         ]
       ],
       plazo: [
-        this.instrument_exists ? "" : this.instrument_work.plazo,
+        this.instrument_null ? "" : this.instrument_work.plazo,
         [Validators.required]
       ],
       rendimiento_bruto: [
-        this.instrument_exists ? "" : this.instrument_work.rendimiento_bruto,
+        this.instrument_null ? "" : this.instrument_work.rendimiento_bruto,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       /*formato_ingreso: [
-        this.instrument_exists ? "" : this.instrument_work.formato_ingreso,
+        this.instrument_null ? "" : this.instrument_work.formato_ingreso,
         [Validators.required]
       ],*/
       fecha_liquidacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -194,7 +201,7 @@ export class PBUR implements InstrumentComponent {
         Validators.required
       ],
       fecha_vencimiento: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -210,7 +217,7 @@ export class PBUR implements InstrumentComponent {
         Validators.required
       ],
       fecha_operacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -226,7 +233,7 @@ export class PBUR implements InstrumentComponent {
         Validators.required
       ],
       fecha_ultima_cupon: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -257,6 +264,9 @@ export class PBUR implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+    console.log("formulario");
+    console.log(form);
+
     if (!form.valid) {
       return false;
     }

+ 21 - 14
src/app/components/instruments/vcn/vcn.component.ts

@@ -62,7 +62,7 @@ export class VCN implements InstrumentComponent {
     11: "Nov",
     12: "Dic"
   };
-  instrument_exists: boolean;
+  instrument_null: boolean;
   instrument_work: any = [];
   investmentProposalForm: FormGroup;
   myDpOptions: IAngularMyDpOptions = {
@@ -104,7 +104,7 @@ export class VCN 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 (
@@ -126,26 +126,32 @@ export class VCN implements InstrumentComponent {
 
     this.investmentProposalForm = this.formBuilder.group({
       valor_par: [
-        this.instrument_exists ? false : this.instrument_work.valor_par
+        this.instrument_null || this.instrument_work.valor_par == null
+          ? false
+          : this.instrument_work.valor_par
       ],
       valor_nominal: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal,
+        this.instrument_null ? "" : this.instrument_work.valor_nominal,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? 0 : this.instrument_work.otros_costos,
+        this.instrument_null || this.instrument_work.otros_costos == null
+          ? 0
+          : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
 
       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]
       ],
       comision_casa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_casa_porcentaje,
         [
@@ -154,7 +160,7 @@ export class VCN implements InstrumentComponent {
         ]
       ],
       comision_bolsa_porcentaje: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : this.instrument_work.comision_bolsa_porcentaje,
         [
@@ -163,18 +169,18 @@ export class VCN implements InstrumentComponent {
         ]
       ],
       rendimiento_bruto: [
-        this.instrument_exists ? "" : this.instrument_work.rendimiento_bruto,
+        this.instrument_null ? "" : this.instrument_work.rendimiento_bruto,
         [
           Validators.required,
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
       /*formato_ingreso: [
-        this.instrument_exists ? "" : this.instrument_work.formato_ingreso,
+        this.instrument_null ? "" : this.instrument_work.formato_ingreso,
         [Validators.required]
       ],*/
       fecha_liquidacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -190,7 +196,7 @@ export class VCN implements InstrumentComponent {
         Validators.required
       ],
       fecha_vencimiento: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -206,7 +212,7 @@ export class VCN implements InstrumentComponent {
         Validators.required
       ],
       fecha_operacion: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -222,7 +228,7 @@ export class VCN implements InstrumentComponent {
         Validators.required
       ],
       fecha_ultima_cupon: [
-        this.instrument_exists
+        this.instrument_null
           ? ""
           : {
               isRange: false,
@@ -255,6 +261,7 @@ export class VCN implements InstrumentComponent {
 
   getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
+
     if (!form.valid) {
       return false;
     }