addd dropdown at expense table action

This commit is contained in:
pramod.mahajan 2025-10-04 16:25:28 +05:30
parent f0f579beae
commit 1e49cf17a2
2 changed files with 59 additions and 24 deletions

View File

@ -112,10 +112,10 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
}; };
const expenseColumns = [ const expenseColumns = [
{ {
key: "expenseUId", key: "expenseUId",
label: "Expense Id", label: "Expense Id",
getValue: (e) => e.expenseUId|| "N/A", getValue: (e) => e.expenseUId || "N/A",
align: "text-start mx-2", align: "text-start mx-2",
}, },
{ {
@ -294,26 +294,61 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
}) })
} }
></i> ></i>
{canEditExpense(expense) && ( {canDetetExpense(expense) &&
<i canEditExpense(expense) && (
className="bx bx-edit text-secondary cursor-pointer" <div className="dropdown z-2">
onClick={() => <button
setManageExpenseModal({ type="button"
IsOpen: true, className="btn btn-xs btn-icon btn-text-secondary rounded-pill dropdown-toggle hide-arrow p-0 m-0"
expenseId: expense.id, data-bs-toggle="dropdown"
}) aria-expanded="false"
} >
></i> <i
)} className="bx bx-dots-vertical-rounded text-muted p-0"
{canDetetExpense(expense) && ( data-bs-toggle="tooltip"
<i data-bs-offset="0,8"
className="bx bx-trash text-danger cursor-pointer" data-bs-placement="top"
onClick={() => { data-bs-custom-class="tooltip-dark"
setIsDeleteModalOpen(true); title="More Action"
setDeletingId(expense.id); ></i>
}} </button>
></i> <ul className="dropdown-menu dropdown-menu-end w-auto">
)} {canDetetExpense(expense) && (
<li
onClick={() =>
setManageExpenseModal({
IsOpen: true,
expenseId: expense.id,
})
}
>
<a className="dropdown-item px-2 cursor-pointer py-1">
<i className="bx bx-edit text-primary bx-xs me-2"></i>
<span className="align-left ">
Modify
</span>
</a>
</li>
)}
{canDetetExpense(expense) && (
<li
onClick={() => {
setIsDeleteModalOpen(true);
setDeletingId(expense.id);
}}
>
<a className="dropdown-item px-2 cursor-pointer py-1">
<i className="bx bx-trash text-danger bx-xs me-2"></i>
<span className="align-left">
Delete
</span>
</a>
</li>
)}
</ul>
</div>
)}
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -40,11 +40,11 @@ const Header = () => {
const isProjectPath = pathname === "/projects"; const isProjectPath = pathname === "/projects";
const isDirectory = pathname === "/directory"; const isDirectory = pathname === "/directory";
const isEmployeeList = pathname === "/employees"; const isEmployeeList = pathname === "/employees";
const isExpense = pathname === "/expenses"; // const isExpense = pathname === "/expenses";
const isEmployeeProfile = UUID_REGEX.test(pathname); const isEmployeeProfile = UUID_REGEX.test(pathname);
const hideDropPaths = const hideDropPaths =
isDirectory || isEmployeeList || isExpense || isEmployeeProfile; isDirectory || isEmployeeList || isEmployeeProfile;
const showProjectDropdown = !hideDropPaths; const showProjectDropdown = !hideDropPaths;