Merge branch 'OnFieldWork_V1' of https://git.marcoaiot.com/admin/marco.pms.web into OnFieldWork_V1

This commit is contained in:
pramod.mahajan 2025-10-04 14:13:43 +05:30
commit b53e6284b9
5 changed files with 37 additions and 28 deletions

View File

@ -71,10 +71,10 @@ const { labels, series, total } = useMemo(() => {
return (
<>
<div className="card-header d-flex justify-content-between align-items-center ">
<div className="card-header d-flex justify-content-between mt-2 align-items-center ">
<div>
<h5 className="mb-1 card-title">Expense Breakdown</h5>
<p className="card-subtitle me-3">Detailed project expenses</p>
<h5 className="mb-1 fw-bold text-start">Expense Breakdown</h5>
<p className="card-subtitle">Category Wise Expense Breakdown</p>
</div>
<div className="text-end">

View File

@ -108,6 +108,23 @@ const ExpenseByProject = () => {
</li>
</ul>
</div>
</div>
{/* Range Buttons + Expense Dropdown */}
<div className="d-flex align-items-center flex-wrap">
{["1M", "3M", "6M", "12M", "All"].map((item) => (
<button
key={item}
className={`border-0 px-2 py-1 text-sm rounded ${range === item
? "text-white bg-primary"
: "text-body bg-transparent"
}`}
style={{ cursor: "pointer", transition: "all 0.2s ease" }}
onClick={() => setRange(item)}
>
{item}
</button>
))}
{viewMode === "Category" && (
<select
className="form-select form-select-sm ms-auto mb-3"
@ -126,22 +143,6 @@ const ExpenseByProject = () => {
)}
</div>
{/* Range Buttons + Expense Dropdown */}
<div className="d-flex gap-2 align-items-center flex-wrap">
{["1M", "3M", "6M", "12M", "All"].map((item) => (
<button
key={item}
className={`border-0 px-2 py-1 text-sm rounded ${range === item
? "text-white bg-primary"
: "text-body bg-transparent"
}`}
style={{ cursor: "pointer", transition: "all 0.2s ease" }}
onClick={() => setRange(item)}
>
{item}
</button>
))}
</div>
</div>
{/* Chart */}

View File

@ -46,6 +46,7 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
projectIds: project ? [project] : defaultFilter.projectIds || [],
createdByIds: defaultFilter.createdByIds || [],
paidById: defaultFilter.paidById || [],
ExpenseTypeIds: defaultFilter.ExpenseTypeIds || [],
isTransactionDate: defaultFilter.isTransactionDate ?? true,
startDate: defaultFilter.startDate,
endDate: defaultFilter.endDate,
@ -143,8 +144,7 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
<div className="d-inline-flex border rounded-pill mb-1 overflow-hidden shadow-none">
<button
type="button"
className={`btn px-2 py-1 rounded-0 text-tiny ${
isTransactionDate ? "active btn-primary text-white" : ""
className={`btn px-2 py-1 rounded-0 text-tiny ${isTransactionDate ? "active btn-primary text-white" : ""
}`}
onClick={() => setValue("isTransactionDate", true)}
>
@ -152,8 +152,7 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
</button>
<button
type="button"
className={`btn px-2 py-1 rounded-0 text-tiny ${
!isTransactionDate ? "active btn-primary text-white" : ""
className={`btn px-2 py-1 rounded-0 text-tiny ${!isTransactionDate ? "active btn-primary text-white" : ""
}`}
onClick={() => setValue("isTransactionDate", false)}
>
@ -194,6 +193,13 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
labelKey={(item) => item.name}
valueKey="id"
/>
<SelectMultiple
name="ExpenseTypeIds"
label="Category :"
options={data.expensesType}
labelKey={(item) => item.name}
valueKey="id"
/>
<div className="mb-3">
<label className="form-label">Status :</label>

View File

@ -159,6 +159,7 @@ export const SearchSchema = z.object({
statusIds: z.array(z.string()).optional(),
createdByIds: z.array(z.string()).optional(),
paidById: z.array(z.string()).optional(),
ExpenseTypeIds: z.array(z.string()).optional(),
startDate: z.string().optional(),
endDate: z.string().optional(),
isTransactionDate: z.boolean().default(true),
@ -169,6 +170,7 @@ export const defaultFilter = {
statusIds: [],
createdByIds: [],
paidById: [],
ExpenseTypeIds: [],
isTransactionDate: true,
startDate: null,
endDate: null,

View File

@ -10,7 +10,7 @@ import moment from "moment";
const cleanFilter = (filter) => {
const cleaned = { ...filter };
["projectIds", "statusIds", "createdByIds", "paidById"].forEach((key) => {
["projectIds", "statusIds", "createdByIds", "paidById","ExpenseTypeIds"].forEach((key) => {
if (Array.isArray(cleaned[key]) && cleaned[key].length === 0) {
delete cleaned[key];
}