Oscar José Nuñez Chávez 5 jaren geleden
bovenliggende
commit
ad8ce420f0

+ 8 - 1
src/app/components/dashboard/dashboard.component.html

@@ -42,29 +42,33 @@
                 </div>
               </div>
               <div class="col-sm-12 col-md-6">
-                <h4>Tarifa actual:</h4>
+                <h4>Tarifa actual (USD$/kWh):</h4>
                 <div *ngIf="rates.tarifa_actual.cargo_energia">
                   Cargo de energia:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_b1">
                   Cargo de energia por bloque 1:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia_b1 | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_b2">
                   Cargo de energia por bloque 2:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia_b2 | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_b3">
                   Cargo de energia por bloque 3:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia_b3 | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_punta">
@@ -73,6 +77,7 @@
                     {{
                       rates.tarifa_actual.cargo_energia_punta | number: "1.2-4"
                     }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_resto">
@@ -81,6 +86,7 @@
                     {{
                       rates.tarifa_actual.cargo_energia_resto | number: "1.2-4"
                     }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_valle">
@@ -89,6 +95,7 @@
                     {{
                       rates.tarifa_actual.cargo_energia_valle | number: "1.2-4"
                     }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <br />

+ 1 - 6
src/app/components/profile/profile.component.ts

@@ -46,10 +46,6 @@ export class ProfileComponent implements OnInit {
     });
     Swal.showLoading();
 
-    this.catalogsService.getCatalogs().subscribe((res) => {
-      console.log(res);
-    });
-
     this.catalogsService.getCatalogByName("distribuidoras").subscribe((res) => {
       this.distributor = res["data"]["catalogo"]["records"];
     });
@@ -62,7 +58,6 @@ export class ProfileComponent implements OnInit {
       .getUserById(this.authService.getUserId())
       .subscribe((ans) => {
         this.user = ans["data"]["user"];
-        console.log(this.user);
         Swal.close();
         this.editProfile = true;
         this.first_name = this.user.first_name;
@@ -98,7 +93,6 @@ export class ProfileComponent implements OnInit {
 
   editUser(form: any) {
     this.submitted = true;
-    console.log(this.userForm);
     // stop here if form is invalid
     if (this.userForm.invalid) {
       return;
@@ -135,6 +129,7 @@ export class ProfileComponent implements OnInit {
             confirmButtonText: "Se ha actualizado su perfil exitosamente",
           }).then((result) => {
             Swal.close();
+            window.location.reload();
           });
         }
       },

+ 35 - 9
src/app/components/rates/rates.component.html

@@ -21,29 +21,33 @@
                     {{ rates.distribuidora }}
                   </strong>
                 </h3>
-                <h4>Tarifa actual:</h4>
+                <h4>Tarifa actual (USD$/kWh):</h4>
                 <div *ngIf="rates.tarifa_actual.cargo_energia">
                   Cargo de energia:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_b1">
                   Cargo de energia por bloque 1:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia_b1 | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_b2">
                   Cargo de energia por bloque 2:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia_b2 | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_b3">
                   Cargo de energia por bloque 3:
                   <strong>
                     {{ rates.tarifa_actual.cargo_energia_b3 | number: "1.2-4" }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_punta">
@@ -52,6 +56,7 @@
                     {{
                       rates.tarifa_actual.cargo_energia_punta | number: "1.2-4"
                     }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_resto">
@@ -60,6 +65,7 @@
                     {{
                       rates.tarifa_actual.cargo_energia_resto | number: "1.2-4"
                     }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <div *ngIf="rates.tarifa_actual.cargo_energia_valle">
@@ -68,6 +74,7 @@
                     {{
                       rates.tarifa_actual.cargo_energia_valle | number: "1.2-4"
                     }}
+                    USD$/kWh
                   </strong>
                 </div>
                 <br />
@@ -84,7 +91,7 @@
                 </div>
                 <h4>Incremento con respecto a tarifa anterior (%)</h4>
 
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia">
+                <div *ngIf="rates.incremento_porcentaje.cargo_energia != null">
                   Cargo de energia:
                   <strong>
                     {{
@@ -93,7 +100,10 @@
                     }}%
                   </strong>
                 </div>
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia_b1">
+
+                <div
+                  *ngIf="rates.incremento_porcentaje.cargo_energia_b1 != null"
+                >
                   Cargo de energia por bloque 1:
                   <strong>
                     {{
@@ -102,7 +112,9 @@
                     }}%
                   </strong>
                 </div>
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia_b2">
+                <div
+                  *ngIf="rates.incremento_porcentaje.cargo_energia_b2 != null"
+                >
                   Cargo de energia por bloque 2:
                   <strong>
                     {{
@@ -111,16 +123,22 @@
                     }}%
                   </strong>
                 </div>
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia_b3">
+                <div
+                  *ngIf="rates.incremento_porcentaje.cargo_energia_b3 != null"
+                >
                   Cargo de energia por bloque 3:
                   <strong>
                     {{
                       rates.incremento_porcentaje.cargo_energia_b3
-                        | number: "1.2-4"
+                        | number: "0.2-4"
                     }}%
                   </strong>
                 </div>
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia_punta">
+                <div
+                  *ngIf="
+                    rates.incremento_porcentaje.cargo_energia_punta != null
+                  "
+                >
                   Cargo de energia punta:
                   <strong>
                     {{
@@ -129,7 +147,11 @@
                     }}%
                   </strong>
                 </div>
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia_resto">
+                <div
+                  *ngIf="
+                    rates.incremento_porcentaje.cargo_energia_resto != null
+                  "
+                >
                   Cargo de energia resto:
                   <strong>
                     {{
@@ -138,7 +160,11 @@
                     }}%
                   </strong>
                 </div>
-                <div *ngIf="rates.incremento_porcentaje.cargo_energia_valle">
+                <div
+                  *ngIf="
+                    rates.incremento_porcentaje.cargo_energia_valle != null
+                  "
+                >
                   Cargo de energia valle:
                   <strong>
                     {{

+ 66 - 29
src/app/components/rates/rates.component.ts

@@ -155,6 +155,9 @@ export class RatesComponent implements OnInit {
       let cargo_energia_b1 = [];
       let cargo_energia_b2 = [];
       let cargo_energia_b3 = [];
+      let cargo_energia_punta = [];
+      let cargo_energia_resto = [];
+      let cargo_energia_valle = [];
 
       for (let prop in meterKeys2) {
         console.log();
@@ -171,72 +174,106 @@ export class RatesComponent implements OnInit {
         labels.push(
           `${this.metersValues[prop]["dateMin"]} - ${this.metersValues[prop]["dateMax"]}`
         );
-
         if (this.metersValues[prop]["cargo_energia"] != "") {
           cargo_energia.push(this.metersValues[prop]["cargo_energia"]);
         }
-
         if (this.metersValues[prop]["cargo_energia_b1"] != "") {
           cargo_energia_b1.push(this.metersValues[prop]["cargo_energia_b1"]);
         }
-
         if (this.metersValues[prop]["cargo_energia_b2"] != "") {
           cargo_energia_b2.push(this.metersValues[prop]["cargo_energia_b2"]);
         }
-
         if (this.metersValues[prop]["cargo_energia_b3"] != "") {
           cargo_energia_b3.push(this.metersValues[prop]["cargo_energia_b3"]);
         }
-
-        /*
-        
-        
-        this.metersData.push(
-          {
-            label: label,
-            backgroundColor: this.barChartColors[prop],
-            data: measure_values,
-            barPercentage: 0.7,
-            borderColor: this.borderChartColors[prop],
-          }
-        );*/
+        if (this.metersValues[prop]["cargo_energia_punta"] != "") {
+          cargo_energia_punta.push(
+            this.metersValues[prop]["cargo_energia_punta"]
+          );
+        }
+        if (this.metersValues[prop]["cargo_energia_resto"] != "") {
+          cargo_energia_resto.push(
+            this.metersValues[prop]["cargo_energia_resto"]
+          );
+        }
+        if (this.metersValues[prop]["cargo_energia_valle"] != "") {
+          cargo_energia_valle.push(
+            this.metersValues[prop]["cargo_energia_valle"]
+          );
+        }
       }
-      console.log(labels);
       this.barChartType = "line";
       this.barChartLabels = labels;
 
-      this.metersData.push(
-        {
+      if (cargo_energia.length > 0) {
+        this.metersData.push({
           label: "Cargo energia",
           backgroundColor: this.barChartColors[0],
           data: cargo_energia,
           barPercentage: 0.7,
           borderColor: this.borderChartColors[0],
-        },
-        {
+        });
+      }
+      if (cargo_energia_b1.length > 0) {
+        this.metersData.push({
           label: "Cargo energia bloque 1",
           backgroundColor: this.barChartColors[1],
           data: cargo_energia_b1,
           barPercentage: 0.7,
           borderColor: this.borderChartColors[1],
-        },
-        {
+        });
+      }
+      if (cargo_energia_b2.length > 0) {
+        this.metersData.push({
           label: "Cargo energia bloque 2",
           backgroundColor: this.barChartColors[2],
           data: cargo_energia_b2,
           barPercentage: 0.7,
           borderColor: this.borderChartColors[2],
-        },
-        {
+        });
+      }
+      if (cargo_energia_b3.length > 0) {
+        this.metersData.push({
           label: "Cargo energia bloque 3",
           backgroundColor: this.barChartColors[3],
           data: cargo_energia_b3,
           barPercentage: 0.7,
           borderColor: this.borderChartColors[3],
-        }
-      );
+        });
+      }
+      if (cargo_energia_punta.length > 0) {
+        this.metersData.push({
+          label: "Cargo energia punta",
+          backgroundColor: this.barChartColors[4],
+          data: cargo_energia_punta,
+          barPercentage: 0.7,
+          borderColor: this.borderChartColors[4],
+        });
+      }
+      if (cargo_energia_resto.length > 0) {
+        this.metersData.push({
+          label: "Cargo energia resto",
+          backgroundColor: this.barChartColors[5],
+          data: cargo_energia_resto,
+          barPercentage: 0.7,
+          borderColor: this.borderChartColors[5],
+        });
+      }
+      if (cargo_energia_valle.length > 0) {
+        this.metersData.push({
+          label: "Cargo energia valle",
+          backgroundColor: this.barChartColors[6],
+          data: cargo_energia_valle,
+          barPercentage: 0.7,
+          borderColor: this.borderChartColors[6],
+        });
+      }
+
       /*
-      
+      cargo_energia_punta
+cargo_energia_resto
+cargo_energia_valle
+
       this.metersValues[0]["data"]
                   .map((obj) =>
                     formatDate(