Fix: Improve field editing and optimize job loading
- Prevent layout shift during field editing by using absolute positioning. - Implement filtering of jobs based on the user's collapsed group preferences. - Modify the `useJobs` hook to fetch jobs with filters based on the open/closed state of job categories. - Update the `dataService` to use the filter parameter when fetching jobs.
This commit is contained in:
@@ -20,7 +20,8 @@ const Index = () => {
|
||||
updateJob,
|
||||
deleteJob,
|
||||
createMultipleTransactions,
|
||||
createMultipleBillItems
|
||||
createMultipleBillItems,
|
||||
loadJobsForStatuses
|
||||
} = useJobs();
|
||||
|
||||
const [showJobForm, setShowJobForm] = useState(false);
|
||||
@@ -188,6 +189,12 @@ const Index = () => {
|
||||
const newState = { ...collapsedGroups, [status]: !collapsedGroups[status] };
|
||||
setCollapsedGroups(newState);
|
||||
localStorage.setItem('jobGroupsCollapsed', JSON.stringify(newState));
|
||||
|
||||
// Load jobs for newly opened groups
|
||||
if (collapsedGroups[status]) {
|
||||
// Group is becoming visible, load jobs for this status
|
||||
loadJobsForStatuses([status]);
|
||||
}
|
||||
};
|
||||
|
||||
const handleBatchTransactionsAssigned = async (assignments: { jobId: string, transactions: IndTransactionRecordNoId[] }[]) => {
|
||||
|
||||
Reference in New Issue
Block a user