UI changes in Expense Weidget and Attendance weidget.

This commit is contained in:
Kartik Sharma 2025-10-31 16:42:07 +05:30
parent 72eb64177f
commit 7b1ed97452
2 changed files with 13 additions and 16 deletions

View File

@ -118,8 +118,7 @@ const AttendanceOverview = () => {
<option value={30}>Last 30 Days</option> <option value={30}>Last 30 Days</option>
</select> </select>
<button <button
className={`btn btn-sm p-1 ${ className={`btn btn-sm p-1 ${view === "chart" ? "btn-primary" : "btn-outline-primary"
view === "chart" ? "btn-primary" : "btn-outline-primary"
}`} }`}
onClick={() => setView("chart")} onClick={() => setView("chart")}
title="Chart View" title="Chart View"
@ -127,8 +126,7 @@ const AttendanceOverview = () => {
<i className="bx bx-bar-chart-alt-2"></i> <i className="bx bx-bar-chart-alt-2"></i>
</button> </button>
<button <button
className={`btn btn-sm p-1 ${ className={`btn btn-sm p-1 ${view === "table" ? "btn-primary" : "btn-outline-primary"
view === "table" ? "btn-primary" : "btn-outline-primary"
}`} }`}
onClick={() => setView("table")} onClick={() => setView("table")}
title="Table View" title="Table View"
@ -144,6 +142,9 @@ const AttendanceOverview = () => {
<SpinnerLoader /> <SpinnerLoader />
) : error ? ( ) : error ? (
<p className="text-danger">{error}</p> <p className="text-danger">{error}</p>
) : attendanceOverviewData.length === 0 ||
attendanceOverviewData.every((item) => item.present === 0) ? (
<div className="text-center text-dark">No data found</div>
) : view === "chart" ? ( ) : view === "chart" ? (
<div className="w-100"> <div className="w-100">
<ReactApexChart <ReactApexChart
@ -164,9 +165,7 @@ const AttendanceOverview = () => {
style={{ position: "sticky", top: 0, zIndex: 1 }} style={{ position: "sticky", top: 0, zIndex: 1 }}
> >
<tr> <tr>
<th style={{ background: "#f8f9fa", textTransform: "none" }}> <th style={{ background: "#f8f9fa", textTransform: "none" }}>Role</th>
Role
</th>
{dates.map((date, idx) => ( {dates.map((date, idx) => (
<th <th
key={idx} key={idx}
@ -177,15 +176,13 @@ const AttendanceOverview = () => {
))} ))}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{roles.map((role) => ( {roles.map((role) => (
<tr key={role}> <tr key={role}>
<td>{role}</td> <td>{role}</td>
{tableData.map((row, idx) => { {tableData.map((row, idx) => {
const value = row[role]; const value = row[role];
const cellStyle = const cellStyle = value > 0 ? { backgroundColor: "#d5d5d5" } : {};
value > 0 ? { backgroundColor: "#d5d5d5" } : {};
return ( return (
<td key={idx} style={cellStyle}> <td key={idx} style={cellStyle}>
{value} {value}

View File

@ -86,12 +86,12 @@ const ExpenseByProject = () => {
<div className="card shadow-sm h-100 rounded "> <div className="card shadow-sm h-100 rounded ">
{/* Header */} {/* Header */}
<div className="card-header"> <div className="card-header">
<div className="d-flex justify-content-start align-items-center mb-3 mt-3"> <div className="d-flex justify-content-start align-items-center mb-1 mt-1">
<div className="text-start"> <div className="text-start">
<h5 className="mb-1 me-6 card-title">Monthly Expense -</h5> <h5 className="mb-1 me-6 card-title">Monthly Expense -</h5>
<p className="card-subtitle m-0">{projectName}</p> <p className="card-subtitle m-0">{projectName}</p>
</div> </div>
<div className="btn-group mb-4 ms-n8"> <div className="btn-group mb-5 ms-n8">
<button <button
className="btn btn-sm dropdown-toggle fs-5" className="btn btn-sm dropdown-toggle fs-5"
type="button" type="button"
@ -168,7 +168,7 @@ const ExpenseByProject = () => {
<SpinnerLoader /> <SpinnerLoader />
</div> </div>
) : !expenseApiData || expenseApiData.length === 0 ? ( ) : !expenseApiData || expenseApiData.length === 0 ? (
<div className="text-center text-muted py-5">No data found</div> <div className="text-center text-muted py-12">No data found</div>
) : ( ) : (
<Chart options={options} series={series} type="bar" height={235} /> <Chart options={options} series={series} type="bar" height={235} />
)} )}