diff --git a/addons_extensions/hrms_emp_dashboard/static/src/css/hrms_emp_dashboard.css b/addons_extensions/hrms_emp_dashboard/static/src/css/hrms_emp_dashboard.css index 966b44548..1308ba71f 100644 --- a/addons_extensions/hrms_emp_dashboard/static/src/css/hrms_emp_dashboard.css +++ b/addons_extensions/hrms_emp_dashboard/static/src/css/hrms_emp_dashboard.css @@ -430,3 +430,62 @@ flex-direction: column; } } + + +.expense-empty-state{ + min-height:420px; + display:flex; + flex-direction:column; + justify-content:center; + align-items:center; + text-align:center; + + border:1px dashed #d9d9d9; + border-radius:12px; + + background:#fafafa; + padding:40px; +} + +.expense-empty-state .empty-icon{ + width:90px; + height:90px; + + border-radius:50%; + background:#f3f4f6; + + display:flex; + justify-content:center; + align-items:center; + + font-size:42px; + color:#9ca3af; + + margin-bottom:20px; +} + +.expense-empty-state h3{ + font-size:24px; + font-weight:600; + color:#374151; + margin-bottom:12px; +} + +.expense-empty-state p{ + width:500px; + max-width:95%; + color:#6b7280; + line-height:1.7; + margin-bottom:25px; +} + +.hrms-two-charts{ + display:grid; + grid-template-columns:1fr 1fr; + gap:20px; +} + +#hrmsExpenseChart, +#hrmsExpenseStateChart{ + min-height:340px; +} \ No newline at end of file diff --git a/addons_extensions/hrms_emp_dashboard/static/src/js/hrms_emp_dashboard.js b/addons_extensions/hrms_emp_dashboard/static/src/js/hrms_emp_dashboard.js index 1ed42754a..05fa78f80 100644 --- a/addons_extensions/hrms_emp_dashboard/static/src/js/hrms_emp_dashboard.js +++ b/addons_extensions/hrms_emp_dashboard/static/src/js/hrms_emp_dashboard.js @@ -68,11 +68,23 @@ class HrmsEmployeeDashboard extends Component { return; } this.state.data = response; - setTimeout(() => this.initCharts(), 100); + // setTimeout(() => this.initCharts(), 100); + const expenses = response.expenses || {}; + const total = + (expenses.series || []).reduce( + (sum, value) => sum + Number(value || 0), + 0 + ); + this.state.expenseCount = total; + if (this.state.expenseCount > 0) { + setTimeout(() => this.initCharts(), 100); + } else { + this.destroyCharts(); + } } catch (error) { console.error(error); this.state.error = "Unable to load employee dashboard."; - this.notification.add("Unable to load employee dashboard", { type: "danger" }); + this.notification.add("Unable to load employee dashboard", {type: "danger"}); } finally { this.state.loading = false; } @@ -139,6 +151,9 @@ class HrmsEmployeeDashboard extends Component { } renderExpenseChart() { + if (!this.state.expenseCount) { + return; + } const expenses = this.state.data.expenses; debugger; this.chartBase("#hrmsExpenseChart", { @@ -159,6 +174,9 @@ class HrmsEmployeeDashboard extends Component { } renderExpenseStateChart() { + if (!this.state.expenseCount) { + return; + } const expenses = this.state.data.expenses; this.chartBase("#hrmsExpenseStateChart", { chart: { @@ -291,6 +309,34 @@ class HrmsEmployeeDashboard extends Component { }); } + // addExpense() { + // this.action.doAction({ + // type: "ir.actions.act_window", + // name: "Add Expense", + // res_model: "hr.expense", + // views: [[false, "form"]], + // target: "new", + // context: { + // default_expense_date: this.formatDate(new Date()), + // }, + // }); + // } + // + // addBusinessTravel() { + // this.action.doAction({ + // type: "ir.actions.act_window", + // name: "Add Business Travel", + // res_model: "travel.trip", + // views: [[false, "form"]], + // target: "new", + // context: { + // default_employee_id: this.state.data.employee.id, + // default_start_date: this.state.dateFrom, + // default_end_date: this.state.dateTo, + // }, + // }); + // } + // raiseHelpdeskTicket() { // window.open( diff --git a/addons_extensions/hrms_emp_dashboard/static/src/xml/hrms_emp_dashboard.xml b/addons_extensions/hrms_emp_dashboard/static/src/xml/hrms_emp_dashboard.xml index 4f3481021..11bafdaf9 100644 --- a/addons_extensions/hrms_emp_dashboard/static/src/xml/hrms_emp_dashboard.xml +++ b/addons_extensions/hrms_emp_dashboard/static/src/xml/hrms_emp_dashboard.xml @@ -156,18 +156,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Expenses + - Add Expense - Add Business Travel + + + Add Expense + + + + + Add Business Travel + - - - - + + + + + + + + + + + + + + + + + + No Expense Records Found + + + There are no expense records available for the selected + period. Click Add Expense to create your + first expense claim. + + + + + + Add Expense + + + + + + diff --git a/addons_extensions/requisitions/views/hr_requisition.xml b/addons_extensions/requisitions/views/hr_requisition.xml index 3905329e2..f5acb8246 100644 --- a/addons_extensions/requisitions/views/hr_requisition.xml +++ b/addons_extensions/requisitions/views/hr_requisition.xml @@ -82,6 +82,7 @@ Recruitment Requisitions + recruitment-requisitions recruitment.requisition list,form
+ There are no expense records available for the selected + period. Click Add Expense to create your + first expense claim. +