Procházet zdrojové kódy

chore: Calculator component code cleanup

fzadrazil před 3 roky
rodič
revize
127e9cef2f

+ 1 - 1
src/app/calculator/calculator.component.html

@@ -68,7 +68,7 @@
                 [class.bg-primary]="selected"
                 [class.hidden]="date.month !== currentMonth"
                 [class.text-muted]="disabled"
-                [class.has-task]="hasTask(date)">
+                [class.has-task]="hasDataAvailable(date)">
             {{ date.day }}
           </span>
         </ng-template>

+ 2 - 9
src/app/calculator/calculator.component.ts

@@ -87,22 +87,15 @@ export class CalculatorComponent implements HsPanelComponent, OnInit {
    */
   resetDate() {
     this.calcService.selectedDate = undefined;
+    this.calcService.selectedDateCalendar = undefined;
     this.calcService.availableDates = undefined;
   }
 
-  updateRangeSlider(value: string) {
-    this.calcService.dateCalendarSelects.next({date: value});
-  }
-
   updateSelectedDate(value: NgbDateStruct) {
     this.calcService.selectedDate = value.year + '-' + value.month + '-' + value.day;
   }
 
-  isWeekend(date: NgbDateStruct) {
-    return date.day > 5;
-  }
-
-  hasTask(date: NgbDateStruct): boolean {
+  hasDataAvailable(date: NgbDateStruct): boolean {
     if (this.calcService && this.calcService.availableDates) {
       let found = this.calcService.availableDates.filter((item, index) => {
         return item.indexOf(`${date.year}-${date.month.toString().padStart(2, "0")}-${date.day.toString().padStart(2, "0")}`) == 0;