| 1 |
import { onWillStart } from "@odoo/owl"; |
| 2 |
import { user } from "@web/core/user"; |
| 3 |
import { CalendarCommonRenderer } from '@web/views/calendar/calendar_common/calendar_common_renderer'; |
| 4 |
import { useMandatoryDays } from '../../hooks'; |
| 5 |
import { TimeOffCalendarCommonPopover } from './calendar_common_popover'; |
| 6 |
|
| 7 |
|
| 8 |
export class TimeOffCalendarCommonRenderer extends CalendarCommonRenderer { |
| 9 |
static components = { |
| 10 |
...TimeOffCalendarCommonRenderer, |
| 11 |
Popover: TimeOffCalendarCommonPopover, |
| 12 |
}; |
| 13 |
setup() { |
| 14 |
super.setup(); |
| 15 |
this.mandatoryDays = useMandatoryDays(this.props); |
| 16 |
onWillStart(async () => { |
| 17 |
this.isManager = (await user.hasGroup("hr_holidays.group_hr_holidays_user")); |
| 18 |
}); |
| 19 |
} |
| 20 |
|
| 21 |
getDayCellClassNames(info) { |
| 22 |
return [...super.getDayCellClassNames(info), ...this.mandatoryDays(info)]; |
| 23 |
} |
| 24 |
|
| 25 |
onClick(info) { |
| 26 |
// To open record view |
| 27 |
return this.onDblClick(info) |
| 28 |
} |
| 29 |
} |