@@ -464,7 +464,12 @@ function Header({
|
|||||||
{
|
{
|
||||||
key: 'mytasks',
|
key: 'mytasks',
|
||||||
icon: <FaTasks/>,
|
icon: <FaTasks/>,
|
||||||
label: <Link to="/manage/tasks">{t('menus.header.my_tasks')}</Link>,
|
label: <Link to="/manage/tasks/mytasks">{t('menus.header.my_tasks')}</Link>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'all_tasks',
|
||||||
|
icon: <FaTasks/>,
|
||||||
|
label: <Link to="/manage/tasks/alltasks">{t('menus.header.all_tasks')}</Link>,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,46 +1,5 @@
|
|||||||
import {gql} from "@apollo/client";
|
import {gql} from "@apollo/client";
|
||||||
|
|
||||||
/**
|
|
||||||
* All tasks paginated query
|
|
||||||
* @type {DocumentNode}
|
|
||||||
*/
|
|
||||||
export const QUERY_ALL_TASKS_PAGINATED = gql`
|
|
||||||
query QUERY_ALL_TASKS_PAGINATED(
|
|
||||||
$offset: Int
|
|
||||||
$limit: Int
|
|
||||||
$order: [tasks_order_by!]!
|
|
||||||
) {
|
|
||||||
tasks(
|
|
||||||
offset: $offset
|
|
||||||
limit: $limit
|
|
||||||
order_by: $order
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
created_at
|
|
||||||
updated_at
|
|
||||||
title
|
|
||||||
description
|
|
||||||
deleted
|
|
||||||
deleted_at
|
|
||||||
due_date
|
|
||||||
created_by
|
|
||||||
assigned_to
|
|
||||||
completed
|
|
||||||
completed_at
|
|
||||||
remind_at
|
|
||||||
priority
|
|
||||||
jobid
|
|
||||||
joblineid
|
|
||||||
partsorderid
|
|
||||||
billid
|
|
||||||
}
|
|
||||||
tasks_aggregate {
|
|
||||||
aggregate {
|
|
||||||
count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const PARTIAL_TASK_FIELDS = gql`
|
const PARTIAL_TASK_FIELDS = gql`
|
||||||
fragment TaskFields on tasks {
|
fragment TaskFields on tasks {
|
||||||
@@ -87,6 +46,45 @@ const PARTIAL_TASK_FIELDS = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const QUERY_ALL_TASKS_PAGINATED = gql`
|
||||||
|
${PARTIAL_TASK_FIELDS}
|
||||||
|
query QUERY_ALL_TASKS_PAGINATED(
|
||||||
|
$offset: Int
|
||||||
|
$limit: Int
|
||||||
|
$bodyshop: uuid!
|
||||||
|
$deleted: Boolean
|
||||||
|
$completed: Boolean
|
||||||
|
$assigned_to: String
|
||||||
|
$order: [tasks_order_by!]!
|
||||||
|
) {
|
||||||
|
tasks(
|
||||||
|
offset: $offset
|
||||||
|
limit: $limit
|
||||||
|
order_by: $order
|
||||||
|
where: {
|
||||||
|
bodyshopid: {_eq: $bodyshop},
|
||||||
|
deleted: {_eq: $deleted},
|
||||||
|
assigned_to: {_eq: $assigned_to},
|
||||||
|
completed: {_eq: $completed}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
...TaskFields
|
||||||
|
}
|
||||||
|
tasks_aggregate(
|
||||||
|
where: {
|
||||||
|
bodyshopid: {_eq: $bodyshop},
|
||||||
|
deleted: {_eq: $deleted},
|
||||||
|
assigned_to: {_eq: $assigned_to},
|
||||||
|
completed: {_eq: $completed}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
aggregate {
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
// Query for joblineid
|
// Query for joblineid
|
||||||
export const QUERY_JOBLINE_TASKS_PAGINATED = gql`
|
export const QUERY_JOBLINE_TASKS_PAGINATED = gql`
|
||||||
${PARTIAL_TASK_FIELDS}
|
${PARTIAL_TASK_FIELDS}
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ const Dms = lazy(() => import("../dms/dms.container"));
|
|||||||
const DmsPayables = lazy(() => import("../dms-payables/dms-payables.container"));
|
const DmsPayables = lazy(() => import("../dms-payables/dms-payables.container"));
|
||||||
const ManageRootPage = lazy(() => import("../manage-root/manage-root.page.container"));
|
const ManageRootPage = lazy(() => import("../manage-root/manage-root.page.container"));
|
||||||
const TtApprovals = lazy(() => import("../tt-approvals/tt-approvals.page.container"));
|
const TtApprovals = lazy(() => import("../tt-approvals/tt-approvals.page.container"));
|
||||||
const TasksPage = lazy(() => import("../tasks/tasks.page.container"));
|
const MyTasksPage = lazy(() => import("../tasks/myTasksPageContainer.jsx"));
|
||||||
|
const AllTasksPage = lazy(() => import("../tasks/allTasksPageContainer.jsx"));
|
||||||
|
|
||||||
const TaskUpsertModalContainer = lazy(() => import("../../components/task-upsert-modal/task-upsert-modal.container"));
|
const TaskUpsertModalContainer = lazy(() => import("../../components/task-upsert-modal/task-upsert-modal.container"));
|
||||||
const { Content, Footer } = Layout;
|
const { Content, Footer } = Layout;
|
||||||
|
|
||||||
@@ -259,12 +261,19 @@ export function Manage({ conflict, bodyshop, enableJoyRide, joyRideSteps, setJoy
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path='/tasks'
|
path='/tasks/mytasks'
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin/>}>
|
<Suspense fallback={<Spin/>}>
|
||||||
<TasksPage/>
|
<MyTasksPage/>
|
||||||
</Suspense>}
|
</Suspense>}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path='/tasks/alltasks'
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin/>}>
|
||||||
|
<AllTasksPage/>
|
||||||
|
</Suspense>}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/inventory/"
|
path="/inventory/"
|
||||||
element={
|
element={
|
||||||
|
|||||||
48
client/src/pages/tasks/allTasksPageContainer.jsx
Normal file
48
client/src/pages/tasks/allTasksPageContainer.jsx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import React, {useEffect} from "react";
|
||||||
|
import {useTranslation} from "react-i18next";
|
||||||
|
import TasksPageComponent from "./tasks.page.component";
|
||||||
|
|
||||||
|
import {connect} from "react-redux";
|
||||||
|
import {createStructuredSelector} from "reselect";
|
||||||
|
import {setBreadcrumbs, setSelectedHeader} from "../../redux/application/application.actions";
|
||||||
|
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
||||||
|
import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors.js";
|
||||||
|
import TaskPageTypes from "./taskPageTypes.jsx";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
currentUser: selectCurrentUser,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||||
|
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function MyTasksPageContainer({bodyshop, currentUser, setBreadcrumbs, setSelectedHeader, query}) {
|
||||||
|
const {t} = useTranslation();
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = t("titles.all_tasks", {
|
||||||
|
app: InstanceRenderManager({
|
||||||
|
imex: '$t(titles.imexonline)',
|
||||||
|
rome: '$t(titles.romeonline)',
|
||||||
|
promanager: '$t(titles.promanager)'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
setSelectedHeader("all_tasks");
|
||||||
|
setBreadcrumbs([
|
||||||
|
{
|
||||||
|
link: "/manage/alltasks",
|
||||||
|
label: t("titles.bc.all_tasks"),
|
||||||
|
},]);
|
||||||
|
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TasksPageComponent type={TaskPageTypes.ALL_TASKS} currentUser={currentUser} bodyshop={bodyshop}/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(MyTasksPageContainer);
|
||||||
@@ -7,6 +7,7 @@ import {createStructuredSelector} from "reselect";
|
|||||||
import {setBreadcrumbs, setSelectedHeader} from "../../redux/application/application.actions";
|
import {setBreadcrumbs, setSelectedHeader} from "../../redux/application/application.actions";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
||||||
import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors.js";
|
import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors.js";
|
||||||
|
import TaskPageTypes from "./taskPageTypes.jsx";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -18,30 +19,30 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function TasksPageContainer({bodyshop, currentUser, setBreadcrumbs, setSelectedHeader}) {
|
export function MyTasksPageContainer({bodyshop, currentUser, setBreadcrumbs, setSelectedHeader, query}) {
|
||||||
const {t} = useTranslation();
|
const {t} = useTranslation();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = t("titles.tasks", {
|
document.title = t("titles.my_tasks", {
|
||||||
app: InstanceRenderManager({
|
app: InstanceRenderManager({
|
||||||
imex: '$t(titles.imexonline)',
|
imex: '$t(titles.imexonline)',
|
||||||
rome: '$t(titles.romeonline)',
|
rome: '$t(titles.romeonline)',
|
||||||
promanager: '$t(titles.promanager)'
|
promanager: '$t(titles.promanager)'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
setSelectedHeader("tasks");
|
setSelectedHeader("my_tasks");
|
||||||
setBreadcrumbs([
|
setBreadcrumbs([
|
||||||
{
|
{
|
||||||
link: "/manage/tasks",
|
link: "/manage/mytasks",
|
||||||
label: t("titles.bc.tasks"),
|
label: t("titles.bc.my_tasks"),
|
||||||
},]);
|
},]);
|
||||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TasksPageComponent currentUser={currentUser} bodyshop={bodyshop}/>
|
<TasksPageComponent type={TaskPageTypes.MY_TASKS} currentUser={currentUser} bodyshop={bodyshop}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(TasksPageContainer);
|
)(MyTasksPageContainer);
|
||||||
6
client/src/pages/tasks/taskPageTypes.jsx
Normal file
6
client/src/pages/tasks/taskPageTypes.jsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const TaskPageTypes = {
|
||||||
|
MY_TASKS: 'myTasks',
|
||||||
|
ALL_TASKS: 'allTasks',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TaskPageTypes;
|
||||||
@@ -1,13 +1,19 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import TaskListContainer from "../../components/task-list/task-list.container.jsx";
|
import TaskListContainer from "../../components/task-list/task-list.container.jsx";
|
||||||
import {QUERY_MY_TASKS_PAGINATED} from "../../graphql/tasks.queries.js";
|
import {QUERY_ALL_TASKS_PAGINATED, QUERY_MY_TASKS_PAGINATED} from "../../graphql/tasks.queries.js";
|
||||||
|
import taskPageTypes from "./taskPageTypes.jsx";
|
||||||
|
|
||||||
export default function TasksPageComponent({bodyshop, currentUser}) {
|
export default function TasksPageComponent({bodyshop, currentUser, type}) {
|
||||||
|
switch (type) {
|
||||||
|
case taskPageTypes.MY_TASKS:
|
||||||
|
return <TaskListContainer onlyMine={true} relationshipId={currentUser.email}
|
||||||
|
relationshipType={'user'} query={QUERY_MY_TASKS_PAGINATED}
|
||||||
|
bodyshop={bodyshop} titleTranslation={'tasks.titles.my_tasks'}
|
||||||
|
currentUser={currentUser}/>
|
||||||
|
case taskPageTypes.ALL_TASKS:
|
||||||
|
return <TaskListContainer query={QUERY_ALL_TASKS_PAGINATED} bodyshop={bodyshop}
|
||||||
|
titleTranslation={'tasks.titles.my_tasks'}
|
||||||
|
currentUser={currentUser}/>
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<TaskListContainer onlyMine={true} relationshipId={currentUser.email} relationshipType={'user'} query={QUERY_MY_TASKS_PAGINATED} bodyshop={bodyshop} titleTranslation={'tasks.titles.my_tasks'}
|
|
||||||
currentUser={currentUser}/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2177,6 +2177,7 @@
|
|||||||
"create_task": "Create Task",
|
"create_task": "Create Task",
|
||||||
"tasks": "Tasks",
|
"tasks": "Tasks",
|
||||||
"my_tasks": "My Tasks",
|
"my_tasks": "My Tasks",
|
||||||
|
"all_tasks": "All Tasks",
|
||||||
"accounting": "Accounting",
|
"accounting": "Accounting",
|
||||||
"accounting-payables": "Payables",
|
"accounting-payables": "Payables",
|
||||||
"accounting-payments": "Payments",
|
"accounting-payments": "Payments",
|
||||||
@@ -3134,12 +3135,16 @@
|
|||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
"tasks": "Tasks",
|
"tasks": "Tasks",
|
||||||
|
"all_tasks": "All Tasks",
|
||||||
|
"my_tasks": "My Tasks",
|
||||||
"accounting-payables": "Payables | {{app}}",
|
"accounting-payables": "Payables | {{app}}",
|
||||||
"accounting-payments": "Payments | {{app}}",
|
"accounting-payments": "Payments | {{app}}",
|
||||||
"accounting-receivables": "Receivables | {{app}}",
|
"accounting-receivables": "Receivables | {{app}}",
|
||||||
"app": "",
|
"app": "",
|
||||||
"bc": {
|
"bc": {
|
||||||
"tasks": "Tasks",
|
"tasks": "Tasks",
|
||||||
|
"all_tasks": "All Tasks",
|
||||||
|
"my_tasks": "My Tasks",
|
||||||
"accounting-payables": "Payables",
|
"accounting-payables": "Payables",
|
||||||
"accounting-payments": "Payments",
|
"accounting-payments": "Payments",
|
||||||
"accounting-receivables": "Receivables",
|
"accounting-receivables": "Receivables",
|
||||||
|
|||||||
@@ -2175,6 +2175,7 @@
|
|||||||
"header": {
|
"header": {
|
||||||
"create_task": "",
|
"create_task": "",
|
||||||
"tasks": "",
|
"tasks": "",
|
||||||
|
"all_tasks": "",
|
||||||
"my_tasks": "",
|
"my_tasks": "",
|
||||||
"accounting": "",
|
"accounting": "",
|
||||||
"accounting-payables": "",
|
"accounting-payables": "",
|
||||||
@@ -3133,12 +3134,16 @@
|
|||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
"tasks": "",
|
"tasks": "",
|
||||||
|
"all_tasks": "",
|
||||||
|
"my_tasks": "",
|
||||||
"accounting-payables": "",
|
"accounting-payables": "",
|
||||||
"accounting-payments": "",
|
"accounting-payments": "",
|
||||||
"accounting-receivables": "",
|
"accounting-receivables": "",
|
||||||
"app": "",
|
"app": "",
|
||||||
"bc": {
|
"bc": {
|
||||||
"tasks": "",
|
"tasks": "",
|
||||||
|
"all_tasks": "",
|
||||||
|
"my_tasks": "",
|
||||||
"accounting-payables": "",
|
"accounting-payables": "",
|
||||||
"accounting-payments": "",
|
"accounting-payments": "",
|
||||||
"accounting-receivables": "",
|
"accounting-receivables": "",
|
||||||
|
|||||||
@@ -2176,6 +2176,7 @@
|
|||||||
"create_task": "",
|
"create_task": "",
|
||||||
"tasks": "",
|
"tasks": "",
|
||||||
"my_tasks": "",
|
"my_tasks": "",
|
||||||
|
"all_tasks": "",
|
||||||
"accounting": "",
|
"accounting": "",
|
||||||
"accounting-payables": "",
|
"accounting-payables": "",
|
||||||
"accounting-payments": "",
|
"accounting-payments": "",
|
||||||
@@ -3137,8 +3138,12 @@
|
|||||||
"accounting-receivables": "",
|
"accounting-receivables": "",
|
||||||
"app": "",
|
"app": "",
|
||||||
"tasks": "",
|
"tasks": "",
|
||||||
|
"all_tasks": "",
|
||||||
|
"my_tasks": "",
|
||||||
"bc": {
|
"bc": {
|
||||||
"tasks": "",
|
"tasks": "",
|
||||||
|
"all_tasks": "",
|
||||||
|
"my_tasks": "",
|
||||||
"accounting-payables": "",
|
"accounting-payables": "",
|
||||||
"accounting-payments": "",
|
"accounting-payments": "",
|
||||||
"accounting-receivables": "",
|
"accounting-receivables": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user