Forráskód Böngészése

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

Oscar José Nuñez Chávez 5 éve
szülő
commit
c7197c0a37

+ 3 - 3
src/app/components/instruments/lete/lete.component.ts

@@ -212,9 +212,9 @@ export class LETE implements InstrumentComponent {
         {
           valor_nominal: +this.f.valor_nominal.value,
           plazo: +this.f.plazo.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
-          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
-          rendimiento_bruto: this.f.rendimiento_bruto.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,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate.formatted
         }

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

@@ -402,13 +402,13 @@
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="monto">
-              <th mat-header-cell *matHeaderCellDef>Monto</th>
+            <ng-container matColumnDef="ingreso_bruto">
+              <th mat-header-cell *matHeaderCellDef>Ingreso bruto</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.monto == "" || row.monto == undefined
+                  row.ingreso_bruto == "" || row.ingreso_bruto == undefined
                     ? "-"
-                    : (row.monto | number: "1.2-4")
+                    : (row.ingreso_bruto | number: "1.2-4")
                 }}
               </td>
             </ng-container>

+ 4 - 4
src/app/components/instruments/vcn/vcn.component.html

@@ -441,13 +441,13 @@
               </td>
             </ng-container>
 
-            <ng-container matColumnDef="monto">
-              <th mat-header-cell *matHeaderCellDef>Monto</th>
+            <ng-container matColumnDef="ingreso_bruto">
+              <th mat-header-cell *matHeaderCellDef>Ingreso bruto</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.monto == "" || row.monto == undefined
+                  row.ingreso_bruto == "" || row.ingreso_bruto == undefined
                     ? "-"
-                    : (row.monto | number: "1.2-4")
+                    : (row.ingreso_bruto | number: "1.2-4")
                 }}
               </td>
             </ng-container>

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

@@ -208,7 +208,7 @@
                       >
                         <i class="fas fa-search-dollar"></i>
                       </a>
-                      <!--
+
                       <a
                         *ngIf="
                           can_upload_payment(row.id_estado_inversion.codigo) &&
@@ -223,7 +223,7 @@
                         ]"
                       >
                         <i class="fas fa-money-bill-wave"></i>
-                      </a>-->
+                      </a>
                       <a
                         *ngIf="
                           can_finish_proposal(row.id_estado_inversion.codigo) &&

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

@@ -232,7 +232,7 @@ export class InvestmentProposalsComponent implements OnInit {
   }
 
   can_upload_payment(status: string) {
-    if (status == "COMPR") {
+    if (status == "PGAPR") {
       return true;
     } else {
       return false;
@@ -432,6 +432,7 @@ export class InvestmentProposalsComponent implements OnInit {
   }
 
   userType(userRole: any, requiredRole: any) {
+    console.log(userRole);
     if (userRole.length == 0) {
       return true;
     }

+ 10 - 0
src/app/components/investment-proposals/payment-approval/payment-approval.component.html

@@ -116,7 +116,17 @@
                             <h4>Cuenta bancaria:</h4>
                             <div class="field">{{ cuenta_bancaria }}</div>
                           </div>
+                          <div class="col-sm-6" *ngIf="cuenta_bancaria_destino">
+                            <h4>Cuenta bancaria destino:</h4>
+                            <div class="field">
+                              {{ cuenta_bancaria_destino }}
+                            </div>
+                          </div>
 
+                          <div class="col-sm-6" *ngIf="emitir_nombre">
+                            <h4>Emitir a nombre:</h4>
+                            <div class="field">{{ emitir_nombre }}</div>
+                          </div>
                           <div class="col-sm-6">
                             <h4>Fecha de vencimiento:</h4>
                             <div class="field">{{ fecha_vencimiento }}</div>

+ 9 - 0
src/app/components/investment-proposals/payment-approval/payment-approval.component.ts

@@ -73,6 +73,8 @@ export class PaymentApprovalComponent implements OnInit {
   generated_inputs_previous: any;
   generated_inputs_next: any;
   userListNext: any;
+  cuenta_bancaria_destino: any;
+  emitir_nombre: any;
 
   constructor(
     private router: Router,
@@ -129,6 +131,13 @@ export class PaymentApprovalComponent implements OnInit {
           this.tipo_pago = resp["result"]["id_tipo_pago"]["nombre"];
           this.cuenta_bancaria = resp["result"]["id_cuenta_bancaria"]["nombre"];
           this.fecha_vencimiento = resp["result"]["fecha_vencimiento"];
+          if (resp["result"]["id_cuenta_bancaria"] != undefined) {
+            this.cuenta_bancaria_destino =
+              resp["result"]["id_cuenta_bancaria_destino"]["nombre"];
+          }
+          if (resp["result"]["emitir_nombre"] != undefined) {
+            this.emitir_nombre = resp["result"]["emitir_nombre"];
+          }
         });
 
       this.investmentService

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

@@ -66,6 +66,16 @@
                       <div class="field">{{ cuenta_bancaria }}</div>
                     </div>
 
+                    <div class="col-sm-6" *ngIf="cuenta_bancaria_destino">
+                      <h4>Cuenta bancaria destino:</h4>
+                      <div class="field">{{ cuenta_bancaria_destino }}</div>
+                    </div>
+
+                    <div class="col-sm-6" *ngIf="emitir_nombre">
+                      <h4>Emitir a nombre:</h4>
+                      <div class="field">{{ emitir_nombre }}</div>
+                    </div>
+
                     <div class="col-sm-6">
                       <h4>Fecha de vencimiento:</h4>
                       <div class="field">{{ fecha_vencimiento }}</div>

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

@@ -74,6 +74,8 @@ export class PaymentRequirementComponent implements OnInit {
   generated_inputs_previous: string;
   userListNext: any;
   generated_inputs_next: string;
+  cuenta_bancaria_destino: any;
+  emitir_nombre: any;
 
   constructor(
     private http: HttpClient,
@@ -130,6 +132,15 @@ export class PaymentRequirementComponent implements OnInit {
         this.codigo = resp["result"]["codigo"];
         this.tipo_pago = resp["result"]["id_tipo_pago"]["nombre"];
         this.cuenta_bancaria = resp["result"]["id_cuenta_bancaria"]["nombre"];
+
+        if (resp["result"]["id_cuenta_bancaria"] != undefined) {
+          this.cuenta_bancaria_destino =
+            resp["result"]["id_cuenta_bancaria_destino"]["nombre"];
+        }
+        if (resp["result"]["emitir_nombre"] != undefined) {
+          this.emitir_nombre = resp["result"]["emitir_nombre"];
+        }
+
         this.fecha_vencimiento = resp["result"]["fecha_vencimiento"];
       });
 
@@ -168,6 +179,94 @@ export class PaymentRequirementComponent implements OnInit {
       return false;
     }
 
+    (async () => {
+      Swal.fire({
+        title: `<h3>Enviar información de pago</h3>`,
+        icon: "info",
+
+        html: `${this.generated_inputs_next}`,
+        confirmButtonText: "Enviar requisición",
+        showCancelButton: true,
+        cancelButtonText: "Cancelar",
+        showLoaderOnConfirm: true,
+
+        preConfirm: () => {
+          let array = [];
+
+          for (let i = 0; i < this.userListNext.length; i++) {
+            let html_input: HTMLInputElement = document.getElementById(
+              "next-" + this.userListNext[i]
+            ) as HTMLInputElement;
+            let html_value: string = html_input.value;
+            if (html_input.checked == true) {
+              array.push(html_value);
+            }
+          }
+
+          const formData = new FormData();
+          formData.append("id_inversion", this.investmentProposalID);
+          formData.append("evidencia", this.fileData);
+          formData.append("step", "next");
+          formData.append("comentario", form.value.comentario);
+          formData.append("notificar", array.toString());
+
+          this.paymentObject = {
+            fecha_pago: form.value.fecha_pago.singleDate.formatted,
+            id_inversion: this.investmentProposalID
+            //comentario:
+          };
+
+          this.investmentsService
+            .updatePaymentInfoProposalInvestment(
+              this.investmentProposalID,
+              this.paymentObject
+            )
+            .subscribe(
+              success => {
+                this.investmentService
+                  .sendProposalInvestmentToNextStep(formData)
+                  .subscribe(
+                    success => {
+                      if (success) {
+                        Swal.fire({
+                          allowOutsideClick: false,
+                          icon: "success",
+                          showCancelButton: false,
+                          title: "Exito",
+                          confirmButtonText: "La propuesta ha sido liquidada"
+                        }).then(result => {
+                          Swal.close();
+                          window.location.href = "#/investment-proposals";
+                        });
+                      }
+                    },
+                    err => {
+                      Swal.fire({
+                        icon: "error",
+                        title: "Error en el servidor",
+                        text: err.message
+                      });
+                    }
+                  );
+              },
+              err => {
+                Swal.fire({
+                  icon: "error",
+                  title: "Error en el servidor",
+                  text: err.message
+                });
+              }
+            );
+        }
+      });
+    })();
+
+    /*
+    this.submitted = true;
+    if (!form.valid) {
+      return false;
+    }
+
     this.paymentObject = {
       fecha_pago: form.value.fecha_pago.singleDate.formatted,
       id_inversion: this.investmentProposalID
@@ -227,6 +326,8 @@ export class PaymentRequirementComponent implements OnInit {
             text: err.message
           });
         }
-      );
+      );*/
   }
+
+  sendPaymentInfo(form: any) {}
 }

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

@@ -197,6 +197,24 @@
                             <div class="field">{{ cuenta_bancaria }}</div>
                           </div>
 
+                          <div
+                            class="col-lg-3 col-md-4 col-sm-6"
+                            *ngIf="cuenta_bancaria_destino"
+                          >
+                            <h4>Cuenta bancaria destino:</h4>
+                            <div class="field">
+                              {{ cuenta_bancaria_destino }}
+                            </div>
+                          </div>
+
+                          <div
+                            class="col-lg-3 col-md-4 col-sm-6"
+                            *ngIf="emitir_nombre"
+                          >
+                            <h4>Emitir a nombre:</h4>
+                            <div class="field">{{ emitir_nombre }}</div>
+                          </div>
+
                           <div class="col-lg-3 col-md-4 col-sm-6">
                             <h4>Fecha de vencimiento:</h4>
                             <div class="field">{{ fecha_vencimiento }}</div>

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

@@ -72,6 +72,8 @@ export class InvestmentProposalDetailComponent implements OnInit {
   cuenta_bancaria: any;
   fecha_vencimiento: any;
   fecha_pago: any;
+  cuenta_bancaria_destino: any;
+  emitir_nombre: any;
 
   constructor(
     private router: Router,
@@ -315,6 +317,7 @@ export class InvestmentProposalDetailComponent implements OnInit {
 
           if (
             this.state == "COMPR" ||
+            this.state == "PGAPR" ||
             this.state == "LIQUI" ||
             this.state == "FINAL"
           )
@@ -329,6 +332,13 @@ export class InvestmentProposalDetailComponent implements OnInit {
                   resp["result"]["id_cuenta_bancaria"]["nombre"];
                 this.fecha_vencimiento = resp["result"]["fecha_vencimiento"];
                 this.fecha_pago = resp["result"]["fecha_pago"] || "";
+                if (resp["result"]["id_cuenta_bancaria_destino"] != null) {
+                  this.cuenta_bancaria_destino =
+                    resp["result"]["id_cuenta_bancaria_destino"]["nombre"];
+                }
+                if (resp["result"]["emitir_nombre"] != null) {
+                  this.emitir_nombre = resp["result"]["emitir_nombre"];
+                }
               });
         });
 

+ 1 - 1
src/app/components/investments/costs/pbur/pbur.costs.component.ts

@@ -294,7 +294,7 @@ export class PBURCostsComponent implements OnInit {
       posicion: new FormControl(item.posicion),
       plazo: new FormControl(item.plazo),
       fecha_pago: new FormControl(item.fecha_pago),
-      monto: new FormControl(item.monto),
+      ingreso_bruto: new FormControl(item.ingreso_bruto),
       costo_cedeval: new FormControl(item.costo_cedeval),
       costo_transferencia: new FormControl(item.costo_transferencia),
       costo_banco: new FormControl(item.costo_banco),

+ 1 - 1
src/app/components/investments/costs/vcn/vcn.costs.component.ts

@@ -294,7 +294,7 @@ export class VCNCostsComponent implements OnInit {
       posicion: new FormControl(item.posicion),
       plazo: new FormControl(item.plazo),
       fecha_pago: new FormControl(item.fecha_pago),
-      monto: new FormControl(item.monto),
+      ingreso_bruto: new FormControl(item.ingreso_bruto),
       costo_cedeval: new FormControl(item.costo_cedeval),
       costo_transferencia: new FormControl(item.costo_transferencia),
       costo_banco: new FormControl(item.costo_banco),