From 301c680bffe89f053d68510426e85eb618d78686 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Tue, 26 Mar 2024 21:36:27 -0400 Subject: [PATCH] - Progress commit Signed-off-by: Dave Richer --- .../components/header/header.component.jsx | 4 +- .../jobs-detail-header-actions.component.jsx | 2 +- .../task-list/task-list.component.jsx | 27 +++++---- .../task-upsert-modal.component.jsx | 59 ++++++++++++------- .../task-upsert-modal.container.jsx | 3 + client/src/translations/en_us/common.json | 55 +++++++++++++++++ client/src/translations/es/common.json | 55 +++++++++++++++++ client/src/translations/fr/common.json | 55 +++++++++++++++++ 8 files changed, 222 insertions(+), 38 deletions(-) diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index 1b5d5b5c4..150298ee5 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -476,7 +476,7 @@ function Header({ key: 'tasks', id: 'tasks', icon: , - label: t('menus.header.my_tasks'), + label: t('menus.header.tasks'), children: [ { key: 'createTask', @@ -492,7 +492,7 @@ function Header({ { key: 'mytasks', icon: , - label: {t('menus.header.tasks')}, + label: {t('menus.header.my_tasks')}, } ] }, diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx index 27c81d7b2..0a5ac3ae0 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx @@ -774,7 +774,7 @@ export function JobsDetailHeaderActions({ menuItems.push( job.inproduction ? { - key: 'addtoproduction', + key: 'removefromproduction', disabled: !job.converted, label: t("jobs.actions.removefromproduction"), onClick: () => AddToProduction(client, job.id, refetch, true) diff --git a/client/src/components/task-list/task-list.component.jsx b/client/src/components/task-list/task-list.component.jsx index 2f1d125b8..9ffa3da37 100644 --- a/client/src/components/task-list/task-list.component.jsx +++ b/client/src/components/task-list/task-list.component.jsx @@ -31,7 +31,7 @@ const DueDateRecord = ({dueDate}) => { const relativeDueDate = dueDateDayjs.fromNow(); const today = dayjs(); - if (dueDateDayjs.isAfter(today)) { + if (dueDateDayjs.isBefore(today)) { return
{dueDate}
; } else { @@ -81,13 +81,14 @@ const mapStateToProps = (state) => ({ export default connect(mapStateToProps, mapDispatchToProps)(TaskListComponent); function TaskListComponent({ - loading, - tasks, - total, - refetch, - toggleCompletedStatus, + loading, + tasks, + total, + refetch, + toggleCompletedStatus, setTaskUpsertContext, - }) { + toggleDeletedStatus + }) { const {t} = useTranslation(); const search = queryString.parse(useLocation().search); @@ -135,7 +136,7 @@ function TaskListComponent({ key: "due_date", sorter: true, sortOrder: sortcolumn === "due_date" && sortorder, - width: '5%', + width: '8%', render: (text, record) => , }, { @@ -154,7 +155,7 @@ function TaskListComponent({ width: '5%', render: (text, record) => ( - - - @@ -228,10 +229,10 @@ function TaskListComponent({ checked={deleted === "true"} onChange={(value) => handleSwitchChange('deleted', value)} /> - - diff --git a/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx b/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx index 05ac709f7..f5f3a258b 100644 --- a/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx +++ b/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx @@ -1,15 +1,17 @@ import {Col, Form, Input, Row, Select, Switch} from "antd"; -import React, {useCallback} from "react"; +import React from "react"; import {useTranslation} from "react-i18next"; import {FormDatePicker} from "../form-date-picker/form-date-picker.component.jsx"; import {createStructuredSelector} from "reselect"; -import {selectBodyshop} from "../../redux/user/user.selectors.js"; +import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors.js"; +import dayjs from '../../utils/day'; import {connect} from "react-redux"; import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component.jsx"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, + currentUser: selectCurrentUser, }); const mapDispatchToProps = (dispatch) => ({}); @@ -23,6 +25,7 @@ export default connect( export function TaskUpsertModalComponent({ form, bodyshop, + currentUser, selectedJobId, setSelectedJobId, selectedJobDetails, @@ -32,14 +35,19 @@ export function TaskUpsertModalComponent({ }) { const {t} = useTranslation(); - console.dir(data) + const datePickerPresets = [ + {label: t('tasks.date_presets.next_week'), value: dayjs().add(1, 'week')}, + {label: t('tasks.date_presets.two_weeks'), value: dayjs().add(2, 'weeks')}, + {label: t('tasks.date_presets.three_weeks'), value: dayjs().add(3, 'weeks')}, + {label: t('tasks.date_presets.one_month'), value: dayjs().add(1, 'month')}, + ]; if (loading || error) return ; return ( <> - + - + @@ -60,14 +68,14 @@ export function TaskUpsertModalComponent({ > {bodyshop.employees.map((employee) => ( @@ -97,7 +106,7 @@ export function TaskUpsertModalComponent({ label={t("tasks.fields.due_date")} name="due_date" > - + @@ -105,7 +114,7 @@ export function TaskUpsertModalComponent({ label={t("tasks.fields.remind_at")} name="remind_at" > - + @@ -117,7 +126,7 @@ export function TaskUpsertModalComponent({ > @@ -126,16 +135,14 @@ export function TaskUpsertModalComponent({ - {data.jobs.map((job) => ( {job.ro_number} @@ -151,7 +158,7 @@ export function TaskUpsertModalComponent({ label={t("tasks.fields.joblineid")} name="joblineid" > - {selectedJobDetails?.joblines?.map((jobline) => ( {jobline.line_desc} @@ -165,8 +172,12 @@ export function TaskUpsertModalComponent({ label={t("tasks.fields.partsorderid")} name="partsorderid" > - + {selectedJobDetails?.parts_orders?.map((partsOrder) => ( + + {partsOrder.order_number} - {partsOrder.vendor.name} + + ))} @@ -175,8 +186,12 @@ export function TaskUpsertModalComponent({ label={t("tasks.fields.billid")} name="billid" > - + {selectedJobDetails?.bills?.map((bill) => ( + + {bill.invoice_number} - {bill.vendor.name} + + ))} diff --git a/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx b/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx index 7a5e0ddf6..520fe2453 100644 --- a/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx +++ b/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx @@ -131,6 +131,9 @@ export function TaskUpsertModalContainer({ {...values, jobid: selectedJobId, created_by: currentUser.email, bodyshopid: bodyshop.id}, ], }, + updateQueries: { + query: QUERY_GET_TASKS_JOB_DETAILS, + }, update(cache) { cache.modify({ fields: { diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 14a98d82a..be0e15d1d 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2095,12 +2095,67 @@ } } }, + "tasks": { + "date_presets": { + "next_week": "Next Week", + "two_weeks": "Two Weeks", + "three_weeks": "Three Weeks", + "one_month": "One Month" + }, + "actions": { + "new": "New Task", + "edit": "Edit Task" + }, + "titles": { + "completed": "Completed Tasks", + "deleted": "Deleted Tasks" + }, + "buttons": { + "create": "Create Task", + "complete": "Complete", + "delete": "Delete", + "edit": "Edit", + "refresh": "Refresh" + }, + "placeholders": { + "description": "Enter a description", + "jobid": "Select a Job", + "joblineid": "Select a Job Line", + "partsorderid": "Select a Parts Order", + "billid": "Select a Bill" + }, + "fields": { + "priorities": { + "low": "Low", + "medium": "Medium", + "high": "High" + }, + "title": "Title", + "joblineid": "Job Line", + "jobid": "Job", + "partsorderid": "Parts Order", + "billid": "Bill", + "description": "Description", + "due_date": "Due Date", + "actions": "Actions", + "priority": "Priority", + "remind_at": "Remind At", + "assigned_to": "Assigned To", + "completed": "Completed", + "job": { + "ro_number": "RO #" + } + } + }, "menus": { "currentuser": { "languageselector": "Language", "profile": "Profile" }, "header": { + "create_task": "Create Task", + "tasks": "Tasks", + "my_tasks": "My Tasks", "accounting": "Accounting", "accounting-payables": "Payables", "accounting-payments": "Payments", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index ba11bb4a3..519bec455 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2094,12 +2094,67 @@ } } }, + "tasks": { + "date_presets": { + "next_week": "", + "two_weeks": "", + "three_weeks": "", + "one_month": "" + }, + "actions": { + "new": "", + "edit": "" + }, + "titles": { + "completed": "", + "deleted": "" + }, + "buttons": { + "create": "", + "complete": "", + "delete": "", + "edit": "", + "refresh":"" + }, + "placeholders": { + "description": "", + "jobid": "", + "joblineid": "", + "partsorderid": "", + "billid": "" + }, + "fields": { + "priorities": { + "low": "", + "medium":"", + "high": "" + }, + "title": "", + "joblineid":"", + "jobid": "", + "partsorderid": "", + "billid": "", + "description": "", + "due_date": "", + "actions": "", + "priority": "", + "remind_at": "", + "assigned_to": "", + "completed": "", + "job": { + "ro_number": "" + } + } + }, "menus": { "currentuser": { "languageselector": "idioma", "profile": "Perfil" }, "header": { + "create_task": "", + "tasks": "", + "my_tasks": "", "accounting": "", "accounting-payables": "", "accounting-payments": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1117003e0..c64f10047 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2094,12 +2094,67 @@ } } }, + "tasks": { + "date_presets": { + "next_week": "", + "two_weeks": "", + "three_weeks": "", + "one_month": "" + }, + "actions": { + "new": "", + "edit": "" + }, + "titles": { + "completed": "", + "deleted": "" + }, + "buttons": { + "create": "", + "complete": "", + "delete": "", + "edit": "", + "refresh":"" + }, + "placeholders": { + "description": "", + "jobid": "", + "joblineid": "", + "partsorderid": "", + "billid": "" + }, + "fields": { + "priorities": { + "low": "", + "medium":"", + "high": "" + }, + "title": "", + "joblineid":"", + "jobid": "", + "partsorderid": "", + "billid": "", + "description": "", + "due_date": "", + "actions": "", + "priority": "", + "remind_at": "", + "assigned_to": "", + "completed": "", + "job": { + "ro_number": "" + } + } + }, "menus": { "currentuser": { "languageselector": "La langue", "profile": "Profil" }, "header": { + "create_task": "", + "tasks": "", + "my_tasks": "", "accounting": "", "accounting-payables": "", "accounting-payments": "",