Advertisement
Guest User

angular-datatables 1619

a guest
Jan 4th, 2022
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.85 KB | None | 0 0
  1. diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html
  2. index f2a23d8..0dc43ab 100644
  3. --- a/src/app/dashboard/dashboard.component.html
  4. +++ b/src/app/dashboard/dashboard.component.html
  5. @@ -1,15 +1,15 @@
  6. -<div class="container" style="padding:10px;" *ngIf="!loading">
  7. +<div class="container" style="padding:10px;" [hidden]="loading">
  8.  
  9.      <!--Overview with dropdown filters-->
  10.      <div class="row" style="padding: 10px;">
  11. -      
  12. +
  13.  
  14.              <div class="col-md" style="padding: 10px;">
  15. -                    
  16. +
  17.                    <button class="btn btn-primary" (click)="openModal()">Select Date Range</button>
  18.              </div>
  19. -    
  20. -            
  21. +
  22. +
  23.      </div>
  24.  
  25.      <div class="row text-center" style="padding: 10px; margin-top: 10px; margin-bottom: 10px;">
  26. @@ -33,8 +33,8 @@
  27.          </div>
  28.      </div>
  29.  
  30. -    
  31. -    <div class="row" style="padding: 10px; margin-top: 10px; margin-bottom: 10px;">
  32. +
  33. +    <div class="row" style="padding: 10px; margin-top: 10px; margin-bottom: 10px;">
  34.          <table datatable [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" class="row-border hover">
  35.              <thead>
  36.                  <tr>
  37. @@ -67,7 +67,7 @@
  38.  
  39.  </div>
  40.  
  41. -<div *ngIf="loading" class="text-center" style="padding: 10px">
  42. +<div [hidden]="!loading" class="text-center" style="padding: 10px">
  43.      <div class="spinner-border text-warning" role="status">
  44.          <span class="visually-hidden">Loading...</span>
  45.      </div>
  46. @@ -99,7 +99,7 @@
  47.                  <label class="form-label" for="enddate"> Select End Date</label>
  48.                  <mdb-date-picker formControlName="EndDate" name="enddate" [options]="myDatePickerOptions" [placeholder]="'Select End Date'" required></mdb-date-picker>
  49.              </div>
  50. -            
  51. +
  52.          </form>
  53.        </div>
  54.        <div class="modal-footer">
  55. diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
  56. index 9bedf31..fba065e 100644
  57. --- a/src/app/dashboard/dashboard.component.ts
  58. +++ b/src/app/dashboard/dashboard.component.ts
  59. @@ -29,13 +29,13 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  60.    loading = false;
  61.  
  62.  
  63. -  /*** Data varibales ***/
  64. +  /*** Data varibales ***/
  65.    completed_bookings= 0;
  66.    upcoming_bookings= 0;
  67.    total_revenue= 0;
  68.    total_bookings= 0;
  69.  
  70. -
  71. +
  72.    //Booking Table
  73.    booking_table: Array<any> = [];
  74.  
  75. @@ -53,7 +53,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  76.  
  77.          this.loading = false
  78.  
  79. -        
  80. +
  81.          //Bookings Overview data
  82.          this.completed_bookings = data.result.completed_bookings
  83.          this.total_bookings = data.result.total_number_of_bookings
  84. @@ -76,7 +76,6 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  85.    }
  86.  
  87.    ngAfterViewInit(): void {
  88. -    this.dtTrigger.next();
  89.    }
  90.  
  91.    ngOnDestroy(): void{
  92. @@ -113,7 +112,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  93.      })
  94.    }
  95.  
  96. -  
  97. +
  98.    //Get All-Time Dashboard Data
  99.    getAllData(){
  100.  
  101. @@ -123,16 +122,16 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  102.  
  103.          this.loading = false
  104.  
  105. -        
  106. +
  107.          //Bookings Overview data
  108.          this.completed_bookings = data.result.completed_bookings
  109.          this.total_bookings = data.result.total_number_of_bookings
  110.          this.total_revenue = data.result.total_revenue
  111.          this.upcoming_bookings = data.result.upcoming_bookings
  112.  
  113. -      
  114. -        setTimeout(() => {
  115. +
  116.          this.booking_table = data.result.booking_table;
  117. +        setTimeout(() => {
  118.          this.dtTrigger.next();
  119.          }, 1000);
  120.  
  121. @@ -176,7 +175,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  122.          console.log(error)
  123.        }
  124.  
  125. -    );  
  126. +    );
  127.  
  128.  
  129.    }
  130. @@ -199,14 +198,14 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  131.        //Bookings per City Data
  132.        this.bookings_per_city =[
  133.          {data: data.result.percentage_of_bookings_per_city_dataset.data, label:"Percentage of bookings per city"}
  134. -      ]
  135. +      ]
  136.        this.bookings_per_city_labels = data.result.percentage_of_bookings_per_city_labels;
  137.        this.generateColors(this.bookings_per_city_labels);
  138.  
  139.        //Bookings per Venue Data
  140.        this.bookings_per_venue =[
  141.          {data: data.result.percentage_of_bookings_per_venue_dataset.data, label:"Percentage of bookings per venue"}
  142. -      ]
  143. +      ]
  144.        this.bookings_per_venue_labels = data.result.percentage_of_bookings_per_venue_labels;
  145.        this.generateColors(this.bookings_per_venue_labels);
  146.  
  147. @@ -236,5 +235,5 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
  148.        this.dtTrigger.next();
  149.      });
  150.    }
  151. -  
  152. +
  153.  }
  154.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement