@@ -84,10 +84,13 @@ function TaskListComponent({
|
||||
loading,
|
||||
tasks,
|
||||
total,
|
||||
titleTranslation,
|
||||
refetch,
|
||||
toggleCompletedStatus,
|
||||
setTaskUpsertContext,
|
||||
toggleDeletedStatus
|
||||
toggleDeletedStatus,
|
||||
relationshipType,
|
||||
relationshipId
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
|
||||
@@ -186,7 +189,9 @@ function TaskListComponent({
|
||||
const handleCreateTask = () => {
|
||||
setTaskUpsertContext({
|
||||
actions: {},
|
||||
context: {},
|
||||
context: {
|
||||
[relationshipType]: relationshipId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -241,7 +246,7 @@ function TaskListComponent({
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={t("menus.header.my_tasks")}
|
||||
title={titleTranslation}
|
||||
extra={tasksExtra()}
|
||||
>
|
||||
<Table
|
||||
|
||||
@@ -4,7 +4,6 @@ import {useMutation, useQuery} from "@apollo/client";
|
||||
import {
|
||||
MUTATION_TOGGLE_TASK_COMPLETED,
|
||||
MUTATION_TOGGLE_TASK_DELETED,
|
||||
QUERY_MY_TASKS_PAGINATED
|
||||
} from "../../graphql/tasks.queries.js";
|
||||
import {pageLimit} from "../../utils/config.js";
|
||||
import AlertComponent from "../alert/alert.component.jsx";
|
||||
@@ -13,18 +12,18 @@ import TaskListComponent from "./task-list.component.jsx";
|
||||
import {notification} from "antd";
|
||||
import {useTranslation} from "react-i18next";
|
||||
|
||||
export default function TaskListContainer({bodyshop, currentUser}) {
|
||||
export default function TaskListContainer({bodyshop, titleTranslation ,query, relationshipType, relationshipId}) {
|
||||
const {t} = useTranslation();
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const {page, sortcolumn, sortorder, deleted, completed} = searchParams;
|
||||
const {loading, error, data, refetch} = useQuery(
|
||||
QUERY_MY_TASKS_PAGINATED,
|
||||
query,
|
||||
{
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
variables: {
|
||||
bodyshop: bodyshop.id,
|
||||
user: currentUser.email,
|
||||
[relationshipType]: relationshipId,
|
||||
deleted: deleted === 'true',
|
||||
completed: completed === "true",
|
||||
offset: page ? (page - 1) * pageLimit : 0,
|
||||
@@ -129,9 +128,12 @@ export default function TaskListContainer({bodyshop, currentUser}) {
|
||||
loading={loading}
|
||||
tasks={data ? data.tasks : null}
|
||||
total={data ? data.tasks_aggregate.aggregate.count : 0}
|
||||
titleTranslation={t(titleTranslation || "tasks.title")}
|
||||
refetch={refetch}
|
||||
toggleCompletedStatus={toggleCompletedStatus}
|
||||
toggleDeletedStatus={toggleDeletedStatus}
|
||||
relationshipType={relationshipType}
|
||||
relationshipId={relationshipId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user