Debian Codegraph @

addons/hr_attendance/static/src/components/greetings/greetings.js

raw symbols SCIP
1 import {Component, onWillDestroy} from "@odoo/owl";
2 import { registry } from "@web/core/registry";
3 import { deserializeDateTime } from "@web/core/l10n/dates";
4
5 export class KioskGreetings extends Component {
6 static template = "hr_attendance.public_kiosk_greetings";
7 static props = {
8 employeeData: { type: Object },
9 kioskReturn: { type: Function },
10 };
11
12 setup() {
13 this.formatDateTime = registry.category("formatters").get("datetime");
14 this.formatFloatTime = registry.category("formatters").get("float_time");
15 this.employeeName = this.props.employeeData.employee_name;
16 this.employeeAvatar = this.props.employeeData.employee_avatar;
17 this.hoursToday = this.formatFloatTime(this.props.employeeData.hours_today);
18 this.attendance = this.props.employeeData.attendance;
19 this.check_in_time = this.formatDateTime(this.attendance.check_in && deserializeDateTime(this.attendance.check_in));
20 this.check_out_time = this.formatDateTime(this.attendance.check_out && deserializeDateTime(this.attendance.check_out));
21 this.kiosk_delay = setTimeout(() => {
22 this.props.kioskReturn(true)
23 }, this.props.employeeData.kiosk_delay)
24 if (this.props.employeeData.display_overtime){
25 this.overtimeToday = this.formatFloatTime(this.props.employeeData.overtime_today);
26 this.totalOvertime = this.formatFloatTime(this.props.employeeData.total_overtime);
27 }
28 onWillDestroy(() => clearTimeout(this.kiosk_delay));
29 }
30 }