|
|
@@ -140,9 +140,43 @@ export class FINVCostsComponent implements OnInit {
|
|
|
Swal.close();
|
|
|
}, 1200);
|
|
|
}
|
|
|
-
|
|
|
+ clearProyeccion(proyecciones,nombres,tipoDato){
|
|
|
+ let clearPro = []
|
|
|
+
|
|
|
+ proyecciones.forEach(createNewProyeccion);
|
|
|
+
|
|
|
+ function createNewProyeccion(arrFila, index) {
|
|
|
+ nombres.forEach(loopNombres);
|
|
|
+
|
|
|
+ function loopNombres(nombre, index) {
|
|
|
+
|
|
|
+ arrFila[nombre] = parseFloat(arrFila[nombre].toString().replace(",",""))
|
|
|
+ }
|
|
|
+ clearPro.push(arrFila)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return clearPro;
|
|
|
+ }
|
|
|
+
|
|
|
+ public inputValidator(event: any) {
|
|
|
+ //console.log(event.target.value);
|
|
|
+ const pattern = /^[0-9]*$/;
|
|
|
+ //let inputChar = String.fromCharCode(event.charCode)
|
|
|
+
|
|
|
+ if (!pattern.test(event.target.value)) {
|
|
|
+
|
|
|
+ event.target.value = event.target.value.replace(/[^\d,.]+/g, '');
|
|
|
+ // invalid character, prevent input
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
recalculateProjectionChanges() {
|
|
|
- let objProjection = { proyecciones: this.form.value };
|
|
|
+ let nombresProyecciones = ["dividendo_porcentaje",
|
|
|
+ "rendimiento_porcentaje"]
|
|
|
+ let clearPro = this.clearProyeccion(this.form.value,nombresProyecciones,"decimal")
|
|
|
+ let objProjection = { proyecciones: clearPro };
|
|
|
Swal.fire({
|
|
|
allowOutsideClick: false,
|
|
|
icon: "info",
|