Bladeren bron

Avances del sprint 6

Oscar José Nuñez Chávez 5 jaren geleden
bovenliggende
commit
654cacd7f7
40 gewijzigde bestanden met toevoegingen van 1883 en 262 verwijderingen
  1. 70 23
      src/app/components/instruments/bonos/bonos.component.html
  2. 18 1
      src/app/components/instruments/bonos/bonos.component.ts
  3. 49 23
      src/app/components/instruments/certificados/certificados.component.html
  4. 14 4
      src/app/components/instruments/certificados/certificados.component.ts
  5. 38 3
      src/app/components/instruments/cete/cete.component.html
  6. 3 0
      src/app/components/instruments/cete/cete.component.ts
  7. 49 23
      src/app/components/instruments/eurobonos/eurobonos.component.html
  8. 13 1
      src/app/components/instruments/eurobonos/eurobonos.component.ts
  9. 36 1
      src/app/components/instruments/fondos/fondos.component.html
  10. 10 0
      src/app/components/instruments/fondos/fondos.component.ts
  11. 45 0
      src/app/components/instruments/futuros/futuros.component.html
  12. 19 1
      src/app/components/instruments/futuros/futuros.component.ts
  13. 32 2
      src/app/components/instruments/lete/lete.component.html
  14. 11 0
      src/app/components/instruments/lete/lete.component.ts
  15. 38 3
      src/app/components/instruments/opciones/opciones.component.html
  16. 14 1
      src/app/components/instruments/opciones/opciones.component.ts
  17. 36 0
      src/app/components/instruments/pemp/pemp.component.html
  18. 13 5
      src/app/components/instruments/pemp/pemp.component.ts
  19. 38 0
      src/app/components/instruments/pper/pper.component.html
  20. 12 4
      src/app/components/instruments/pper/pper.component.ts
  21. 46 12
      src/app/components/instruments/titulos/titulos.component.html
  22. 15 3
      src/app/components/instruments/titulos/titulos.component.ts
  23. 36 12
      src/app/components/investment-proposals/approve/approve.component.ts
  24. 29 9
      src/app/components/investment-proposals/investment-proposals.component.ts
  25. 35 11
      src/app/components/investment-proposals/payment-approval/payment-approval.component.ts
  26. 1 1
      src/app/components/investment-proposals/payment-info/payment-info.component.html
  27. 10 1
      src/app/components/investment-proposals/payment-info/payment-info.component.ts
  28. 25 3
      src/app/components/investment-proposals/payment-requirement/payment-requirement.component.ts
  29. 12 10
      src/app/components/investment-proposals/proposal-detail/proposal-detail.component.html
  30. 35 11
      src/app/components/investment-proposals/review/review.component.ts
  31. 5 2
      src/app/components/plugins/investment-print/investment-print.html
  32. 817 25
      src/app/components/plugins/investment-print/investment-print.ts
  33. 112 9
      src/app/components/profile/profile.component.html
  34. 15 1
      src/app/components/profile/profile.component.scss
  35. 82 11
      src/app/components/profile/profile.component.ts
  36. 7 0
      src/app/components/shared/sidebar/sidebar.component.ts
  37. 14 0
      src/app/services/catalogs.service.ts
  38. 7 0
      src/app/services/instrument-calculations.service.ts
  39. 1 1
      src/app/services/instruments.service.ts
  40. 21 45
      src/app/services/user.service.ts

+ 70 - 23
src/app/components/instruments/bonos/bonos.component.html

@@ -7,6 +7,27 @@
     [formGroup]="investmentProposalForm"
   >
     <div class="row">
+      <div class="col-6">
+        <div class="form-group">
+          <label>Tipo de ejecución: </label>
+        </div>
+        <select
+          class="custom-select"
+          formControlName="ejecucion"
+          (change)="toggle_ejecucion($event.target.value)"
+        >
+          <option
+            *ngFor="let item of ejecuciones"
+            [value]="item.codigo"
+            [selected]="item.codigo == ejecucion"
+          >
+            {{ item.nombre }}</option
+          >
+        </select>
+      </div>
+
+      <br />
+
       <div class=" col-md-6 col-sm-12 border border-light">
         <div class="row no-gutters">
           <!-- Valor nominal compra -->
@@ -15,6 +36,36 @@
             <h5>Compra</h5>
           </div>
 
+          <div class="col-lg-6 col-sm-12 pr-xl-3">
+            <div class="form-group">
+              <label for="renta_porcentaje">Renta: </label>
+              <div class="input-box-container">
+                <p>
+                  <i class="fas fa-percent" aria-hidden="true"></i>
+                </p>
+                <input
+                  type="text"
+                  formControlName="renta_porcentaje"
+                  class="form-control"
+                  [ngClass]="{
+                    'is-invalid': submitted && f.renta_porcentaje.errors
+                  }"
+                />
+                <div
+                  *ngIf="submitted && f.renta_porcentaje.errors"
+                  class="invalid-feedback"
+                >
+                  <div *ngIf="f.renta_porcentaje.errors.required">
+                    Campo requerido
+                  </div>
+                  <div *ngIf="f.renta_porcentaje.errors.pattern">
+                    Debe ingresar una cifra válida
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
           <div class="col-lg-6 col-sm-12 pr-xl-3">
             <div class="form-group">
               <label for="costo_cedeval">Costo CEDEVAL: </label>
@@ -1019,8 +1070,7 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_bruto | number: "1.2-4"
                 }}
               </td>
@@ -1035,25 +1085,21 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_neto | number: "1.2-4"
                 }}
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta ($)</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.impuesto == "" || row.impuesto == undefined
-                    ? "-"
-                    : row.impuesto
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                {{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
 
@@ -1093,6 +1139,12 @@
           Instrumento de compra
         </h3>
       </div>
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>Costo CEDEVAL:</h4>
         <div class="field">
@@ -1577,8 +1629,7 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_bruto | number: "1.2-4"
                 }}
               </td>
@@ -1594,25 +1645,21 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_neto | number: "1.2-4"
                 }}
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta ($)</th>
               <td mat-cell *matCellDef="let row">
-                {{
-                  row.impuesto == "" || row.impuesto == undefined
-                    ? "-"
-                    : row.impuesto
+                ${{
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                ${{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
 

+ 18 - 1
src/app/components/instruments/bonos/bonos.component.ts

@@ -30,7 +30,7 @@ export class BONO implements InstrumentComponent {
     "fecha_pago",
     "ingreso_bruto",
     "ingreso_neto",
-    "impuesto"
+    "renta"
   ];
 
   @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@@ -128,6 +128,11 @@ export class BONO implements InstrumentComponent {
   ytm_vencimiento_porcentaje_venta: any;
   comision_bolsa_venta: any;
   consolidado_proyeccion: any;
+  ejecucion: boolean = false;
+  ejecuciones = [
+    { codigo: 1, nombre: "Completa" },
+    { codigo: 0, nombre: "Parcial" }
+  ];
 
   constructor(
     private formBuilder: FormBuilder,
@@ -172,6 +177,15 @@ export class BONO implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      ejecucion: [this.instrument_exists ? "" : this.ejecucion],
+
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       costo_cedeval: [
         this.instrument_exists ? "" : this.instrument_work.costo_cedeval,
         [
@@ -403,6 +417,7 @@ export class BONO implements InstrumentComponent {
           id_periodicidad: +this.general.periodicidad
         },
         {
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           costo_cedeval: +this.f.costo_cedeval.value,
           costo_transferencia: +this.f.costo_transferencia.value,
           valor_nominal_compra: +this.f.valor_nominal_compra.value,
@@ -552,6 +567,8 @@ export class BONO implements InstrumentComponent {
           this.dataSource.sort = this.sort;
 
           this.bonosObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             costo_cedeval: this.investmentProposalForm.value.costo_cedeval,
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,

+ 49 - 23
src/app/components/instruments/certificados/certificados.component.html

@@ -15,6 +15,36 @@
             <h5>Compra</h5>
           </div>
 
+          <div class="col-lg-6 col-sm-12 pr-xl-3">
+            <div class="form-group">
+              <label for="renta_porcentaje">Renta: </label>
+              <div class="input-box-container">
+                <p>
+                  <i class="fas fa-percent" aria-hidden="true"></i>
+                </p>
+                <input
+                  type="text"
+                  formControlName="renta_porcentaje"
+                  class="form-control"
+                  [ngClass]="{
+                    'is-invalid': submitted && f.renta_porcentaje.errors
+                  }"
+                />
+                <div
+                  *ngIf="submitted && f.renta_porcentaje.errors"
+                  class="invalid-feedback"
+                >
+                  <div *ngIf="f.renta_porcentaje.errors.required">
+                    Campo requerido
+                  </div>
+                  <div *ngIf="f.renta_porcentaje.errors.pattern">
+                    Debe ingresar una cifra válida
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
           <div class="col-lg-6 col-sm-12 pr-xl-3">
             <div class="form-group">
               <label for="costo_cedeval">Costo CEDEVAL: </label>
@@ -1019,8 +1049,7 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_bruto | number: "1.2-4"
                 }}
               </td>
@@ -1035,25 +1064,21 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_neto | number: "1.2-4"
                 }}
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta ($)</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.impuesto == "" || row.impuesto == undefined
-                    ? "-"
-                    : row.impuesto
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                {{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
 
@@ -1093,6 +1118,12 @@
           Instrumento de compra
         </h3>
       </div>
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>Costo CEDEVAL:</h4>
         <div class="field">
@@ -1576,8 +1607,7 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_bruto | number: "1.2-4"
                 }}
               </td>
@@ -1593,25 +1623,21 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_neto | number: "1.2-4"
                 }}
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta ($)</th>
               <td mat-cell *matCellDef="let row">
-                {{
-                  row.impuesto == "" || row.impuesto == undefined
-                    ? "-"
-                    : row.impuesto
+                ${{
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                ${{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
 

+ 14 - 4
src/app/components/instruments/certificados/certificados.component.ts

@@ -30,7 +30,7 @@ export class CINV implements InstrumentComponent {
     "fecha_pago",
     "ingreso_bruto",
     "ingreso_neto",
-    "impuesto"
+    "renta"
   ];
 
   @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@@ -172,6 +172,13 @@ export class CINV implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       costo_cedeval: [
         this.instrument_exists ? "" : this.instrument_work.costo_cedeval,
         [
@@ -403,6 +410,7 @@ export class CINV implements InstrumentComponent {
           id_periodicidad: +this.general.periodicidad
         },
         {
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           costo_cedeval: +this.f.costo_cedeval.value,
           costo_transferencia: +this.f.costo_transferencia.value,
           valor_nominal_compra: +this.f.valor_nominal_compra.value,
@@ -540,6 +548,7 @@ export class CINV implements InstrumentComponent {
           // Proyecciones
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
+            this.hasProjections = true;
             let proyecciones_temp = this.proyecciones;
             this.consolidado_proyeccion =
               proyecciones_temp[proyecciones_temp.length - 1];
@@ -547,14 +556,15 @@ export class CINV implements InstrumentComponent {
           }
 
           this.operation_result = true;
-          this.dataSource.data = this.proyecciones;
-          this.dataSource2.data = this.proyecciones;
-
+          this.dataSource.data = this.proyecciones.slice(0, -1);
+          this.dataSource2.data = this.proyecciones.slice(0, -1);
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
           // Obj
           this.bonosObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             costo_cedeval: this.investmentProposalForm.value.costo_cedeval,
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,

+ 38 - 3
src/app/components/instruments/cete/cete.component.html

@@ -156,6 +156,36 @@
         </div>
       </div>
 
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
       <!-- Otros Costos -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -334,9 +364,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">
-            {{ rendimiento_neto | number: "1.2-4" }}
-          </div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -536,6 +564,13 @@
           $USD {{ instrument_work.comision_bolsa | number: "1.2-4" }}
         </div>
       </div>
+
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>Rendimiento bruto:</h4>
         <div class="field">

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

@@ -270,6 +270,7 @@ export class CETE implements InstrumentComponent {
           id_periodicidad: +this.general.periodicidad
         },
         {
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           valor_nominal: +this.f.valor_nominal.value,
           comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
           comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
@@ -309,6 +310,8 @@ export class CETE implements InstrumentComponent {
           this.dataSource.sort = this.sort;
 
           this.ceteObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             valor_nominal: this.investmentProposalForm.value.valor_nominal,
             plazo: this.investmentProposalForm.value.plazo,
             comision_casa_porcentaje: this.investmentProposalForm.value

+ 49 - 23
src/app/components/instruments/eurobonos/eurobonos.component.html

@@ -15,6 +15,36 @@
             <h5>Compra</h5>
           </div>
 
+          <div class="col-lg-6 col-sm-12 pr-xl-3">
+            <div class="form-group">
+              <label for="renta_porcentaje">Renta: </label>
+              <div class="input-box-container">
+                <p>
+                  <i class="fas fa-percent" aria-hidden="true"></i>
+                </p>
+                <input
+                  type="text"
+                  formControlName="renta_porcentaje"
+                  class="form-control"
+                  [ngClass]="{
+                    'is-invalid': submitted && f.renta_porcentaje.errors
+                  }"
+                />
+                <div
+                  *ngIf="submitted && f.renta_porcentaje.errors"
+                  class="invalid-feedback"
+                >
+                  <div *ngIf="f.renta_porcentaje.errors.required">
+                    Campo requerido
+                  </div>
+                  <div *ngIf="f.renta_porcentaje.errors.pattern">
+                    Debe ingresar una cifra válida
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
           <div class="col-lg-6 col-sm-12 pr-xl-3">
             <div class="form-group">
               <label for="costo_cedeval">Costo CEDEVAL: </label>
@@ -1019,8 +1049,7 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_bruto | number: "1.2-4"
                 }}
               </td>
@@ -1035,25 +1064,21 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_neto | number: "1.2-4"
                 }}
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta ($)</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.impuesto == "" || row.impuesto == undefined
-                    ? "-"
-                    : row.impuesto
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                {{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
 
@@ -1093,6 +1118,12 @@
           Instrumento de compra
         </h3>
       </div>
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>Costo CEDEVAL:</h4>
         <div class="field">
@@ -1576,8 +1607,7 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_bruto | number: "1.2-4"
                 }}
               </td>
@@ -1593,25 +1623,21 @@
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{
+                ${{
                   consolidado_proyeccion.total_ingreso_neto | number: "1.2-4"
                 }}
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta ($)</th>
               <td mat-cell *matCellDef="let row">
-                {{
-                  row.impuesto == "" || row.impuesto == undefined
-                    ? "-"
-                    : row.impuesto
+                ${{
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                ${{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
 

+ 13 - 1
src/app/components/instruments/eurobonos/eurobonos.component.ts

@@ -30,7 +30,7 @@ export class EURB implements InstrumentComponent {
     "fecha_pago",
     "ingreso_bruto",
     "ingreso_neto",
-    "impuesto"
+    "renta"
   ];
 
   @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@@ -172,6 +172,13 @@ export class EURB implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       costo_cedeval: [
         this.instrument_exists ? "" : this.instrument_work.costo_cedeval,
         [
@@ -403,6 +410,7 @@ export class EURB implements InstrumentComponent {
           id_periodicidad: +this.general.periodicidad
         },
         {
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           costo_cedeval: +this.f.costo_cedeval.value,
           costo_transferencia: +this.f.costo_transferencia.value,
           valor_nominal_compra: +this.f.valor_nominal_compra.value,
@@ -539,6 +547,7 @@ export class EURB implements InstrumentComponent {
           // Proyecciones
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
+            this.hasProjections = true;
             let proyecciones_temp = this.proyecciones;
             this.consolidado_proyeccion =
               proyecciones_temp[proyecciones_temp.length - 1];
@@ -551,7 +560,10 @@ export class EURB implements InstrumentComponent {
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
+          // Obj
           this.bonosObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             costo_cedeval: this.investmentProposalForm.value.costo_cedeval,
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,

+ 36 - 1
src/app/components/instruments/fondos/fondos.component.html

@@ -253,6 +253,36 @@
         </div>
       </div>
 
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
       <!-- Fecha de operación -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -652,7 +682,12 @@
           $USD {{ instrument_work_summary.comision_bolsa | number: "1.2-4" }}
         </div>
       </div>
-
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>Rendimiento (%):</h4>
         <div class="field">

+ 10 - 0
src/app/components/instruments/fondos/fondos.component.ts

@@ -155,6 +155,13 @@ export class FINV implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       cuota_participacion: [
         this.instrument_exists ? "" : this.instrument_work.cuota_participacion,
         [
@@ -278,6 +285,7 @@ export class FINV implements InstrumentComponent {
         {
           cuota_participacion: +this.f.cuota_participacion.value,
           valor_participacion: +this.f.valor_participacion.value,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           comision_bolsa_porcentaje: +this.f.comision_bolsa_porcentaje.value,
           comision_casa_porcentaje: +this.f.comision_casa_porcentaje.value,
           dividendo_porcentaje: +this.f.dividendo_porcentaje.value,
@@ -334,6 +342,8 @@ export class FINV implements InstrumentComponent {
           this.dataSource.sort = this.sort;
 
           this.fondosObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             cuota_participacion: this.investmentProposalForm.value
               .cuota_participacion,
             valor_participacion: this.investmentProposalForm.value

+ 45 - 0
src/app/components/instruments/futuros/futuros.component.html

@@ -75,6 +75,36 @@
           </div>
         </div>
       </div>
+
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
     </div>
 
     <br />
@@ -867,6 +897,21 @@
 <div *ngIf="summary">
   <div class="timeline-body">
     <div class="row">
+      <div class="col-6">
+        <h3>
+          Ticker
+        </h3>
+        <div class="field">
+          {{ instrument_work_summary.ticker }}
+        </div>
+      </div>
+      <div class="col-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
+
       <!-- COMPRA -->
       <div class="col-12">
         <h3>

+ 19 - 1
src/app/components/instruments/futuros/futuros.component.ts

@@ -143,6 +143,11 @@ export class FUTU implements InstrumentComponent {
         this.instrument_work.valor_recibido > 0
       ) {
         this.ejecucion = 1;
+      } else if (
+        this.instrument_work.valor_pagado > 1 ||
+        this.instrument_work.valor_recibido > 1
+      ) {
+        this.ejecucion = 0;
       } else {
         this.ejecucion = +this.instrument_work_summary.completo;
       }
@@ -152,6 +157,13 @@ export class FUTU implements InstrumentComponent {
       operacion: [this.instrument_exists ? "" : this.instrument_work.corto],
       ejecucion: [this.instrument_exists ? "" : this.ejecucion],
       ticker: [this.instrument_exists ? "" : this.instrument_work.ticker],
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       precio_unitario_compra: [
         this.instrument_exists
           ? ""
@@ -528,7 +540,10 @@ export class FUTU implements InstrumentComponent {
         },
         {
           completo: this.tipoEjecucion,
+          cancelado: this.tipoEjecucion,
+
           corto: this.tipoOperacion,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           precio_unitario_compra: this.f.precio_unitario_compra.value,
           comision_broker_compra: this.f.comision_broker_compra.value,
           cantidad_contratos_compra: this.f.cantidad_contratos_compra.value,
@@ -631,9 +646,12 @@ export class FUTU implements InstrumentComponent {
 
           this.futurosObject = {
             completo: this.tipoEjecucion,
+            cancelado: this.tipoEjecucion,
+
             corto: this.tipoOperacion,
             ticker: this.investmentProposalForm.value.ticker,
-
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             fecha_inicio_vigencia: this.fecha_inicio_vigencia
           };
 

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

@@ -152,6 +152,36 @@
         </div>
       </div>
 
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
           <label for="fecha_operacion">Fecha operación: </label>
@@ -363,9 +393,9 @@
         </div>
       </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
-        <h4>Ingreso neto:</h4>
+        <h4>Renta (%):</h4>
         <div class="field">
-          $USD {{ instrument_work.ingreso_neto | number: "1.2-4" }}
+          {{ instrument_work.renta_porcentaje | number: "1.2-4" }}%
         </div>
       </div>
 

+ 11 - 0
src/app/components/instruments/lete/lete.component.ts

@@ -92,6 +92,14 @@ export class LETE implements InstrumentComponent {
     this.general = this.formDataService.getGeneralInfo();
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
+
       valor_nominal: [
         this.instrument_exists ? "" : this.instrument_work.valor_nominal,
         [
@@ -212,6 +220,7 @@ export class LETE implements InstrumentComponent {
         {
           valor_nominal: +this.f.valor_nominal.value,
           plazo: +this.f.plazo.value,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           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,
@@ -233,6 +242,8 @@ export class LETE implements InstrumentComponent {
           Swal.close();
 
           this.leteObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             valor_nominal: this.investmentProposalForm.value.valor_nominal,
             plazo: this.investmentProposalForm.value.plazo,
             comision_casa_porcentaje: this.investmentProposalForm.value

+ 38 - 3
src/app/components/instruments/opciones/opciones.component.html

@@ -47,8 +47,6 @@
     </div>
 
     <div class="row">
-      <!-- Fecha de vencimiento -->
-
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
           <label for="ticker">Ticker: </label>
@@ -72,6 +70,36 @@
           </div>
         </div>
       </div>
+
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
     </div>
 
     <br />
@@ -864,7 +892,7 @@
 <div *ngIf="summary">
   <div class="timeline-body">
     <div class="row">
-      <div class="col-12">
+      <div class="col-6">
         <h3>
           Ticker
         </h3>
@@ -872,6 +900,13 @@
           {{ instrument_work_summary.ticker }}
         </div>
       </div>
+      <div class="col-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
+
       <!-- COMPRA -->
       <div class="col-12">
         <h3>

+ 14 - 1
src/app/components/instruments/opciones/opciones.component.ts

@@ -137,6 +137,13 @@ export class OPC implements InstrumentComponent {
     this.investmentProposalForm = this.formBuilder.group({
       operacion: [this.instrument_exists ? "" : +this.instrument_work.corto],
       ejecucion: [this.instrument_exists ? "" : this.ejecucion],
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       ticker: [this.instrument_exists ? "" : this.instrument_work.ticker],
       precio_unitario_compra: [
         this.instrument_exists
@@ -520,7 +527,10 @@ export class OPC implements InstrumentComponent {
         },
         {
           completo: this.tipoEjecucion,
+          cancelado: this.tipoEjecucion,
+
           corto: this.tipoOperacion,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           precio_unitario_compra: this.f.precio_unitario_compra.value,
           comision_broker_compra: this.f.comision_broker_compra.value,
           cantidad_contratos_compra: this.f.cantidad_contratos_compra.value,
@@ -623,9 +633,12 @@ export class OPC implements InstrumentComponent {
 
           this.opcionesObject = {
             completo: this.tipoEjecucion,
+            cancelado: this.tipoEjecucion,
+
             corto: this.tipoOperacion,
             ticker: this.investmentProposalForm.value.ticker,
-
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             fecha_inicio_vigencia: this.fecha_inicio_vigencia
           };
 

+ 36 - 0
src/app/components/instruments/pemp/pemp.component.html

@@ -100,6 +100,36 @@
         </div>
       </div>
 
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
       <!-- Comisián desembolso -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -477,6 +507,12 @@
           {{ instrument_work.iva_porcentaje | number: "1.2-4" }}%
         </div>
       </div>
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>IVA ($):</h4>
         <div class="field">

+ 13 - 5
src/app/components/instruments/pemp/pemp.component.ts

@@ -100,10 +100,8 @@ export class PEMP implements InstrumentComponent {
   dataSource2 = new MatTableDataSource(this.proyecciones);
   hasProjections: boolean;
   fecha_vencimiento: any;
-  consolidado_proyeccion = {
-    total_ingreso_bruto: 0,
-    total_ingreso_neto: 0
-  };
+  consolidado_proyeccion: any;
+
   fecha_operacion: any;
   comision_desembolso: any;
 
@@ -136,6 +134,14 @@ export class PEMP implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
+
       monto_prestamo: [
         this.instrument_exists ? "" : this.instrument_work.monto_prestamo,
         [
@@ -236,6 +242,7 @@ export class PEMP implements InstrumentComponent {
         },
         {
           monto_prestamo: +this.f.monto_prestamo.value,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           tasa_porcentaje: +this.f.tasa_porcentaje.value,
           iva_porcentaje: +this.f.iva_porcentaje.value,
           comision_desembolso_porcentaje: +this.f.comision_desembolso_porcentaje
@@ -255,7 +262,6 @@ export class PEMP implements InstrumentComponent {
           this.comision_desembolso_porcentaje =
             ans["result"]["instrumento"]["comision_desembolso_porcentaje"];
           this.iva = ans["result"]["instrumento"]["iva"];
-          this.proyecciones = ans["result"]["instrumento"]["proyecciones"];
           this.fecha_operacion =
             ans["result"]["instrumento"]["fecha_operacion"];
           this.fecha_vencimiento =
@@ -276,6 +282,8 @@ export class PEMP implements InstrumentComponent {
           this.dataSource.sort = this.sort;
 
           this.pempObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             monto_prestamo: this.investmentProposalForm.value.monto_prestamo,
             tasa_porcentaje: this.investmentProposalForm.value.tasa_porcentaje,
             iva_porcentaje: this.investmentProposalForm.value.iva_porcentaje,

+ 38 - 0
src/app/components/instruments/pper/pper.component.html

@@ -193,6 +193,36 @@
         </div>
       </div>
 
+      <div class="col-lg-6 col-sm-12 pr-xl-3">
+        <div class="form-group">
+          <label for="renta_porcentaje">Renta: </label>
+          <div class="input-box-container">
+            <p>
+              <i class="fas fa-percent" aria-hidden="true"></i>
+            </p>
+            <input
+              type="text"
+              formControlName="renta_porcentaje"
+              class="form-control"
+              [ngClass]="{
+                'is-invalid': submitted && f.renta_porcentaje.errors
+              }"
+            />
+            <div
+              *ngIf="submitted && f.renta_porcentaje.errors"
+              class="invalid-feedback"
+            >
+              <div *ngIf="f.renta_porcentaje.errors.required">
+                Campo requerido
+              </div>
+              <div *ngIf="f.renta_porcentaje.errors.pattern">
+                Debe ingresar una cifra válida
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
       <!-- Total de cuotas mensuales -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -663,6 +693,14 @@
           $USD {{ instrument_work.monto_prestamo | number: "1.2-4" }}
         </div>
       </div>
+
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
+
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>IVA (%):</h4>
         <div class="field">

+ 12 - 4
src/app/components/instruments/pper/pper.component.ts

@@ -106,10 +106,7 @@ export class PPER implements InstrumentComponent {
   dataSource2 = new MatTableDataSource(this.proyecciones);
   hasProjections: boolean;
   fecha_vencimiento: any;
-  consolidado_proyeccion = {
-    total_ingreso_bruto: 0,
-    total_ingreso_neto: 0
-  };
+  consolidado_proyeccion: any;
   fecha_otorgamiento: any;
   comision_desembolso: any;
   fecha_gracia: any;
@@ -156,6 +153,14 @@ export class PPER implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
+
       monto_prestamo: [
         this.instrument_exists ? "" : this.instrument_work.monto_prestamo,
         [
@@ -267,6 +272,7 @@ export class PPER implements InstrumentComponent {
         },
         {
           monto_prestamo: this.f.monto_prestamo.value,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           fecha_otorgamiento: this.f.fecha_otorgamiento.value.singleDate
             .formatted,
           plazo_gracia: this.f.plazo_gracia.value,
@@ -311,6 +317,8 @@ export class PPER implements InstrumentComponent {
           this.dataSource.sort = this.sort;
 
           this.pperObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
             monto_prestamo: this.investmentProposalForm.value.monto_prestamo,
             plazo_gracia: this.investmentProposalForm.value.plazo_gracia,
             tasa_porcentaje: this.investmentProposalForm.value.tasa_porcentaje,

+ 46 - 12
src/app/components/instruments/titulos/titulos.component.html

@@ -14,6 +14,36 @@
             <h5>Compra</h5>
           </div>
 
+          <div class="col-lg-6 col-sm-12 pr-xl-3">
+            <div class="form-group">
+              <label for="renta_porcentaje">Renta: </label>
+              <div class="input-box-container">
+                <p>
+                  <i class="fas fa-percent" aria-hidden="true"></i>
+                </p>
+                <input
+                  type="text"
+                  formControlName="renta_porcentaje"
+                  class="form-control"
+                  [ngClass]="{
+                    'is-invalid': submitted && f.renta_porcentaje.errors
+                  }"
+                />
+                <div
+                  *ngIf="submitted && f.renta_porcentaje.errors"
+                  class="invalid-feedback"
+                >
+                  <div *ngIf="f.renta_porcentaje.errors.required">
+                    Campo requerido
+                  </div>
+                  <div *ngIf="f.renta_porcentaje.errors.pattern">
+                    Debe ingresar una cifra válida
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
           <div class="col-lg-6 col-sm-12 pr-xl-3">
             <div class="form-group">
               <label for="costo_cedeval">Costo CEDEVAL: </label>
@@ -1129,18 +1159,18 @@
                 }}
               </td>
             </ng-container>
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.impuesto == "" || row.impuesto == undefined
+                  row.renta == "" || row.renta == undefined
                     ? "-"
-                    : (row.impuesto | number: "1.2-4")
+                    : (row.renta | number: "1.2-4")
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
                 $USD
-                {{ consolidado_proyeccion.total_impuesto | number: "1.2-4" }}
+                {{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
             <ng-container matColumnDef="ingreso_neto">
@@ -1216,6 +1246,12 @@
           Instrumento de compra
         </h3>
       </div>
+      <div class="col-lg-3 col-md-4 col-sm-6">
+        <h4>Renta (%):</h4>
+        <div class="field">
+          {{ instrument_work_summary.renta_porcentaje | number: "1.2-4" }}%
+        </div>
+      </div>
       <div class="col-lg-3 col-md-4 col-sm-6">
         <h4>Costo CEDEVAL:</h4>
         <div class="field">
@@ -1751,19 +1787,17 @@
                 }}
               </td>
             </ng-container>
-            <ng-container matColumnDef="impuesto">
-              <th mat-header-cell *matHeaderCellDef>Impuesto</th>
+            <ng-container matColumnDef="renta">
+              <th mat-header-cell *matHeaderCellDef>Renta</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.impuesto == "" || row.impuesto == undefined
+                  row.renta == "" || row.renta == undefined
                     ? "-"
-                    : (row.impuesto | number: "1.2-4")
+                    : (row.renta | number: "1.2-4")
                 }}
               </td>
               <td mat-footer-cell *matFooterCellDef>
-                $USD{{
-                  consolidado_proyeccion.total_impuesto | number: "1.2-4"
-                }}
+                $USD{{ consolidado_proyeccion.total_renta | number: "1.2-4" }}
               </td>
             </ng-container>
             <ng-container matColumnDef="ingreso_neto">

+ 15 - 3
src/app/components/instruments/titulos/titulos.component.ts

@@ -36,7 +36,7 @@ export class TIT implements InstrumentComponent {
     "ingreso_bruto",
     "impuesto",
     "ingreso_neto",
-    "impuesto",
+    "renta",
     "saldo"
   ];
 
@@ -184,6 +184,13 @@ export class TIT implements InstrumentComponent {
     }
 
     this.investmentProposalForm = this.formBuilder.group({
+      renta_porcentaje: [
+        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        [
+          Validators.required,
+          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
+        ]
+      ],
       costo_cedeval: [
         this.instrument_exists ? "" : this.instrument_work.costo_cedeval,
         [
@@ -469,6 +476,8 @@ export class TIT implements InstrumentComponent {
           id_periodicidad: +this.general.periodicidad
         },
         {
+          renta_porcentaje: +this.f.renta_porcentaje.value,
+          costo_cedeval: +this.f.costo_cedeval.value,
           costo_transferencia: +this.f.costo_transferencia.value,
           valor_nominal_compra: +this.f.valor_nominal_compra.value,
           precio_compra: +this.f.precio_compra.value,
@@ -502,7 +511,6 @@ export class TIT implements InstrumentComponent {
           fecha_liquidacion_venta: this.f.fecha_liquidacion_venta.value
             .singleDate.formatted,
           fecha_emision: this.f.fecha_emision.value.singleDate.formatted,
-          costo_cedeval: this.f.costo_cedeval.value,
           amortizacion_porcentajes: this.amortizaciones
         }
       )
@@ -608,6 +616,7 @@ export class TIT implements InstrumentComponent {
           // Proyecciones
           this.proyecciones = ans["result"]["proyecciones"];
           if (this.proyecciones != undefined && this.proyecciones.length > 0) {
+            this.hasProjections = true;
             let proyecciones_temp = this.proyecciones;
             this.consolidado_proyeccion =
               proyecciones_temp[proyecciones_temp.length - 1];
@@ -620,7 +629,11 @@ export class TIT implements InstrumentComponent {
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
+          // Obj
           this.titulosObject = {
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
+            costo_cedeval: this.investmentProposalForm.value.costo_cedeval,
             costo_transferencia: this.investmentProposalForm.value
               .costo_transferencia,
             valor_nominal_compra: this.investmentProposalForm.value
@@ -715,7 +728,6 @@ export class TIT implements InstrumentComponent {
 
             amortizacion_porcentajes: this.amortizaciones,-**/
             // Proyecciones
-            costo_cedeval: this.f.costo_cedeval.value,
             proyecciones: this.proyecciones
           };
 

+ 36 - 12
src/app/components/investment-proposals/approve/approve.component.ts

@@ -103,12 +103,36 @@ export class InvestmentProposalApproveComponent implements OnInit {
 
           if (this.userListPrevious.length > 0) {
             for (let i = 0; i < this.userListPrevious.length; i++) {
-              this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i]}' name='users' value='${this.userListPrevious[i]}'><label class='form-check-label' for='previous-${this.userListPrevious[i]}'>${this.userListPrevious[i]}</label></div>`;
+              if (this.userListPrevious[i].checked_email == true) {
+                this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${
+                  this.userListPrevious[i].name
+                }' name='users' value='${
+                  this.userListPrevious[i].name
+                }' checked='${
+                  this.userListPrevious[i].default_email == "true"
+                    ? true
+                    : false
+                }'><label class='form-check-label' for='previous-${
+                  this.userListPrevious[i].name
+                }'>${this.userListPrevious[i].name}</label></div>`;
+              } else {
+                this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i].name}' name='users' value='${this.userListPrevious[i].name}'><label class='form-check-label' for='previous-${this.userListPrevious[i].name}'>${this.userListPrevious[i].name}</label></div>`;
+              }
             }
           }
           if (this.userListNext.length > 0) {
             for (let i = 0; i < this.userListNext.length; i++) {
-              this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i]}' name='users' value='${this.userListNext[i]}'><label class='form-check-label' for='next-${this.userListNext[i]}'>${this.userListNext[i]}</label></div>`;
+              if (this.userListNext[i].checked_email == true) {
+                this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${
+                  this.userListNext[i].name
+                }' name='users' value='${this.userListNext[i].name}' checked='${
+                  this.userListNext[i].default_email == "true" ? true : false
+                }'><label class='form-check-label' for='next-${
+                  this.userListNext[i].name
+                }'>${this.userListNext[i].name}</label></div>`;
+              } else {
+                this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i].name}' name='users' value='${this.userListNext[i].name}'><label class='form-check-label' for='next-${this.userListNext[i].name}'>${this.userListNext[i].name}</label></div>`;
+              }
             }
           }
         });
@@ -388,7 +412,7 @@ export class InvestmentProposalApproveComponent implements OnInit {
 
           for (let i = 0; i < this.userListNext.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "next-" + this.userListNext[i]
+              "next-" + this.userListNext[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {
@@ -427,8 +451,8 @@ export class InvestmentProposalApproveComponent implements OnInit {
               }
             },
             err => {
-              debugger
-              if(err.code==405){
+              debugger;
+              if (err.code == 405) {
                 Swal.fire({
                   icon: "error",
                   title: "Operacion no permitida",
@@ -436,14 +460,14 @@ export class InvestmentProposalApproveComponent implements OnInit {
                 }).then(result => {
                   Swal.close();
                   window.location.href = "#/investment-proposals";
-                });  
-              }else{
+                });
+              } else {
                 Swal.fire({
                   icon: "error",
                   title: "Error al guardar",
                   text: err.message
                 });
-              }             
+              }
             }
           );
       });
@@ -492,7 +516,7 @@ export class InvestmentProposalApproveComponent implements OnInit {
 
           for (let i = 0; i < this.userListPrevious.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "previous-" + this.userListPrevious[i]
+              "previous-" + this.userListPrevious[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {
@@ -531,7 +555,7 @@ export class InvestmentProposalApproveComponent implements OnInit {
               }
             },
             err => {
-              if(err.code==405){
+              if (err.code == 405) {
                 Swal.fire({
                   icon: "error",
                   title: "Operacion no permitida",
@@ -540,14 +564,14 @@ export class InvestmentProposalApproveComponent implements OnInit {
                   Swal.close();
                   window.location.href = "#/investment-proposals";
                 });
-              }else{
+              } else {
                 Swal.fire({
                   icon: "error",
                   title: "Error al guardar",
                   text: err.message
                 });
               }
-              this.router.navigate(["/investment-proposals"]);              
+              this.router.navigate(["/investment-proposals"]);
             }
           );
       });

+ 29 - 9
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -295,7 +295,17 @@ export class InvestmentProposalsComponent implements OnInit {
 
         if (this.userList.length > 0) {
           for (let i = 0; i < this.userList.length; i++) {
-            this.test += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='${this.userList[i]}' name='users' value='${this.userList[i]}'><label class='form-check-label' for='${this.userList[i]}'>${this.userList[i]}</label></div>`;
+            if (this.userList[i].checked_email == true) {
+              this.test += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${
+                this.userList[i].name
+              }' name='users' value='${this.userList[i].name}' checked='${
+                this.userList[i].default_email == "true" ? true : false
+              }'><label class='form-check-label' for='next-${
+                this.userList[i].name
+              }'>${this.userList[i].name}</label></div>`;
+            } else {
+              this.test += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userList[i].name}' name='users' value='${this.userList[i].name}'><label class='form-check-label' for='next-${this.userList[i].name}'>${this.userList[i].name}</label></div>`;
+            }
           }
         }
       });
@@ -337,7 +347,7 @@ export class InvestmentProposalsComponent implements OnInit {
 
             for (let i = 0; i < this.userList.length; i++) {
               let html_input: HTMLInputElement = document.getElementById(
-                this.userList[i]
+                this.userList[i].name
               ) as HTMLInputElement;
               let html_value: string = html_input.value;
               if (html_input.checked == true) {
@@ -377,7 +387,7 @@ export class InvestmentProposalsComponent implements OnInit {
                 }
               },
               err => {
-                if(err.code==405){
+                if (err.code == 405) {
                   Swal.fire({
                     icon: "error",
                     title: "Operacion no permitida",
@@ -386,7 +396,7 @@ export class InvestmentProposalsComponent implements OnInit {
                     Swal.close();
                     window.location.href = "#/investment-proposals";
                   });
-                }else{
+                } else {
                   Swal.fire({
                     icon: "error",
                     title: "Error al guardar",
@@ -412,7 +422,17 @@ export class InvestmentProposalsComponent implements OnInit {
 
         if (this.userList.length > 0) {
           for (let i = 0; i < this.userList.length; i++) {
-            this.test += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='${this.userList[i]}' name='users' value='${this.userList[i]}'><label class='form-check-label' for='${this.userList[i]}'>${this.userList[i]}</label></div>`;
+            if (this.userList[i].checked_email == true) {
+              this.test += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${
+                this.userList[i].name
+              }' name='users' value='${this.userList[i].name}' checked='${
+                this.userList[i].default_email == "true" ? true : false
+              }'><label class='form-check-label' for='next-${
+                this.userList[i].name
+              }'>${this.userList[i].name}</label></div>`;
+            } else {
+              this.test += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userList[i].name}' name='users' value='${this.userList[i].name}'><label class='form-check-label' for='next-${this.userList[i].name}'>${this.userList[i].name}</label></div>`;
+            }
           }
         }
       });
@@ -457,7 +477,7 @@ export class InvestmentProposalsComponent implements OnInit {
 
             for (let i = 0; i < this.userList.length; i++) {
               let html_input: HTMLInputElement = document.getElementById(
-                this.userList[i]
+                this.userList[i].name
               ) as HTMLInputElement;
               let html_value: string = html_input.value;
               if (html_input.checked == true) {
@@ -497,7 +517,7 @@ export class InvestmentProposalsComponent implements OnInit {
                 }
               },
               err => {
-                if(err.code==405){
+                if (err.code == 405) {
                   Swal.fire({
                     icon: "error",
                     title: "Operacion no permitida",
@@ -506,14 +526,14 @@ export class InvestmentProposalsComponent implements OnInit {
                     Swal.close();
                     window.location.href = "#/investment-proposals";
                   });
-                }else{
+                } else {
                   Swal.fire({
                     icon: "error",
                     title: "Error al guardar",
                     text: err.message
                   });
                 }
-                this.router.navigate(["/investment-proposals"]);              
+                this.router.navigate(["/investment-proposals"]);
               }
             );
         });

+ 35 - 11
src/app/components/investment-proposals/payment-approval/payment-approval.component.ts

@@ -111,12 +111,36 @@ export class PaymentApprovalComponent implements OnInit {
 
           if (this.userListPrevious.length > 0) {
             for (let i = 0; i < this.userListPrevious.length; i++) {
-              this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i]}' name='users' value='${this.userListPrevious[i]}'><label class='form-check-label' for='previous-${this.userListPrevious[i]}'>${this.userListPrevious[i]}</label></div>`;
+              if (this.userListPrevious[i].checked_email == true) {
+                this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${
+                  this.userListPrevious[i].name
+                }' name='users' value='${
+                  this.userListPrevious[i].name
+                }' checked='${
+                  this.userListPrevious[i].default_email == "true"
+                    ? true
+                    : false
+                }'><label class='form-check-label' for='previous-${
+                  this.userListPrevious[i].name
+                }'>${this.userListPrevious[i].name}</label></div>`;
+              } else {
+                this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i].name}' name='users' value='${this.userListPrevious[i].name}'><label class='form-check-label' for='previous-${this.userListPrevious[i].name}'>${this.userListPrevious[i].name}</label></div>`;
+              }
             }
           }
           if (this.userListNext.length > 0) {
             for (let i = 0; i < this.userListNext.length; i++) {
-              this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i]}' name='users' value='${this.userListNext[i]}'><label class='form-check-label' for='next-${this.userListNext[i]}'>${this.userListNext[i]}</label></div>`;
+              if (this.userListNext[i].checked_email == true) {
+                this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${
+                  this.userListNext[i].name
+                }' name='users' value='${this.userListNext[i].name}' checked='${
+                  this.userListNext[i].default_email == "true" ? true : false
+                }'><label class='form-check-label' for='next-${
+                  this.userListNext[i].name
+                }'>${this.userListNext[i].name}</label></div>`;
+              } else {
+                this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i].name}' name='users' value='${this.userListNext[i].name}'><label class='form-check-label' for='next-${this.userListNext[i].name}'>${this.userListNext[i].name}</label></div>`;
+              }
             }
           }
         });
@@ -415,7 +439,7 @@ export class PaymentApprovalComponent implements OnInit {
 
           for (let i = 0; i < this.userListNext.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "next-" + this.userListNext[i]
+              "next-" + this.userListNext[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {
@@ -454,7 +478,7 @@ export class PaymentApprovalComponent implements OnInit {
               }
             },
             err => {
-              if(err.code==405){
+              if (err.code == 405) {
                 Swal.fire({
                   icon: "error",
                   title: "Operacion no permitida",
@@ -462,14 +486,14 @@ export class PaymentApprovalComponent implements OnInit {
                 }).then(result => {
                   Swal.close();
                   window.location.href = "#/investment-proposals";
-                });  
-              }else{
+                });
+              } else {
                 Swal.fire({
                   icon: "error",
                   title: "Error al guardar",
                   text: err.message
                 });
-              }              
+              }
             }
           );
       });
@@ -518,7 +542,7 @@ export class PaymentApprovalComponent implements OnInit {
 
           for (let i = 0; i < this.userListPrevious.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "previous-" + this.userListPrevious[i]
+              "previous-" + this.userListPrevious[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {
@@ -557,7 +581,7 @@ export class PaymentApprovalComponent implements OnInit {
               }
             },
             err => {
-              if(err.code==405){
+              if (err.code == 405) {
                 Swal.fire({
                   icon: "error",
                   title: "Operacion no permitida",
@@ -566,13 +590,13 @@ export class PaymentApprovalComponent implements OnInit {
                   Swal.close();
                   window.location.href = "#/investment-proposals";
                 });
-              }else{
+              } else {
                 Swal.fire({
                   icon: "error",
                   title: "Error al guardar",
                   text: err.message
                 });
-              }              
+              }
             }
           );
       });

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

@@ -132,7 +132,7 @@
                   </div>
                 </div>
 
-                <div class="col-lg-6 col-sm-12 pr-xl-3" *ngIf="payment_check">
+                <div class="col-lg-6 col-sm-12 pr-xl-3">
                   <div class="form-group">
                     <label for="emitir_nombre">Emitir a nombre: </label>
                     <div class="input-box-container">

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

@@ -106,6 +106,13 @@ export class PaymentInfoComponent implements OnInit {
           }
         }
       });
+
+    this.catalogService
+      .getBankAccounts("origen", this.investmentProposalID)
+      .subscribe(res => {
+        console.log(res);
+      });
+
     this.investmentsService
       .getProposalInvestment(this.investmentProposalID)
       .subscribe(
@@ -147,7 +154,7 @@ export class PaymentInfoComponent implements OnInit {
             cuenta_bancaria: "",
             fecha_vencimiento: "",
             cuenta_bancaria_destino: "",
-            emitir_nombre: ""
+            emitir_nombre: res["result"]["emitir_a_nombre_de"]
           });
         },
         err => {
@@ -165,6 +172,7 @@ export class PaymentInfoComponent implements OnInit {
     this.catalogService.getCountries().subscribe(res => {
       this.funds = res;
     });
+
     this.catalogService.getCatalogInfo("bancos").subscribe(res => {
       this.banks = res;
       this.catalogService.getCatalogInfo("cuentas-bancarias").subscribe(res => {
@@ -275,6 +283,7 @@ export class PaymentInfoComponent implements OnInit {
                 array.push(html_value);
               }
             }
+            // http://localhost:8001/api/cuentas-bancarias?tipo=origen&id_inversion=51
 
             this.reviewProposal["notificar"] = array.toString();
             this.paymentObject = {

+ 25 - 3
src/app/components/investment-proposals/payment-requirement/payment-requirement.component.ts

@@ -114,12 +114,34 @@ export class PaymentRequirementComponent implements OnInit {
 
         if (this.userListPrevious.length > 0) {
           for (let i = 0; i < this.userListPrevious.length; i++) {
-            this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i]}' name='users' value='${this.userListPrevious[i]}'><label class='form-check-label' for='previous-${this.userListPrevious[i]}'>${this.userListPrevious[i]}</label></div>`;
+            if (this.userListPrevious[i].checked_email == true) {
+              this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${
+                this.userListPrevious[i].name
+              }' name='users' value='${
+                this.userListPrevious[i].name
+              }' checked='${
+                this.userListPrevious[i].default_email == "true" ? true : false
+              }'><label class='form-check-label' for='previous-${
+                this.userListPrevious[i].name
+              }'>${this.userListPrevious[i].name}</label></div>`;
+            } else {
+              this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i].name}' name='users' value='${this.userListPrevious[i].name}'><label class='form-check-label' for='previous-${this.userListPrevious[i].name}'>${this.userListPrevious[i].name}</label></div>`;
+            }
           }
         }
         if (this.userListNext.length > 0) {
           for (let i = 0; i < this.userListNext.length; i++) {
-            this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i]}' name='users' value='${this.userListNext[i]}'><label class='form-check-label' for='next-${this.userListNext[i]}'>${this.userListNext[i]}</label></div>`;
+            if (this.userListNext[i].checked_email == true) {
+              this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${
+                this.userListNext[i].name
+              }' name='users' value='${this.userListNext[i].name}' checked='${
+                this.userListNext[i].default_email == "true" ? true : false
+              }'><label class='form-check-label' for='next-${
+                this.userListNext[i].name
+              }'>${this.userListNext[i].name}</label></div>`;
+            } else {
+              this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i].name}' name='users' value='${this.userListNext[i].name}'><label class='form-check-label' for='next-${this.userListNext[i].name}'>${this.userListNext[i].name}</label></div>`;
+            }
           }
         }
       });
@@ -196,7 +218,7 @@ export class PaymentRequirementComponent implements OnInit {
 
           for (let i = 0; i < this.userListNext.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "next-" + this.userListNext[i]
+              "next-" + this.userListNext[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {

+ 12 - 10
src/app/components/investment-proposals/proposal-detail/proposal-detail.component.html

@@ -34,18 +34,20 @@
               </h4>
             </div>
 
-            <!--
-            <hr />
-            <div>
-              <app-investment-print
-                [investmentID]="investmentProposalID"
-              ></app-investment-print>
-            </div>
-            <hr />
--->
             <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">
+                        <app-investment-print
+                          [investmentID]="investmentProposalID"
+                        ></app-investment-print>
+                      </div>
+                    </div>
+                  </li>
+
                   <li class="timeline-inverted">
                     <div class="timeline-badge"></div>
                     <div class="timeline-panel">
@@ -303,7 +305,7 @@
 
                         <a
                           title="Historico"
-                          class="btn btn-primary btn-custom-small"
+                          class="btn btn-dark btn-custom-small"
                           [routerLink]="[
                             '/investment-proposal',
                             investmentProposalID,

+ 35 - 11
src/app/components/investment-proposals/review/review.component.ts

@@ -105,12 +105,36 @@ export class InvestmentProposalReviewComponent implements OnInit {
 
           if (this.userListPrevious.length > 0) {
             for (let i = 0; i < this.userListPrevious.length; i++) {
-              this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i]}' name='users' value='${this.userListPrevious[i]}'><label class='form-check-label' for='previous-${this.userListPrevious[i]}'>${this.userListPrevious[i]}</label></div>`;
+              if (this.userListPrevious[i].checked_email == true) {
+                this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${
+                  this.userListPrevious[i].name
+                }' name='users' value='${
+                  this.userListPrevious[i].name
+                }' checked='${
+                  this.userListPrevious[i].default_email == "true"
+                    ? true
+                    : false
+                }'><label class='form-check-label' for='previous-${
+                  this.userListPrevious[i].name
+                }'>${this.userListPrevious[i].name}</label></div>`;
+              } else {
+                this.generated_inputs_previous += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='previous-${this.userListPrevious[i].name}' name='users' value='${this.userListPrevious[i].name}'><label class='form-check-label' for='previous-${this.userListPrevious[i].name}'>${this.userListPrevious[i].name}</label></div>`;
+              }
             }
           }
           if (this.userListNext.length > 0) {
             for (let i = 0; i < this.userListNext.length; i++) {
-              this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i]}' name='users' value='${this.userListNext[i]}'><label class='form-check-label' for='next-${this.userListNext[i]}'>${this.userListNext[i]}</label></div>`;
+              if (this.userListNext[i].checked_email == true) {
+                this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${
+                  this.userListNext[i].name
+                }' name='users' value='${this.userListNext[i].name}' checked='${
+                  this.userListNext[i].default_email == "true" ? true : false
+                }'><label class='form-check-label' for='next-${
+                  this.userListNext[i].name
+                }'>${this.userListNext[i].name}</label></div>`;
+              } else {
+                this.generated_inputs_next += `<div class='form-check form-check-inline'><input type='checkbox' class='form-check-input' id='next-${this.userListNext[i].name}' name='users' value='${this.userListNext[i].name}'><label class='form-check-label' for='next-${this.userListNext[i].name}'>${this.userListNext[i].name}</label></div>`;
+              }
             }
           }
         });
@@ -390,7 +414,7 @@ export class InvestmentProposalReviewComponent implements OnInit {
 
           for (let i = 0; i < this.userListNext.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "next-" + this.userListNext[i]
+              "next-" + this.userListNext[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {
@@ -429,7 +453,7 @@ export class InvestmentProposalReviewComponent implements OnInit {
               }
             },
             err => {
-              if(err.code==405){
+              if (err.code == 405) {
                 Swal.fire({
                   icon: "error",
                   title: "Operacion no permitida",
@@ -438,13 +462,13 @@ export class InvestmentProposalReviewComponent implements OnInit {
                   Swal.close();
                   window.location.href = "#/investment-proposals";
                 });
-              }else{
+              } else {
                 Swal.fire({
                   icon: "error",
                   title: "Error al guardar",
                   text: err.message
                 });
-              }              
+              }
             }
           );
       });
@@ -493,7 +517,7 @@ export class InvestmentProposalReviewComponent implements OnInit {
 
           for (let i = 0; i < this.userListPrevious.length; i++) {
             let html_input: HTMLInputElement = document.getElementById(
-              "previous-" + this.userListPrevious[i]
+              "previous-" + this.userListPrevious[i].name
             ) as HTMLInputElement;
             let html_value: string = html_input.value;
             if (html_input.checked == true) {
@@ -532,7 +556,7 @@ export class InvestmentProposalReviewComponent implements OnInit {
               }
             },
             err => {
-              if(err.code==405){
+              if (err.code == 405) {
                 Swal.fire({
                   icon: "error",
                   title: "Operacion no permitida",
@@ -540,14 +564,14 @@ export class InvestmentProposalReviewComponent implements OnInit {
                 }).then(result => {
                   Swal.close();
                   window.location.href = "#/investment-proposals";
-                });  
-              }else{
+                });
+              } else {
                 Swal.fire({
                   icon: "error",
                   title: "Error al guardar",
                   text: err.message
                 });
-              }              
+              }
             }
           );
       });

+ 5 - 2
src/app/components/plugins/investment-print/investment-print.html

@@ -1,6 +1,9 @@
 <button
   (click)="generatePdf('download')"
-  class="btn btn-primary d-flex align-items-center justify-content-center"
+  class="btn btn-primary btn-custom-small "
 >
-  <i class="material-icons"> cloud_download </i><span>Download PDF</span>
+  <i class="material-icons">cloud_download</i>
+  <span>
+    Resumen de propuesta de inversión
+  </span>
 </button>

+ 817 - 25
src/app/components/plugins/investment-print/investment-print.ts

@@ -35,19 +35,12 @@ export class InvestmentPrint implements OnInit {
           // TO DO, crear una funcion que devuelva los campos necesarios de cada instrumento
           this.instrumentName = this.investmentResult.id_inversion_instrumento.id_tipo_instrumento.codigo;
           this.investmentInstrument = this.investmentResult.id_inversion_instrumento.instrumento;
-          Object.entries(this.investmentInstrument).forEach(([key, value]) => {
-            if (key != "proyecciones") {
-              this.columnKey.push(
-                key.replace(/([-_][a-z])/g, group =>
-                  group
-                    .toUpperCase()
-                    .replace("-", " ")
-                    .replace("_", " ")
-                )
-              );
-              this.columnValue.push(value);
-            }
-          });
+          console.log(this.investmentInstrument);
+          this.getInstrumentColumns(
+            this.instrumentName,
+            this.investmentInstrument
+          );
+
           this.catalogService.getRateTypes().subscribe(res => {
             this.rates = res.find(
               e => e.id_tipo_tasa == this.investmentResult.id_tipo_tasa
@@ -58,6 +51,817 @@ export class InvestmentPrint implements OnInit {
     }
   }
 
+  getInstrumentColumns(instrumentName: string, investmentInstrument: any) {
+    switch (instrumentName) {
+      case "LETE":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "valor_nominal") {
+            this.columnKey.push("Valor nominal");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "plazo") {
+            this.columnKey.push("Plazo");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "comision_casa_porcentaje") {
+            this.columnKey.push("Comisión casa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_bolsa_porcentaje") {
+            this.columnKey.push("Comisión bolsa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_bruto") {
+            this.columnKey.push("Rendimiento bruto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "ingreso_bruto") {
+            this.columnKey.push("Ingreso bruto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "ingreso_neto") {
+            this.columnKey.push("Ingreso neto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_transado") {
+            this.columnKey.push("Valor transado");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "precio_porcentaje") {
+            this.columnKey.push("Precio (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_neto") {
+            this.columnKey.push("Rendimiento neto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "total_pagar") {
+            this.columnKey.push("Total a pagar");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa") {
+            this.columnKey.push("Comisión bolsa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_casa") {
+            this.columnKey.push("Comisión casa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_vencimiento") {
+            this.columnKey.push("Fecha vencimiento");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_operacion") {
+            this.columnKey.push("Fecha operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion") {
+            this.columnKey.push("Fecha liquidación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_redencion") {
+            this.columnKey.push("Fecha redención");
+            this.columnValue.push(value.toString());
+          }
+        });
+
+        break;
+      case "CETE":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "valor_nominal") {
+            this.columnKey.push("Valor nominal");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "plazo") {
+            this.columnKey.push("Plazo");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "comision_casa_porcentaje") {
+            this.columnKey.push("Comisión casa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_bolsa_porcentaje") {
+            this.columnKey.push("Comisión bolsa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_bruto") {
+            this.columnKey.push("RendRendimiento bruto (%)imiento bruto");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "otros_costos") {
+            this.columnKey.push("Otros costos");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_operacion") {
+            this.columnKey.push("Fecha de operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion") {
+            this.columnKey.push("Fecha de liquidación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_ultima_cupon") {
+            this.columnKey.push("Fecha última cupón");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento") {
+            this.columnKey.push("Fecha de vencimiento");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "ingreso_bruto") {
+            this.columnKey.push("Ingreso bruto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "ingreso_neto") {
+            this.columnKey.push("Ingreso neto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_transado") {
+            this.columnKey.push("Valor transado");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "precio_porcentaje") {
+            this.columnKey.push("Precio (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_neto") {
+            this.columnKey.push("Rendimiento neto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "total_pagar") {
+            this.columnKey.push("Total a pagar");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa") {
+            this.columnKey.push("Comisión bolsa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_casa") {
+            this.columnKey.push("Comisión casa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+        });
+        break;
+      case "VCN":
+      case "PBUR":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "valor_par") {
+            this.columnKey.push("Valor par");
+            this.columnValue.push(value.toString() == "true" ? "Si" : "No");
+          }
+          if (key == "valor_nominal") {
+            this.columnKey.push("Valor nominal");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_casa_porcentaje") {
+            this.columnKey.push("Comisión casa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_bolsa_porcentaje") {
+            this.columnKey.push("Comisión bolsa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_casa") {
+            this.columnKey.push("Comisión casa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa") {
+            this.columnKey.push("Comisión bolsa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "rendimiento_bruto") {
+            this.columnKey.push("Rendimiento bruto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "otros_costos") {
+            this.columnKey.push("Otros costos");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "ingreso_bruto") {
+            this.columnKey.push("Ingreso bruto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "ingreso_neto") {
+            this.columnKey.push("Ingreso neto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_transado") {
+            this.columnKey.push("Valor transado");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "precio_porcentaje") {
+            this.columnKey.push("Precio (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_neto") {
+            this.columnKey.push("Rendimiento neto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "total_pagar") {
+            this.columnKey.push("Total a pagar");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "interes_acumulado") {
+            this.columnKey.push("Interés acumulado");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_inicio_vigencia") {
+            this.columnKey.push("Fecha inicio de vigencia");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "plazo") {
+            this.columnKey.push("Plazo");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_operacion") {
+            this.columnKey.push("Fecha de operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion") {
+            this.columnKey.push("Fecha de liquidación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_ultima_cupon") {
+            this.columnKey.push("Fecha última cupón");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento") {
+            this.columnKey.push("Fecha de vencimiento");
+            this.columnValue.push(value.toString());
+          }
+        });
+        break;
+      case "DAP":
+        console.log("enter here");
+        console.log(investmentInstrument);
+
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "monto_inversion") {
+            this.columnKey.push("Monto inversión");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "tasa_porcentaje") {
+            this.columnKey.push("Tasa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "ingreso_bruto") {
+            this.columnKey.push("Ingreso bruto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "ingreso_neto") {
+            this.columnKey.push("Ingreso neto");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "rendimiento_bruto") {
+            this.columnKey.push("Rendimiento bruto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_neto") {
+            this.columnKey.push("Rendimiento neto (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "fecha_inicio_vigencia") {
+            this.columnKey.push("Fecha inicio de vigencia");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "renta") {
+            this.columnKey.push("Renta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "numero_certificado") {
+            this.columnKey.push("Número de certificado");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_operacion") {
+            this.columnKey.push("Fecha de operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento") {
+            this.columnKey.push("Fecha de vencimiento");
+            this.columnValue.push(value.toString());
+          }
+        });
+        console.log(this.columnKey);
+        break;
+      case "BONO":
+      case "EURB":
+      case "CINV":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "costo_cedeval") {
+            this.columnKey.push("Costo cedeval");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "costo_transferencia") {
+            this.columnKey.push("Costo transferencia");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_nominal_compra") {
+            this.columnKey.push("Valor nominal compra");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "precio_compra") {
+            this.columnKey.push("Precio compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "precio_vencimiento_compra") {
+            this.columnKey.push("Precio vencimiento compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "cupon_porcentaje_compra") {
+            this.columnKey.push("Cupón compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_casa_porcentaje_compra") {
+            this.columnKey.push("Comisión casa compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_bolsa_porcentaje_compra") {
+            this.columnKey.push("Comisión bolsa compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "valor_nominal_venta") {
+            this.columnKey.push("Valor nominal venta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "precio_venta") {
+            this.columnKey.push("Precio venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "precio_vencimiento_venta") {
+            this.columnKey.push("Precio vencimiento venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "cupon_porcentaje_venta") {
+            this.columnKey.push("Cupón venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_casa_porcentaje_venta") {
+            this.columnKey.push("Comisión casa venta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_bolsa_porcentaje_venta") {
+            this.columnKey.push("Comisión bolsa venta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "fecha_vencimiento_compra") {
+            this.columnKey.push("Fecha vencimiento compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_ultima_cupon_compra") {
+            this.columnKey.push("Fecha última cupón");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion_compra") {
+            this.columnKey.push("Fecha liquidación compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento_venta") {
+            this.columnKey.push("Fecha vencimiento venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_ultima_cupon_venta") {
+            this.columnKey.push("Fecha última cupón venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion_venta") {
+            this.columnKey.push("Fecha liquidación venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "comision_casa_compra") {
+            this.columnKey.push("Comisión casa compra ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa_compra") {
+            this.columnKey.push("Comisión bolsa compra ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_siguiente_cupon_compra") {
+            this.columnKey.push("Fecha siguiente cupón compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "dias_vencimiento_compra") {
+            this.columnKey.push("Días vencimiento compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "dias_acumulados_compra") {
+            this.columnKey.push("Días acumulados");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "ytm_vencimiento_porcentaje_compra") {
+            this.columnKey.push("YTM vencimiento compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "ytm_vencimiento_comision_porcentaje_compra") {
+            this.columnKey.push("YTM vencimiento comisión compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "interes_acumulado_compra") {
+            this.columnKey.push("Interés acumulado compra ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "interes_acumulado_porcentaje_compra") {
+            this.columnKey.push(" Interés acumulado compra (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "precio_sucio_porcentaje_compra") {
+            this.columnKey.push("Precio sucio compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "valor_transado_compra") {
+            this.columnKey.push("Valor transado compra");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "monto_pagar") {
+            this.columnKey.push("Monto a pagar");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_inicio_vigencia") {
+            this.columnKey.push("Fecha inicio vigencia");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "comision_casa_venta") {
+            this.columnKey.push("Comisión venta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa_venta") {
+            this.columnKey.push("Comisión venta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_siguiente_cupon_venta") {
+            this.columnKey.push("Fecha siguiente cupón venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "dias_vencimiento_venta") {
+            this.columnKey.push("Días vencimiento venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "dias_acumulados_venta") {
+            this.columnKey.push("Días acumulados venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "ytm_vencimiento_porcentaje_venta") {
+            this.columnKey.push("YTM vencimiento venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "ytm_vencimiento_comision_porcentaje_venta") {
+            this.columnKey.push("YTM vencimiento comisión venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "interes_acumulado_venta") {
+            this.columnKey.push("Interés acumulado venta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "interes_acumulado_porcentaje_venta") {
+            this.columnKey.push("Interés acumulado venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "precio_sucio_porcentaje_venta") {
+            this.columnKey.push("Precio sucio venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "valor_transado_venta") {
+            this.columnKey.push("Valor transado venta");
+            this.columnValue.push("$" + value.toString());
+          }
+        });
+
+        break;
+
+      case "TIT":
+        break;
+      case "FINV":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "cuota_participacion") {
+            this.columnKey.push("Cuota participación");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_participacion") {
+            this.columnKey.push("Valor participación");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa_porcentaje") {
+            this.columnKey.push("Comisión bolsa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_casa_porcentaje") {
+            this.columnKey.push("Comisión casa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "dividendo_porcentaje") {
+            this.columnKey.push("Dividendo (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "rendimiento_porcentaje") {
+            this.columnKey.push("Rendimiento (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "dias_liquidacion") {
+            this.columnKey.push("Días liquidación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "dias_vencimiento") {
+            this.columnKey.push("Días vencimiento");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_operacion") {
+            this.columnKey.push("Fecha de operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "valor_nominal") {
+            this.columnKey.push("Valor nominal");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_transado") {
+            this.columnKey.push("Valor transado");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "monto_pagar") {
+            this.columnKey.push("Monto a pagar");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_casa") {
+            this.columnKey.push("Comisión casa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_bolsa") {
+            this.columnKey.push("Comisión bolsa ($)");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_liquidacion") {
+            this.columnKey.push("Fecha de liquidación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento") {
+            this.columnKey.push("Fecha de vencimiento");
+            this.columnValue.push(value.toString());
+          }
+        });
+
+        break;
+      case "OPC":
+      case "FUTU":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "ticker") {
+            this.columnKey.push("Ticker");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "corto") {
+            this.columnKey.push("Tipo de operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "precio_unitario_compra") {
+            this.columnKey.push("Precio unitario compra");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_broker_compra") {
+            this.columnKey.push("Comisión broker compra");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "cantidad_contratos_compra") {
+            this.columnKey.push("Cantidad contratos compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "unidades_contratos_compra") {
+            this.columnKey.push("Unidades contratos compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "valor_transado_compra") {
+            this.columnKey.push("Valor transado compra");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_pagado") {
+            this.columnKey.push("Valor pagado");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "ganancia_perdida") {
+            this.columnKey.push("Ganancia/Pérdida");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "rendimiento") {
+            this.columnKey.push("Rendimiento");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "precio_unitario_venta") {
+            this.columnKey.push("Precio unitario venta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "comision_broker_venta") {
+            this.columnKey.push("Comisión broker venta");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "cantidad_contratos_venta") {
+            this.columnKey.push("Cantidad contratos venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "unidades_contratos_venta") {
+            this.columnKey.push("Unidades contratos venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "valor_transado_venta") {
+            this.columnKey.push("Valor transado venta");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "valor_recibido") {
+            this.columnKey.push("Valor recibido");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "fecha_cancelado") {
+            this.columnKey.push("Fecha cancelado");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion_compra") {
+            this.columnKey.push("Fecha liquidación compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento_compra") {
+            this.columnKey.push("Fecha vencimiento compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_operacion_compra") {
+            this.columnKey.push("Fecha de operación compra");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_liquidacion_venta") {
+            this.columnKey.push("Fecha liquidación venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento_venta") {
+            this.columnKey.push("Fecha vencimientoz venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_operacion_venta") {
+            this.columnKey.push("Fecha de operación venta");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_inicio_vigencia") {
+            this.columnKey.push("Fecha inicio de vigencia");
+            this.columnValue.push(value.toString());
+          }
+        });
+
+        break;
+
+        break;
+      case "PPER":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "monto_prestamo") {
+            this.columnKey.push("Monto préstamo");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "plazo_gracia") {
+            this.columnKey.push("Plazo gracia");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "tasa_porcentaje") {
+            this.columnKey.push("Tasa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "iva_porcentaje") {
+            this.columnKey.push("IVA (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "pago_seguro_dano") {
+            this.columnKey.push("Pago seguro por daño");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "pago_seguro_vivienda") {
+            this.columnKey.push("Pago seguro vivienda");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "total_cuotas_mensuales") {
+            this.columnKey.push("Total cuotas mensuales");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "numero_deudor") {
+            this.columnKey.push("Número deudor");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "nombre_deudor") {
+            this.columnKey.push("Nombre deudor");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_otorgamiento") {
+            this.columnKey.push("Fecha de otorgamiento");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_fin_otorgamiento") {
+            this.columnKey.push("Fecha fin de otorgamiento");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_gracia") {
+            this.columnKey.push("Fecha gracia");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "cuota_sin_seguros") {
+            this.columnKey.push("Cuota sin seguros");
+            this.columnValue.push("$" + value.toString());
+          }
+        });
+
+        break;
+      case "PEMP":
+        Object.entries(investmentInstrument).forEach(([key, value]) => {
+          if (value == null) {
+            value = "-";
+          }
+          if (key == "renta_porcentaje") {
+            this.columnKey.push("Renta (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "monto_prestamo") {
+            this.columnKey.push("Monto préstamo");
+            this.columnValue.push("$" + value.toString());
+          }
+          if (key == "tasa_porcentaje") {
+            this.columnKey.push("Tasa (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "iva_porcentaje") {
+            this.columnKey.push("IVA (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_desembolso_porcentaje") {
+            this.columnKey.push("Comisión desembolso (%)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "comision_desembolso") {
+            this.columnKey.push("Comisión desembolso ($)");
+            this.columnValue.push(value.toString() + "%");
+          }
+          if (key == "fecha_operacion") {
+            this.columnKey.push("Fecha de operación");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "fecha_vencimiento") {
+            this.columnKey.push("Fecha de vencimiento");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "plazo") {
+            this.columnKey.push("Plazo");
+            this.columnValue.push(value.toString());
+          }
+          if (key == "iva") {
+            this.columnKey.push("IVA");
+            this.columnValue.push("$" + value.toString());
+          }
+        });
+
+        break;
+    }
+  }
+
   generatePdf(action = "open") {
     console.log(pdfMake);
     var documentDefinition;
@@ -288,16 +1092,4 @@ export class InvestmentPrint implements OnInit {
       }
     };
   }
-
-  /*
-  getProfilePicObject() {
-    if (this.resume.profilePic){
-      return {
-        image: this.resume.profilePic,
-        width: 75,
-        alignment: 'right'
-      };
-    }
-    return null;
-  }*/
 }

+ 112 - 9
src/app/components/profile/profile.component.html

@@ -1,16 +1,119 @@
-<h2 class="floating-title">{{title}}</h2>
+<h2 class="floating-title">{{ title }}</h2>
 
 <div class="main-content">
-  
   <div class="container-fluid">
+    <div class="row justify-content-center">
+      <div class="col-12">
+        <div class="align-container">
+          <div class="card">
+            <div class="card-header">
+              <div class="row align-items-center">
+                <div class="col-8">
+                  <h3 class="mb-0">Editar perfil</h3>
+                </div>
+              </div>
+            </div>
+            <div class="card-body">
+              <form
+                class="form-auth-small ng-untouched ng-pristine ng-valid"
+                [formGroup]="userForm"
+              >
+                <h6 class="heading-small text-muted mb-4">
+                  Información de usuario
+                </h6>
+                <div class="pl-lg-4">
+                  <div class="row">
+                    <div class="col-lg-12">
+                      <div class="hint-wrapper">
+                        <small class="hint">
+                          <i class="fas fa-exclamation-circle"></i>
+                          La contraseña debe contener letras mayusculas,
+                          minusculas, al menos un número y un símbolo.
+                        </small>
+                      </div>
 
-    <div class="row">
-      <div class="col-lg-12 col-md-12 col-sm-12">
-        <div class="card dark-yellow-skin bg-gradient-danger card-img-holder text-white profile">
-          <div class="card-body">
-            <img alt="circle-image" class="card-img-absolute" src="assets/img/waves-opt.png">
-            <h4 class="font-weight-normal mb-3">Administrador</h4>
-            <h2 class="mb-3">{{email}}</h2>
+                      <div class="form-group">
+                        <label for="old_password">Contraseña vieja</label>
+                        <input
+                          type="password"
+                          class="form-control"
+                          formControlName="old_password"
+                          [ngClass]="{
+                            'is-invalid': submitted && f.old_password.errors
+                          }"
+                        />
+                        <div
+                          *ngIf="submitted && f.old_password.errors"
+                          class="invalid-feedback"
+                        >
+                          <div *ngIf="f.old_password.errors.required">
+                            Campo requerido
+                          </div>
+                        </div>
+                      </div>
+                      <div class="form-group">
+                        <label for="new_password">Nueva contraseña</label>
+                        <input
+                          type="password"
+                          class="form-control"
+                          formControlName="new_password"
+                          [ngClass]="{
+                            'is-invalid': submitted && f.new_password.errors
+                          }"
+                        />
+                        <div
+                          *ngIf="submitted && f.new_password.errors"
+                          class="invalid-feedback"
+                        >
+                          <div *ngIf="f.new_password.errors.required">
+                            Campo requerido
+                          </div>
+                          <div *ngIf="f.new_password.errors.minlength">
+                            La contraseña debe contener al menos 8 caracteres
+                          </div>
+                          <div
+                            *ngIf="f.new_password.hasError('passwordStrength')"
+                            style="white-space: pre;"
+                          >
+                            {{ f.new_password.errors["passwordStrength"] }}
+                          </div>
+                        </div>
+                      </div>
+                      <div class="form-group">
+                        <label for="confirm_new_password"
+                          >Nueva confirmar contraseña</label
+                        >
+                        <input
+                          type="password"
+                          class="form-control"
+                          formControlName="confirm_new_password"
+                          [ngClass]="{
+                            'is-invalid':
+                              submitted && f.confirm_new_password.errors
+                          }"
+                        />
+                        <div
+                          *ngIf="submitted && f.confirm_new_password.errors"
+                          class="invalid-feedback"
+                        >
+                          <div *ngIf="f.confirm_new_password.errors.required">
+                            Campo requerido
+                          </div>
+                          <div *ngIf="f.confirm_new_password.errors.mustMatch">
+                            Las contraseñas deben coincidir
+                          </div>
+                        </div>
+                      </div>
+
+                      <br />
+                      <button class="btn btn-primary" (click)="editUser()">
+                        Actualizar contraseña
+                      </button>
+                    </div>
+                  </div>
+                </div>
+              </form>
+            </div>
           </div>
         </div>
       </div>

+ 15 - 1
src/app/components/profile/profile.component.scss

@@ -1,6 +1,20 @@
-
 .profile {
   background: url("/assets/img/dawn.jpg") 0 320px;
 }
 
+.header {
+  position: relative;
+  padding: 10px 20px;
+}
+.bg-gradient-default {
+  background: linear-gradient(87deg, #172b4d 0, #1a174d 100%) !important;
+}
 
+.mask {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  transition: all 0.15s ease;
+}

+ 82 - 11
src/app/components/profile/profile.component.ts

@@ -1,23 +1,94 @@
-import { Component, OnInit } from '@angular/core';
-import { Title } from '@angular/platform-browser';
+import { Component, OnInit } from "@angular/core";
+import { FormGroup, FormBuilder, Validators, FormArray } from "@angular/forms";
+import { UserService } from "@app/services/user.service";
+
+import Swal from "sweetalert2";
+import {
+  PasswordStrengthValidator,
+  ValidatorComponent
+} from "../plugins/validator/validator.component";
 
 @Component({
-  selector: 'app-profile',
-  templateUrl: './profile.component.html',
-  styleUrls: ['./profile.component.scss']
+  selector: "app-profile",
+  templateUrl: "./profile.component.html",
+  styleUrls: ["./profile.component.scss"]
 })
 export class ProfileComponent implements OnInit {
-
   title = "Perfil del usuario";
+  userForm: FormGroup;
+  submitted: boolean = false;
+  editProfile: boolean;
 
-  constructor(private titleService: Title) { }
-
-  email:string;
+  constructor(
+    private userService: UserService,
+    private formBuilder: FormBuilder
+  ) {}
 
   ngOnInit() {
-    this.titleService.setTitle(this.title);
-    this.email = localStorage.getItem("email");
+    this.userForm = this.formBuilder.group(
+      {
+        old_password: ["", Validators.required],
+        new_password: [
+          "",
+          [
+            Validators.required,
+            Validators.minLength(8),
+            PasswordStrengthValidator
+          ]
+        ],
+        confirm_new_password: ["", Validators.required]
+      },
+      {
+        validator: ValidatorComponent("new_password", "confirm_new_password")
+      }
+    );
+  }
 
+  get f() {
+    return this.userForm.controls;
   }
 
+  editUser() {
+    this.submitted = true;
+    // stop here if form is invalid
+    if (this.userForm.invalid) {
+      return;
+    }
+
+    let user = {
+      old_password: this.f.old_password.value,
+      new_password: this.f.new_password.value,
+      confirm_new_password: this.f.confirm_new_password.value
+    };
+
+    Swal.fire({
+      allowOutsideClick: false,
+      icon: "info",
+      text: "Espere por favor..."
+    });
+    Swal.showLoading();
+    this.userService.changePassword(user).subscribe(
+      success => {
+        if (success) {
+          Swal.fire({
+            allowOutsideClick: false,
+            icon: "success",
+            showCancelButton: false,
+            title: "Exito",
+            confirmButtonText: "Se ha actualizado su perfil exitosamente"
+          }).then(result => {
+            Swal.close();
+            window.location.reload();
+          });
+        }
+      },
+      err => {
+        Swal.fire({
+          icon: "error",
+          title: "Error al guardar",
+          text: err.message
+        });
+      }
+    );
+  }
 }

+ 7 - 0
src/app/components/shared/sidebar/sidebar.component.ts

@@ -18,6 +18,13 @@ export const ROUTES: RouteInfo[] = [
     icon: "dashboard",
     class: ""
   },
+  {
+    path: "/profile",
+    title: "Perfil del usuario",
+    icon: "people",
+    class: ""
+    //allowed_roles: [2, 3]
+  },
   {
     path: "/investment-proposals",
     title: "Propuestas de inversión",

+ 14 - 0
src/app/services/catalogs.service.ts

@@ -14,6 +14,20 @@ export class CatalogsService {
 
   constructor(private http: HttpClient) {}
 
+  getBankAccounts(origen: string, id_inversion: string) {
+    return this.http
+      .get<any>(
+        `${environment.productionApiUrl}/cuentas-bancarias?tipo=${origen}&id_inversion=${id_inversion}`,
+        {}
+      )
+      .pipe(
+        map(response => {
+          return response;
+        }),
+        catchError(this.errorHandl)
+      );
+  }
+
   getCatalogInfo(url: string) {
     return this.http
       .get<any>(`${environment.productionApiUrl}/${url}`, {})

+ 7 - 0
src/app/services/instrument-calculations.service.ts

@@ -23,6 +23,7 @@ export class InstrumentCalculations {
       comision_casa_porcentaje: number;
       comision_bolsa_porcentaje: number;
       rendimiento_bruto: number;
+      renta_porcentaje: number;
       fecha_operacion: string;
       fecha_liquidacion?: string;
     }
@@ -50,6 +51,7 @@ export class InstrumentCalculations {
     },
     info_instrumento: {
       valor_nominal: number;
+      renta_porcentaje: number;
       comision_casa_porcentaje: number;
       comision_bolsa_porcentaje: number;
       plazo: number;
@@ -84,6 +86,7 @@ export class InstrumentCalculations {
       id_formato_ingreso: number;
     },
     info_instrumento: {
+      renta_porcentaje: number;
       costo_cedeval: number;
       comision_casa_porcentaje_compra: number;
       comision_bolsa_porcentaje_compra: number;
@@ -149,6 +152,7 @@ export class InstrumentCalculations {
       fecha_vencimiento_venta: string;
       fecha_emision: string;
       costo_cedeval: number;
+      renta_porcentaje: number;
       amortizacion_porcentajes: any;
     }
   ): Observable<boolean> {
@@ -177,6 +181,7 @@ export class InstrumentCalculations {
     info_instrumento: {
       cuota_participacion: number;
       valor_participacion: number;
+      renta_porcentaje: number;
       comision_bolsa_porcentaje: number;
       comision_casa_porcentaje: number;
       dividendo_porcentaje: number;
@@ -336,6 +341,7 @@ export class InstrumentCalculations {
       monto_prestamo: number;
       tasa_porcentaje: number;
       iva_porcentaje: number;
+      renta_porcentaje: number;
       comision_desembolso_porcentaje: number;
       fecha_operacion: string;
       fecha_vencimiento: string;
@@ -368,6 +374,7 @@ export class InstrumentCalculations {
       plazo_gracia: number;
       tasa_porcentaje: number;
       iva_porcentaje: number;
+      renta_porcentaje: number;
       pago_seguro_dano: number;
       pago_seguro_vivienda: number;
       total_cuotas_mensuales: number;

+ 1 - 1
src/app/services/instruments.service.ts

@@ -42,7 +42,7 @@ export class InstrumentsService {
       }),
       new Instrument(FINV, { key: "FINV", name: "Fondo de inversión" }),
       new Instrument(OPC, { key: "OPC", name: "Opciones" }),
-      new Instrument(FUTU, { key: "FINV", name: "Futuros" }),
+      new Instrument(FUTU, { key: "FUTU", name: "Futuros" }),
       new Instrument(PPER, { key: "PPER", name: "Préstamos personales" }),
       new Instrument(PEMP, { key: "PEMP", name: "Préstamos empresariales" })
     ];

+ 21 - 45
src/app/services/user.service.ts

@@ -1,57 +1,34 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
+import { Injectable } from "@angular/core";
+import { HttpClient } from "@angular/common/http";
 
-import { environment } from '@environments/environment';
-import { User } from '@app/models';
-import { Observable } from 'rxjs/internal/Observable';
-import { throwError } from 'rxjs/internal/observable/throwError';
-import { map, catchError } from 'rxjs/operators';
+import { environment } from "@environments/environment";
+import { User } from "@app/models";
+import { Observable } from "rxjs/internal/Observable";
+import { throwError } from "rxjs/internal/observable/throwError";
+import { map, catchError } from "rxjs/operators";
 
-@Injectable({ providedIn: 'root' })
+@Injectable({ providedIn: "root" })
 export class UserService {
-  constructor(private http: HttpClient) { }
-
-  getAllUsers() {
-      return this.http.get<User[]>(`${environment.productionApiUrl}/users`);
-  }
-
-
-  createUser(user: { first_name :string, last_name :string, 
-    email :string, role :number, organizations?: any }): Observable<boolean> {
-      return this.http.post<any>(`${environment.productionApiUrl}/users`, user)
-      .pipe(
-        map(response => {
-          return response;
-        }),
-        catchError(this.errorHandl)
-      )  
-  }
-
-  validateUserToken(user: {token :string}): Observable<boolean> {
-      return this.http.post<any>(`${environment.productionApiUrl}/user/tokenvalidation`, user)
-      .pipe(
-        map(response => {
-          return response;
-        }),
-        catchError(this.errorHandl)
-      )  
-  }
-  
-  activateUser(user: { first_name :string, last_name :string, 
-    email :string, password: string, confirm_password :string }): Observable<boolean> {
-      return this.http.post<any>(`${environment.productionApiUrl}/user/activate`, user)
+  constructor(private http: HttpClient) {}
+
+  changePassword(user: {
+    old_password: string;
+    new_password: string;
+    confirm_new_password: string;
+  }): Observable<boolean> {
+    return this.http
+      .put<any>(`${environment.productionApiUrl}/change-password`, user)
       .pipe(
         map(response => {
           return response;
         }),
         catchError(this.errorHandl)
-      )  
+      );
   }
 
-
   errorHandl(error) {
-    let errorMessage = '';
-    if(error.error) {
+    let errorMessage = "";
+    if (error.error) {
       // Get client-side error
       errorMessage = error.error;
     } else {
@@ -59,6 +36,5 @@ export class UserService {
       errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
     }
     return throwError(errorMessage);
- }
-
+  }
 }