#fix:HRMSdashboard

This commit is contained in:
seshikanth 2026-06-30 16:17:45 +05:30
parent 3de90ee7ce
commit 625bd67064
4 changed files with 211 additions and 8 deletions

View File

@ -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;
}

View File

@ -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(

View File

@ -156,18 +156,115 @@
</div>
</section>
<!-- <section class="hrms-panel wide">-->
<!-- <div class="hrms-panel-header">-->
<!-- <h2>Expenses</h2>-->
<!-- <div class="hrms-panel-actions">-->
<!-- <button class="btn btn-primary btn-sm" t-on-click="addExpense"><i class="fa fa-plus me-1"/>Add Expense</button>-->
<!-- <button class="btn btn-light btn-sm" t-on-click="addBusinessTravel"><i class="fa fa-suitcase me-1"/>Add Business Travel</button>-->
<!-- </div>-->
<!-- </div>-->
<!-- -->
<!-- <div class="hrms-two-charts">-->
<!-- <div id="hrmsExpenseChart"/>-->
<!-- <div id="hrmsExpenseStateChart"/>-->
<!-- </div>-->
<!-- </section>-->
<!-- <section class="hrms-panel wide">-->
<!-- <div class="hrms-panel-header">-->
<!-- <h2>Expenses</h2>-->
<!-- <div class="hrms-panel-actions">-->
<!-- <button class="btn btn-primary btn-sm"-->
<!-- t-on-click="addExpense">-->
<!-- <i class="fa fa-plus me-1"/>-->
<!-- Add Expenses-->
<!-- </button>-->
<!-- <button class="btn btn-light btn-sm"-->
<!-- t-on-click="addBusinessTravel">-->
<!-- <i class="fa fa-suitcase me-1"/>-->
<!-- Add Business Travel-->
<!-- </button>-->
<!-- </div>-->
<!-- </div>-->
<!-- &lt;!&ndash; Charts &ndash;&gt;-->
<!-- <t t-if="state.expenseCount > 0">-->
<!-- <div class="hrms-two-charts">-->
<!-- <div id="hrmsExpenseChart"></div>-->
<!-- <div id="hrmsExpenseStateChart"></div>-->
<!-- </div>-->
<!-- </t>-->
<!-- &lt;!&ndash; Empty State &ndash;&gt;-->
<!-- <t t-else="">-->
<!-- <div class="expense-empty-state">-->
<!-- <i class="fa fa-receipt empty-icon"></i>-->
<!-- <h3>No Expense Records Found</h3>-->
<!-- <p>-->
<!-- No expenses were found for the selected period.-->
<!-- Click the button below to create your first expense.-->
<!-- </p>-->
<!-- <button class="btn btn-primary"-->
<!-- t-on-click="addExpense">-->
<!-- <i class="fa fa-plus me-1"></i>-->
<!-- Add Expense-->
<!-- </button>-->
<!-- </div>-->
<!-- </t>-->
<!-- </section>-->
<section class="hrms-panel wide">
<div class="hrms-panel-header">
<h2>Expenses</h2>
<div class="hrms-panel-actions">
<button class="btn btn-primary btn-sm" t-on-click="addExpense"><i class="fa fa-plus me-1"/>Add Expense</button>
<button class="btn btn-light btn-sm" t-on-click="addBusinessTravel"><i class="fa fa-suitcase me-1"/>Add Business Travel</button>
<button class="btn btn-primary btn-sm"
t-on-click="addExpense">
<i class="fa fa-plus me-1"/>
Add Expense
</button>
<button class="btn btn-light btn-sm"
t-on-click="addBusinessTravel">
<i class="fa fa-suitcase me-1"/>
Add Business Travel
</button>
</div>
</div>
<div class="hrms-two-charts">
<div id="hrmsExpenseChart"/>
<div id="hrmsExpenseStateChart"/>
</div>
<!-- Expense Charts -->
<t t-if="state.expenseCount > 0">
<div class="hrms-two-charts">
<div id="hrmsExpenseChart"></div>
<div id="hrmsExpenseStateChart"></div>
</div>
</t>
<!-- Empty State -->
<t t-else="">
<div class="expense-empty-state">
<div class="empty-icon">
<i class="fa fa-file-invoice-dollar"/>
</div>
<h3>No Expense Records Found</h3>
<p>
There are no expense records available for the selected
period. Click <strong>Add Expense</strong> to create your
first expense claim.
</p>
<div class="mt-3">
<button class="btn btn-primary"
t-on-click="addExpense">
<i class="fa fa-plus me-1"/>
Add Expense
</button>
</div>
</div>
</t>
</section>
<section class="hrms-panel wide">

View File

@ -82,6 +82,7 @@
</record>
<record id="action_recruitment_requisition" model="ir.actions.act_window">
<field name="name">Recruitment Requisitions</field>
<field name="path">recruitment-requisitions</field>
<field name="res_model">recruitment.requisition</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">