| 1 |
import { CashierName } from "@point_of_sale/app/components/navbar/cashier_name/cashier_name"; |
| 2 |
import { patch } from "@web/core/utils/patch"; |
| 3 |
import { useCashierSelector } from "@pos_hr/app/utils/select_cashier_mixin"; |
| 4 |
|
| 5 |
patch(CashierName.prototype, { |
| 6 |
setup() { |
| 7 |
super.setup(...arguments); |
| 8 |
if (this.pos.config.module_pos_hr) { |
| 9 |
this.cashierSelector = useCashierSelector(); |
| 10 |
} |
| 11 |
}, |
| 12 |
|
| 13 |
get avatar() { |
| 14 |
if (this.pos.config.module_pos_hr) { |
| 15 |
const cashier = this.pos.getCashier(); |
| 16 |
if (!(cashier && cashier.id)) { |
| 17 |
return ""; |
| 18 |
} |
| 19 |
return `/web/image/hr.employee.public/${cashier.id}/avatar_128`; |
| 20 |
} |
| 21 |
return super.avatar; |
| 22 |
}, |
| 23 |
|
| 24 |
get cssClass() { |
| 25 |
if (this.pos.config.module_pos_hr) { |
| 26 |
return { oe_status: true }; |
| 27 |
} |
| 28 |
return super.cssClass; |
| 29 |
}, |
| 30 |
async selectCashier(pin = false, login = false, list = false) { |
| 31 |
return await this.cashierSelector(...arguments); |
| 32 |
}, |
| 33 |
}); |