Selaa lähdekoodia

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

Oscar José Nuñez Chávez 5 vuotta sitten
vanhempi
commit
7e93ba95e5

+ 1 - 1
src/app/components/instruments/cete/cete.component.ts

@@ -158,7 +158,7 @@ export class CETE implements InstrumentComponent {
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? "" : this.instrument_work.rendimiento_bruto,
+        this.instrument_exists ? 0 : this.instrument_work.rendimiento_bruto,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
       fecha_liquidacion: [

+ 1 - 1
src/app/components/instruments/pbur/pbur.component.ts

@@ -136,7 +136,7 @@ export class PBUR implements InstrumentComponent {
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? "" : this.instrument_work.otros_costos,
+        this.instrument_exists ? 0 : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
       renta_porcentaje: [

+ 1 - 1
src/app/components/instruments/vcn/vcn.component.ts

@@ -136,7 +136,7 @@ export class VCN implements InstrumentComponent {
         ]
       ],
       otros_costos: [
-        this.instrument_exists ? "" : this.instrument_work.otros_costos,
+        this.instrument_exists ? 0 : this.instrument_work.otros_costos,
         [Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
       ],
       plazo: [

+ 60 - 62
src/app/components/investment-proposals/approve/approve.component.ts

@@ -337,41 +337,40 @@ export class InvestmentProposalApproveComponent implements OnInit {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
-
-      // if (comentario) {
-        this.reviewProposal = {
-          id_inversion: this.investmentProposalID,
-          step: "next",
-          comentario: comentario
-        };
+        preConfirm: comentario => {
+          this.reviewProposal = {
+            id_inversion: this.investmentProposalID,
+            step: "next",
+            comentario: comentario
+          };
 
-        this.investmentService
-          .sendProposalInvestmentToNextStep(this.reviewProposal)
-          .subscribe(
-            success => {
-              if (success) {
+          this.investmentService
+            .sendProposalInvestmentToNextStep(this.reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "success",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido aprobada"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }
+              },
+              err => {
                 Swal.fire({
-                  allowOutsideClick: false,
-                  icon: "success",
-                  showCancelButton: false,
-                  title: "Exito",
-                  confirmButtonText: "La propuesta ha sido aprobada"
-                }).then(result => {
-                  Swal.close();
-                  window.location.href = "#/investment-proposals";
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
                 });
               }
-            },
-            err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
-            }
-          );
-      // }
+            );
+        }
+      });
     })();
   }
 
@@ -391,41 +390,40 @@ export class InvestmentProposalApproveComponent implements OnInit {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
-
-      // if (comentario) {
-        this.reviewProposal = {
-          id_inversion: this.investmentProposalID,
-          step: "previous",
-          comentario: comentario
-        };
+        preConfirm: comentario => {
+          this.reviewProposal = {
+            id_inversion: this.investmentProposalID,
+            step: "previous",
+            comentario: comentario
+          };
 
-        this.investmentService
-          .sendProposalInvestmentToNextStep(this.reviewProposal)
-          .subscribe(
-            success => {
-              if (success) {
+          this.investmentService
+            .sendProposalInvestmentToNextStep(this.reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "warning",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido rechazada"
+                  }).then(result => {
+                    window.location.href = "#/investment-proposals";
+                    Swal.close();
+                  });
+                }
+              },
+              err => {
                 Swal.fire({
-                  allowOutsideClick: false,
-                  icon: "warning",
-                  showCancelButton: false,
-                  title: "Exito",
-                  confirmButtonText: "La propuesta ha sido rechazada"
-                }).then(result => {
-                  window.location.href = "#/investment-proposals";
-                  Swal.close();
+                  icon: "error",
+                  title: "Error en el servidor",
+                  text: err.message
                 });
               }
-            },
-            err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error en el servidor",
-                text: err.message
-              });
-            }
-          );
-      // }
+            );
+        }
+      });
     })();
   }
 }

+ 71 - 71
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -229,7 +229,7 @@ export class InvestmentProposalsComponent implements OnInit {
   }
 
   sendToReview(investmentProposalID: number, investmentCode: string) {
-    async () => {
+    (async () => {
       const { value: comentario } = await Swal.fire({
         title: `<h3>Enviar a revisión propuesta de inversión ${investmentCode}</h3>`,
         icon: "info",
@@ -237,47 +237,48 @@ export class InvestmentProposalsComponent implements OnInit {
         input: "textarea",
         showCancelButton: true,
         confirmButtonText: "Enviar propuesta",
-        cancelButtonText: "Cancelar"
+        cancelButtonText: "Cancelar",
         // inputValidator: value => {
         //   if (!value) {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
 
-      //if (comentario) {
-      let reviewProposal = {
-        id_inversion: investmentProposalID,
-        step: "next",
-        comentario: comentario
-      };
-
-      this.investmentsService
-        .sendReviewProposalInvestment(reviewProposal)
-        .subscribe(
-          success => {
-            if (success) {
-              Swal.fire({
-                allowOutsideClick: false,
-                icon: "success",
-                showCancelButton: false,
-                title: "Exito",
-                confirmButtonText: "La propuesta ha sido enviada a revisión"
-              }).then(result => {
-                Swal.close();
-                window.location.reload();
-              });
-            }
-          },
-          err => {
-            Swal.fire({
-              icon: "error",
-              title: "Error al guardar",
-              text: err.message
-            });
-          }
-        );
-    };
+        preConfirm: comentario => {
+          let reviewProposal = {
+            id_inversion: investmentProposalID,
+            step: "next",
+            comentario: comentario
+          };
+
+          this.investmentsService
+            .sendReviewProposalInvestment(reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "success",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido enviada a revisión"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.reload();
+                  });
+                }
+              },
+              err => {
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }
+            );
+        }
+      });
+    })();
   }
 
   //Enviar a revision la propuesta de inversion
@@ -290,42 +291,41 @@ export class InvestmentProposalsComponent implements OnInit {
         html: `<p style="text-align:left;">Comentario:</p>`,
         showCancelButton: true,
         confirmButtonText: "Finalizar",
-        cancelButtonText: "Cancelar"
+        cancelButtonText: "Cancelar",
+        preConfirm: comentario => {
+          let reviewProposal = {
+            id_inversion: investmentProposalID,
+            step: "next",
+            comentario: comentario
+          };
+
+          this.investmentsService
+            .sendReviewProposalInvestment(reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "success",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido finalizada"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.reload();
+                  });
+                }
+              },
+              err => {
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }
+            );
+        }
       });
-
-      //if (comentario) {
-      let reviewProposal = {
-        id_inversion: investmentProposalID,
-        step: "next",
-        comentario: comentario
-      };
-
-      this.investmentsService
-        .sendReviewProposalInvestment(reviewProposal)
-        .subscribe(
-          success => {
-            if (success) {
-              Swal.fire({
-                allowOutsideClick: false,
-                icon: "success",
-                showCancelButton: false,
-                title: "Exito",
-                confirmButtonText: "La propuesta ha sido finalizada"
-              }).then(result => {
-                Swal.close();
-                window.location.href = "#/investment-proposals";
-              });
-            }
-          },
-          err => {
-            Swal.fire({
-              icon: "error",
-              title: "Error al guardar",
-              text: err.message
-            });
-          }
-        );
-      //}
     })();
   }
 

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

@@ -104,8 +104,7 @@ 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"];
-        this.fecha_pago = resp["result"]["fecha_pago"];
-        this.fecha_vencimiento = resp["result"]["fecha_pago"];
+        this.fecha_vencimiento = resp["result"]["fecha_vencimiento"];
       });
 
     this.investmentProposalForm = this.formBuilder.group({

+ 1 - 1
src/app/components/investment-proposals/result/result.component.scss

@@ -4,5 +4,5 @@ h4 {
 
 .field {
   margin-bottom: 10px;
-  color: #104911;
+  color: green;
 }

+ 62 - 64
src/app/components/investment-proposals/result/result.component.ts

@@ -319,41 +319,40 @@ export class ResultComponent implements OnInit {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
-
-      // if (comentario) {
-        this.reviewProposal = {
-          id_inversion: this.investmentProposalID,
-          step: "next",
-          comentario: comentario
-        };
-
-        this.investmentService
-          .sendReviewProposalInvestment(this.reviewProposal)
-          .subscribe(
-            success => {
-              if (success) {
+        preConfirm: comentario => {
+          this.reviewProposal = {
+            id_inversion: this.investmentProposalID,
+            step: "next",
+            comentario: comentario
+          };
+
+          this.investmentService
+            .sendReviewProposalInvestment(this.reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "success",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido enviada a revisión"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }
+              },
+              err => {
                 Swal.fire({
-                  allowOutsideClick: false,
-                  icon: "success",
-                  showCancelButton: false,
-                  title: "Exito",
-                  confirmButtonText: "La propuesta ha sido enviada a revisión"
-                }).then(result => {
-                  Swal.close();
-                  window.location.href = "#/investment-proposals";
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
                 });
               }
-            },
-            err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
-            }
-          );
-      // }
+            );
+        }
+      });
     })();
   }
 
@@ -419,41 +418,40 @@ export class ResultComponent implements OnInit {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
-
-      // if (comentario) {
-        this.reviewProposal = {
-          id_inversion: this.investmentProposalID,
-          step: "next",
-          comentario: comentario
-        };
-
-        this.investmentService
-          .sendReviewProposalInvestment(this.reviewProposal)
-          .subscribe(
-            success => {
-              if (success) {
+        preConfirm: comentario => {
+          this.reviewProposal = {
+            id_inversion: this.investmentProposalID,
+            step: "next",
+            comentario: comentario
+          };
+
+          this.investmentService
+            .sendReviewProposalInvestment(this.reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "success",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido finalizada"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }
+              },
+              err => {
                 Swal.fire({
-                  allowOutsideClick: false,
-                  icon: "success",
-                  showCancelButton: false,
-                  title: "Exito",
-                  confirmButtonText: "La propuesta ha sido finalizada"
-                }).then(result => {
-                  Swal.close();
-                  window.location.href = "#/investment-proposals";
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
                 });
               }
-            },
-            err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
-            }
-          );
-      // }
+            );
+        }
+      });
     })();
   }
 

+ 60 - 62
src/app/components/investment-proposals/review/review.component.ts

@@ -337,41 +337,40 @@ export class InvestmentProposalReviewComponent implements OnInit {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
-
-      // if (comentario) {
-        this.reviewProposal = {
-          id_inversion: this.investmentProposalID,
-          step: "next",
-          comentario: comentario
-        };
+        preConfirm: comentario => {
+          this.reviewProposal = {
+            id_inversion: this.investmentProposalID,
+            step: "next",
+            comentario: comentario
+          };
 
-        this.investmentService
-          .sendProposalInvestmentToNextStep(this.reviewProposal)
-          .subscribe(
-            success => {
-              if (success) {
+          this.investmentService
+            .sendProposalInvestmentToNextStep(this.reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "success",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido aprobada"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }
+              },
+              err => {
                 Swal.fire({
-                  allowOutsideClick: false,
-                  icon: "success",
-                  showCancelButton: false,
-                  title: "Exito",
-                  confirmButtonText: "La propuesta ha sido aprobada"
-                }).then(result => {
-                  Swal.close();
-                  window.location.href = "#/investment-proposals";
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
                 });
               }
-            },
-            err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
-            }
-          );
-      // }
+            );
+        }
+      });
     })();
   }
 
@@ -391,41 +390,40 @@ export class InvestmentProposalReviewComponent implements OnInit {
         //     return "Debe ingresar un comentario";
         //   }
         // }
-      });
-
-      // if (comentario) {
-        this.reviewProposal = {
-          id_inversion: this.investmentProposalID,
-          step: "previous",
-          comentario: comentario
-        };
+        preConfirm: comentario => {
+          this.reviewProposal = {
+            id_inversion: this.investmentProposalID,
+            step: "previous",
+            comentario: comentario
+          };
 
-        this.investmentService
-          .sendProposalInvestmentToNextStep(this.reviewProposal)
-          .subscribe(
-            success => {
-              if (success) {
+          this.investmentService
+            .sendProposalInvestmentToNextStep(this.reviewProposal)
+            .subscribe(
+              success => {
+                if (success) {
+                  Swal.fire({
+                    allowOutsideClick: false,
+                    icon: "warning",
+                    showCancelButton: false,
+                    title: "Exito",
+                    confirmButtonText: "La propuesta ha sido rechazada"
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }
+              },
+              err => {
                 Swal.fire({
-                  allowOutsideClick: false,
-                  icon: "warning",
-                  showCancelButton: false,
-                  title: "Exito",
-                  confirmButtonText: "La propuesta ha sido rechazada"
-                }).then(result => {
-                  Swal.close();
-                  window.location.href = "#/investment-proposals";
+                  icon: "error",
+                  title: "Error en el servidor",
+                  text: err.message
                 });
               }
-            },
-            err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error en el servidor",
-                text: err.message
-              });
-            }
-          );
-      // }
+            );
+        }
+      });
     })();
   }
 }