- Progress Commit

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-04-01 14:45:55 -04:00
parent 54dc9c8587
commit ae07f71e76
17 changed files with 223 additions and 78 deletions

View File

@@ -90,7 +90,9 @@ function TaskListComponent({
setTaskUpsertContext,
toggleDeletedStatus,
relationshipType,
relationshipId
relationshipId,
onlyMine ,
parentJobId
}) {
const {t} = useTranslation();
@@ -102,12 +104,25 @@ function TaskListComponent({
sortcolumn,
sortorder,
deleted,
completed
completed,
mine
} = search;
const history = useNavigate();
const columns = [
const columns = [];
if (!onlyMine) {
columns.push(
{
title: t("tasks.fields.assigned_to"),
dataIndex: "assigned_to",
key: "assigned_to",
width: '10%',
}
);
}
columns.push(
{
title: t("tasks.fields.job.ro_number"),
dataIndex: ["job", "ro_number"],
@@ -178,8 +193,8 @@ function TaskListComponent({
</Button>
</Space>
),
},
];
}
);
const [state, setState] = useState({
sortedInfo: {},
@@ -190,6 +205,7 @@ function TaskListComponent({
setTaskUpsertContext({
actions: {},
context: {
jobid: parentJobId,
[relationshipType]: relationshipId,
},
});
@@ -219,6 +235,15 @@ function TaskListComponent({
const tasksExtra = useCallback(() => {
return (
<Space direction='horizontal'>
{!onlyMine && (
<Switch
checkedChildren={t('tasks.buttons.myTasks')}
unCheckedChildren={t('tasks.buttons.allTasks')}
title={t('tasks.titles.mine')}
checked={mine === "true"}
onChange={(value) => handleSwitchChange('mine', value)}
/>
)}
<Switch
checkedChildren={<CheckCircleFilled/>}
unCheckedChildren={<CheckCircleOutlined/>}
@@ -242,7 +267,7 @@ function TaskListComponent({
</Button>
</Space>
);
}, [refetch, deleted, completed]);
}, [refetch, deleted, completed, mine]);
return (
<Card

View File

@@ -12,10 +12,10 @@ import TaskListComponent from "./task-list.component.jsx";
import {notification} from "antd";
import {useTranslation} from "react-i18next";
export default function TaskListContainer({bodyshop, titleTranslation ,query, relationshipType, relationshipId}) {
export default function TaskListContainer({bodyshop, titleTranslation ,query, relationshipType, relationshipId, currentUser, onlyMine, parentJobId}) {
const {t} = useTranslation();
const searchParams = queryString.parse(useLocation().search);
const {page, sortcolumn, sortorder, deleted, completed} = searchParams;
const {page, sortcolumn, sortorder, deleted, completed, mine} = searchParams;
const {loading, error, data, refetch} = useQuery(
query,
{
@@ -26,6 +26,7 @@ export default function TaskListContainer({bodyshop, titleTranslation ,query, r
[relationshipType]: relationshipId,
deleted: deleted === 'true',
completed: completed === "true",
assigned_to: mine === "true" ? currentUser.email: undefined, // replace currentUserID with the actual ID of the current user
offset: page ? (page - 1) * pageLimit : 0,
limit: pageLimit,
order: [
@@ -147,6 +148,8 @@ export default function TaskListContainer({bodyshop, titleTranslation ,query, r
toggleDeletedStatus={toggleDeletedStatus}
relationshipType={relationshipType}
relationshipId={relationshipId}
onlyMine={onlyMine}
parentJobId={parentJobId}
/>
);
}