Changes in OnField Work.
This commit is contained in:
parent
73534226e3
commit
b318d469f6
@ -51,7 +51,7 @@ const ExpenseFilterPanel = forwardRef(({ onApply, handleGroupBy, setFilterdata }
|
||||
startDate: defaultFilter.startDate,
|
||||
endDate: defaultFilter.endDate,
|
||||
};
|
||||
}, [status,selectedProjectId]);
|
||||
}, [status, selectedProjectId]);
|
||||
|
||||
const methods = useForm({
|
||||
resolver: zodResolver(SearchSchema),
|
||||
@ -119,12 +119,12 @@ const ExpenseFilterPanel = forwardRef(({ onApply, handleGroupBy, setFilterdata }
|
||||
const [appliedStatusId, setAppliedStatusId] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!status) return;
|
||||
if (!status || !data) return;
|
||||
|
||||
if (status !== appliedStatusId && data) {
|
||||
if (status !== appliedStatusId) {
|
||||
const filterWithStatus = {
|
||||
...dynamicDefaultFilter,
|
||||
projectIds: selectedProjectId ? [selectedProjectId] : [], // ✅ include project ID
|
||||
projectIds: selectedProjectId ? [selectedProjectId] : dynamicDefaultFilter.projectIds || [],
|
||||
startDate: dynamicDefaultFilter.startDate
|
||||
? moment.utc(dynamicDefaultFilter.startDate, "DD-MM-YYYY").toISOString()
|
||||
: undefined,
|
||||
@ -135,7 +135,6 @@ const ExpenseFilterPanel = forwardRef(({ onApply, handleGroupBy, setFilterdata }
|
||||
|
||||
onApply(filterWithStatus);
|
||||
handleGroupBy(selectedGroup.id);
|
||||
|
||||
setAppliedStatusId(status);
|
||||
}
|
||||
}, [
|
||||
@ -146,10 +145,9 @@ const ExpenseFilterPanel = forwardRef(({ onApply, handleGroupBy, setFilterdata }
|
||||
handleGroupBy,
|
||||
selectedGroup.id,
|
||||
appliedStatusId,
|
||||
selectedProjectId, // ✅ added dependency
|
||||
selectedProjectId, // ✅ Added dependency
|
||||
]);
|
||||
|
||||
|
||||
if (isLoading || isFetching) return <ExpenseFilterSkeleton />;
|
||||
if (isError && isFetched)
|
||||
return <div>Something went wrong Here- {error.message} </div>;
|
||||
|
@ -36,16 +36,17 @@ const Header = () => {
|
||||
const pathname = location.pathname;
|
||||
|
||||
// ======= MEMO CHECKS =======
|
||||
|
||||
const isDashboardPath = pathname === "/" || pathname === "/dashboard";
|
||||
const isProjectPath = pathname === "/projects";
|
||||
const isDirectory = pathname === "/directory";
|
||||
const isEmployeeList = pathname === "/employees";
|
||||
const isMasters = pathname === "/masters";
|
||||
// const isExpense = pathname === "/expenses";
|
||||
const isEmployeeProfile = UUID_REGEX.test(pathname);
|
||||
const isMasters = pathname === "/masters";
|
||||
const isExpensePath = pathname.startsWith("/expenses");
|
||||
|
||||
const hideDropPaths =
|
||||
isDirectory || isEmployeeList || isMasters || isEmployeeProfile;
|
||||
isDirectory || isEmployeeList || isMasters || isEmployeeProfile || isExpensePath;
|
||||
|
||||
const showProjectDropdown = !hideDropPaths;
|
||||
|
||||
|
@ -95,6 +95,7 @@ const router = createBrowserRouter(
|
||||
{ path: "/activities/reports", element: <Reports /> },
|
||||
{ path: "/gallary", element: <ComingSoonPage /> },
|
||||
{ path: "/expenses/:status?/:project?", element: <ExpensePage /> },
|
||||
{ path: "/expenses", element: <ExpensePage /> },
|
||||
{ path: "/masters", element: <MasterPage /> },
|
||||
{ path: "/tenants", element: <TenantPage /> },
|
||||
{ path: "/tenants/new-tenant", element: <CreateTenant /> },
|
||||
|
Loading…
x
Reference in New Issue
Block a user