|
|
@@ -22,6 +22,7 @@ export class SchedulesComponent implements OnInit { |
|
|
|
selectedDatesForSchedule: Array<number> = []; |
|
|
|
showSchedulePopup: boolean = false; |
|
|
|
scheduleType: string = 'change time'; |
|
|
|
selectedMonthIndex: number; |
|
|
|
scheduleFromTime = { |
|
|
|
hour: '09', |
|
|
|
min: '30', |
|
|
@@ -37,13 +38,23 @@ export class SchedulesComponent implements OnInit { |
|
|
|
profile_type: string = ''; |
|
|
|
profile_info: any; |
|
|
|
|
|
|
|
outletHoliday: { |
|
|
|
outletTiming: { |
|
|
|
close_timing: string; |
|
|
|
holidays: string, |
|
|
|
open_timing: string, |
|
|
|
schedules: { |
|
|
|
outlet_id: number |
|
|
|
} |
|
|
|
} = { |
|
|
|
holidays: '' |
|
|
|
close_timing: "2021-10-28T09:37:05.776Z", |
|
|
|
holidays: '', |
|
|
|
open_timing: "2021-10-28T09:37:05.776Z", |
|
|
|
schedules: { |
|
|
|
outlet_id: null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
selectedHolidays: Array<string> = [new Date('2021-10-21T00:00').toString(), new Date('2021-10-22T00:00').toString()]; |
|
|
|
selectedHolidays: Array<string> = []; |
|
|
|
|
|
|
|
constructor( |
|
|
|
private outletService: OutletService |
|
|
@@ -57,7 +68,6 @@ export class SchedulesComponent implements OnInit { |
|
|
|
this.renderCalendar(); |
|
|
|
|
|
|
|
this.profile_type = localStorage.current_login_type; |
|
|
|
// this.selectedHolidays = [3,5] |
|
|
|
|
|
|
|
if (this.profile_type === 'VENDOR') { |
|
|
|
this.profile_info = JSON.parse(localStorage.vendor_info); |
|
|
@@ -71,7 +81,6 @@ export class SchedulesComponent implements OnInit { |
|
|
|
|
|
|
|
selectDates(dates: Array<number>) { |
|
|
|
this.selectedDatesForSchedule = dates; |
|
|
|
console.log(this.profile_info) |
|
|
|
} |
|
|
|
|
|
|
|
toggleDates(date: number) { |
|
|
@@ -136,17 +145,18 @@ export class SchedulesComponent implements OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
scheduleHolidays() { |
|
|
|
|
|
|
|
this.selectedHolidays = []; |
|
|
|
console.log(this.selectedHolidays) |
|
|
|
|
|
|
|
this.outletService.addOutletSchedules(this.outletHoliday).then((data) => { |
|
|
|
this.selectedHolidays = this.selectedDatesForSchedule.map(selectedDates => this.getTodayString(selectedDates.toString())) |
|
|
|
this.outletTiming.holidays = JSON.stringify(this.selectedHolidays) |
|
|
|
this.outletTiming.schedules.outlet_id = this.profile_info.outlet_id |
|
|
|
console.log(this.outletTiming) |
|
|
|
|
|
|
|
this.outletService.addOutletSchedules(this.outletTiming).then((data) => { |
|
|
|
console.log(data) |
|
|
|
// this.profile_info.schedules.push(data) |
|
|
|
}, err=>{ |
|
|
|
console.log("Unable to Update Holidays") |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getTodayString(selectedMonthDay: string) { |
|
|
|
let monthIndex = this.monthMap.findIndex((month) => this.selectedMonth.toLowerCase() === month.toLowerCase()) + 1; |
|
|
|
return new Date(this.selectedYear + '-' + monthIndex.toString().padStart(2, '0') + '-' + selectedMonthDay.toString().padStart(2, '0') + 'T00:00').toString(); |
|
|
|