Selaa lähdekoodia

Merge branch 'features-o' of onunez/frontend-inversiones into development

Oscar José Nuñez Chávez 5 vuotta sitten
vanhempi
commit
4ff8fde594

+ 8 - 4
src/app/components/instruments/fondos/fondos.component.html

@@ -463,6 +463,7 @@
             <ng-container matColumnDef="ingreso_bruto">
               <th mat-header-cell *matHeaderCellDef>Ingreso bruto</th>
               <td mat-cell *matCellDef="let row">
+                $USD
                 {{
                   row.ingreso_bruto == "" || row.ingreso_bruto == undefined
                     ? "-"
@@ -500,7 +501,7 @@
                   row.dividendo_porcentaje == undefined
                     ? "-"
                     : (row.dividendo_porcentaje | number: "1.2-4")
-                }}
+                }}%
               </td>
               <td mat-footer-cell *matFooterCellDef>
                 {{
@@ -517,7 +518,7 @@
                   row.rendimiento_porcentaje == undefined
                     ? "-"
                     : (row.rendimiento_porcentaje | number: "1.2-4")
-                }}
+                }}%
               </td>
               <td mat-footer-cell *matFooterCellDef>
                 {{
@@ -529,6 +530,7 @@
             <ng-container matColumnDef="rendimiento">
               <th mat-header-cell *matHeaderCellDef>Rendimiento ($)</th>
               <td mat-cell *matCellDef="let row">
+                $USD
                 {{
                   row.rendimiento == "" || row.rendimiento == undefined
                     ? "-"
@@ -730,6 +732,7 @@
             <ng-container matColumnDef="ingreso_bruto">
               <th mat-header-cell *matHeaderCellDef>Ingreso bruto</th>
               <td mat-cell *matCellDef="let row">
+                $USD
                 {{
                   row.ingreso_bruto == "" || row.ingreso_bruto == undefined
                     ? "-"
@@ -746,6 +749,7 @@
             <ng-container matColumnDef="ingreso_neto">
               <th mat-header-cell *matHeaderCellDef>Ingreso neto</th>
               <td mat-cell *matCellDef="let row">
+                $USD
                 {{
                   row.ingreso_neto == "" || row.ingreso_neto == undefined
                     ? "-"
@@ -767,7 +771,7 @@
                   row.dividendo_porcentaje == undefined
                     ? "-"
                     : (row.dividendo_porcentaje | number: "1.2-4")
-                }}
+                }}%
               </td>
               <td mat-footer-cell *matFooterCellDef>
                 {{
@@ -784,7 +788,7 @@
                   row.rendimiento_porcentaje == undefined
                     ? "-"
                     : (row.rendimiento_porcentaje | number: "1.2-4")
-                }}
+                }}%
               </td>
               <td mat-footer-cell *matFooterCellDef>
                 {{

+ 4 - 0
src/app/components/instruments/futuros/futuros.component.ts

@@ -322,6 +322,8 @@ export class FUTU implements InstrumentComponent {
     console.log("tipo de ejecucion");
     console.log(this.tipoEjecucion);
 
+    const ticker = this.investmentProposalForm.get("ticker");
+
     const precio_unitario_compra = this.investmentProposalForm.get(
       "precio_unitario_compra"
     );
@@ -365,6 +367,8 @@ export class FUTU implements InstrumentComponent {
       "fecha_vencimiento_venta"
     );
 
+    ticker.setValidators([Validators.required]);
+
     if (this.tipoEjecucion == 1) {
       precio_unitario_compra.setValidators([
         Validators.required,

+ 1 - 4
src/app/components/instruments/opciones/opciones.component.html

@@ -38,10 +38,7 @@
           <option
             *ngFor="let item of ejecuciones"
             [value]="item.codigo"
-            [selected]="
-              instrument_exists == false &&
-              item.codigo == instrument_work.completo
-            "
+            [selected]="item.codigo == ejecucion"
           >
             {{ item.nombre }}</option
           >

+ 13 - 17
src/app/components/instruments/opciones/opciones.component.ts

@@ -134,22 +134,8 @@ export class OPC implements InstrumentComponent {
     console.log(this.operaciones);
     console.log(this.instrument_work);
 
-    if (
-      this.instrument_work != undefined &&
-      this.instrument_work.completo == undefined
-    ) {
-      if (
-        this.instrument_work.valor_pagado > 0 &&
-        this.instrument_work.valor_recibido > 0
-      ) {
-        this.ejecucion = 1;
-      } else {
-        this.ejecucion = +this.instrument_work_summary.completo;
-      }
-    }
-
     this.investmentProposalForm = this.formBuilder.group({
-      operacion: [this.instrument_exists ? "" : this.instrument_work.corto],
+      operacion: [this.instrument_exists ? "" : +this.instrument_work.corto],
       ejecucion: [this.instrument_exists ? "" : this.ejecucion],
       ticker: [this.instrument_exists ? "" : this.instrument_work.ticker],
       precio_unitario_compra: [
@@ -296,11 +282,18 @@ export class OPC implements InstrumentComponent {
           this.instrument_work_summary.valor_recibido > 0
         ) {
           this.ejecucion = 1;
+        } else if (
+          this.instrument_work_summary.valor_pagado > 0 ||
+          this.instrument_work_summary.valor_recibido > 0
+        ) {
+          this.ejecucion = 0;
         }
+        this.investmentProposalForm.patchValue({
+          ejecucion: this.ejecucion
+        });
       } else {
         this.ejecucion = +this.instrument_work_summary.completo;
       }
-
       this.toggle_operacion(this.operacion);
       this.toggle_ejecucion(this.ejecucion);
     }
@@ -322,6 +315,8 @@ export class OPC implements InstrumentComponent {
     console.log("tipo de ejecucion");
     console.log(this.tipoEjecucion);
 
+    const ticker = this.investmentProposalForm.get("ticker");
+
     const precio_unitario_compra = this.investmentProposalForm.get(
       "precio_unitario_compra"
     );
@@ -365,6 +360,8 @@ export class OPC implements InstrumentComponent {
       "fecha_vencimiento_venta"
     );
 
+    ticker.setValidators([Validators.required]);
+
     if (this.tipoEjecucion == 1) {
       precio_unitario_compra.setValidators([
         Validators.required,
@@ -486,7 +483,6 @@ export class OPC implements InstrumentComponent {
     fecha_liquidacion_venta.updateValueAndValidity();
     fecha_vencimiento_venta.updateValueAndValidity();
   }
-
   save(form: any): boolean {
     if (!form.valid) {
       return false;