Sfoglia il codice sorgente

Merge branch 'improvements' of onunez/soma-frontend into development

Oscar José Nuñez Chávez 6 anni fa
parent
commit
d0489da2a1

+ 24 - 12
src/app/components/assets/assets.component.ts

@@ -161,8 +161,7 @@ export class AssetsComponent implements OnInit {
       else {
         this.city = this.listAssets.find(object=>object.id == this.assetID).city;
       }
-      console.log("asset city");
-      console.log(this.city);
+  
       let tempAsset = this.listAssets.find(object=>object.id == this.assetID);
 
       if (tempAsset["meters_installed"].length > 0){
@@ -195,7 +194,7 @@ export class AssetsComponent implements OnInit {
     //this.chartjs = true;
     setTimeout(()=>{
       Swal.close();
-    }, 2500);
+    }, 3000);
   }
   
   // Default check asset dropdown if a value is equal to an assetID
@@ -219,7 +218,8 @@ export class AssetsComponent implements OnInit {
     this.assetID = event.target.value;
     let tempAsset = this.listAssets.find(object=>object.id == this.assetID);
     this.city = tempAsset["city"];
-
+    this.total_savings = 0;
+    this.last_day_savings = 0;
     if (tempAsset["meters_installed"].length > 0){
       this.metersInstalled = true;
       this.getSavings(this.assetID);
@@ -227,13 +227,25 @@ export class AssetsComponent implements OnInit {
       this.getMeasureRangeChart(this.view, this.initialDate, this.assetID);
       this.getEnvironmentalData(this.assetID);
     }
-    else {
-      this.metersInstalled = false;
-      if (this.chart1 != undefined){
-        this.chart1.destroy();
-      }
-      this.chart1 = undefined;
-      this.chart1 = new Chart('canvas', {});
+    else { 
+
+      Swal.fire({
+        allowOutsideClick: false,
+        type: 'info',
+        text: 'Espere por favor...'
+      });
+      Swal.showLoading();
+      setTimeout(()=>{
+        Swal.close();
+        this.metersInstalled = false;
+        if (this.chart1 != undefined ){
+          this.chart1.destroy();
+        }
+        this.chart1 = undefined;
+        this.chart1 = new Chart('canvas', {});
+    
+      }, 3000);
+  
     }
   }
   
@@ -553,7 +565,7 @@ export class AssetsComponent implements OnInit {
     });
     setTimeout(()=>{
       Swal.close();
-    }, 1600)
+    }, 1800)
   }
 
   getDateWithFormat(view:string, date:string){

+ 3 - 0
src/app/components/plugins/weather-card/weather-card.component.html

@@ -22,6 +22,9 @@
     <div class="error-weather alert" role="alert">
       <i class="fas fa-exclamation-circle"></i>
       {{errorMessage}}
+      <button type="button" class="close" data-dismiss="alert" aria-label="Close">
+        <span aria-hidden="true">&times;</span>
+      </button>
     </div>
   </div>
 </div>

+ 6 - 1
src/app/components/plugins/weather-card/weather-card.component.scss

@@ -83,7 +83,12 @@ div.right-panel
   margin: 5px 0;
   background: #FFF3CD;
   width: 100%;
+
+  .close {
+    font-size: 12px;
+  }
+
   i {
     color: inherit;
   }
-}
+}