Sfoglia il codice sorgente

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

Oscar José Nuñez Chávez 5 anni fa
parent
commit
4a0cec4713
24 ha cambiato i file con 783 aggiunte e 235 eliminazioni
  1. 7 8
      src/app/components/instruments/cete/cete.component.ts
  2. 6 44
      src/app/components/instruments/dap/dap.component.html
  3. 6 4
      src/app/components/instruments/dap/dap.component.ts
  4. 6 2
      src/app/components/instruments/lete/lete.component.html
  5. 57 43
      src/app/components/instruments/lete/lete.component.ts
  6. 6 2
      src/app/components/instruments/pbur/pbur.component.html
  7. 67 54
      src/app/components/instruments/pbur/pbur.component.ts
  8. 6 2
      src/app/components/instruments/vcn/vcn.component.html
  9. 63 39
      src/app/components/instruments/vcn/vcn.component.ts
  10. 2 2
      src/app/components/investment-proposals/complement-info/complement-info.component.html
  11. 3 1
      src/app/components/investment-proposals/general-info/general-info.component.ts
  12. 8 4
      src/app/components/investment-proposals/investment-proposals.component.html
  13. 8 0
      src/app/components/investment-proposals/investment-proposals.component.ts
  14. 6 12
      src/app/components/investment-proposals/payment-info/payment-info.component.html
  15. 2 1
      src/app/components/investment-proposals/payment-info/payment-info.component.ts
  16. 172 0
      src/app/components/investment-proposals/proposal-detail/review/proposal-detail.component.html
  17. 6 0
      src/app/components/investment-proposals/proposal-detail/review/proposal-detail.component.scss
  18. 324 0
      src/app/components/investment-proposals/proposal-detail/review/proposal-detail.component.ts
  19. 12 10
      src/app/components/investment-proposals/result/result.component.ts
  20. 1 1
      src/app/components/login/login.component.scss
  21. 3 1
      src/app/layouts/admin/admin.module.ts
  22. 6 0
      src/app/layouts/admin/admin.routing.ts
  23. 2 1
      src/app/services/form-investment-proposal.service.ts
  24. 4 4
      src/app/services/instrument-calculations.service.ts

+ 7 - 8
src/app/components/instruments/cete/cete.component.ts

@@ -154,7 +154,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -170,7 +170,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -186,7 +186,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -202,7 +202,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_ultima_cupon,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon
@@ -262,11 +262,10 @@ export class CETE implements InstrumentComponent {
         },
         {
           valor_nominal: +this.f.valor_nominal.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
           plazo: +this.f.plazo.value,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate

+ 6 - 44
src/app/components/instruments/dap/dap.component.html

@@ -125,37 +125,6 @@
         </div>
       </div>
 
-      <!-- Rendimiento bruto -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="rendimiento_bruto">Rendimiento bruto: </label>
-          <div class="input-box-container">
-            <p>
-              <i class="fas fa-percent" aria-hidden="true"></i>
-            </p>
-            <input
-              type="text"
-              formControlName="rendimiento_bruto"
-              class="form-control"
-              [ngClass]="{
-                'is-invalid': submitted && f.rendimiento_bruto.errors
-              }"
-            />
-            <div
-              *ngIf="submitted && f.rendimiento_bruto.errors"
-              class="invalid-feedback"
-            >
-              <div *ngIf="f.rendimiento_bruto.errors.required">
-                Campo requerido
-              </div>
-              <div *ngIf="f.rendimiento_bruto.errors.pattern">
-                Debe ingresar una cifra válida
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-
       <!-- Fecha operación -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -247,15 +216,7 @@
             >Cálculos del instrumento</span
           >
         </div>
-        <!--
-  monto_inversion
-ingreso_bruto
-ingreso_neto
-rendimiento_bruto
-rendimiento_neto
-plazo
-fecha_inicio_vigencia
--->
+
         <div class="col-sm-6">
           <h4>Monto inversión:</h4>
           <div class="field">$USD {{ monto_inversion | number: "1.2-4" }}</div>
@@ -283,7 +244,10 @@ fecha_inicio_vigencia
             {{ rendimiento_neto | number: "1.2-4" }}
           </div>
         </div>
-
+        <div class="col-sm-6">
+          <h4>Renta:</h4>
+          <div class="field">$USD {{ renta | number: "1.2-4" }}</div>
+        </div>
         <div class="col-sm-6">
           <h4>Fecha inicio de vigencia:</h4>
           <div class="field">{{ fecha_inicio_vigencia }}</div>
@@ -339,9 +303,7 @@ fecha_inicio_vigencia
               <th mat-header-cell *matHeaderCellDef>Renta</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.renta == "" || row.renta == undefined
-                    ? "-"
-                    : row.renta * 100
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
             </ng-container>

+ 6 - 4
src/app/components/instruments/dap/dap.component.ts

@@ -87,6 +87,7 @@ export class DAP implements InstrumentComponent {
   proyecciones: any;
   dataSource = new MatTableDataSource(this.proyecciones);
   dapObject: {};
+  renta: any;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -139,7 +140,7 @@ export class DAP implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -155,7 +156,7 @@ export class DAP implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -215,8 +216,8 @@ export class DAP implements InstrumentComponent {
         },
         {
           monto_inversion: +this.f.monto_inversion.value,
-          tasa_porcentaje: this.f.tasa_porcentaje.value / 100,
-          renta_porcentaje: this.f.renta_porcentaje.value / 100,
+          tasa_porcentaje: +this.f.tasa_porcentaje.value,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           plazo: +this.f.plazo.value,
           //id_formato_ingreso: this.f.formato_ingreso.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
@@ -232,6 +233,7 @@ export class DAP implements InstrumentComponent {
           this.rendimiento_neto = ans["result"]["rendimiento_neto"];
           this.plazo = ans["result"]["plazo"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
+          this.renta = ans["result"]["renta"];
           this.proyecciones = ans["result"]["proyecciones"];
 
           this.dataSource.data = this.proyecciones;

+ 6 - 2
src/app/components/instruments/lete/lete.component.html

@@ -255,7 +255,7 @@
           <br />
           <button
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -290,7 +290,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">{{ rendimiento_neto * 100 }} %</div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -304,6 +304,10 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
       </div>
     </div>
 

+ 57 - 43
src/app/components/instruments/lete/lete.component.ts

@@ -76,6 +76,7 @@ export class LETE implements InstrumentComponent {
   comision_casa: number = 0.0;
 
   leteObject: {};
+  fecha_vencimiento: string = "-";
 
   constructor(
     private formBuilder: FormBuilder,
@@ -141,7 +142,7 @@ export class LETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -157,7 +158,7 @@ export class LETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -173,7 +174,7 @@ export class LETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_redencion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_redencion
@@ -191,35 +192,12 @@ export class LETE implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.leteObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      plazo: this.investmentProposalForm.value.plazo,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_liquidacion:
-        this.investmentProposalForm.value.fecha_liquidacion.singleDate
-          .formatted || "",
-      fecha_redencion:
-        this.investmentProposalForm.value.fecha_redencion == undefined
-          ? this.investmentProposalForm.value.fecha_redencion.singleDate
-              .formatted
-          : ""
-      /*id_inversion_instrumento:
-        this.instrument_work.id_inversion_instrumento == undefined
-          ? ""
-          : this.instrument_work.id_inversion_instrumento*/
-    };
 
     this.formDataService.setWork(this.leteObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -238,10 +216,9 @@ export class LETE implements InstrumentComponent {
         {
           valor_nominal: +this.f.valor_nominal.value,
           plazo: +this.f.plazo.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate.formatted
         }
@@ -257,8 +234,55 @@ export class LETE implements InstrumentComponent {
           this.total_pagar = ans["result"]["total_pagar"];
           this.comision_bolsa = ans["result"]["comision_bolsa"];
           this.comision_casa = ans["result"]["comision_casa"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
+          Swal.close();
+
+          this.leteObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            plazo: this.investmentProposalForm.value.plazo,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            ingreso_bruto: this.ingreso_bruto,
+            ingreso_neto: this.ingreso_neto,
+            valor_transado: this.valor_transado,
+            precio_porcentaje: this.precio_porcentaje,
+            rendimiento_neto: this.rendimiento_neto,
+            total_pagar: this.total_pagar,
+            comision_bolsa: this.comision_bolsa,
+            comision_casa: this.comision_casa,
+            fecha_vencimiento: this.fecha_vencimiento,
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_liquidacion:
+              this.investmentProposalForm.value.fecha_liquidacion.singleDate
+                .formatted || "",
+            fecha_redencion:
+              this.investmentProposalForm.value.fecha_redencion == undefined
+                ? this.investmentProposalForm.value.fecha_redencion.singleDate
+                    .formatted
+                : ""
+            /*id_inversion_instrumento:
+        this.instrument_work.id_inversion_instrumento == undefined
+          ? ""
+          : this.instrument_work.id_inversion_instrumento*/
+          };
 
+          this.formDataService.setWork(this.leteObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              console.log("paramsID");
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -266,6 +290,7 @@ export class LETE implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
@@ -282,17 +307,6 @@ export class LETE implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 6 - 2
src/app/components/instruments/pbur/pbur.component.html

@@ -345,7 +345,7 @@
           <br />
           <button
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -392,7 +392,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">{{ rendimiento_neto * 100 }} %</div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -406,6 +406,10 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de inicio de vigencia:</h4>
+          <div class="field">{{ fecha_inicio_vigencia }}</div>
+        </div>
       </div>
     </div>
 

+ 67 - 54
src/app/components/instruments/pbur/pbur.component.ts

@@ -73,6 +73,7 @@ export class PBUR implements InstrumentComponent {
   plazo: number = 0;
   interes_acumulado: number = 0;
   fecha_inicio_vigencia: string;
+  instrumentSaved: boolean;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -84,7 +85,9 @@ export class PBUR implements InstrumentComponent {
   ) {
     this.instrument_work = this.formDataService.getWork();
     this.instrument_exists = this.instrument_work == undefined;
-
+    console.log(this.instrument_work);
+    console.log("instrument exists");
+    console.log(this.instrument_exists);
     this.general = this.formDataService.getGeneralInfo();
 
     //getIncomeFormat
@@ -149,7 +152,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -165,7 +168,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -181,7 +184,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -197,7 +200,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_ultima_cupon,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon
@@ -215,40 +218,10 @@ export class PBUR implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.pburObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      renta_porcentaje: this.investmentProposalForm.value.renta_porcentaje,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      otros_costos: this.investmentProposalForm.value.otros_costos,
-      plazo: this.investmentProposalForm.value.plazo,
-      //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
-
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_liquidacion:
-        this.investmentProposalForm.value.fecha_liquidacion.singleDate
-          .formatted || "",
-      fecha_ultima_cupon:
-        this.investmentProposalForm.value.fecha_ultima_cupon != undefined
-          ? this.investmentProposalForm.value.fecha_ultima_cupon.singleDate
-              .formatted
-          : "",
-      fecha_vencimiento:
-        this.investmentProposalForm.value.fecha_vencimiento != undefined
-          ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-              .formatted
-          : ""
-    };
-
-    this.formDataService.setWork(this.pburObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -271,10 +244,9 @@ export class PBUR implements InstrumentComponent {
         {
           valor_par: false,
           valor_nominal: +this.f.valor_nominal.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
           plazo: this.f.plazo.value,
           renta_porcentaje: this.f.renta_porcentaje.value,
@@ -289,7 +261,6 @@ export class PBUR implements InstrumentComponent {
       )
       .subscribe(
         ans => {
-          console.log(ans);
           this.ingreso_bruto = ans["result"]["ingreso_bruto"];
           this.ingreso_neto = ans["result"]["ingreso_neto"];
           this.valor_transado = ans["result"]["valor_transado"];
@@ -301,8 +272,60 @@ export class PBUR implements InstrumentComponent {
           this.plazo = ans["result"]["plazo"];
           this.interes_acumulado = ans["result"]["interes_acumulado"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
-          console.log(ans);
+
+          this.pburObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            comision_casa: ans["result"]["comision_casa"],
+            comision_bolsa: ans["result"]["comision_bolsa"],
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            otros_costos: this.investmentProposalForm.value.otros_costos,
+            ingreso_bruto: ans["result"]["ingreso_bruto"],
+            ingreso_neto: ans["result"]["ingreso_neto"],
+
+            valor_transado: ans["result"]["valor_transado"],
+            precio_porcentaje: ans["result"]["precio_porcentaje"],
+            rendimiento_neto: ans["result"]["rendimiento_neto"],
+            total_pagar: ans["result"]["total_pagar"],
+            interes_acumulado: ans["result"]["interes_acumulado"],
+            fecha_inicio_vigencia: ans["result"]["fecha_inicio_vigencia"],
+            plazo: this.investmentProposalForm.value.plazo,
+            //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
+
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_liquidacion:
+              this.investmentProposalForm.value.fecha_liquidacion.singleDate
+                .formatted || "",
+            fecha_ultima_cupon:
+              this.investmentProposalForm.value.fecha_ultima_cupon != undefined
+                ? this.investmentProposalForm.value.fecha_ultima_cupon
+                    .singleDate.formatted
+                : "",
+            fecha_vencimiento:
+              this.investmentProposalForm.value.fecha_vencimiento != undefined
+                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
+                    .formatted
+                : ""
+          };
+          this.formDataService.setWork(this.pburObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              console.log("paramsID");
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -310,6 +333,7 @@ export class PBUR implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
@@ -326,17 +350,6 @@ export class PBUR implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 6 - 2
src/app/components/instruments/vcn/vcn.component.html

@@ -345,7 +345,7 @@
           <br />
           <button
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -394,7 +394,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">{{ rendimiento_neto * 100 }} %</div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -408,6 +408,10 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de inicio de vigencia:</h4>
+          <div class="field">{{ fecha_inicio_vigencia }}</div>
+        </div>
       </div>
     </div>
 

+ 63 - 39
src/app/components/instruments/vcn/vcn.component.ts

@@ -149,7 +149,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -165,7 +165,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -181,7 +181,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -197,7 +197,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_ultima_cupon,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon
@@ -215,39 +215,12 @@ export class VCN implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.vcnObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      renta_porcentaje: this.investmentProposalForm.value.renta_porcentaje,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      otros_costos: this.investmentProposalForm.value.otros_costos,
-      //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
-      plazo: this.investmentProposalForm.value.plazo,
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_liquidacion:
-        this.investmentProposalForm.value.fecha_liquidacion.singleDate
-          .formatted || "",
-      fecha_ultima_cupon:
-        this.investmentProposalForm.value.fecha_ultima_cupon != undefined
-          ? this.investmentProposalForm.value.fecha_ultima_cupon.singleDate
-              .formatted
-          : "",
-      fecha_vencimiento:
-        this.investmentProposalForm.value.fecha_vencimiento != undefined
-          ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-              .formatted
-          : ""
-    };
 
     this.formDataService.setWork(this.vcnObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -261,7 +234,7 @@ export class VCN implements InstrumentComponent {
 
     this.instrumentCalcService
       .vcnCalc(
-        "VCN", // Codigo del instrumento
+        "PBUR", // Codigo del instrumento
         {
           id_tipo_base: this.general.base_anual,
           id_periodicidad: this.general.periodicidad,
@@ -270,10 +243,9 @@ export class VCN implements InstrumentComponent {
         {
           valor_par: false,
           valor_nominal: +this.f.valor_nominal.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
           plazo: this.f.plazo.value,
           renta_porcentaje: this.f.renta_porcentaje.value,
@@ -288,7 +260,6 @@ export class VCN implements InstrumentComponent {
       )
       .subscribe(
         ans => {
-          console.log(ans);
           this.ingreso_bruto = ans["result"]["ingreso_bruto"];
           this.ingreso_neto = ans["result"]["ingreso_neto"];
           this.valor_transado = ans["result"]["valor_transado"];
@@ -300,8 +271,60 @@ export class VCN implements InstrumentComponent {
           this.plazo = ans["result"]["plazo"];
           this.interes_acumulado = ans["result"]["interes_acumulado"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
-          console.log(ans);
+
+          this.vcnObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            comision_casa: ans["result"]["comision_casa"],
+            comision_bolsa: ans["result"]["comision_bolsa"],
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            otros_costos: this.investmentProposalForm.value.otros_costos,
+            ingreso_bruto: ans["result"]["ingreso_bruto"],
+            ingreso_neto: ans["result"]["ingreso_neto"],
+
+            valor_transado: ans["result"]["valor_transado"],
+            precio_porcentaje: ans["result"]["precio_porcentaje"],
+            rendimiento_neto: ans["result"]["rendimiento_neto"],
+            total_pagar: ans["result"]["total_pagar"],
+            interes_acumulado: ans["result"]["interes_acumulado"],
+            fecha_inicio_vigencia: ans["result"]["fecha_inicio_vigencia"],
+            plazo: this.investmentProposalForm.value.plazo,
+            //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
+
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_liquidacion:
+              this.investmentProposalForm.value.fecha_liquidacion.singleDate
+                .formatted || "",
+            fecha_ultima_cupon:
+              this.investmentProposalForm.value.fecha_ultima_cupon != undefined
+                ? this.investmentProposalForm.value.fecha_ultima_cupon
+                    .singleDate.formatted
+                : "",
+            fecha_vencimiento:
+              this.investmentProposalForm.value.fecha_vencimiento != undefined
+                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
+                    .formatted
+                : ""
+          };
+          this.formDataService.setWork(this.vcnObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              console.log("paramsID");
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -309,6 +332,7 @@ export class VCN implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }

+ 2 - 2
src/app/components/investment-proposals/complement-info/complement-info.component.html

@@ -213,9 +213,9 @@
                         >
                           <option
                             *ngFor="let item of operations"
-                            [value]="item.id_tipo_operaciones"
+                            [value]="item.id_tipo_operacion"
                             [selected]="
-                              item.id_tipo_operaciones ==
+                              item.id_tipo_operacion ==
                               complementInfo.operaciones
                             "
                           >

+ 3 - 1
src/app/components/investment-proposals/general-info/general-info.component.ts

@@ -111,7 +111,7 @@ export class InvestmentProposalGeneralInfoComponent
             console.log("results");
             console.log(res);
             console.log("-------");
-
+            console.log(this.formDataService.getFormData());
             this.gInfo = {
               asunto: res["result"]["asunto"],
               origenes_fondo:
@@ -213,6 +213,8 @@ export class InvestmentProposalGeneralInfoComponent
             }
 
             this.instrument = this.formDataService.getWork();
+            console.log("inicializar instrumento");
+            console.log(this.instrument);
             if (
               this.instrument == undefined ||
               Object.values(this.instrument).every(x => x === null || x === "")

+ 8 - 4
src/app/components/investment-proposals/investment-proposals.component.html

@@ -13,10 +13,7 @@
               <li class="breadcrumb-item">Propuestas de inversión</li>
             </ol>
           </nav>
-          <a
-            class="btn btn-primary"
-            (click)="create_investment_proposal()"
-          >
+          <a class="btn btn-primary" (click)="create_investment_proposal()">
             Nuevo registro
           </a>
         </div>
@@ -99,6 +96,13 @@
                   <th mat-header-cell *matHeaderCellDef>&nbsp;</th>
                   <td mat-cell *matCellDef="let row">
                     <div class="action-buttons">
+                      <a
+                        title="Detalle propuesta"
+                        class="btn btn-success btn-custom-small"
+                        (click)="view_investment_proposal(row.id_inversion)"
+                      >
+                        <i class="fas fa-info"></i>
+                      </a>
                       <a
                         *ngIf="
                           can_modify_or_send_to_review(

+ 8 - 0
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -117,6 +117,14 @@ export class InvestmentProposalsComponent implements OnInit {
     }
   }
 
+  view_investment_proposal(id: string) {
+    this.formInvestmentProposal.resetFormData();
+
+    setTimeout(() => {
+      this.router.navigate([`/investment-proposal/${id}`]);
+    }, 1000);
+  }
+
   modify_investment_proposal(id: string) {
     this.formInvestmentProposal.resetFormData();
 

+ 6 - 12
src/app/components/investment-proposals/payment-info/payment-info.component.html

@@ -76,26 +76,23 @@
 
                     <select
                       class="custom-select"
-                      formControlName="payment_types"
+                      formControlName="tipo_pago"
                       [ngClass]="{
-                        'is-invalid': submitted && f.payment_types.errors
+                        'is-invalid': submitted && f.tipo_pago.errors
                       }"
                     >
                       <option
-                        *ngFor="let item of funds"
-                        [value]="item.id_payment_types"
-                        [selected]="
-                          item.id_payment_types == general.payment_types
-                        "
+                        *ngFor="let item of payment_types"
+                        [value]="item.id_tipo_pago"
                       >
                         {{ item.nombre }}</option
                       >
                     </select>
                     <div
-                      *ngIf="submitted && f.payment_types.errors"
+                      *ngIf="submitted && f.tipo_pago.errors"
                       class="invalid-feedback"
                     >
-                      <div *ngIf="f.payment_types.errors.required">
+                      <div *ngIf="f.tipo_pago.errors.required">
                         Campo requerido
                       </div>
                     </div>
@@ -116,9 +113,6 @@
                       <option
                         *ngFor="let item of funds"
                         [value]="item.id_cuenta_bancaria"
-                        [selected]="
-                          item.id_cuenta_bancaria == general.cuenta_bancaria
-                        "
                       >
                         {{ item.nombre }}</option
                       >

+ 2 - 1
src/app/components/investment-proposals/payment-info/payment-info.component.ts

@@ -103,6 +103,7 @@ export class PaymentInfoComponent implements OnInit {
 
     this.catalogService.getPaymentTypes().subscribe(res => {
       this.payment_types = res;
+      console.log(this.payment_types);
     });
     this.catalogService.getCountries().subscribe(res => {
       this.countries = res;
@@ -116,7 +117,7 @@ export class PaymentInfoComponent implements OnInit {
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
-      payment_types: ["", [Validators.required]],
+      tipo_pago: ["", [Validators.required]],
       cuenta_bancaria: [""],
       fecha_pago: ["", Validators.required],
       fecha_vencimiento: ["", Validators.required]

+ 172 - 0
src/app/components/investment-proposals/proposal-detail/review/proposal-detail.component.html

@@ -0,0 +1,172 @@
+<h2 class="floating-title">{{ title }}</h2>
+
+<div class="main-content">
+  <div class="container-fluid">
+    <div class="row">
+      <div class="col-12 align-right">
+        <div class="align-container">
+          <nav aria-label="breadcrumb">
+            <ol class="breadcrumb">
+              <li class="breadcrumb-item">
+                <a [routerLink]="['/']">Dashboard</a>
+              </li>
+              <li class="breadcrumb-item">
+                <a [routerLink]="['/investment-proposals']">
+                  Propuestas de inversión
+                </a>
+              </li>
+              <li class="breadcrumb-item">Detalle propuesta</li>
+            </ol>
+          </nav>
+        </div>
+      </div>
+
+      <br />
+    </div>
+    <br />
+    <div class="row justify-content-center">
+      <div class="col-12">
+        <div class="align-container">
+          <div class="card borderless">
+            <div class="card-header card-header-icon card-header-rose">
+              <h4 class="card-title">
+                Resumen de la propuesta
+              </h4>
+            </div>
+            <div class="card-body">
+              <div class="align-container">
+                <ul class="timeline timeline-simple">
+                  <li class="timeline-inverted">
+                    <div class="timeline-badge"></div>
+                    <div class="timeline-panel">
+                      <div class="timeline-heading">
+                        <span class="badge badge-success"
+                          >Información general</span
+                        >
+                      </div>
+                      <div class="timeline-body">
+                        <div class="row">
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Asunto:</h4>
+                            <div class="field">
+                              {{ subject }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Orígenes de fondo:</h4>
+                            <div class="field">
+                              {{ funds }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Nombre:</h4>
+                            <div class="field">
+                              {{ investmentName }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipo Tasa:</h4>
+                            <div class="field">
+                              {{ rates }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipo Renta:</h4>
+                            <div class="field">
+                              {{ revenues }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Periodicidad:</h4>
+                            <div class="field">
+                              {{ periodicities }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Instrumentos:</h4>
+                            <div class="field">
+                              {{ instrumentTypes }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Casa:</h4>
+                            <div class="field">
+                              {{ financials }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Base:</h4>
+                            <div class="field">
+                              {{ base_types }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipo de mercado:</h4>
+                            <div class="field">
+                              {{ markets }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Emisores:</h4>
+                            <div class="field">
+                              {{ emitters }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Empresa:</h4>
+                            <div class="field">
+                              {{ companies }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>País:</h4>
+                            <div class="field">
+                              {{ countries }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Plazo:</h4>
+                            <div class="field">
+                              {{ payment_terms }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipos de operaciones:</h4>
+                            <div class="field">
+                              {{ operations }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Comentarios:</h4>
+                            <div class="field">
+                              {{ comment }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Justificación:</h4>
+                            <div class="field">
+                              {{ justification }}
+                            </div>
+                          </div>
+                        </div>
+                      </div>
+                    </div>
+                  </li>
+                  <li class="timeline-inverted">
+                    <div class="timeline-badge"></div>
+                    <div class="timeline-panel">
+                      <div class="timeline-heading">
+                        <span class="badge badge-warning">Instrumento</span>
+                        <ng-template instrument-host></ng-template>
+                      </div>
+                    </div>
+                  </li>
+                </ul>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>

+ 6 - 0
src/app/components/investment-proposals/proposal-detail/review/proposal-detail.component.scss

@@ -0,0 +1,6 @@
+.review-buttons {
+  text-align: center;
+  button {
+    margin: 0 20px;
+  }
+}

+ 324 - 0
src/app/components/investment-proposals/proposal-detail/review/proposal-detail.component.ts

@@ -0,0 +1,324 @@
+import {
+  Component,
+  OnInit,
+  Input,
+  ViewChild,
+  ComponentFactoryResolver
+} from "@angular/core";
+import { Router, ActivatedRoute } from "@angular/router";
+import { InvestmentProposalForm } from "@app/models/investment-proposal-form";
+import { FormInvestmentProposalService } from "@app/services/form-investment-proposal.service";
+import { Instrument } from "@app/models/instrument";
+import { InvestmentProposalWorkflowService } from "@app/services/investment-proposal-workflow.service";
+import { InstrumentDirective } from "@app/components/investment-proposals/instrument/instrument.directive";
+import { InstrumentComponent } from "@app/components/investment-proposals/instrument/instrument.component";
+import { InstrumentsService } from "@app/services/instruments.service";
+import Swal from "sweetalert2";
+import { CatalogsService } from "@app/services/catalogs.service";
+import { InvestmentsService } from "@app/services/investments.service";
+
+@Component({
+  selector: "app-investment-proposal-detail",
+  templateUrl: "./proposal-detail.component.html",
+  styleUrls: ["./proposal-detail.component.scss"]
+})
+export class InvestmentProposalDetailComponent implements OnInit {
+  title = "Detalle de la propuesta de inversión";
+  @Input() ads: Instrument[];
+  @Input() formData: InvestmentProposalForm;
+  @ViewChild(InstrumentDirective, { static: true })
+  adHost: InstrumentDirective;
+  isFormValid: boolean = false;
+  general: any;
+  instrument: any;
+  complement: any;
+  final: any;
+  workType: string;
+  form: any;
+  currentAdIndex = -1;
+  interval: any;
+  indexDynamicComponent: number;
+  investmentProposalID: string;
+  investmentExists;
+  state;
+  financials;
+  base_types;
+  countries;
+  companies;
+  rates;
+  revenues;
+  funds;
+  instrumentTypes;
+  markets;
+  emitters;
+  periodicities;
+  format_incomes;
+  payment_terms;
+  operations;
+  gInfo: any;
+  gInstrument: any;
+  gComplement: any;
+  subject: any;
+  investmentName: any;
+  comment: any;
+  justification: any;
+
+  constructor(
+    private router: Router,
+
+    private formDataService: FormInvestmentProposalService,
+    private componentFactoryResolver: ComponentFactoryResolver,
+    private instrumentService: InvestmentProposalWorkflowService,
+    private loadInstrumentsService: InstrumentsService,
+    private catalogService: CatalogsService,
+    private route: ActivatedRoute,
+    private investmentService: InvestmentsService
+  ) {}
+
+  ngOnInit() {
+    //this.formDataService
+    this.ads = this.loadInstrumentsService.getInstruments();
+    this.route.params.subscribe(params => {
+      this.investmentProposalID = params["id"];
+    });
+    if (this.investmentProposalID == undefined)
+      this.investmentProposalID = this.route.snapshot.queryParamMap.get("id");
+
+    if (this.investmentProposalID != undefined) {
+      this.investmentExists = true;
+      this.investmentService
+        .getProposalInvestment(this.investmentProposalID)
+        .subscribe(res => {
+          this.state = res["result"]["id_estado_inversion"]["codigo"];
+
+          this.gInfo = {
+            asunto: res["result"]["asunto"],
+            origenes_fondo:
+              res["result"]["id_origen_fondo"] == null
+                ? ""
+                : res["result"]["id_origen_fondo"]["id_origen_fondo"],
+            name: res["result"]["nombre_inversion"],
+            //date: "",
+            tipo_tasa: res["result"]["id_tipo_tasa"] || "",
+            tipo_renta:
+              res["result"]["id_tipo_renta"] == null
+                ? ""
+                : res["result"]["id_tipo_renta"]["id_tipo_renta"],
+            periodicidad:
+              res["result"]["id_periodicidad"] == null
+                ? ""
+                : res["result"]["id_periodicidad"]["id_periodicidad"],
+
+            instrumentos:
+              res["result"]["id_inversion_instrumento"]["id_tipo_instrumento"][
+                "codigo"
+              ],
+            base_anual:
+              res["result"]["id_tipo_base"] == null
+                ? ""
+                : res["result"]["id_tipo_base"]["id_tipo_base"],
+            casa:
+              res["result"]["id_entidad"] == null
+                ? ""
+                : res["result"]["id_entidad"]["id_entidad_financiera"],
+            formato_ingreso:
+              res["result"]["id_formato_ingreso"] == null
+                ? ""
+                : res["result"]["id_formato_ingreso"]["id_formato_ingreso"]
+          };
+
+          this.gInstrument =
+            res["result"]["id_inversion_instrumento"]["instrumento"];
+
+          this.gInstrument["id_inversion_instrumento"] =
+            res["result"]["id_inversion_instrumento"][
+              "id_inversion_instrumento"
+            ];
+
+          this.gComplement = {
+            tipo_mercado:
+              res["result"]["id_tipo_mercado"] == null
+                ? ""
+                : res["result"]["id_tipo_mercado"]["id_tipo_mercado"],
+            emisores:
+              res["result"]["id_tipo_emisor"] == null
+                ? ""
+                : res["result"]["id_tipo_emisor"]["id_tipo_emisor"],
+            empresa:
+              res["result"]["id_empresa"] == null
+                ? ""
+                : res["result"]["id_empresa"]["id_empresa"],
+            pais:
+              res["result"]["id_pais"] == null
+                ? ""
+                : res["result"]["id_pais"]["id_pais"],
+            plazo:
+              res["result"]["id_plazo"] == null
+                ? ""
+                : res["result"]["id_plazo"]["id_plazo"],
+            operaciones:
+              res["result"]["id_tipo_operacion"] == null
+                ? ""
+                : res["result"]["id_tipo_operacion"]["id_tipo_operacion"],
+            comentarios: res["result"]["comentario"],
+            justificacion: res["result"]["justificacion"]
+          };
+          this.formDataService.setGeneralInfo(this.gInfo);
+
+          this.formDataService.setWork(this.gInstrument);
+
+          this.formDataService.setComplementInfo(this.gComplement);
+
+          this.general = this.formDataService.getGeneralInfo();
+          this.instrument = this.formDataService.getWork();
+          this.complement = this.formDataService.getComplementInfo();
+          this.formData = this.formDataService.getFormData();
+
+          this.formData.instrumentos;
+
+          this.indexDynamicComponent = this.ads.findIndex(
+            x => x.component.name == this.formData.instrumentos
+          );
+          if (this.indexDynamicComponent >= 0) {
+            this.loadComponent();
+          } else {
+            console.log("No existe el componente");
+          }
+          if (this.general != undefined) {
+            this.subject = this.general.asunto;
+            this.investmentName = this.general.name;
+            this.comment = this.complement.comment;
+            this.justification = this.complement.comment;
+
+            this.catalogService.getFinancialEntities().subscribe(res => {
+              this.financials = res.find(
+                e => e.id_entidad_financiera == this.general.casa
+              );
+              this.financials =
+                this.financials != undefined ? this.financials.nombre : "-";
+            });
+
+            this.catalogService.getBaseTypes().subscribe(res => {
+              this.base_types = res.find(
+                e => e.id_tipo_base == this.general.base_anual
+              );
+              this.base_types =
+                this.base_types != undefined
+                  ? ` ${this.base_types.tipo_base} / ${this.base_types.tipo_base_dias}`
+                  : "-";
+            });
+
+            this.catalogService.getCountries().subscribe(res => {
+              this.countries = res.find(e => e.id_pais == this.complement.pais);
+              this.countries =
+                this.countries != undefined ? this.countries.nombre : "-";
+            });
+            this.catalogService.getCompanies().subscribe(res => {
+              this.companies = res.find(
+                e => e.id_empresa == this.complement.empresa
+              );
+              this.companies =
+                this.companies != undefined ? this.companies.nombre : "-";
+            });
+            this.catalogService.getRateTypes().subscribe(res => {
+              this.rates = res.find(
+                e => e.id_tipo_tasa == this.general.tipo_tasa
+              );
+              this.rates = this.rates != undefined ? this.rates.nombre : "-";
+            });
+            this.catalogService.getRevenueTypes().subscribe(res => {
+              this.revenues = res.find(
+                e => e.id_tipo_renta == this.general.tipo_renta
+              );
+              this.revenues =
+                this.revenues != undefined ? this.revenues.nombre : "-";
+            });
+
+            this.catalogService.getFundsOrigins().subscribe(res => {
+              this.funds = res.find(
+                e => e.id_origen_fondo == this.general.origenes_fondo
+              );
+              this.funds = this.funds != undefined ? this.funds.nombre : "-";
+            });
+            this.catalogService.getInstrumentTypes().subscribe(res => {
+              this.instrumentTypes = res.find(
+                e => e.codigo == this.general.instrumentos
+              );
+              this.instrumentTypes =
+                this.instrumentTypes != undefined
+                  ? this.instrumentTypes.nombre
+                  : "-";
+            });
+
+            this.catalogService.getMarketTypes().subscribe(res => {
+              this.markets = res.find(
+                e => e.id_tipo_mercado == this.complement.tipo_mercado
+              );
+              this.markets =
+                this.markets != undefined ? this.markets.nombre : "-";
+            });
+            this.catalogService.getEmitterTypes().subscribe(res => {
+              this.emitters = res.find(
+                e => e.id_tipo_emisor == this.complement.emisores
+              );
+              this.emitters =
+                this.emitters != undefined ? this.emitters.nombre : "-";
+            });
+            this.catalogService.getPeriodicities().subscribe(res => {
+              this.periodicities = res.find(
+                e => e.id_periodicidad == this.general.periodicidad
+              );
+              this.periodicities =
+                this.periodicities != undefined
+                  ? this.periodicities.nombre
+                  : "-";
+            });
+
+            this.catalogService.getPaymentTerms().subscribe(res => {
+              this.payment_terms = res.find(
+                e => e.codigo == this.complement.calificadora_riesgo
+              );
+              this.payment_terms =
+                this.payment_terms != undefined
+                  ? this.payment_terms.nombre
+                  : "-";
+            });
+            this.catalogService.getOperationTypes().subscribe(res => {
+              this.operations = res.find(
+                e => e.codigo == this.complement.operaciones
+              );
+              this.operations =
+                this.operations != undefined ? this.operations.nombre : "-";
+            });
+            //getIncomeFormat
+            this.catalogService.getIncomeFormat().subscribe(res => {
+              this.format_incomes = res.find(
+                e => e.id_formato_ingreso == this.general.formato_ingreso
+              );
+              this.format_incomes =
+                this.format_incomes != undefined
+                  ? this.format_incomes.nombre
+                  : "-";
+            });
+          }
+        });
+    } else {
+      this.investmentExists = false;
+    }
+  }
+
+  loadComponent() {
+    this.currentAdIndex = this.indexDynamicComponent % this.ads.length;
+    const adItem = this.ads[this.currentAdIndex];
+    const componentFactory = this.componentFactoryResolver.resolveComponentFactory(
+      adItem.component
+    );
+
+    const viewContainerRef = this.adHost.viewContainerRef;
+    viewContainerRef.clear();
+
+    const componentRef = viewContainerRef.createComponent(componentFactory);
+    (<InstrumentComponent>componentRef.instance).data = adItem.data;
+    (<InstrumentComponent>componentRef.instance).summary = true;
+  }
+}

+ 12 - 10
src/app/components/investment-proposals/result/result.component.ts

@@ -190,12 +190,14 @@ export class ResultComponent implements OnInit {
         this.periodicities != undefined ? this.periodicities.nombre : "-";
     });
     this.catalogService.getPaymentTerms().subscribe(res => {
-      this.payment_terms = res.find(e => e.codigo == this.complement.plazo);
+      this.payment_terms = res.find(e => e.id_plazo == this.complement.plazo);
       this.payment_terms =
         this.payment_terms != undefined ? this.payment_terms.nombre : "-";
     });
     this.catalogService.getOperationTypes().subscribe(res => {
-      this.operations = res.find(e => e.codigo == this.complement.operaciones);
+      this.operations = res.find(
+        e => e.id_tipo_operacion == this.complement.operaciones
+      );
       this.operations =
         this.operations != undefined ? this.operations.nombre : "-";
     });
@@ -216,20 +218,20 @@ export class ResultComponent implements OnInit {
     this.inversion = {
       codigo_instrumento: this.general.instrumentos,
       info_inversion: {
-        id_empresa: this.complement.empresa,
-        id_pais: this.complement.pais,
+        id_empresa: +this.complement.empresa,
+        id_pais: +this.complement.pais,
         id_entidad: +this.general.casa,
-        id_origen_fondo: this.general.origenes_fondo,
-        id_periodicidad: this.general.periodicidad,
+        id_origen_fondo: +this.general.origenes_fondo,
+        id_periodicidad: +this.general.periodicidad,
         id_plazo: +this.complement.plazo,
-        id_tipo_base: this.general.base_anual,
+        id_tipo_base: +this.general.base_anual,
         id_tipo_emisor: +this.complement.emisores,
         id_tipo_mercado: this.complement.tipo_mercado,
         id_tipo_operacion: +this.complement.operaciones,
         //id_tipo_pago: 1,
-        id_formato_ingreso: this.general.formato_ingreso,
-        id_tipo_renta: this.general.tipo_renta,
-        id_tipo_tasa: this.general.tipo_tasa,
+        id_formato_ingreso: +this.general.formato_ingreso,
+        id_tipo_renta: +this.general.tipo_renta,
+        id_tipo_tasa: +this.general.tipo_tasa,
         nombre_inversion: this.general.name,
         asunto: this.general.asunto,
         comentario: this.complement.comentarios,

+ 1 - 1
src/app/components/login/login.component.scss

@@ -79,7 +79,7 @@
 
   .auth-main:before {
     width: 100%;
-    background-image: url("/assets/img/login-bg.png");
+    //background-image: url("/assets/img/login-bg.png");
   }
 
   .top {

+ 3 - 1
src/app/layouts/admin/admin.module.ts

@@ -74,6 +74,7 @@ import { ChangeHistoryComponent } from "@app/components/investment-proposals/cha
 
 import { PaymentRequirementComponent } from "@app/components/investment-proposals/payment-requirement/payment-requirement.component";
 import { PaymentInfoComponent } from "@app/components/investment-proposals/payment-info/payment-info.component";
+import { InvestmentProposalDetailComponent } from "@app/components/investment-proposals/proposal-detail/review/proposal-detail.component";
 
 // This array defines which "componentId" maps to which lazy-loaded module.
 
@@ -137,7 +138,8 @@ import { PaymentInfoComponent } from "@app/components/investment-proposals/payme
     APNComponent,
     InstrumentDirective,
     PaymentInfoComponent,
-    PaymentRequirementComponent
+    PaymentRequirementComponent,
+    InvestmentProposalDetailComponent
   ],
   entryComponents: [
     LETE,

+ 6 - 0
src/app/layouts/admin/admin.routing.ts

@@ -20,6 +20,8 @@ import { ChangeHistoryComponent } from "@app/components/investment-proposals/cha
 import { PaymentInfoComponent } from "@app/components/investment-proposals/payment-info/payment-info.component";
 
 import { PaymentRequirementComponent } from "@app/components/investment-proposals/payment-requirement/payment-requirement.component";
+import { InvestmentProposalDetailComponent } from "@app/components/investment-proposals/proposal-detail/review/proposal-detail.component";
+
 import { NgModule } from "@angular/core";
 import { from } from "rxjs";
 
@@ -178,5 +180,9 @@ export const AdminLayoutRoutes: Routes = [
   {
     path: "investment-proposal/:id/payment",
     component: PaymentRequirementComponent
+  },
+  {
+    path: "investment-proposal/:id",
+    component: InvestmentProposalDetailComponent
   }
 ];

+ 2 - 1
src/app/services/form-investment-proposal.service.ts

@@ -110,7 +110,8 @@ export class FormInvestmentProposalService {
     // Reset the workflow
     // Return the form data after all this.* members had been reset
     this.formData.clear();
-
+    this.instrumentData = undefined;
+    this.setWork(this.instrumentData);
     this.isGeneralInfoFormValid = this.isWorkFormValid = this.isComplementInfoFormValid = false;
     this.workflowService.resetSteps();
     return this.formData;

+ 4 - 4
src/app/services/instrument-calculations.service.ts

@@ -28,7 +28,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/lete`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento
@@ -62,7 +62,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/cete`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento
@@ -98,7 +98,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/vcn`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento
@@ -128,7 +128,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/dap`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento