diff --git a/client/src/components/chat-presets/chat-presets.component.jsx b/client/src/components/chat-presets/chat-presets.component.jsx index 16b11de15..5d67721b8 100644 --- a/client/src/components/chat-presets/chat-presets.component.jsx +++ b/client/src/components/chat-presets/chat-presets.component.jsx @@ -1,5 +1,5 @@ import { PlusCircleOutlined } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; diff --git a/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx b/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx index 865878ff8..707b066ee 100644 --- a/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx +++ b/client/src/components/contracts-rates-change-button/contracts-rates-change-button.component.jsx @@ -1,5 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; diff --git a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx index 2ade8de15..644139a0b 100644 --- a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx +++ b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx @@ -3,21 +3,19 @@ import { Button, Card, Dropdown, - Input, - Menu, - Space, + Input, Space, Table, - Tooltip, + Tooltip } from "antd"; +import moment from "moment"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { DateTimeFormatter } from "../../utils/DateFormatter"; -import { alphaSort } from "../../utils/sorters"; -import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; -import moment from "moment"; import { GenerateDocument } from "../../utils/RenderTemplate"; +import { alphaSort } from "../../utils/sorters"; import { TemplateList } from "../../utils/TemplateConstants"; +import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; export default function CourtesyCarsList({ loading, courtesycars, refetch }) { const [state, setState] = useState({ sortedInfo: {}, diff --git a/client/src/components/dms-post-form/dms-post-form.component.jsx b/client/src/components/dms-post-form/dms-post-form.component.jsx index 56179729b..5f4dd1dd5 100644 --- a/client/src/components/dms-post-form/dms-post-form.component.jsx +++ b/client/src/components/dms-post-form/dms-post-form.component.jsx @@ -6,12 +6,10 @@ import { Dropdown, Form, Input, - InputNumber, - Menu, - Select, + InputNumber, Select, Space, Statistic, - Typography, + Typography } from "antd"; import Dinero from "dinero.js"; import moment from "moment"; diff --git a/client/src/components/job-at-change/job-at-change.component.jsx b/client/src/components/job-at-change/job-at-change.component.jsx index 845447855..9305cd326 100644 --- a/client/src/components/job-at-change/job-at-change.component.jsx +++ b/client/src/components/job-at-change/job-at-change.component.jsx @@ -1,11 +1,11 @@ -import React from "react"; +import { DownOutlined } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { UPDATE_JOB } from "../../graphql/jobs.queries"; +import { Dropdown, notification } from "antd"; +import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { Dropdown, Menu, notification } from "antd"; -import { DownOutlined } from "@ant-design/icons"; +import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ diff --git a/client/src/components/job-at-change/schedule-event.color.component.jsx b/client/src/components/job-at-change/schedule-event.color.component.jsx index 0066d06e0..16956b710 100644 --- a/client/src/components/job-at-change/schedule-event.color.component.jsx +++ b/client/src/components/job-at-change/schedule-event.color.component.jsx @@ -1,11 +1,11 @@ -import React from "react"; +import { DownOutlined } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries"; +import { Dropdown, notification } from "antd"; +import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { Dropdown, Menu, notification } from "antd"; -import { DownOutlined } from "@ant-design/icons"; +import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ diff --git a/client/src/components/job-at-change/schedule-event.component.jsx b/client/src/components/job-at-change/schedule-event.component.jsx index 5d7302b90..19d84fe56 100644 --- a/client/src/components/job-at-change/schedule-event.component.jsx +++ b/client/src/components/job-at-change/schedule-event.component.jsx @@ -2,11 +2,9 @@ import { AlertFilled } from "@ant-design/icons"; import { Button, Divider, - Dropdown, - Menu, - notification, + Dropdown, notification, Popover, - Space, + Space } from "antd"; import parsePhoneNumber from "libphonenumber-js"; import moment from "moment"; @@ -18,7 +16,7 @@ import { Link, useHistory, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { openChatByPhone, - setMessage, + setMessage } from "../../redux/messaging/messaging.actions"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -27,11 +25,11 @@ import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; import ChatOpenButton from "../chat-open-button/chat-open-button.component"; import DataLabel from "../data-label/data-label.component"; +import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component"; import ScheduleAtChange from "./job-at-change.component"; import ScheduleEventColor from "./schedule-event.color.component"; import ScheduleEventNote from "./schedule-event.note.component"; -import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 159af19cd..c79a13bc2 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -1,24 +1,15 @@ import { DeleteFilled, + EditFilled, FilterFilled, + HomeOutlined, + MinusCircleTwoTone, + PlusCircleTwoTone, SyncOutlined, WarningFilled, - EditFilled, - PlusCircleTwoTone, - MinusCircleTwoTone, - HomeOutlined, } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { - Button, - Dropdown, - Input, - Menu, - PageHeader, - Space, - Table, - Tag, -} from "antd"; +import { Button, Dropdown, Input, PageHeader, Space, Table, Tag } from "antd"; import axios from "axios"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -38,13 +29,13 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re // import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container"; // import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container"; // import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container"; -import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container"; import _ from "lodash"; -import JobCreateIOU from "../job-create-iou/job-create-iou.component"; -import JobLinesExpander from "./job-lines-expander.component"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import moment from "moment"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import JobCreateIOU from "../job-create-iou/job-create-iou.component"; import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component"; +import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container"; +import JobLinesExpander from "./job-lines-expander.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, diff --git a/client/src/components/job-lines-preset-button/job-lines-preset-button.component.jsx b/client/src/components/job-lines-preset-button/job-lines-preset-button.component.jsx index 6dde888fb..2e5d8f4ae 100644 --- a/client/src/components/job-lines-preset-button/job-lines-preset-button.component.jsx +++ b/client/src/components/job-lines-preset-button/job-lines-preset-button.component.jsx @@ -1,5 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; diff --git a/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx b/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx index f9895f147..b4a5fa602 100644 --- a/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx +++ b/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx @@ -1,6 +1,6 @@ import { DownCircleFilled } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { Button, Dropdown, Menu, notification } from "antd"; +import { Button, Dropdown, notification } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; diff --git a/client/src/components/jobs-change-status/jobs-change-status.component.jsx b/client/src/components/jobs-change-status/jobs-change-status.component.jsx index 9e6979f19..284779a93 100644 --- a/client/src/components/jobs-change-status/jobs-change-status.component.jsx +++ b/client/src/components/jobs-change-status/jobs-change-status.component.jsx @@ -1,6 +1,6 @@ import { DownCircleFilled } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { Button, Dropdown, Menu, notification } from "antd"; +import { Button, Dropdown, notification } from "antd"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx index d643df239..9f5a31347 100644 --- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx +++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx @@ -1,4 +1,4 @@ -import { Button, Dropdown, Menu } from "antd"; +import { Button, Dropdown } from "antd"; import _ from "lodash"; import React from "react"; import { useTranslation } from "react-i18next"; diff --git a/client/src/components/jobs-detail-change-estimator/jobs-detail-change-estimator.component.jsx b/client/src/components/jobs-detail-change-estimator/jobs-detail-change-estimator.component.jsx index 37577f0e2..615fc750d 100644 --- a/client/src/components/jobs-detail-change-estimator/jobs-detail-change-estimator.component.jsx +++ b/client/src/components/jobs-detail-change-estimator/jobs-detail-change-estimator.component.jsx @@ -1,5 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; diff --git a/client/src/components/jobs-detail-change-filehandler/jobs-detail-change-filehandler.component.jsx b/client/src/components/jobs-detail-change-filehandler/jobs-detail-change-filehandler.component.jsx index fd3cfd663..3499ea5e5 100644 --- a/client/src/components/jobs-detail-change-filehandler/jobs-detail-change-filehandler.component.jsx +++ b/client/src/components/jobs-detail-change-filehandler/jobs-detail-change-filehandler.component.jsx @@ -1,5 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; 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 7342f303d..24a3967dc 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 @@ -1,6 +1,6 @@ import { DownCircleFilled } from "@ant-design/icons"; import { useApolloClient, useMutation } from "@apollo/client"; -import { Button, Dropdown, Menu, notification, Popconfirm } from "antd"; +import { Button, Dropdown, notification, Popconfirm } from "antd"; import React, { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -13,7 +13,7 @@ import { selectJobReadOnly } from "../../redux/application/application.selectors import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop, - selectCurrentUser, + selectCurrentUser } from "../../redux/user/user.selectors"; import JobsDetailHeaderActionsAddevent from "./jobs-detail-header-actions.addevent"; import AddToProduction from "./jobs-detail-header-actions.addtoproduction.util"; diff --git a/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx b/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx index d83869b48..2ddf772e0 100644 --- a/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx +++ b/client/src/components/jobs-detail-rates-change-button/jobs-detail-rates-change-button.component.jsx @@ -1,5 +1,5 @@ import { DownOutlined } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -18,20 +18,16 @@ export function JobsDetailRatesChangeButton({ disabled, form, bodyshop }) { form.setFieldsValue({ ...rate, labor_rate_desc: rate.rate_label }); }; - const menu = ( -
- - {bodyshop.md_labor_rates.map((rate, idx) => ( - - {rate.rate_label} - - ))} - -
- ); - + const menu = { + onClick: handleClick, + items: bodyshop.md_labor_rates.map((rate, idx) => ({ + key: idx, + value: rate, + label: rate.rate_label, + })), + }; return ( - + - {bodyshop.md_notes_presets.map((i, idx) => ( - handleSelect(i)} - key={idx} - style={{ breakInside: "avoid" }} - > - {i.label} - - ))} - - ); + const menu = { + style: { + columnCount: Math.floor(bodyshop.md_notes_presets.length / 10) + 1, + }, + items: bodyshop.md_notes_presets.map((i, idx) => ({ + key: idx, + style: { breakInside: "avoid" }, + onClick: () => handleSelect(i), + label: i.label, + })), + }; return (
- + - - {bodyshop.md_parts_order_comment.map((comment, idx) => ( - - {comment.label} - - ))} - -
- ); + const menu = { + onClick: handleClick, + items: bodyshop.md_parts_order_comment.map((comment, idx) => ({ + key: idx, + value: comment.comment, + label: comment.label, + })), + }; return (
@@ -308,7 +299,7 @@ export function PartsOrderModalComponent({ label={ {t("parts_orders.fields.comments")} - + - {cols - .filter((i) => !columnKeys.includes(i.key)) - .map((item) => ( - - {item.title} - - ))} - - ); + const menu = { + style: { + columnCount: Math.max(Math.floor(cols.length / 10), 1), + }, + onClick: handleAdd, + items: cols + .filter((i) => !columnKeys.includes(i.key)) + .map((item) => ({ + key: item.key, + style: { breakInside: "avoid" }, + label: item.title, + })), + }; return (
- +
); } - -// c.key)} -// render={(item) => item.title} -// onChange={(nextTargetKeys, direction, moveKeys) => { -// setColumns(dataSource.filter((i) => nextTargetKeys.includes(i.key))); -// }} -// /> diff --git a/client/src/components/production-list-columns/production-list-columns.alert.component.jsx b/client/src/components/production-list-columns/production-list-columns.alert.component.jsx index 8823afb46..72107b607 100644 --- a/client/src/components/production-list-columns/production-list-columns.alert.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.alert.component.jsx @@ -1,10 +1,10 @@ import { ExclamationCircleFilled } from "@ant-design/icons"; -import { Dropdown, Menu } from "antd"; +import { useMutation } from "@apollo/client"; +import { Dropdown } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; -import { useMutation } from "@apollo/client"; -import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { logImEXEvent } from "../../firebase/firebase.utils"; +import { UPDATE_JOB } from "../../graphql/jobs.queries"; export default function ProductionListColumnAlert({ record }) { const { t } = useTranslation(); @@ -34,15 +34,18 @@ export default function ProductionListColumnAlert({ record }) { return ( - - {record.production_vars && record.production_vars.alert - ? t("production.labels.alertoff") - : t("production.labels.alerton")} - - - } + menu={{ + items: [ + { + key: "toggleAlert", + onClick: handleAlertToggle, + label: + record.production_vars && record.production_vars.alert + ? t("production.labels.alertoff") + : t("production.labels.alerton"), + }, + ], + }} trigger={["contextMenu"]} >
- - {t("production.actions.bodypriority-clear")} - - - {new Array(15).fill().map((value, index) => ( - + menu={{ + onClick: handleSetBodyPriority, + items: [ + { + key: "clearBodyPriority", + label: t("production.actions.bodypriority-clear"), + }, + { + key: "set", + label: t("production.actions.bodypriority-set"), + children: new Array(15).fill().map((value, index) => ({ + key: index + 1, + label: (
{index + 1}
-
- ))} -
- - } + ), + })), + }, + ], + }} trigger={["click"]} >
diff --git a/client/src/components/production-list-columns/production-list-columns.detailpriority.component.jsx b/client/src/components/production-list-columns/production-list-columns.detailpriority.component.jsx index ebd88163f..3e023dec7 100644 --- a/client/src/components/production-list-columns/production-list-columns.detailpriority.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.detailpriority.component.jsx @@ -1,9 +1,9 @@ import { useMutation } from "@apollo/client"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; -import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { logImEXEvent } from "../../firebase/firebase.utils"; +import { UPDATE_JOB } from "../../graphql/jobs.queries"; export default function ProductionListColumnDetailPriority({ record }) { const { t } = useTranslation(); @@ -31,25 +31,27 @@ export default function ProductionListColumnDetailPriority({ record }) { return ( - - {t("production.actions.detailpriority-clear")} - - - {new Array(15).fill().map((value, index) => ( - + menu={{ + onClick: handleSetDetailPriority, + items: [ + { + key: "clearDetailPriority", + label: t("production.actions.detailpriority-clear"), + }, + { + key: "set", + label: t("production.actions.detailpriority-set"), + children: new Array(15).fill().map((value, index) => ({ + key: index + 1, + label: (
{index + 1}
-
- ))} -
- - } + ), + })), + }, + ], + }} trigger={["click"]} >
diff --git a/client/src/components/production-list-columns/production-list-columns.paintpriority.component.jsx b/client/src/components/production-list-columns/production-list-columns.paintpriority.component.jsx index 501a625d8..f0fa0c984 100644 --- a/client/src/components/production-list-columns/production-list-columns.paintpriority.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.paintpriority.component.jsx @@ -1,9 +1,9 @@ import { useMutation } from "@apollo/client"; -import { Dropdown, Menu } from "antd"; +import { Dropdown } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; -import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { logImEXEvent } from "../../firebase/firebase.utils"; +import { UPDATE_JOB } from "../../graphql/jobs.queries"; export default function ProductionListColumnPaintPriority({ record }) { const { t } = useTranslation(); @@ -31,25 +31,27 @@ export default function ProductionListColumnPaintPriority({ record }) { return ( - - {t("production.actions.paintpriority-clear")} - - - {new Array(15).fill().map((value, index) => ( - + menu={{ + onClick: handleSetPaintPriority, + items: [ + { + key: "clearPaintPriority", + label: t("production.actions.paintpriority-clear"), + }, + { + key: "set", + label: t("production.actions.paintpriority-set"), + children: new Array(15).fill().map((value, index) => ({ + key: index + 1, + label: (
{index + 1}
-
- ))} -
- - } + ), + })), + }, + ], + }} trigger={["click"]} >
diff --git a/client/src/components/production-list-columns/production-list-columns.status.category.jsx b/client/src/components/production-list-columns/production-list-columns.status.category.jsx index 115b69a3f..ac21669c2 100644 --- a/client/src/components/production-list-columns/production-list-columns.status.category.jsx +++ b/client/src/components/production-list-columns/production-list-columns.status.category.jsx @@ -1,5 +1,5 @@ import { useMutation } from "@apollo/client"; -import { Dropdown, Menu, Spin } from "antd"; +import { Dropdown, Spin } from "antd"; import React, { useState } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -38,16 +38,14 @@ export function ProductionListColumnCategory({ record, bodyshop }) { return ( - {bodyshop.md_categories.map((item) => ( - {item} - ))} - - } + menu={{ + style: { maxHeight: "200px", overflowY: "auto" }, + onClick: handleSetStatus, + items: bodyshop.md_categories.map((item) => ({ + key: item, + label: item, + })), + }} trigger={["click"]} >
diff --git a/client/src/components/production-list-columns/production-list-columns.status.component.jsx b/client/src/components/production-list-columns/production-list-columns.status.component.jsx index e29ffdbeb..18e4c8c9c 100644 --- a/client/src/components/production-list-columns/production-list-columns.status.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.status.component.jsx @@ -1,12 +1,12 @@ import { useMutation } from "@apollo/client"; -import { Dropdown, Menu, Spin } from "antd"; +import { Dropdown, Spin } from "antd"; import React, { useState } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; -import { selectBodyshop } from "../../redux/user/user.selectors"; import { insertAuditTrail } from "../../redux/application/application.actions"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import AuditTrailMapping from "../../utils/AuditTrailMappings"; const mapStateToProps = createStructuredSelector({ @@ -47,16 +47,14 @@ export function ProductionListColumnStatus({ return ( - {bodyshop.md_ro_statuses.production_statuses.map((item) => ( - {item} - ))} - - } + menu={{ + style: { maxHeight: "200px", overflowY: "auto" }, + onClick: handleSetStatus, + items: bodyshop.md_ro_statuses.production_statuses.map((item) => ({ + key: item, + label: item, + })), + }} trigger={["click"]} >
diff --git a/client/src/components/production-list-table/production-list-print.component.jsx b/client/src/components/production-list-table/production-list-print.component.jsx index 4e31b33d0..355541cfc 100644 --- a/client/src/components/production-list-table/production-list-print.component.jsx +++ b/client/src/components/production-list-table/production-list-print.component.jsx @@ -1,8 +1,8 @@ -import { Button, Dropdown, Menu } from "antd"; +import { Button, Dropdown } from "antd"; import React, { useState } from "react"; -import { TemplateList } from "../../utils/TemplateConstants"; import { useTranslation } from "react-i18next"; import { GenerateDocument } from "../../utils/RenderTemplate"; +import { TemplateList } from "../../utils/TemplateConstants"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -31,98 +31,86 @@ export function ProductionListPrint({ bodyshop }) { return ( - {Object.keys(ProdTemplates).map((key) => ( - { + menu={{ + items: [ + ...Object.keys(ProdTemplates).map((key) => ({ + key: key, + onClick: async () => { + setLoading(true); + await GenerateDocument( + { + name: ProdTemplates[key].key, + // variables: { id: contract.id }, + }, + {}, + "p" + ); + setLoading(false); + }, + label: ProdTemplates[key].title, + })), + { + key: "prodbyonetech", + label: t("reportcenter.templates.production_by_technician_one"), + children: bodyshop.employees.map((e) => ({ + key: e.id, + onClick: async () => { setLoading(true); await GenerateDocument( { - name: ProdTemplates[key].key, - // variables: { id: contract.id }, + name: production_by_technician_one.key, + variables: { id: e.id }, }, {}, "p" ); setLoading(false); - }} - > - {ProdTemplates[key].title} - - ))} - - {bodyshop.employees.map((e) => ( - { - setLoading(true); - await GenerateDocument( - { - name: production_by_technician_one.key, - variables: { id: e.id }, - }, - {}, - "p" - ); - setLoading(false); - }} - > - {e.first_name} {e.last_name} - - ))} - - - {bodyshop.md_categories.map((e) => ( - { - setLoading(true); - await GenerateDocument( - { - name: production_by_category_one.key, - variables: { category: e }, - }, - {}, - "p" - ); - setLoading(false); - }} - > - {e} - - ))} - - - {bodyshop.md_ro_statuses.production_statuses.map((e) => ( - { - setLoading(true); - await GenerateDocument( - { - name: production_by_repair_status_one.key, - variables: { status: e }, - }, - {}, - "p" - ); - setLoading(false); - }} - > - {e} - - ))} - - - } + }, + label: `${e.first_name || ""} ${e.last_name || ""}`.trim(), + })), + }, + { + key: "prodbycategory", + label: t("reportcenter.templates.production_by_category_one"), + children: bodyshop.md_categories.map((e) => ({ + key: e, + onClick: async () => { + setLoading(true); + await GenerateDocument( + { + name: production_by_category_one.key, + variables: { category: e }, + }, + {}, + "p" + ); + setLoading(false); + }, + label: e, + })), + }, + { + key: "prodbyrepairstatus", + label: t("reportcenter.templates.production_by_repair_status_one"), + children: bodyshop.md_ro_statuses.production_statuses.map((e) => ({ + key: e, + onClick: async () => { + setLoading(true); + await GenerateDocument( + { + name: production_by_repair_status_one.key, + variables: { status: e }, + }, + {}, + "p" + ); + setLoading(false); + }, + label: e, + })), + }, + ], + }} > diff --git a/client/src/components/production-list-table/production-list-table.component.jsx b/client/src/components/production-list-table/production-list-table.component.jsx index 6595476d5..97230eb83 100644 --- a/client/src/components/production-list-table/production-list-table.component.jsx +++ b/client/src/components/production-list-table/production-list-table.component.jsx @@ -4,7 +4,6 @@ import { Button, Dropdown, Input, - Menu, PageHeader, Space, Statistic, @@ -121,13 +120,10 @@ export function ProductionListTable({ const headerItem = (col) => ( - - {t("production.actions.removecolumn")} - - - } + menu={{ + onClick: removeColumn, + items: [{ key: col.key, label: t("production.actions.removecolumn") }], + }} trigger={["contextMenu"]} > {col.title} diff --git a/client/src/components/schedule-block-day/schedule-block-day.component.jsx b/client/src/components/schedule-block-day/schedule-block-day.component.jsx index 548da1f9f..5c58eb3c7 100644 --- a/client/src/components/schedule-block-day/schedule-block-day.component.jsx +++ b/client/src/components/schedule-block-day/schedule-block-day.component.jsx @@ -1,13 +1,13 @@ import { useMutation } from "@apollo/client"; -import { Dropdown, Menu, notification } from "antd"; +import { Dropdown, notification } from "antd"; import moment from "moment"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; +import { logImEXEvent } from "../../firebase/firebase.utils"; import { INSERT_APPOINTMENT_BLOCK } from "../../graphql/appointments.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; -import { logImEXEvent } from "../../firebase/firebase.utils"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -55,15 +55,12 @@ export function ScheduleBlockDay({ } }; - const menu = ( - - {t("appointments.actions.block")} - - ); - return ( diff --git a/client/src/components/tech-sider/tech-sider.component.jsx b/client/src/components/tech-sider/tech-sider.component.jsx index 1bd3bcdf8..e91dd8dd8 100644 --- a/client/src/components/tech-sider/tech-sider.component.jsx +++ b/client/src/components/tech-sider/tech-sider.component.jsx @@ -30,50 +30,68 @@ export function TechSider({ technician, techLogout }) { return ( - - } - > - {t("menus.tech.login")} - - }> - {t("menus.tech.joblookup")} - - } - > - {t("menus.tech.jobclockin")} - - } - > - {t("menus.tech.shiftclockin")} - - }> - {t("menus.tech.productionlist")} - - } - > - {t("menus.tech.productionboard")} - - techLogout()} - icon={} - > - {t("menus.tech.logout")} - - + , + label: {t("menus.tech.login")}, + }, + { + key: "joblookup", + disabled: !!!technician, + icon: , + label: ( + {t("menus.tech.joblookup")} + ), + }, + { + key: "jobclockin", + disabled: !!!technician, + icon: , + label: ( + {t("menus.tech.jobclockin")} + ), + }, + { + key: "shiftclock", + disabled: !!!technician, + icon: , + label: ( + + {t("menus.tech.shiftclockin")} + + ), + }, + { + key: "prodlist", + disabled: !!!technician, + icon: , + label: ( + {t("menus.tech.productionlist")} + ), + }, + { + key: "prodboard", + disabled: !!!technician, + icon: , + label: ( + {t("menus.tech.productionboard")} + ), + }, + { + key: "logout", + disabled: !!!technician, + onClick: () => techLogout(), + icon: , + label: t("menus.tech.logout"), + }, + ]} + > ); } diff --git a/client/src/pages/contract-detail/contract-detail.page.component.jsx b/client/src/pages/contract-detail/contract-detail.page.component.jsx index 3cf317236..a81b20d50 100644 --- a/client/src/pages/contract-detail/contract-detail.page.component.jsx +++ b/client/src/pages/contract-detail/contract-detail.page.component.jsx @@ -3,11 +3,10 @@ import { Col, Dropdown, Form, - Menu, PageHeader, Row, Space, - Typography, + Typography } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; @@ -76,10 +75,11 @@ export function ContractDetailPage({ - + menu={{ + items: [ + { + key: "contract", + onClick: () => GenerateDocument( { name: TemplateList("courtesycarcontract") @@ -88,13 +88,15 @@ export function ContractDetailPage({ }, {}, "p" - ) - } - > - {t("contracts.actions.printcontract")} - - + ), + label: t("contracts.actions.printcontract"), + }, + { + key: "terms", + label: t( + "printcenter.courtesycarcontract.courtesy_car_terms" + ), + onClick: () => GenerateDocument( { name: TemplateList("courtesycarcontract") @@ -103,15 +105,14 @@ export function ContractDetailPage({ }, {}, "p" - ) - } - > - {t( - "printcenter.courtesycarcontract.courtesy_car_terms" - )} - - + ), + }, + { + key: "impound", + label: t( + "printcenter.courtesycarcontract.courtesy_car_impound" + ), + onClick: () => GenerateDocument( { name: TemplateList("courtesycarcontract") @@ -120,15 +121,10 @@ export function ContractDetailPage({ }, {}, "p" - ) - } - > - {t( - "printcenter.courtesycarcontract.courtesy_car_impound" - )} - - - } + ), + }, + ], + }} > diff --git a/client/src/utils/GraphQLClient.js b/client/src/utils/GraphQLClient.js index eb631aff8..f997f66a1 100644 --- a/client/src/utils/GraphQLClient.js +++ b/client/src/utils/GraphQLClient.js @@ -142,7 +142,7 @@ middlewares.push( const cache = new InMemoryCache({}); -export default new ApolloClient({ +const c = new ApolloClient({ link: ApolloLink.from(middlewares), cache, connectToDevTools: process.env.NODE_ENV !== "production", @@ -161,3 +161,5 @@ export default new ApolloClient({ }, }, }); + +export default c;