Przeglądaj źródła

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

Oscar José Nuñez Chávez 5 lat temu
rodzic
commit
fd706fcbcc

+ 4 - 36
src/app/components/instruments/dap/dap.component.html

@@ -158,42 +158,6 @@
         </div>
       </div>
 
-      <!-- Fecha vencimiento -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="fecha_vencimiento">Fecha vencimiento: </label>
-
-          <div class="input-box-container">
-            <div>
-              <p>
-                <i class="far fa-calendar" aria-hidden="true"></i>
-              </p>
-              <input
-                class="input-box form-control"
-                placeholder="Seleccione una fecha"
-                angular-mydatepicker
-                formControlName="fecha_vencimiento"
-                (click)="dp2.toggleCalendar()"
-                [options]="myDpOptions"
-                #dp2="angular-mydatepicker"
-                [ngClass]="{
-                  'is-invalid': submitted && f.fecha_vencimiento.errors
-                }"
-              />
-            </div>
-          </div>
-
-          <div
-            *ngIf="submitted && f.fecha_vencimiento.errors"
-            class="invalid-feedback"
-          >
-            <div *ngIf="f.fecha_vencimiento.errors.required">
-              Campo requerido
-            </div>
-          </div>
-        </div>
-      </div>
-
       <!-- # de certificado -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -266,6 +230,10 @@
           <h4>Renta:</h4>
           <div class="field">$USD {{ renta | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
         <div class="col-sm-6">
           <h4>Fecha inicio de vigencia:</h4>
           <div class="field">{{ fecha_inicio_vigencia }}</div>

+ 5 - 8
src/app/components/instruments/dap/dap.component.ts

@@ -92,6 +92,7 @@ export class DAP implements InstrumentComponent {
   renta: any;
   hasProjections: boolean;
   numero_certificado: any;
+  fecha_vencimiento: any;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -221,8 +222,7 @@ export class DAP implements InstrumentComponent {
           renta_porcentaje: +this.f.renta_porcentaje.value,
           plazo: +this.f.plazo.value,
           //id_formato_ingreso: this.f.formato_ingreso.value,
-          fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
-          fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
+          fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted
         }
       )
       .subscribe(
@@ -237,6 +237,8 @@ export class DAP implements InstrumentComponent {
           this.renta = ans["result"]["renta"];
           this.proyecciones = ans["result"]["proyecciones"];
           this.numero_certificado = ans["result"]["numero_certificado"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
+
           this.dataSource.data = this.proyecciones;
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
@@ -258,12 +260,7 @@ export class DAP implements InstrumentComponent {
             proyecciones: this.proyecciones,
 
             fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-              .singleDate.formatted,
-            fecha_vencimiento:
-              this.investmentProposalForm.value.fecha_vencimiento != undefined
-                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-                    .formatted
-                : ""
+              .singleDate.formatted
           };
           this.formDataService.setWork(this.dapObject);
           Swal.close();

+ 4 - 34
src/app/components/instruments/pbur/pbur.component.html

@@ -281,40 +281,6 @@
           </div>
         </div>
       </div>
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="fecha_vencimiento">Fecha vencimiento: </label>
-
-          <div class="input-box-container">
-            <div>
-              <p>
-                <i class="far fa-calendar" aria-hidden="true"></i>
-              </p>
-              <input
-                class="input-box form-control"
-                placeholder="Seleccione una fecha"
-                angular-mydatepicker
-                formControlName="fecha_vencimiento"
-                (click)="dp2.toggleCalendar()"
-                [options]="myDpOptions"
-                #dp2="angular-mydatepicker"
-                [ngClass]="{
-                  'is-invalid': submitted && f.fecha_vencimiento.errors
-                }"
-              />
-            </div>
-          </div>
-
-          <div
-            *ngIf="submitted && f.fecha_vencimiento.errors"
-            class="invalid-feedback"
-          >
-            <div *ngIf="f.fecha_vencimiento.errors.required">
-              Campo requerido
-            </div>
-          </div>
-        </div>
-      </div>
 
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -422,6 +388,10 @@
           <h4>Fecha de inicio de vigencia:</h4>
           <div class="field">{{ fecha_inicio_vigencia }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
       </div>
     </div>
 

+ 5 - 10
src/app/components/instruments/pbur/pbur.component.ts

@@ -94,6 +94,7 @@ export class PBUR implements InstrumentComponent {
   dataSource2 = new MatTableDataSource(this.proyecciones);
   @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
   @ViewChild(MatSort, { static: true }) sort: MatSort;
+  fecha_vencimiento: any;
   constructor(
     private formBuilder: FormBuilder,
     private router: Router,
@@ -140,7 +141,7 @@ export class PBUR implements InstrumentComponent {
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
       renta_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        this.instrument_exists ? 10 : this.instrument_work.renta_porcentaje,
         [Validators.required]
       ],
       comision_casa_porcentaje: [
@@ -267,7 +268,7 @@ export class PBUR implements InstrumentComponent {
     Swal.showLoading();
 
     this.instrumentCalcService
-      .vcnCalc(
+      .pburCalc(
         "PBUR", // Codigo del instrumento
         {
           id_tipo_base: +this.general.base_anual,
@@ -288,8 +289,7 @@ export class PBUR implements InstrumentComponent {
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate
             .formatted,
           fecha_ultima_cupon: this.f.fecha_ultima_cupon.value.singleDate
-            .formatted,
-          fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
+            .formatted
         }
       )
       .subscribe(
@@ -302,10 +302,10 @@ export class PBUR implements InstrumentComponent {
           this.total_pagar = ans["result"]["total_pagar"];
           this.comision_bolsa = ans["result"]["comision_bolsa"];
           this.comision_casa = ans["result"]["comision_casa"];
-          this.plazo = ans["result"]["plazo"];
           this.interes_acumulado = ans["result"]["interes_acumulado"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
           this.proyecciones = ans["result"]["proyecciones"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
 
           if (this.f.valor_par.value == true) {
             this.hasProjections = true;
@@ -353,11 +353,6 @@ export class PBUR implements InstrumentComponent {
               this.investmentProposalForm.value.fecha_ultima_cupon != undefined
                 ? this.investmentProposalForm.value.fecha_ultima_cupon
                     .singleDate.formatted
-                : "",
-            fecha_vencimiento:
-              this.investmentProposalForm.value.fecha_vencimiento != undefined
-                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-                    .formatted
                 : ""
           };
           this.formDataService.setWork(this.pburObject);

+ 1 - 24
src/app/components/instruments/vcn/vcn.component.html

@@ -192,30 +192,7 @@
           </div>
         </div>
       </div>
-      <!-- Plazo inversión -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="plazo">Plazo inversión: </label>
-          <div class="input-box-container">
-            <p>
-              <i class="fas fa-business-time"></i>
-            </p>
-            <input
-              type="text"
-              formControlName="plazo"
-              class="form-control"
-              [ngClass]="{
-                'is-invalid': submitted && f.plazo.errors
-              }"
-            />
-            <div *ngIf="submitted && f.plazo.errors" class="invalid-feedback">
-              <div *ngIf="f.plazo.errors.required">
-                Campo requerido
-              </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>

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

@@ -139,12 +139,9 @@ export class VCN implements InstrumentComponent {
         this.instrument_exists ? 0 : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
-      plazo: [
-        this.instrument_exists ? "" : this.instrument_work.plazo,
-        [Validators.required]
-      ],
+
       renta_porcentaje: [
-        this.instrument_exists ? "" : this.instrument_work.renta_porcentaje,
+        this.instrument_exists ? 10 : this.instrument_work.renta_porcentaje,
         [Validators.required]
       ],
       comision_casa_porcentaje: [
@@ -283,7 +280,6 @@ export class VCN implements InstrumentComponent {
           comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
           rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
-          plazo: this.f.plazo.value,
           renta_porcentaje: this.f.renta_porcentaje.value,
           //id_formato_ingreso: this.f.formato_ingreso.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,

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

@@ -42,7 +42,7 @@
                 <!-- Valor nominal -->
                 <div class="col-lg-6 col-sm-12 pr-xl-3">
                   <div class="form-group">
-                    <label for="monto">Monto: </label>
+                    <label for="monto">Monto a pagar: </label>
                     <div class="input-box-container">
                       <p>
                         <i class="fas fa-dollar-sign"></i>

+ 16 - 4
src/app/components/investment-proposals/payment-info/payment-info.component.ts

@@ -93,10 +93,22 @@ export class PaymentInfoComponent implements OnInit {
       .subscribe(
         res => {
           this.inversionCode = res["result"]["codigo_inversion"];
-          this.inversionAmount =
-            res["result"]["id_inversion_instrumento"]["instrumento"][
-              "valor_nominal"
-            ];
+
+          if (
+            res["result"]["id_inversion_instrumento"]["id_tipo_instrumento"][
+              "codigo"
+            ] == "DAP"
+          ) {
+            this.inversionAmount =
+              res["result"]["id_inversion_instrumento"]["instrumento"][
+                "monto_inversion"
+              ];
+          } else {
+            this.inversionAmount =
+              res["result"]["id_inversion_instrumento"]["instrumento"][
+                "total_pagar"
+              ];
+          }
           this.investmentProposalForm.setValue({
             monto: this.inversionAmount,
             tipo_pago: "",

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

@@ -48,7 +48,7 @@
                       <div class="field">{{ codigo_inversion }}</div>
                     </div>
                     <div class="col-sm-6">
-                      <h4>Monto:</h4>
+                      <h4>Monto a pagar:</h4>
                       <div class="field">
                         $USD {{ monto | number: "1.2-4" }}
                       </div>

+ 38 - 3
src/app/services/instrument-calculations.service.ts

@@ -74,7 +74,7 @@ export class InstrumentCalculations {
         catchError(this.errorHandl)
       );
   }
-  // Para vcn y papel bursatil
+  // Para vcn
   vcnCalc(
     codigo_instrumento: string,
     info_inversion: {
@@ -89,7 +89,6 @@ export class InstrumentCalculations {
       comision_bolsa_porcentaje: number;
       rendimiento_bruto: number;
       otros_costos: number;
-      plazo: number;
       renta_porcentaje: number;
       fecha_operacion: string;
       fecha_liquidacion: string;
@@ -111,6 +110,42 @@ export class InstrumentCalculations {
       );
   }
 
+  // Para pbur
+  pburCalc(
+    codigo_instrumento: string,
+    info_inversion: {
+      id_tipo_base: number;
+      id_periodicidad: number;
+      id_formato_ingreso: number;
+    },
+    info_instrumento: {
+      valor_par: boolean;
+      valor_nominal: number;
+      comision_casa_porcentaje: number;
+      comision_bolsa_porcentaje: number;
+      rendimiento_bruto: number;
+      otros_costos: number;
+      plazo: number;
+      renta_porcentaje: number;
+      fecha_operacion: string;
+      fecha_liquidacion: string;
+      fecha_ultima_cupon: string;
+    }
+  ): Observable<boolean> {
+    return this.http
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
+        codigo_instrumento,
+        info_inversion,
+        info_instrumento
+      })
+      .pipe(
+        map(response => {
+          return response;
+        }),
+        catchError(this.errorHandl)
+      );
+  }
+
   dapCalc(
     codigo_instrumento: string,
     info_inversion: {
@@ -124,7 +159,7 @@ export class InstrumentCalculations {
       renta_porcentaje: number;
       plazo: number;
       fecha_operacion: string;
-      fecha_vencimiento: string;
+      //fecha_vencimiento: string;
     }
   ): Observable<boolean> {
     return this.http