- Progress commit

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-03-26 21:36:27 -04:00
parent 595159f24d
commit 301c680bff
8 changed files with 222 additions and 38 deletions

View File

@@ -476,7 +476,7 @@ function Header({
key: 'tasks',
id: 'tasks',
icon: <FaTasks />,
label: t('menus.header.my_tasks'),
label: t('menus.header.tasks'),
children: [
{
key: 'createTask',
@@ -492,7 +492,7 @@ function Header({
{
key: 'mytasks',
icon: <FaTasks/>,
label: <Link to="/manage/tasks">{t('menus.header.tasks')}</Link>,
label: <Link to="/manage/tasks">{t('menus.header.my_tasks')}</Link>,
}
]
},

View File

@@ -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)

View File

@@ -31,7 +31,7 @@ const DueDateRecord = ({dueDate}) => {
const relativeDueDate = dueDateDayjs.fromNow();
const today = dayjs();
if (dueDateDayjs.isAfter(today)) {
if (dueDateDayjs.isBefore(today)) {
return <div title={relativeDueDate} style={{color: 'red'}}>
<DateFormatter>{dueDate}</DateFormatter></div>;
} 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) => <DueDateRecord dueDate={record.due_date} />,
},
{
@@ -154,7 +155,7 @@ function TaskListComponent({
width: '5%',
render: (text, record) => (
<Space direction='horizontal'>
<Button title={t('tasks.actions.edit')} onClick={() => {
<Button title={t('tasks.buttons.edit')} onClick={() => {
setTaskUpsertContext({
actions: {},
context: {
@@ -164,12 +165,12 @@ function TaskListComponent({
}}>
<EditFilled/>
</Button>
<Button title={t('tasks.actions.toggle_completed')}
<Button title={t('tasks.buttons.complete')}
onClick={() => toggleCompletedStatus(record.id, record.completed)}>
{record.completed ? <CheckCircleOutlined/> :
<CheckCircleFilled/>}
</Button>
<Button title={t('tasks.actions.toggle_deleted')}
<Button title={t('tasks.buttons.delete')}
onClick={() => toggleDeletedStatus(record.id, record.deleted)}>
{record.deleted ? <DeleteFilled/> : <DeleteOutlined/>}
</Button>
@@ -228,10 +229,10 @@ function TaskListComponent({
checked={deleted === "true"}
onChange={(value) => handleSwitchChange('deleted', value)}
/>
<Button title={t('tasks.titles.create')} onClick={handleCreateTask}>
<Button title={t('tasks.buttons.create')} onClick={handleCreateTask}>
<PlusCircleFilled/>{t('tasks.buttons.create')}
</Button>
<Button title={t('tasks.titles.refresh')}
<Button title={t('tasks.buttons.refresh')}
onClick={() => refetch()}>
<SyncOutlined/>
</Button>

View File

@@ -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 <LoadingSkeleton active/>;
return (
<>
<Row gutter={[16, 16]}>
<Col span={18}>
<Col span={16}>
<Form.Item
label={t("tasks.fields.title")}
name="title"
@@ -49,7 +57,7 @@ export function TaskUpsertModalComponent({
},
]}
>
<Input placeholder={t("tasks.labels.titleplaceholder")}/>
<Input placeholder={t("tasks.fields.title")}/>
</Form.Item>
</Col>
<Col span={4}>
@@ -60,14 +68,14 @@ export function TaskUpsertModalComponent({
>
<Select
options={[
{value: 3, label: t("tasks.fields.priority.low")},
{value: 2, label: t("tasks.fields.priority.medium")},
{value: 1, label: t("tasks.fields.priority.high")},
{value: 3, label: t("tasks.fields.priorities.low")},
{value: 2, label: t("tasks.fields.priorities.medium")},
{value: 1, label: t("tasks.fields.priorities.high")},
]}
/>
</Form.Item>
</Col>
<Col span={2}>
<Col span={4}>
<Form.Item
label={t("tasks.fields.completed")}
name="completed"
@@ -82,6 +90,7 @@ export function TaskUpsertModalComponent({
<Form.Item
label={t("tasks.fields.assigned_to")}
name="assigned_to"
initialValue={currentUser.email}
>
<Select placeholder={t("tasks.labels.selectemployee")}>
{bodyshop.employees.map((employee) => (
@@ -97,7 +106,7 @@ export function TaskUpsertModalComponent({
label={t("tasks.fields.due_date")}
name="due_date"
>
<FormDatePicker/>
<FormDatePicker format="MM/DD/YYYY" presets={datePickerPresets}/>
</Form.Item>
</Col>
<Col span={8}>
@@ -105,7 +114,7 @@ export function TaskUpsertModalComponent({
label={t("tasks.fields.remind_at")}
name="remind_at"
>
<FormDatePicker/>
<FormDatePicker format="MM/DD/YYYY" presets={datePickerPresets}/>
</Form.Item>
</Col>
</Row>
@@ -117,7 +126,7 @@ export function TaskUpsertModalComponent({
>
<Input.TextArea
rows={8}
placeholder={t("tasks.labels.descriptionplaceholder")}
placeholder={t("tasks.fields.description")}
/>
</Form.Item>
</Col>
@@ -126,16 +135,14 @@ export function TaskUpsertModalComponent({
<Col span={24}>
<Form.Item
name="jobid"
label="Job ID"
label={t("tasks.fields.jobid")}
rules={[
{
required: true,
message: 'Please select a Job ID',
},
},1
]}
>
<Select placeholder="Select a Job ID" defaultValue={selectedJobId} onSelect={setSelectedJobId}>
<Select placeholder={t('tasks.placeholders.jobid')} defaultValue={selectedJobId} onSelect={setSelectedJobId}>
{data.jobs.map((job) => (
<Select.Option key={job.id} value={job.id}>
{job.ro_number}
@@ -151,7 +158,7 @@ export function TaskUpsertModalComponent({
label={t("tasks.fields.joblineid")}
name="joblineid"
>
<Select placeholder={t("tasks.labels.joblineidplaceholder")} disabled={!selectedJobDetails}>
<Select placeholder={t("tasks.placeholders.joblineid")} disabled={!selectedJobDetails}>
{selectedJobDetails?.joblines?.map((jobline) => (
<Select.Option key={jobline.id} value={jobline.id}>
{jobline.line_desc}
@@ -165,8 +172,12 @@ export function TaskUpsertModalComponent({
label={t("tasks.fields.partsorderid")}
name="partsorderid"
>
<Select placeholder={t("tasks.labels.partsorderidplaceholder")} disabled={!selectedJobDetails}>
{/* Add your options here */}
<Select placeholder={t("tasks.placeholders.partsorderid")} disabled={!selectedJobDetails}>
{selectedJobDetails?.parts_orders?.map((partsOrder) => (
<Select.Option key={partsOrder.id} value={partsOrder.id}>
{partsOrder.order_number} - {partsOrder.vendor.name}
</Select.Option>
))}
</Select>
</Form.Item>
</Col>
@@ -175,8 +186,12 @@ export function TaskUpsertModalComponent({
label={t("tasks.fields.billid")}
name="billid"
>
<Select placeholder={t("tasks.labels.billidplaceholder")} disabled={!selectedJobDetails}>
{/* Add your options here */}
<Select placeholder={t("tasks.placeholders.billid")} disabled={!selectedJobDetails}>
{selectedJobDetails?.bills?.map((bill) => (
<Select.Option key={bill.id} value={bill.id}>
{bill.invoice_number} - {bill.vendor.name}
</Select.Option>
))}
</Select>
</Form.Item>
</Col>

View File

@@ -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: {

View File

@@ -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",

View File

@@ -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": "",

View File

@@ -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": "",