@@ -104,7 +104,7 @@ export function App({
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
// Any route that is not assigned and matched will default to the Landing Page component
|
||||
return (
|
||||
<Suspense fallback={<LoadingSpinner message="ImEX Online"/>}>
|
||||
<Routes>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Icon, {UploadOutlined} from "@ant-design/icons";
|
||||
import {useApolloClient} from "@apollo/client";
|
||||
import {useTreatments} from "@splitsoftware/splitio-react";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {Alert, Divider, Form, Input, Select, Space, Statistic, Switch, Upload,} from "antd";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, {useEffect, useState} from "react";
|
||||
@@ -27,34 +27,18 @@ const mapStateToProps = createStructuredSelector({
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
|
||||
export function BillFormComponent({
|
||||
bodyshop,
|
||||
disabled,
|
||||
form,
|
||||
vendorAutoCompleteOptions,
|
||||
lineData,
|
||||
responsibilityCenters,
|
||||
loadLines,
|
||||
billEdit,
|
||||
disableInvNumber,
|
||||
job,
|
||||
loadOutstandingReturns,
|
||||
loadInventory,
|
||||
preferredMake,
|
||||
}) {
|
||||
export function BillFormComponent({bodyshop, disabled, form, vendorAutoCompleteOptions, lineData, responsibilityCenters, loadLines, billEdit, disableInvNumber, job, loadOutstandingReturns, loadInventory, preferredMake}) {
|
||||
|
||||
const {t} = useTranslation();
|
||||
const client = useApolloClient();
|
||||
const [discount, setDiscount] = useState(0);
|
||||
const {Extended_Bill_Posting} = useTreatments(
|
||||
["Extended_Bill_Posting"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const {ClosingPeriod} = useTreatments(
|
||||
["ClosingPeriod"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {Extended_Bill_Posting, ClosingPeriod} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Extended_Bill_Posting", "ClosingPeriod"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
|
||||
const handleVendorSelect = (props, opt) => {
|
||||
setDiscount(opt.discount);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useLazyQuery, useQuery } from "@apollo/client";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -23,11 +23,11 @@ export function BillFormContainer({
|
||||
disabled,
|
||||
disableInvNumber,
|
||||
}) {
|
||||
const { Simple_Inventory } = useTreatments(
|
||||
["Simple_Inventory"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
const { treatments: {Simple_Inventory} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Simple_Inventory"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const { data: VendorAutoCompleteData } = useQuery(
|
||||
SEARCH_VENDOR_AUTOCOMPLETE,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Button, Form,
|
||||
Input,
|
||||
@@ -40,11 +40,14 @@ export function BillEnterModalLinesComponent({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { setFieldsValue, getFieldsValue, getFieldValue } = form;
|
||||
const { Simple_Inventory } = useTreatments(
|
||||
["Simple_Inventory"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {Simple_Inventory} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Simple_Inventory"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
|
||||
const columns = (remove) => {
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import GlobalSearch from "../global-search/global-search.component";
|
||||
import GlobalSearchOs from "../global-search/global-search-os.component";
|
||||
import "./breadcrumbs.styles.scss";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
breadcrumbs: selectBreadcrumbs,
|
||||
@@ -17,13 +17,14 @@ const mapStateToProps = createStructuredSelector({
|
||||
});
|
||||
|
||||
export function BreadCrumbs({ breadcrumbs, bodyshop }) {
|
||||
const { OpenSearch } = useTreatments(
|
||||
["OpenSearch"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
|
||||
return (
|
||||
const { treatments: {OpenSearch} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["OpenSearch"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<Row className="breadcrumb-container">
|
||||
<Col xs={24} sm={24} md={16}>
|
||||
<Breadcrumb separator=">">
|
||||
|
||||
@@ -48,7 +48,7 @@ export function ContractConvertToRo({
|
||||
|
||||
const contractLength = dayjs(contract.actualreturn).diff(
|
||||
dayjs(contract.start),
|
||||
"days"
|
||||
"day"
|
||||
);
|
||||
const billingLines = [];
|
||||
if (contractLength > 0)
|
||||
|
||||
@@ -153,7 +153,7 @@ export function ContractsList({
|
||||
(record.actualreturn &&
|
||||
record.start &&
|
||||
`${dayjs(record.actualreturn)
|
||||
.diff(dayjs(record.start), "days", true)
|
||||
.diff(dayjs(record.start), "day", true)
|
||||
.toFixed(1)} days`) ||
|
||||
"",
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ import Icon, {
|
||||
UnorderedListOutlined,
|
||||
UserOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import { Layout, Menu } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -87,21 +87,12 @@ function Header({
|
||||
recentItems,
|
||||
setCardPaymentContext,
|
||||
}) {
|
||||
const { Simple_Inventory } = useTreatments(
|
||||
["Simple_Inventory"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
const { DmsAp } = useTreatments(
|
||||
["DmsAp"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
const { ImEXPay } = useTreatments(
|
||||
["ImEXPay"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
// TODO: Client Update - New Split Treatments usage example
|
||||
const { treatments: {ImEXPay, DmsAp, Simple_Inventory} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["ImEXPay", "DmsAp", "Simple_Inventory"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export function JobChecklistForm({
|
||||
bodyshop.intakechecklist.next_contact_hours > 0 && {
|
||||
date_next_contact: dayjs().add(
|
||||
bodyshop.intakechecklist.next_contact_hours,
|
||||
"hours"
|
||||
"hour"
|
||||
),
|
||||
}),
|
||||
...(type === "deliver" && {
|
||||
@@ -226,7 +226,7 @@ export function JobChecklistForm({
|
||||
(job.labhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0 + job.larhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0) / bodyshop.target_touchtime,
|
||||
"days"
|
||||
"day"
|
||||
)),
|
||||
scheduled_delivery:
|
||||
job.scheduled_delivery && dayjs(job.scheduled_delivery),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Button, notification, Popconfirm } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -27,11 +27,13 @@ export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) {
|
||||
const client = useApolloClient();
|
||||
const history = useNavigate();
|
||||
|
||||
const { IOU_Tracking } = useTreatments(
|
||||
["IOU_Tracking"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {IOU_Tracking} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["IOU_Tracking"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
if (IOU_Tracking.treatment !== "on") return null;
|
||||
|
||||
const handleCreateIou = async () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
|
||||
import InputCurrency from "../form-items-formatted/currency-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import JoblinesPreset from "../job-lines-preset-button/job-lines-preset-button.component";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -35,16 +35,12 @@ export function JobLinesUpsertModalComponent({
|
||||
form.resetFields();
|
||||
}, [visible, form]);
|
||||
|
||||
const { Allow_Negative_Jobline_Price } = useTreatments(
|
||||
["Allow_Negative_Jobline_Price"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const { Autohouse_Detail_line } = useTreatments(
|
||||
["Autohouse_Detail_line"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {Allow_Negative_Jobline_Price, Autohouse_Detail_line} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Allow_Negative_Jobline_Price", "Autohouse_Detail_line"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -16,7 +16,7 @@ import Axios from "axios";
|
||||
import Dinero from "dinero.js";
|
||||
import CriticalPartsScan from "../../utils/criticalPartsScan";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobLineEditModal: selectJobLineEditModal,
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -30,11 +30,13 @@ function JobLinesUpsertModalContainer({
|
||||
toggleModalVisible,
|
||||
bodyshop,
|
||||
}) {
|
||||
const { CriticalPartsScanning } = useTreatments(
|
||||
["CriticalPartsScanning"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {CriticalPartsScanning} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ['CriticalPartsScanning'],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [insertJobLine] = useMutation(INSERT_NEW_JOB_LINE);
|
||||
const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
|
||||
|
||||
@@ -20,7 +20,7 @@ import DataLabel from "../data-label/data-label.component";
|
||||
import PaymentExpandedRowComponent from "../payment-expanded-row/payment-expanded-row.component";
|
||||
import PaymentsGenerateLink from "../payments-generate-link/payments-generate-link.component";
|
||||
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -36,21 +36,13 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
setMessage: (text) => dispatch(setMessage(text)),
|
||||
});
|
||||
|
||||
export function JobPayments({
|
||||
job,
|
||||
jobRO,
|
||||
bodyshop,
|
||||
setMessage,
|
||||
openChatByPhone,
|
||||
setPaymentContext,
|
||||
setCardPaymentContext,
|
||||
refetch,
|
||||
}) {
|
||||
const { ImEXPay } = useTreatments(
|
||||
["ImEXPay"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
export function JobPayments({job, jobRO, bodyshop, setMessage, openChatByPhone, setPaymentContext, setCardPaymentContext, refetch}) {
|
||||
|
||||
const { treatments: {ImEXPay} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["ImEXPay"],
|
||||
splitKey:bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [state, setState] = useState({
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from "@apollo/client";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Col, notification, Row } from "antd";
|
||||
import Axios from "axios";
|
||||
import Dinero from "dinero.js";
|
||||
@@ -50,16 +50,14 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
insertAuditTrail: ({ jobid, operation }) =>
|
||||
dispatch(insertAuditTrail({ jobid, operation })),
|
||||
});
|
||||
export function JobsAvailableContainer({
|
||||
bodyshop,
|
||||
currentUser,
|
||||
insertAuditTrail,
|
||||
}) {
|
||||
const { CriticalPartsScanning } = useTreatments(
|
||||
["CriticalPartsScanning"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
export function JobsAvailableContainer({bodyshop, currentUser, insertAuditTrail,}) {
|
||||
|
||||
const { treatments: {CriticalPartsScanning} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["CriticalPartsScanning"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_JOBS, {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import cleanAxios from "../../utils/CleanAxios";
|
||||
import formatBytes from "../../utils/formatbytes";
|
||||
//import yauzl from "yauzl";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -22,18 +22,17 @@ export default connect(
|
||||
mapDispatchToProps
|
||||
)(JobsDocumentsDownloadButton);
|
||||
|
||||
export function JobsDocumentsDownloadButton({
|
||||
bodyshop,
|
||||
galleryImages,
|
||||
identifier,
|
||||
}) {
|
||||
export function JobsDocumentsDownloadButton({ bodyshop, galleryImages, identifier}) {
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [download, setDownload] = useState(null);
|
||||
const { Direct_Media_Download } = useTreatments(
|
||||
["Direct_Media_Download"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {Direct_Media_Download} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Direct_Media_Download"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const imagesToDownload = [
|
||||
...galleryImages.images.filter((image) => image.isSelected),
|
||||
...galleryImages.other.filter((image) => image.isSelected),
|
||||
|
||||
@@ -13,7 +13,8 @@ export default function LoadingSpinner({ loading = true, message, ...props }) {
|
||||
alignContent: "center"
|
||||
}}
|
||||
delay={200}
|
||||
tip={message ? message : null}
|
||||
// TODO: Client Update - tip only works when there are actually children, and this component is used in a lot of places where there are no children
|
||||
// tip={message ? message : null}
|
||||
>
|
||||
{props.children}
|
||||
</Spin>
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
import { DeleteFilled, WarningFilled, DownOutlined } from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Divider,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Radio,
|
||||
Space,
|
||||
Tag,
|
||||
Select,
|
||||
Menu,
|
||||
Dropdown,
|
||||
Checkbox,
|
||||
} from "antd";
|
||||
import {DeleteFilled, DownOutlined, WarningFilled} from "@ant-design/icons";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {Checkbox, Divider, Dropdown, Form, Input, InputNumber, Menu, Radio, Select, Space, Tag,} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
@@ -26,329 +14,319 @@ import VendorSearchSelect from "../vendor-search-select/vendor-search-select.com
|
||||
import PartsOrderModalPriceChange from "./parts-order-modal-price-change.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(PartsOrderModalComponent);
|
||||
|
||||
export function PartsOrderModalComponent({
|
||||
bodyshop,
|
||||
vendorList,
|
||||
sendTypeState,
|
||||
isReturn,
|
||||
preferredMake,
|
||||
job,
|
||||
form,
|
||||
}) {
|
||||
const [sendType, setSendType] = sendTypeState;
|
||||
const { OEConnection } = useTreatments(
|
||||
["OEConnection"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const { OEConnection_PriceChange } = useTreatments(
|
||||
["OEConnection_PriceChange"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const { t } = useTranslation();
|
||||
const handleClick = ({ item, key, keyPath }) => {
|
||||
form.setFieldsValue({ comments: item.props.value });
|
||||
};
|
||||
export function PartsOrderModalComponent({bodyshop, vendorList, sendTypeState, isReturn, preferredMake, job, form,}) {
|
||||
const [sendType, setSendType] = sendTypeState;
|
||||
|
||||
const menu = (
|
||||
<div>
|
||||
<Menu onClick={handleClick}>
|
||||
{bodyshop.md_parts_order_comment.map((comment, idx) => (
|
||||
<Menu.Item value={comment.comment} key={idx}>
|
||||
{comment.label}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
</div>
|
||||
);
|
||||
const {treatments: {OEConnection, OEConnection_PriceChange}} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["OEConnection", "OEConnection_PriceChange"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Form.Item name="returnfrombill" style={{ display: "none" }}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<LayoutFormRow grow noDivider>
|
||||
<Form.Item
|
||||
name="vendorid"
|
||||
label={t("vendors.fields.name")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<VendorSearchSelect
|
||||
options={vendorList}
|
||||
disabled={isReturn}
|
||||
preferredMake={preferredMake}
|
||||
showPhone
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="deliver_by"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
label={t("parts_orders.fields.deliver_by")}
|
||||
>
|
||||
<FormDatePicker onlyFuture />
|
||||
</Form.Item>
|
||||
{job && job.special_coverage_policy && (
|
||||
<Tag color="tomato">
|
||||
<Space>
|
||||
<WarningFilled />
|
||||
<span>{t("jobs.labels.specialcoveragepolicy")}</span>
|
||||
</Space>
|
||||
</Tag>
|
||||
)}
|
||||
{!isReturn && (
|
||||
<Form.Item
|
||||
name="removefrompartsqueue"
|
||||
label={t("parts_orders.labels.removefrompartsqueue")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Checkbox />
|
||||
</Form.Item>
|
||||
)}
|
||||
{OEConnection.treatment === "on" && !isReturn && (
|
||||
<Form.Item
|
||||
name="is_quote"
|
||||
label={t("parts_orders.labels.is_quote")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Checkbox />
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
<Form.Item
|
||||
name="order_type"
|
||||
initialValue="parts_order"
|
||||
label={t("parts_orders.labels.order_type")}
|
||||
>
|
||||
<Radio.Group disabled={sendType === "oec"}>
|
||||
<Radio value={"parts_order"}>
|
||||
{t("parts_orders.labels.parts_order")}
|
||||
</Radio>
|
||||
<Radio value={"sublet"}>
|
||||
{t("parts_orders.labels.sublet_order")}
|
||||
</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<Divider orientation="left">
|
||||
{t("parts_orders.labels.inthisorder")}
|
||||
</Divider>
|
||||
<Form.List name={["parts_order_lines", "data"]}>
|
||||
{(fields, { add, remove, move }) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item required={false} key={field.key}>
|
||||
<div style={{ display: "flex" }}>
|
||||
<LayoutFormRow grow noDivider style={{ flex: 1 }}>
|
||||
<Form.Item
|
||||
//span={8}
|
||||
label={t("parts_orders.fields.line_desc")}
|
||||
key={`${index}line_desc`}
|
||||
name={[field.name, "line_desc"]}
|
||||
rules={[
|
||||
{
|
||||
const {t} = useTranslation();
|
||||
const handleClick = ({item, key, keyPath}) => {
|
||||
form.setFieldsValue({comments: item.props.value});
|
||||
};
|
||||
|
||||
const menu = (
|
||||
<div>
|
||||
<Menu onClick={handleClick}>
|
||||
{bodyshop.md_parts_order_comment.map((comment, idx) => (
|
||||
<Menu.Item value={comment.comment} key={idx}>
|
||||
{comment.label}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Form.Item name="returnfrombill" style={{display: "none"}}>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<LayoutFormRow grow noDivider>
|
||||
<Form.Item
|
||||
name="vendorid"
|
||||
label={t("vendors.fields.name")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.line_remarks")}
|
||||
key={`${index}line_remarks`}
|
||||
name={[field.name, "line_remarks"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.part_type")}
|
||||
key={`${index}part_type`}
|
||||
name={[field.name, "part_type"]}
|
||||
>
|
||||
<Select
|
||||
disabled={
|
||||
!(
|
||||
sendType === "oec" &&
|
||||
OEConnection_PriceChange.treatment === "on"
|
||||
)
|
||||
}
|
||||
>
|
||||
<Select.Option value="PAA">
|
||||
{t("joblines.fields.part_types.PAA")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAC">
|
||||
{t("joblines.fields.part_types.PAC")}
|
||||
</Select.Option>
|
||||
|
||||
<Select.Option value="PAL">
|
||||
{t("joblines.fields.part_types.PAL")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAG">
|
||||
{t("joblines.fields.part_types.PAG")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAM">
|
||||
{t("joblines.fields.part_types.PAM")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAP">
|
||||
{t("joblines.fields.part_types.PAP")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAN">
|
||||
{t("joblines.fields.part_types.PAN")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAO">
|
||||
{t("joblines.fields.part_types.PAO")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAR">
|
||||
{t("joblines.fields.part_types.PAR")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAS">
|
||||
{t("joblines.fields.part_types.PAS")}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.oem_partno")}
|
||||
key={`${index}oem_partno`}
|
||||
name={[field.name, "oem_partno"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{
|
||||
// <Form.Item
|
||||
// label={t("parts_orders.fields.db_price")}
|
||||
// key={`${index}db_price`}
|
||||
// name={[field.name, "db_price"]}
|
||||
// >
|
||||
// <CurrencyInput />
|
||||
// </Form.Item>
|
||||
}
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.quantity")}
|
||||
key={`${index}quantity`}
|
||||
name={[field.name, "quantity"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.act_price")}
|
||||
key={`${index}act_price`}
|
||||
name={[field.name, "act_price"]}
|
||||
>
|
||||
<CurrencyInput
|
||||
addonBefore={
|
||||
<PartsOrderModalPriceChange
|
||||
form={form}
|
||||
field={field}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
{isReturn && (
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.cost")}
|
||||
key={`${index}cost`}
|
||||
name={[field.name, "cost"]}
|
||||
>
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
<Space wrap size="small" align="center">
|
||||
<div>
|
||||
<DeleteFilled
|
||||
style={{ margin: "1rem" }}
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<FormListMoveArrows
|
||||
move={move}
|
||||
index={index}
|
||||
total={fields.length}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
},
|
||||
]}
|
||||
>
|
||||
<VendorSearchSelect
|
||||
options={vendorList}
|
||||
disabled={isReturn}
|
||||
preferredMake={preferredMake}
|
||||
showPhone
|
||||
/>
|
||||
</Form.Item>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
<Form.Item
|
||||
name="comments"
|
||||
label={
|
||||
<Space>
|
||||
{t("parts_orders.fields.comments")}
|
||||
<Dropdown overlay={menu}>
|
||||
<a
|
||||
className="ant-dropdown-link"
|
||||
href=" #"
|
||||
onClick={(e) => e.preventDefault()}
|
||||
>
|
||||
<DownOutlined />
|
||||
</a>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Input.TextArea rows={3} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="deliver_by"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
label={t("parts_orders.fields.deliver_by")}
|
||||
>
|
||||
<FormDatePicker onlyFuture/>
|
||||
</Form.Item>
|
||||
{job && job.special_coverage_policy && (
|
||||
<Tag color="tomato">
|
||||
<Space>
|
||||
<WarningFilled/>
|
||||
<span>{t("jobs.labels.specialcoveragepolicy")}</span>
|
||||
</Space>
|
||||
</Tag>
|
||||
)}
|
||||
{!isReturn && (
|
||||
<Form.Item
|
||||
name="removefrompartsqueue"
|
||||
label={t("parts_orders.labels.removefrompartsqueue")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Checkbox/>
|
||||
</Form.Item>
|
||||
)}
|
||||
{OEConnection.treatment === "on" && !isReturn && (
|
||||
<Form.Item
|
||||
name="is_quote"
|
||||
label={t("parts_orders.labels.is_quote")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Checkbox/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{() => {
|
||||
const is_quote = form.getFieldValue("is_quote");
|
||||
if (is_quote) setSendType("oec");
|
||||
return (
|
||||
<Radio.Group
|
||||
defaultValue={sendType}
|
||||
value={sendType}
|
||||
onChange={(e) => setSendType(e.target.value)}
|
||||
<Form.Item
|
||||
name="order_type"
|
||||
initialValue="parts_order"
|
||||
label={t("parts_orders.labels.order_type")}
|
||||
>
|
||||
<Radio.Group disabled={sendType === "oec"}>
|
||||
<Radio value={"parts_order"}>
|
||||
{t("parts_orders.labels.parts_order")}
|
||||
</Radio>
|
||||
<Radio value={"sublet"}>
|
||||
{t("parts_orders.labels.sublet_order")}
|
||||
</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<Divider orientation="left">
|
||||
{t("parts_orders.labels.inthisorder")}
|
||||
</Divider>
|
||||
<Form.List name={["parts_order_lines", "data"]}>
|
||||
{(fields, {add, remove, move}) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item required={false} key={field.key}>
|
||||
<div style={{display: "flex"}}>
|
||||
<LayoutFormRow grow noDivider style={{flex: 1}}>
|
||||
<Form.Item
|
||||
//span={8}
|
||||
label={t("parts_orders.fields.line_desc")}
|
||||
key={`${index}line_desc`}
|
||||
name={[field.name, "line_desc"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.line_remarks")}
|
||||
key={`${index}line_remarks`}
|
||||
name={[field.name, "line_remarks"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.part_type")}
|
||||
key={`${index}part_type`}
|
||||
name={[field.name, "part_type"]}
|
||||
>
|
||||
<Select
|
||||
disabled={
|
||||
!(
|
||||
sendType === "oec" &&
|
||||
OEConnection_PriceChange.treatment === "on"
|
||||
)
|
||||
}
|
||||
>
|
||||
<Select.Option value="PAA">
|
||||
{t("joblines.fields.part_types.PAA")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAC">
|
||||
{t("joblines.fields.part_types.PAC")}
|
||||
</Select.Option>
|
||||
|
||||
<Select.Option value="PAL">
|
||||
{t("joblines.fields.part_types.PAL")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAG">
|
||||
{t("joblines.fields.part_types.PAG")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAM">
|
||||
{t("joblines.fields.part_types.PAM")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAP">
|
||||
{t("joblines.fields.part_types.PAP")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAN">
|
||||
{t("joblines.fields.part_types.PAN")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAO">
|
||||
{t("joblines.fields.part_types.PAO")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAR">
|
||||
{t("joblines.fields.part_types.PAR")}
|
||||
</Select.Option>
|
||||
<Select.Option value="PAS">
|
||||
{t("joblines.fields.part_types.PAS")}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.oem_partno")}
|
||||
key={`${index}oem_partno`}
|
||||
name={[field.name, "oem_partno"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
{
|
||||
// <Form.Item
|
||||
// label={t("parts_orders.fields.db_price")}
|
||||
// key={`${index}db_price`}
|
||||
// name={[field.name, "db_price"]}
|
||||
// >
|
||||
// <CurrencyInput />
|
||||
// </Form.Item>
|
||||
}
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.quantity")}
|
||||
key={`${index}quantity`}
|
||||
name={[field.name, "quantity"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.act_price")}
|
||||
key={`${index}act_price`}
|
||||
name={[field.name, "act_price"]}
|
||||
>
|
||||
<CurrencyInput
|
||||
addonBefore={
|
||||
<PartsOrderModalPriceChange
|
||||
form={form}
|
||||
field={field}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
{isReturn && (
|
||||
<Form.Item
|
||||
label={t("parts_orders.fields.cost")}
|
||||
key={`${index}cost`}
|
||||
name={[field.name, "cost"]}
|
||||
>
|
||||
<CurrencyInput/>
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
<Space wrap size="small" align="center">
|
||||
<div>
|
||||
<DeleteFilled
|
||||
style={{margin: "1rem"}}
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<FormListMoveArrows
|
||||
move={move}
|
||||
index={index}
|
||||
total={fields.length}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
</Form.Item>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
<Form.Item
|
||||
name="comments"
|
||||
label={
|
||||
<Space>
|
||||
{t("parts_orders.fields.comments")}
|
||||
<Dropdown overlay={menu}>
|
||||
<a
|
||||
className="ant-dropdown-link"
|
||||
href=" #"
|
||||
onClick={(e) => e.preventDefault()}
|
||||
>
|
||||
<DownOutlined/>
|
||||
</a>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Radio disabled={is_quote} value={"none"}>
|
||||
{t("general.labels.none")}
|
||||
</Radio>
|
||||
<Radio disabled={is_quote} value={"e"}>
|
||||
{t("parts_orders.labels.email")}
|
||||
</Radio>
|
||||
<Radio disabled={is_quote} value={"p"}>
|
||||
{t("parts_orders.labels.print")}
|
||||
</Radio>
|
||||
{OEConnection.treatment === "on" && !isReturn && (
|
||||
<Radio value={"oec"}>{t("parts_orders.labels.oec")}</Radio>
|
||||
)}
|
||||
</Radio.Group>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
<Input.TextArea rows={3}/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{() => {
|
||||
const is_quote = form.getFieldValue("is_quote");
|
||||
if (is_quote) setSendType("oec");
|
||||
return (
|
||||
<Radio.Group
|
||||
defaultValue={sendType}
|
||||
value={sendType}
|
||||
onChange={(e) => setSendType(e.target.value)}
|
||||
>
|
||||
<Radio disabled={is_quote} value={"none"}>
|
||||
{t("general.labels.none")}
|
||||
</Radio>
|
||||
<Radio disabled={is_quote} value={"e"}>
|
||||
{t("parts_orders.labels.email")}
|
||||
</Radio>
|
||||
<Radio disabled={is_quote} value={"p"}>
|
||||
{t("parts_orders.labels.print")}
|
||||
</Radio>
|
||||
{OEConnection.treatment === "on" && !isReturn && (
|
||||
<Radio value={"oec"}>{t("parts_orders.labels.oec")}</Radio>
|
||||
)}
|
||||
</Radio.Group>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,395 +1,380 @@
|
||||
import { useMutation, useQuery, useApolloClient } from "@apollo/client";
|
||||
import { Form, Modal, notification } from "antd";
|
||||
import {useApolloClient, useMutation, useQuery} from "@apollo/client";
|
||||
import {Form, Modal, notification} from "antd";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent, auth } from "../../firebase/firebase.utils";
|
||||
import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries";
|
||||
import {
|
||||
INSERT_NEW_PARTS_ORDERS,
|
||||
QUERY_PARTS_ORDER_OEC,
|
||||
} from "../../graphql/parts-orders.queries";
|
||||
import { QUERY_ALL_VENDORS_FOR_ORDER } from "../../graphql/vendors.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||
import {
|
||||
setModalContext,
|
||||
toggleModalVisible,
|
||||
} from "../../redux/modals/modals.actions";
|
||||
import { selectPartsOrder } from "../../redux/modals/modals.selectors";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {auth, logImEXEvent} from "../../firebase/firebase.utils";
|
||||
import {UPDATE_JOB_LINE_STATUS} from "../../graphql/jobs-lines.queries";
|
||||
import {INSERT_NEW_PARTS_ORDERS, QUERY_PARTS_ORDER_OEC,} from "../../graphql/parts-orders.queries";
|
||||
import {QUERY_ALL_VENDORS_FOR_ORDER} from "../../graphql/vendors.queries";
|
||||
import {insertAuditTrail} from "../../redux/application/application.actions";
|
||||
import {setEmailOptions} from "../../redux/email/email.actions";
|
||||
import {setModalContext, toggleModalVisible,} from "../../redux/modals/modals.actions";
|
||||
import {selectPartsOrder} from "../../redux/modals/modals.selectors";
|
||||
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
|
||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import {GenerateDocument} from "../../utils/RenderTemplate";
|
||||
import {TemplateList} from "../../utils/TemplateConstants";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import PartsOrderModalComponent from "./parts-order-modal.component";
|
||||
import axios from "axios";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import _ from "lodash";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import {UPDATE_JOB} from "../../graphql/jobs.queries";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop,
|
||||
partsOrderModal: selectPartsOrder,
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop,
|
||||
partsOrderModal: selectPartsOrder,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
||||
toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")),
|
||||
setBillEnterContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||
insertAuditTrail: ({ jobid, operation }) =>
|
||||
dispatch(insertAuditTrail({ jobid, operation })),
|
||||
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
||||
toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")),
|
||||
setBillEnterContext: (context) =>
|
||||
dispatch(setModalContext({context: context, modal: "billEnter"})),
|
||||
insertAuditTrail: ({jobid, operation}) =>
|
||||
dispatch(insertAuditTrail({jobid, operation})),
|
||||
});
|
||||
|
||||
export function PartsOrderModalContainer({
|
||||
partsOrderModal,
|
||||
toggleModalVisible,
|
||||
currentUser,
|
||||
bodyshop,
|
||||
setEmailOptions,
|
||||
setBillEnterContext,
|
||||
insertAuditTrail,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const client = useApolloClient();
|
||||
const { OEConnection_PriceChange } = useTreatments(
|
||||
["OEConnection_PriceChange"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const { visible, context, actions } = partsOrderModal;
|
||||
const {
|
||||
jobId,
|
||||
linesToOrder,
|
||||
isReturn,
|
||||
vendorId,
|
||||
returnFromBill,
|
||||
invoiceNumber,
|
||||
job,
|
||||
} = context;
|
||||
export function PartsOrderModalContainer({partsOrderModal,toggleModalVisible,currentUser, bodyshop, setEmailOptions, setBillEnterContext, insertAuditTrail,}) {
|
||||
const {t} = useTranslation();
|
||||
const client = useApolloClient();
|
||||
|
||||
const { refetch } = actions;
|
||||
const [form] = Form.useForm();
|
||||
const [saving, setSaving] = useState(false);
|
||||
const sendTypeState = useState("e");
|
||||
const sendType = sendTypeState[0];
|
||||
|
||||
const { loading, error, data } = useQuery(QUERY_ALL_VENDORS_FOR_ORDER, {
|
||||
skip: !visible,
|
||||
variables: { jobId: jobId },
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
const [insertPartOrder] = useMutation(INSERT_NEW_PARTS_ORDERS);
|
||||
const [updateJobLines] = useMutation(UPDATE_JOB_LINE_STATUS);
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
|
||||
const handleFinish = async ({
|
||||
order_type,
|
||||
removefrompartsqueue,
|
||||
is_quote,
|
||||
...values
|
||||
}) => {
|
||||
logImEXEvent("parts_order_insert");
|
||||
setSaving(true);
|
||||
let insertResult;
|
||||
|
||||
insertResult = await insertPartOrder({
|
||||
variables: {
|
||||
po: [
|
||||
{
|
||||
...values,
|
||||
order_date: dayjs().format("YYYY-MM-DD"),
|
||||
orderedby: currentUser.email,
|
||||
jobid: jobId,
|
||||
user_email: currentUser.email,
|
||||
return: isReturn,
|
||||
status: is_quote
|
||||
? bodyshop.md_order_statuses.default_quote || "Quote"
|
||||
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||
},
|
||||
],
|
||||
},
|
||||
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"],
|
||||
});
|
||||
if (!!insertResult.errors) {
|
||||
notification["error"]({
|
||||
message: t("parts_orders.errors.creating"),
|
||||
description: JSON.stringify(insertResult.errors),
|
||||
});
|
||||
return;
|
||||
}
|
||||
notification["success"]({
|
||||
message: values.isReturn
|
||||
? t("parts_orders.successes.return_created")
|
||||
: t("parts_orders.successes.created"),
|
||||
});
|
||||
insertAuditTrail({
|
||||
jobid: jobId,
|
||||
operation: isReturn
|
||||
? AuditTrailMapping.jobspartsreturn(
|
||||
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||
)
|
||||
: AuditTrailMapping.jobspartsorder(
|
||||
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||
),
|
||||
const {treatments: {OEConnection_PriceChange}} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["OEConnection_PriceChange"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const jobLinesResult = await updateJobLines({
|
||||
variables: {
|
||||
ids: values.parts_order_lines.data
|
||||
.filter((item) => item.job_line_id)
|
||||
.map((item) => item.job_line_id),
|
||||
status: isReturn
|
||||
? bodyshop.md_order_statuses.default_returned || "Returned*"
|
||||
: is_quote
|
||||
? bodyshop.md_order_statuses.default_quote || "Quote"
|
||||
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||
},
|
||||
const {visible, context, actions} = partsOrderModal;
|
||||
const {
|
||||
jobId,
|
||||
linesToOrder,
|
||||
isReturn,
|
||||
vendorId,
|
||||
returnFromBill,
|
||||
invoiceNumber,
|
||||
job,
|
||||
} = context;
|
||||
|
||||
const {refetch} = actions;
|
||||
const [form] = Form.useForm();
|
||||
const [saving, setSaving] = useState(false);
|
||||
const sendTypeState = useState("e");
|
||||
const sendType = sendTypeState[0];
|
||||
|
||||
const {loading, error, data} = useQuery(QUERY_ALL_VENDORS_FOR_ORDER, {
|
||||
skip: !visible,
|
||||
variables: {jobId: jobId},
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
if (!isReturn && removefrompartsqueue) {
|
||||
await updateJob({
|
||||
variables: {
|
||||
jobId: jobId,
|
||||
job: {
|
||||
queued_for_parts: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
const [insertPartOrder] = useMutation(INSERT_NEW_PARTS_ORDERS);
|
||||
const [updateJobLines] = useMutation(UPDATE_JOB_LINE_STATUS);
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
|
||||
if (!!jobLinesResult.errors) {
|
||||
notification["error"]({
|
||||
message: t("parts_orders.errors.creating"),
|
||||
description: JSON.stringify(jobLinesResult.errors),
|
||||
});
|
||||
}
|
||||
const handleFinish = async ({
|
||||
order_type,
|
||||
removefrompartsqueue,
|
||||
is_quote,
|
||||
...values
|
||||
}) => {
|
||||
logImEXEvent("parts_order_insert");
|
||||
setSaving(true);
|
||||
let insertResult;
|
||||
|
||||
if (values.vendorid === bodyshop.inhousevendorid) {
|
||||
setBillEnterContext({
|
||||
actions: { refetch: refetch },
|
||||
context: {
|
||||
disableInvNumber: true,
|
||||
job: { id: jobId },
|
||||
bill: {
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
invoice_number: "ih",
|
||||
isinhouse: true,
|
||||
date: new dayjs(),
|
||||
total: 0,
|
||||
billlines: values.parts_order_lines.data.map((p) => {
|
||||
return {
|
||||
joblineid: p.job_line_id,
|
||||
actual_price: p.act_price,
|
||||
actual_cost: 0, //p.act_price,
|
||||
line_desc: p.line_desc,
|
||||
line_remarks: p.line_remarks,
|
||||
part_type: p.part_type,
|
||||
quantity: p.quantity || 1,
|
||||
applicable_taxes: {
|
||||
local: false,
|
||||
state: false,
|
||||
federal: false,
|
||||
},
|
||||
};
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
toggleModalVisible();
|
||||
return;
|
||||
}
|
||||
|
||||
if (refetch) refetch();
|
||||
|
||||
const Templates = TemplateList("partsorder", context);
|
||||
|
||||
if (sendType === "e") {
|
||||
const matchingVendor = data.vendors.filter(
|
||||
(item) => item.id === values.vendorid
|
||||
)[0];
|
||||
|
||||
let vendorEmails =
|
||||
matchingVendor &&
|
||||
matchingVendor.email &&
|
||||
matchingVendor.email.split(RegExp("[;,]"));
|
||||
|
||||
GenerateDocument(
|
||||
{
|
||||
name: isReturn
|
||||
? Templates.parts_return_slip.key
|
||||
: order_type === "parts_order"
|
||||
? Templates.parts_order.key
|
||||
: Templates.sublet_order.key,
|
||||
variables: {
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
},
|
||||
{
|
||||
to: matchingVendor ? vendorEmails : null,
|
||||
replyTo: bodyshop.email,
|
||||
subject: isReturn
|
||||
? Templates.parts_return_slip.subject
|
||||
: order_type === "parts_order"
|
||||
? Templates.parts_order.subject
|
||||
: Templates.sublet_order.subject,
|
||||
},
|
||||
"e",
|
||||
jobId
|
||||
);
|
||||
} else if (sendType === "p") {
|
||||
GenerateDocument(
|
||||
{
|
||||
name: isReturn
|
||||
? Templates.parts_return_slip.key
|
||||
: order_type === "parts_order"
|
||||
? Templates.parts_order.key
|
||||
: Templates.sublet_order.key,
|
||||
variables: {
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
},
|
||||
{},
|
||||
"p"
|
||||
);
|
||||
} else if (sendType === "oec") {
|
||||
//Send to Partner OEC.
|
||||
try {
|
||||
const partsOrder = await client.query({
|
||||
query: QUERY_PARTS_ORDER_OEC,
|
||||
variables: {
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
});
|
||||
let po;
|
||||
//Massage the data based on the split. Should they be able to overwrite OEC pricing?
|
||||
if (OEConnection_PriceChange.treatment === "on") {
|
||||
//Set the flag to include the override.
|
||||
po = _.cloneDeep(partsOrder.data.parts_orders_by_pk);
|
||||
po.parts_order_lines.forEach((pol) => {
|
||||
pol.priceChange = true;
|
||||
});
|
||||
}
|
||||
|
||||
const oecResponse = await axios.post(
|
||||
"http://localhost:1337/oec/",
|
||||
|
||||
po || partsOrder.data.parts_orders_by_pk,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
|
||||
insertResult = await insertPartOrder({
|
||||
variables: {
|
||||
po: [
|
||||
{
|
||||
...values,
|
||||
order_date: dayjs().format("YYYY-MM-DD"),
|
||||
orderedby: currentUser.email,
|
||||
jobid: jobId,
|
||||
user_email: currentUser.email,
|
||||
return: isReturn,
|
||||
status: is_quote
|
||||
? bodyshop.md_order_statuses.default_quote || "Quote"
|
||||
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (oecResponse.data && oecResponse.data.success === false) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("parts_orders.errors.oec", {
|
||||
error: oecResponse.data.error,
|
||||
}),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error OEC.", error);
|
||||
notification["error"]({
|
||||
message: t("parts_orders.errors.oec", {
|
||||
error: JSON.stringify(error.message),
|
||||
}),
|
||||
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"],
|
||||
});
|
||||
setSaving(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setSaving(false);
|
||||
toggleModalVisible();
|
||||
};
|
||||
|
||||
const initialValues = {
|
||||
jobid: jobId,
|
||||
return: isReturn,
|
||||
deliver_by: isReturn ? dayjs(new Date()) : null,
|
||||
vendorid: vendorId,
|
||||
returnfrombill: returnFromBill,
|
||||
|
||||
parts_order_lines: {
|
||||
data: linesToOrder
|
||||
? linesToOrder.reduce((acc, value) => {
|
||||
acc.push({
|
||||
line_desc: value.line_desc,
|
||||
oem_partno: value.oem_partno,
|
||||
db_price: value.db_price,
|
||||
act_price: value.act_price,
|
||||
cost: value.cost,
|
||||
quantity: value.part_qty,
|
||||
job_line_id: isReturn ? value.joblineid : value.id,
|
||||
part_type: value.part_type,
|
||||
...(isReturn && { cm_received: false }),
|
||||
if (!!insertResult.errors) {
|
||||
notification["error"]({
|
||||
message: t("parts_orders.errors.creating"),
|
||||
description: JSON.stringify(insertResult.errors),
|
||||
});
|
||||
return acc;
|
||||
}, [])
|
||||
: [],
|
||||
},
|
||||
};
|
||||
return;
|
||||
}
|
||||
notification["success"]({
|
||||
message: values.isReturn
|
||||
? t("parts_orders.successes.return_created")
|
||||
: t("parts_orders.successes.created"),
|
||||
});
|
||||
insertAuditTrail({
|
||||
jobid: jobId,
|
||||
operation: isReturn
|
||||
? AuditTrailMapping.jobspartsreturn(
|
||||
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||
)
|
||||
: AuditTrailMapping.jobspartsorder(
|
||||
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||
),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && !!linesToOrder) {
|
||||
form.resetFields();
|
||||
}
|
||||
}, [visible, linesToOrder, form]);
|
||||
const jobLinesResult = await updateJobLines({
|
||||
variables: {
|
||||
ids: values.parts_order_lines.data
|
||||
.filter((item) => item.job_line_id)
|
||||
.map((item) => item.job_line_id),
|
||||
status: isReturn
|
||||
? bodyshop.md_order_statuses.default_returned || "Returned*"
|
||||
: is_quote
|
||||
? bodyshop.md_order_statuses.default_quote || "Quote"
|
||||
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={visible}
|
||||
title={
|
||||
isReturn
|
||||
? `${t("parts_orders.labels.returnpartsorder")} ${invoiceNumber}`
|
||||
: t("parts_orders.labels.newpartsorder")
|
||||
}
|
||||
onCancel={() => toggleModalVisible()}
|
||||
onOk={() => form.submit()}
|
||||
okButtonProps={{ loading: saving }}
|
||||
cancelButtonProps={{ loading: saving }}
|
||||
destroyOnClose
|
||||
width="75%"
|
||||
forceRender
|
||||
>
|
||||
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
autoComplete="no"
|
||||
onFinish={handleFinish}
|
||||
initialValues={initialValues}
|
||||
>
|
||||
{loading ? (
|
||||
<LoadingSpinner />
|
||||
) : (
|
||||
<PartsOrderModalComponent
|
||||
form={form}
|
||||
vendorList={(data && data.vendors) || []}
|
||||
sendTypeState={sendTypeState}
|
||||
isReturn={isReturn}
|
||||
preferredMake={data && data.jobs[0] && data.jobs[0].v_make_desc}
|
||||
job={job}
|
||||
/>
|
||||
)}
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
if (!isReturn && removefrompartsqueue) {
|
||||
await updateJob({
|
||||
variables: {
|
||||
jobId: jobId,
|
||||
job: {
|
||||
queued_for_parts: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!!jobLinesResult.errors) {
|
||||
notification["error"]({
|
||||
message: t("parts_orders.errors.creating"),
|
||||
description: JSON.stringify(jobLinesResult.errors),
|
||||
});
|
||||
}
|
||||
|
||||
if (values.vendorid === bodyshop.inhousevendorid) {
|
||||
setBillEnterContext({
|
||||
actions: {refetch: refetch},
|
||||
context: {
|
||||
disableInvNumber: true,
|
||||
job: {id: jobId},
|
||||
bill: {
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
invoice_number: "ih",
|
||||
isinhouse: true,
|
||||
date: new dayjs(),
|
||||
total: 0,
|
||||
billlines: values.parts_order_lines.data.map((p) => {
|
||||
return {
|
||||
joblineid: p.job_line_id,
|
||||
actual_price: p.act_price,
|
||||
actual_cost: 0, //p.act_price,
|
||||
line_desc: p.line_desc,
|
||||
line_remarks: p.line_remarks,
|
||||
part_type: p.part_type,
|
||||
quantity: p.quantity || 1,
|
||||
applicable_taxes: {
|
||||
local: false,
|
||||
state: false,
|
||||
federal: false,
|
||||
},
|
||||
};
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
toggleModalVisible();
|
||||
return;
|
||||
}
|
||||
|
||||
if (refetch) refetch();
|
||||
|
||||
const Templates = TemplateList("partsorder", context);
|
||||
|
||||
if (sendType === "e") {
|
||||
const matchingVendor = data.vendors.filter(
|
||||
(item) => item.id === values.vendorid
|
||||
)[0];
|
||||
|
||||
let vendorEmails =
|
||||
matchingVendor &&
|
||||
matchingVendor.email &&
|
||||
matchingVendor.email.split(RegExp("[;,]"));
|
||||
|
||||
GenerateDocument(
|
||||
{
|
||||
name: isReturn
|
||||
? Templates.parts_return_slip.key
|
||||
: order_type === "parts_order"
|
||||
? Templates.parts_order.key
|
||||
: Templates.sublet_order.key,
|
||||
variables: {
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
},
|
||||
{
|
||||
to: matchingVendor ? vendorEmails : null,
|
||||
replyTo: bodyshop.email,
|
||||
subject: isReturn
|
||||
? Templates.parts_return_slip.subject
|
||||
: order_type === "parts_order"
|
||||
? Templates.parts_order.subject
|
||||
: Templates.sublet_order.subject,
|
||||
},
|
||||
"e",
|
||||
jobId
|
||||
);
|
||||
} else if (sendType === "p") {
|
||||
GenerateDocument(
|
||||
{
|
||||
name: isReturn
|
||||
? Templates.parts_return_slip.key
|
||||
: order_type === "parts_order"
|
||||
? Templates.parts_order.key
|
||||
: Templates.sublet_order.key,
|
||||
variables: {
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
},
|
||||
{},
|
||||
"p"
|
||||
);
|
||||
} else if (sendType === "oec") {
|
||||
//Send to Partner OEC.
|
||||
try {
|
||||
const partsOrder = await client.query({
|
||||
query: QUERY_PARTS_ORDER_OEC,
|
||||
variables: {
|
||||
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||
},
|
||||
});
|
||||
let po;
|
||||
//Massage the data based on the split. Should they be able to overwrite OEC pricing?
|
||||
if (OEConnection_PriceChange.treatment === "on") {
|
||||
//Set the flag to include the override.
|
||||
po = _.cloneDeep(partsOrder.data.parts_orders_by_pk);
|
||||
po.parts_order_lines.forEach((pol) => {
|
||||
pol.priceChange = true;
|
||||
});
|
||||
}
|
||||
|
||||
const oecResponse = await axios.post(
|
||||
"http://localhost:1337/oec/",
|
||||
|
||||
po || partsOrder.data.parts_orders_by_pk,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (oecResponse.data && oecResponse.data.success === false) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("parts_orders.errors.oec", {
|
||||
error: oecResponse.data.error,
|
||||
}),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error OEC.", error);
|
||||
notification["error"]({
|
||||
message: t("parts_orders.errors.oec", {
|
||||
error: JSON.stringify(error.message),
|
||||
}),
|
||||
});
|
||||
setSaving(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setSaving(false);
|
||||
toggleModalVisible();
|
||||
};
|
||||
|
||||
const initialValues = {
|
||||
jobid: jobId,
|
||||
return: isReturn,
|
||||
deliver_by: isReturn ? dayjs(new Date()) : null,
|
||||
vendorid: vendorId,
|
||||
returnfrombill: returnFromBill,
|
||||
|
||||
parts_order_lines: {
|
||||
data: linesToOrder
|
||||
? linesToOrder.reduce((acc, value) => {
|
||||
acc.push({
|
||||
line_desc: value.line_desc,
|
||||
oem_partno: value.oem_partno,
|
||||
db_price: value.db_price,
|
||||
act_price: value.act_price,
|
||||
cost: value.cost,
|
||||
quantity: value.part_qty,
|
||||
job_line_id: isReturn ? value.joblineid : value.id,
|
||||
part_type: value.part_type,
|
||||
...(isReturn && {cm_received: false}),
|
||||
});
|
||||
return acc;
|
||||
}, [])
|
||||
: [],
|
||||
},
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && !!linesToOrder) {
|
||||
form.resetFields();
|
||||
}
|
||||
}, [visible, linesToOrder, form]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={visible}
|
||||
title={
|
||||
isReturn
|
||||
? `${t("parts_orders.labels.returnpartsorder")} ${invoiceNumber}`
|
||||
: t("parts_orders.labels.newpartsorder")
|
||||
}
|
||||
onCancel={() => toggleModalVisible()}
|
||||
onOk={() => form.submit()}
|
||||
okButtonProps={{loading: saving}}
|
||||
cancelButtonProps={{loading: saving}}
|
||||
destroyOnClose
|
||||
width="75%"
|
||||
forceRender
|
||||
>
|
||||
{error ? <AlertComponent message={error.message} type="error"/> : null}
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
autoComplete="no"
|
||||
onFinish={handleFinish}
|
||||
initialValues={initialValues}
|
||||
>
|
||||
{loading ? (
|
||||
<LoadingSpinner/>
|
||||
) : (
|
||||
<PartsOrderModalComponent
|
||||
form={form}
|
||||
vendorList={(data && data.vendors) || []}
|
||||
sendTypeState={sendTypeState}
|
||||
isReturn={isReturn}
|
||||
preferredMake={data && data.jobs[0] && data.jobs[0].v_make_desc}
|
||||
job={job}
|
||||
/>
|
||||
)}
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(PartsOrderModalContainer);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Form, Input, Radio, Select } from "antd";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {Form, Input, Radio, Select} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import DatePickerFormItem from "../form-date-picker/form-date-picker.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import JobSearchSelect from "../job-search-select/job-search-select.component";
|
||||
@@ -12,150 +12,149 @@ import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import PaymentFormTotalPayments from "./payment-form.totalpayments.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export function PaymentFormComponent({
|
||||
form,
|
||||
bodyshop,
|
||||
disabled,
|
||||
}) {
|
||||
const { Qb_Multi_Ar } = useTreatments(
|
||||
["Qb_Multi_Ar"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
export function PaymentFormComponent({form, bodyshop, disabled,}) {
|
||||
|
||||
const { t } = useTranslation();
|
||||
const {treatments: {Qb_Multi_Ar}} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Qb_Multi_Ar"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
name="jobid"
|
||||
label={t("bills.fields.ro_number")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<JobSearchSelect disabled={disabled} notExported={false} clm_no />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
shouldUpdate={(prev, cur) => cur.jobid && prev.jobid !== cur.jobid}
|
||||
>
|
||||
{() => {
|
||||
return (
|
||||
<PaymentFormTotalPayments jobid={form.getFieldValue("jobid")} />
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("payments.fields.amount")}
|
||||
name="amount"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<CurrencyInput disabled={disabled} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("payments.fields.transactionid")}
|
||||
name="transactionid"
|
||||
>
|
||||
<Input disabled={disabled} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("payments.fields.memo")} name="memo">
|
||||
<Input disabled={disabled} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("payments.fields.date")}
|
||||
name="date"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DatePickerFormItem disabled={disabled} />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
const {t} = useTranslation();
|
||||
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("payments.fields.payer")}
|
||||
name="payer"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select disabled={disabled}>
|
||||
<Select.Option value={t("payments.labels.customer")}>
|
||||
{t("payments.labels.customer")}
|
||||
</Select.Option>
|
||||
{Qb_Multi_Ar.treatment === "on" ? (
|
||||
<>
|
||||
<Select.OptGroup label={t("payments.labels.external")}>
|
||||
{bodyshop.md_ins_cos.map((i, idx) => (
|
||||
<Select.Option key={idx} value={i.name}>
|
||||
{i.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select.OptGroup>
|
||||
</>
|
||||
) : (
|
||||
<Select.Option value={t("payments.labels.insurance")}>
|
||||
{t("payments.labels.insurance")}
|
||||
</Select.Option>
|
||||
)}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
return (
|
||||
<div>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
name="jobid"
|
||||
label={t("bills.fields.ro_number")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<JobSearchSelect disabled={disabled} notExported={false} clm_no/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
shouldUpdate={(prev, cur) => cur.jobid && prev.jobid !== cur.jobid}
|
||||
>
|
||||
{() => {
|
||||
return (
|
||||
<PaymentFormTotalPayments jobid={form.getFieldValue("jobid")}/>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
|
||||
<Form.Item
|
||||
label={t("payments.fields.type")}
|
||||
name="type"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select disabled={disabled}>
|
||||
{bodyshop.md_payment_types.map((v, idx) => (
|
||||
<Select.Option key={idx} value={v}>
|
||||
{v}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("general.labels.sendby")}
|
||||
name="sendby"
|
||||
initialValue="none"
|
||||
>
|
||||
<Radio.Group disabled={disabled}>
|
||||
<Radio value="none">{t("general.labels.none")}</Radio>
|
||||
<Radio value="email">{t("general.labels.email")}</Radio>
|
||||
<Radio value="print">{t("general.labels.print")}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
</div>
|
||||
);
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("payments.fields.amount")}
|
||||
name="amount"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<CurrencyInput disabled={disabled}/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("payments.fields.transactionid")}
|
||||
name="transactionid"
|
||||
>
|
||||
<Input disabled={disabled}/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("payments.fields.memo")} name="memo">
|
||||
<Input disabled={disabled}/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("payments.fields.date")}
|
||||
name="date"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DatePickerFormItem disabled={disabled}/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("payments.fields.payer")}
|
||||
name="payer"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select disabled={disabled}>
|
||||
<Select.Option value={t("payments.labels.customer")}>
|
||||
{t("payments.labels.customer")}
|
||||
</Select.Option>
|
||||
{Qb_Multi_Ar.treatment === "on" ? (
|
||||
<>
|
||||
<Select.OptGroup label={t("payments.labels.external")}>
|
||||
{bodyshop.md_ins_cos.map((i, idx) => (
|
||||
<Select.Option key={idx} value={i.name}>
|
||||
{i.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select.OptGroup>
|
||||
</>
|
||||
) : (
|
||||
<Select.Option value={t("payments.labels.insurance")}>
|
||||
{t("payments.labels.insurance")}
|
||||
</Select.Option>
|
||||
)}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("payments.fields.type")}
|
||||
name="type"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select disabled={disabled}>
|
||||
{bodyshop.md_payment_types.map((v, idx) => (
|
||||
<Select.Option key={idx} value={v}>
|
||||
{v}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("general.labels.sendby")}
|
||||
name="sendby"
|
||||
initialValue="none"
|
||||
>
|
||||
<Radio.Group disabled={disabled}>
|
||||
<Radio value="none">{t("general.labels.none")}</Radio>
|
||||
<Radio value="email">{t("general.labels.email")}</Radio>
|
||||
<Radio value="print">{t("general.labels.print")}</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(PaymentFormComponent);
|
||||
|
||||
@@ -23,7 +23,7 @@ export function ProductionlistColumnTouchTime({ bodyshop, job }) {
|
||||
|
||||
const Difference_In_Days = dayjs().diff(
|
||||
dayjs(job.actual_in),
|
||||
"days",
|
||||
"day",
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@@ -1,319 +1,306 @@
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Button,
|
||||
Dropdown,
|
||||
Input,
|
||||
Menu,
|
||||
Space,
|
||||
Statistic,
|
||||
Table,
|
||||
} from "antd";
|
||||
import {SyncOutlined} from "@ant-design/icons";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {Button, Dropdown, Input, Menu, Space, Statistic, Table,} from "antd";
|
||||
import {PageHeader} from "@ant-design/pro-layout";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import React, {useMemo, useState} from "react";
|
||||
import ReactDragListView from "react-drag-listview";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectTechnician} from "../../redux/tech/tech.selectors";
|
||||
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
|
||||
import ProductionListColumnsAdd from "../production-list-columns/production-list-columns.add.component";
|
||||
import ProductionListColumns from "../production-list-columns/production-list-columns.data";
|
||||
import ProductionListDetail from "../production-list-detail/production-list-detail.component";
|
||||
import ProductionListSaveConfigButton from "../production-list-save-config-button/production-list-save-config-button.component";
|
||||
import ProductionListSaveConfigButton
|
||||
from "../production-list-save-config-button/production-list-save-config-button.component";
|
||||
import ProductionListPrint from "./production-list-print.component";
|
||||
import ProductionListTableViewSelect from "./production-list-table-view-select.component";
|
||||
import ResizeableTitle from "./production-list-table.resizeable.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
technician: selectTechnician,
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop,
|
||||
technician: selectTechnician,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
|
||||
export function ProductionListTable({
|
||||
loading,
|
||||
data,
|
||||
refetch,
|
||||
bodyshop,
|
||||
technician,
|
||||
currentUser,
|
||||
}) {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const { Production_List_Status_Colors } = useTreatments(
|
||||
["Production_List_Status_Colors"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
);
|
||||
export function ProductionListTable({loading, data, refetch, bodyshop, technician, currentUser}) {
|
||||
|
||||
const defaultView = assoc && assoc.default_prod_list_view;
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
const [state, setState] = useState(
|
||||
(bodyshop.production_config &&
|
||||
bodyshop.production_config.find((p) => p.name === defaultView)?.columns
|
||||
.tableState) ||
|
||||
bodyshop.production_config[0]?.columns.tableState || {
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" },
|
||||
}
|
||||
);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const matchingColumnConfig = useMemo(() => {
|
||||
return bodyshop.production_config.find((p) => p.name === defaultView);
|
||||
}, [bodyshop.production_config, defaultView]);
|
||||
|
||||
const [columns, setColumns] = useState(
|
||||
(state &&
|
||||
matchingColumnConfig &&
|
||||
matchingColumnConfig.columns.columnKeys.map((k) => {
|
||||
return {
|
||||
...ProductionListColumns({
|
||||
bodyshop,
|
||||
technician,
|
||||
state,
|
||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||
}).find((e) => e.key === k.key),
|
||||
width: k.width ?? 100,
|
||||
};
|
||||
})) ||
|
||||
[]
|
||||
);
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({
|
||||
...state,
|
||||
filteredInfo: filters,
|
||||
sortedInfo: { columnKey: sorter.columnKey, order: sorter.order },
|
||||
const { treatments: {Production_List_Status_Colors} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Production_List_Status_Colors"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
};
|
||||
|
||||
const onDragEnd = (fromIndex, toIndex) => {
|
||||
const columnsCopy = columns.slice();
|
||||
const item = columnsCopy.splice(fromIndex, 1)[0];
|
||||
columnsCopy.splice(toIndex, 0, item);
|
||||
setColumns(columnsCopy);
|
||||
};
|
||||
|
||||
const removeColumn = (e) => {
|
||||
const { key } = e;
|
||||
setColumns(columns.filter((i) => i.key !== key));
|
||||
};
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
);
|
||||
|
||||
const handleResize =
|
||||
(index) =>
|
||||
(e, { size }) => {
|
||||
const nextColumns = [...columns];
|
||||
nextColumns[index] = {
|
||||
...nextColumns[index],
|
||||
width: size.width,
|
||||
};
|
||||
setColumns(nextColumns);
|
||||
const defaultView = assoc && assoc.default_prod_list_view;
|
||||
|
||||
const [state, setState] = useState(
|
||||
(bodyshop.production_config &&
|
||||
bodyshop.production_config.find((p) => p.name === defaultView)?.columns
|
||||
.tableState) ||
|
||||
bodyshop.production_config[0]?.columns.tableState || {
|
||||
sortedInfo: {},
|
||||
filteredInfo: {text: ""},
|
||||
}
|
||||
);
|
||||
|
||||
const {t} = useTranslation();
|
||||
|
||||
const matchingColumnConfig = useMemo(() => {
|
||||
return bodyshop.production_config.find((p) => p.name === defaultView);
|
||||
}, [bodyshop.production_config, defaultView]);
|
||||
|
||||
const [columns, setColumns] = useState(
|
||||
(state &&
|
||||
matchingColumnConfig &&
|
||||
matchingColumnConfig.columns.columnKeys.map((k) => {
|
||||
return {
|
||||
...ProductionListColumns({
|
||||
bodyshop,
|
||||
technician,
|
||||
state,
|
||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||
}).find((e) => e.key === k.key),
|
||||
width: k.width ?? 100,
|
||||
};
|
||||
})) ||
|
||||
[]
|
||||
);
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({
|
||||
...state,
|
||||
filteredInfo: filters,
|
||||
sortedInfo: {columnKey: sorter.columnKey, order: sorter.order},
|
||||
});
|
||||
};
|
||||
|
||||
const headerItem = (col) => (
|
||||
<Dropdown
|
||||
className="prod-header-dropdown"
|
||||
overlay={
|
||||
<Menu onClick={removeColumn}>
|
||||
<Menu.Item key={col.key}>
|
||||
{t("production.actions.removecolumn")}
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
}
|
||||
trigger={["contextMenu"]}
|
||||
>
|
||||
<span>{col.title}</span>
|
||||
</Dropdown>
|
||||
);
|
||||
const onDragEnd = (fromIndex, toIndex) => {
|
||||
const columnsCopy = columns.slice();
|
||||
const item = columnsCopy.splice(fromIndex, 1)[0];
|
||||
columnsCopy.splice(toIndex, 0, item);
|
||||
setColumns(columnsCopy);
|
||||
};
|
||||
|
||||
const dataSource =
|
||||
searchText === ""
|
||||
? data
|
||||
: data.filter(
|
||||
(j) =>
|
||||
(j.ro_number || "")
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_co_nm || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_fn || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_ln || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.status || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(j.ins_co_nm || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(j.v_model_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.v_make_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase())
|
||||
);
|
||||
const removeColumn = (e) => {
|
||||
const {key} = e;
|
||||
setColumns(columns.filter((i) => i.key !== key));
|
||||
};
|
||||
|
||||
// const handleSelectRecord = (record) => {
|
||||
// if (selected !== record.id) {
|
||||
// setSelected(record.id);
|
||||
// } else {
|
||||
// setSelected(null);
|
||||
// }
|
||||
// };
|
||||
|
||||
if (!!!columns) return <div>No columns found.</div>;
|
||||
|
||||
const totalHrs = data
|
||||
.reduce(
|
||||
(acc, val) =>
|
||||
acc +
|
||||
(val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0) +
|
||||
(val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
const totalLAB = data
|
||||
.reduce(
|
||||
(acc, val) => acc + (val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
const totalLAR = data
|
||||
.reduce(
|
||||
(acc, val) => acc + (val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
return (
|
||||
<div>
|
||||
<PageHeader
|
||||
title={
|
||||
<Space>
|
||||
<Statistic
|
||||
title={t("dashboard.titles.productionhours")}
|
||||
value={totalHrs}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("dashboard.titles.labhours")}
|
||||
value={totalLAB}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("dashboard.titles.larhours")}
|
||||
value={totalLAR}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("appointments.labels.inproduction")}
|
||||
value={dataSource && dataSource.length}
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch && refetch()}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
<ProductionListColumnsAdd
|
||||
columnState={[columns, setColumns]}
|
||||
tableState={state}
|
||||
/>
|
||||
<ProductionListSaveConfigButton
|
||||
columns={columns}
|
||||
tableState={state}
|
||||
/>
|
||||
|
||||
<ProductionListTableViewSelect
|
||||
state={state}
|
||||
setState={setState}
|
||||
setColumns={setColumns}
|
||||
/>
|
||||
|
||||
<Input
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
placeholder={t("general.labels.search")}
|
||||
value={searchText}
|
||||
/>
|
||||
<ProductionListPrint />
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
<ProductionListDetail jobs={dataSource} />
|
||||
<ReactDragListView.DragColumn
|
||||
onDragEnd={onDragEnd}
|
||||
nodeSelector="th"
|
||||
handleSelector=".prod-header-dropdown"
|
||||
>
|
||||
<Table
|
||||
sticky
|
||||
pagination={false}
|
||||
size="small"
|
||||
{...(Production_List_Status_Colors.treatment === "on" && {
|
||||
onRow: (record, index) => {
|
||||
if (!bodyshop.md_ro_statuses.production_colors) return null;
|
||||
|
||||
const color = bodyshop.md_ro_statuses.production_colors.find(
|
||||
(x) => x.status === record.status
|
||||
);
|
||||
|
||||
if (!color) {
|
||||
if (index % 2 === 0)
|
||||
return {
|
||||
style: {
|
||||
backgroundColor: `rgb(236, 236, 236)`,
|
||||
},
|
||||
};
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
className: "rowWithColor",
|
||||
style: {
|
||||
"--bgColor": `rgb(${color.color.r},${color.color.g},${color.color.b},${color.color.a})`,
|
||||
},
|
||||
};
|
||||
},
|
||||
})}
|
||||
components={{
|
||||
header: {
|
||||
cell: ResizeableTitle,
|
||||
},
|
||||
}}
|
||||
columns={columns.map((c, index) => {
|
||||
return {
|
||||
...c,
|
||||
filteredValue: state.filteredInfo[c.key] || null,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
||||
title: headerItem(c),
|
||||
ellipsis: true,
|
||||
width: c.width ?? 100,
|
||||
onHeaderCell: (column) => ({
|
||||
width: column.width,
|
||||
onResize: handleResize(index),
|
||||
}),
|
||||
const handleResize =
|
||||
(index) =>
|
||||
(e, {size}) => {
|
||||
const nextColumns = [...columns];
|
||||
nextColumns[index] = {
|
||||
...nextColumns[index],
|
||||
width: size.width,
|
||||
};
|
||||
setColumns(nextColumns);
|
||||
};
|
||||
})}
|
||||
rowKey="id"
|
||||
loading={loading}
|
||||
dataSource={dataSource}
|
||||
scroll={{ x: 1000 }}
|
||||
onChange={handleTableChange}
|
||||
/>
|
||||
</ReactDragListView.DragColumn>
|
||||
</div>
|
||||
);
|
||||
|
||||
const headerItem = (col) => (
|
||||
<Dropdown
|
||||
className="prod-header-dropdown"
|
||||
overlay={
|
||||
<Menu onClick={removeColumn}>
|
||||
<Menu.Item key={col.key}>
|
||||
{t("production.actions.removecolumn")}
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
}
|
||||
trigger={["contextMenu"]}
|
||||
>
|
||||
<span>{col.title}</span>
|
||||
</Dropdown>
|
||||
);
|
||||
|
||||
const dataSource =
|
||||
searchText === ""
|
||||
? data
|
||||
: data.filter(
|
||||
(j) =>
|
||||
(j.ro_number || "")
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_co_nm || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_fn || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_ln || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.status || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(j.ins_co_nm || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(j.v_model_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.v_make_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase())
|
||||
);
|
||||
|
||||
// const handleSelectRecord = (record) => {
|
||||
// if (selected !== record.id) {
|
||||
// setSelected(record.id);
|
||||
// } else {
|
||||
// setSelected(null);
|
||||
// }
|
||||
// };
|
||||
|
||||
if (!!!columns) return <div>No columns found.</div>;
|
||||
|
||||
const totalHrs = data
|
||||
.reduce(
|
||||
(acc, val) =>
|
||||
acc +
|
||||
(val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0) +
|
||||
(val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
const totalLAB = data
|
||||
.reduce(
|
||||
(acc, val) => acc + (val.labhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
const totalLAR = data
|
||||
.reduce(
|
||||
(acc, val) => acc + (val.larhrs?.aggregate?.sum?.mod_lb_hrs || 0),
|
||||
0
|
||||
)
|
||||
.toFixed(1);
|
||||
return (
|
||||
<div>
|
||||
<PageHeader
|
||||
title={
|
||||
<Space>
|
||||
<Statistic
|
||||
title={t("dashboard.titles.productionhours")}
|
||||
value={totalHrs}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("dashboard.titles.labhours")}
|
||||
value={totalLAB}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("dashboard.titles.larhours")}
|
||||
value={totalLAR}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("appointments.labels.inproduction")}
|
||||
value={dataSource && dataSource.length}
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch && refetch()}>
|
||||
<SyncOutlined/>
|
||||
</Button>
|
||||
<ProductionListColumnsAdd
|
||||
columnState={[columns, setColumns]}
|
||||
tableState={state}
|
||||
/>
|
||||
<ProductionListSaveConfigButton
|
||||
columns={columns}
|
||||
tableState={state}
|
||||
/>
|
||||
|
||||
<ProductionListTableViewSelect
|
||||
state={state}
|
||||
setState={setState}
|
||||
setColumns={setColumns}
|
||||
/>
|
||||
|
||||
<Input
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
placeholder={t("general.labels.search")}
|
||||
value={searchText}
|
||||
/>
|
||||
<ProductionListPrint/>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
<ProductionListDetail jobs={dataSource}/>
|
||||
<ReactDragListView.DragColumn
|
||||
onDragEnd={onDragEnd}
|
||||
nodeSelector="th"
|
||||
handleSelector=".prod-header-dropdown"
|
||||
>
|
||||
<Table
|
||||
sticky
|
||||
pagination={false}
|
||||
size="small"
|
||||
{...(Production_List_Status_Colors.treatment === "on" && {
|
||||
onRow: (record, index) => {
|
||||
if (!bodyshop.md_ro_statuses.production_colors) return null;
|
||||
|
||||
const color = bodyshop.md_ro_statuses.production_colors.find(
|
||||
(x) => x.status === record.status
|
||||
);
|
||||
|
||||
if (!color) {
|
||||
if (index % 2 === 0)
|
||||
return {
|
||||
style: {
|
||||
backgroundColor: `rgb(236, 236, 236)`,
|
||||
},
|
||||
};
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
className: "rowWithColor",
|
||||
style: {
|
||||
"--bgColor": `rgb(${color.color.r},${color.color.g},${color.color.b},${color.color.a})`,
|
||||
},
|
||||
};
|
||||
},
|
||||
})}
|
||||
components={{
|
||||
header: {
|
||||
cell: ResizeableTitle,
|
||||
},
|
||||
}}
|
||||
columns={columns.map((c, index) => {
|
||||
return {
|
||||
...c,
|
||||
filteredValue: state.filteredInfo[c.key] || null,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
||||
title: headerItem(c),
|
||||
ellipsis: true,
|
||||
width: c.width ?? 100,
|
||||
onHeaderCell: (column) => ({
|
||||
width: column.width,
|
||||
onResize: handleResize(index),
|
||||
}),
|
||||
};
|
||||
})}
|
||||
rowKey="id"
|
||||
loading={loading}
|
||||
dataSource={dataSource}
|
||||
scroll={{x: 1000}}
|
||||
onChange={handleTableChange}
|
||||
/>
|
||||
</ReactDragListView.DragColumn>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(ProductionListTable);
|
||||
|
||||
@@ -251,7 +251,7 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="MM/DD/YYYY"
|
||||
ranges={DatePIckerRanges}
|
||||
presets={DatePIckerRanges}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
||||
|
||||
@@ -70,7 +70,7 @@ export function ScheduleJobModalComponent({
|
||||
form.setFieldsValue({
|
||||
scheduled_completion: dayjs(values.start).businessAdd(
|
||||
totalHours / bodyshop.target_touchtime,
|
||||
"days"
|
||||
"day"
|
||||
),
|
||||
});
|
||||
}
|
||||
@@ -138,7 +138,7 @@ export function ScheduleJobModalComponent({
|
||||
if (ssDate.isBefore(dayjs())) {
|
||||
form.setFieldsValue({ start: dayjs() });
|
||||
} else {
|
||||
form.setFieldsValue({ start: dayjs(d).add(8, "hours") });
|
||||
form.setFieldsValue({ start: dayjs(d).add(8, "hour") });
|
||||
}
|
||||
handleDateBlur();
|
||||
}}
|
||||
|
||||
@@ -61,9 +61,9 @@ export const ListOfDaysInCurrentMonth = () => {
|
||||
const days = [];
|
||||
const dateStart = dayjs().startOf("month");
|
||||
const dateEnd = dayjs().endOf("month");
|
||||
while (dateEnd.diff(dateStart, "days") > 0) {
|
||||
while (dateEnd.diff(dateStart, "day") > 0) {
|
||||
days.push(dateStart.format("YYYY-MM-DD"));
|
||||
dateStart.add(1, "days");
|
||||
dateStart.add(1, "day");
|
||||
}
|
||||
days.push(dateEnd.format("YYYY-MM-DD"));
|
||||
return days;
|
||||
@@ -73,9 +73,9 @@ export const ListDaysBetween = ({ start, end }) => {
|
||||
const days = [];
|
||||
const dateStart = dayjs(start);
|
||||
const dateEnd = dayjs(end);
|
||||
while (dateEnd.diff(dateStart, "days") > 0) {
|
||||
while (dateEnd.diff(dateStart, "day") > 0) {
|
||||
days.push(dateStart.format("YYYY-MM-DD"));
|
||||
dateStart.add(1, "days");
|
||||
dateStart.add(1, "day");
|
||||
}
|
||||
days.push(dateEnd.format("YYYY-MM-DD"));
|
||||
return days;
|
||||
|
||||
@@ -132,7 +132,7 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
||||
dataIndex: "length",
|
||||
key: "length",
|
||||
render: (text, record) =>
|
||||
dayjs(record.end).diff(dayjs(record.start), "days", true).toFixed(1),
|
||||
dayjs(record.end).diff(dayjs(record.start), "day", true).toFixed(1),
|
||||
},
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Button, Card, Tabs } from "antd";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {Button, Card, Tabs} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import ShopInfoGeneral from "./shop-info.general.component";
|
||||
import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component";
|
||||
import ShopInfoLaborRates from "./shop-info.laborrates.component";
|
||||
@@ -15,88 +15,90 @@ import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycen
|
||||
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
||||
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
|
||||
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import {useLocation, useNavigate} from "react-router-dom";
|
||||
import queryString from "query-string";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoComponent);
|
||||
|
||||
export function ShopInfoComponent({ bodyshop, form, saveLoading }) {
|
||||
const { CriticalPartsScanning } = useTreatments(
|
||||
["CriticalPartsScanning"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
const { t } = useTranslation();
|
||||
const history = useNavigate();
|
||||
const location = useLocation();
|
||||
const search = queryString.parse(location.search);
|
||||
export function ShopInfoComponent({bodyshop, form, saveLoading}) {
|
||||
|
||||
return (
|
||||
<Card
|
||||
extra={
|
||||
<Button
|
||||
type="primary"
|
||||
loading={saveLoading}
|
||||
onClick={() => form.submit()}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<Tabs
|
||||
defaultActiveKey={search.subtab}
|
||||
onChange={(key) =>
|
||||
history({
|
||||
search: `?tab=${search.tab}&subtab=${key}`,
|
||||
})
|
||||
}
|
||||
>
|
||||
<Tabs.TabPane key="general" tab={t("bodyshop.labels.shopinfo")}>
|
||||
<ShopInfoGeneral form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="speedprint" tab={t("bodyshop.labels.speedprint")}>
|
||||
<ShopInfoSpeedPrint form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="rbac" tab={t("bodyshop.labels.rbac")}>
|
||||
<ShopInfoRbacComponent form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="roStatus" tab={t("bodyshop.labels.jobstatuses")}>
|
||||
<ShopInfoROStatusComponent form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="scheduling" tab={t("bodyshop.labels.scheduling")}>
|
||||
<ShopInfoSchedulingComponent form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane
|
||||
key="orderStatus"
|
||||
tab={t("bodyshop.labels.orderstatuses")}
|
||||
>
|
||||
<ShopInfoOrderStatusComponent form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane
|
||||
key="responsibilityCenters"
|
||||
tab={t("bodyshop.labels.responsibilitycenters.title")}
|
||||
>
|
||||
<ShopInfoResponsibilityCenterComponent form={form} />
|
||||
</Tabs.TabPane>
|
||||
const { treatments: {CriticalPartsScanning} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["CriticalPartsScanning"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
<Tabs.TabPane key="checklists" tab={t("bodyshop.labels.checklists")}>
|
||||
<ShopInfoIntakeChecklistComponent form={form} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="laborrates" tab={t("bodyshop.labels.laborrates")}>
|
||||
<ShopInfoLaborRates form={form} />
|
||||
</Tabs.TabPane>
|
||||
{CriticalPartsScanning.treatment === "on" && (
|
||||
<Tabs.TabPane key="partsscan" tab={t("bodyshop.labels.partsscan")}>
|
||||
<ShopInfoPartsScan form={form} />
|
||||
</Tabs.TabPane>
|
||||
)}
|
||||
</Tabs>
|
||||
</Card>
|
||||
);
|
||||
const {t} = useTranslation();
|
||||
const history = useNavigate();
|
||||
const location = useLocation();
|
||||
const search = queryString.parse(location.search);
|
||||
|
||||
return (
|
||||
<Card
|
||||
extra={
|
||||
<Button
|
||||
type="primary"
|
||||
loading={saveLoading}
|
||||
onClick={() => form.submit()}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<Tabs
|
||||
defaultActiveKey={search.subtab}
|
||||
onChange={(key) =>
|
||||
history({
|
||||
search: `?tab=${search.tab}&subtab=${key}`,
|
||||
})
|
||||
}
|
||||
>
|
||||
<Tabs.TabPane key="general" tab={t("bodyshop.labels.shopinfo")}>
|
||||
<ShopInfoGeneral form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="speedprint" tab={t("bodyshop.labels.speedprint")}>
|
||||
<ShopInfoSpeedPrint form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="rbac" tab={t("bodyshop.labels.rbac")}>
|
||||
<ShopInfoRbacComponent form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="roStatus" tab={t("bodyshop.labels.jobstatuses")}>
|
||||
<ShopInfoROStatusComponent form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="scheduling" tab={t("bodyshop.labels.scheduling")}>
|
||||
<ShopInfoSchedulingComponent form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane
|
||||
key="orderStatus"
|
||||
tab={t("bodyshop.labels.orderstatuses")}
|
||||
>
|
||||
<ShopInfoOrderStatusComponent form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane
|
||||
key="responsibilityCenters"
|
||||
tab={t("bodyshop.labels.responsibilitycenters.title")}
|
||||
>
|
||||
<ShopInfoResponsibilityCenterComponent form={form}/>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane key="checklists" tab={t("bodyshop.labels.checklists")}>
|
||||
<ShopInfoIntakeChecklistComponent form={form}/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="laborrates" tab={t("bodyshop.labels.laborrates")}>
|
||||
<ShopInfoLaborRates form={form}/>
|
||||
</Tabs.TabPane>
|
||||
{CriticalPartsScanning.treatment === "on" && (
|
||||
<Tabs.TabPane key="partsscan" tab={t("bodyshop.labels.partsscan")}>
|
||||
<ShopInfoPartsScan form={form}/>
|
||||
</Tabs.TabPane>
|
||||
)}
|
||||
</Tabs>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Button,
|
||||
DatePicker,
|
||||
@@ -35,13 +35,14 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoGeneral);
|
||||
|
||||
export function ShopInfoGeneral({ form, bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const { ClosingPeriod } = useTreatments(
|
||||
["ClosingPeriod"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { treatments: {ClosingPeriod} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["ClosingPeriod"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -413,13 +414,12 @@ export function ShopInfoGeneral({ form, bodyshop }) {
|
||||
{ClosingPeriod.treatment === "on" && (
|
||||
<>
|
||||
<Form.Item
|
||||
allowClear
|
||||
name={["accountingconfig", "ClosingPeriod"]}
|
||||
label={t("bodyshop.fields.closingperiod")} //{t("reportcenter.labels.dates")}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="MM/DD/YYYY"
|
||||
ranges={DatePickerRanges}
|
||||
presets={DatePickerRanges}
|
||||
/>
|
||||
</Form.Item>
|
||||
</>
|
||||
|
||||
@@ -1,94 +1,97 @@
|
||||
import { Form, Input } from "antd";
|
||||
import {Form, Input} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ShopInfoOrderStatusComponent);
|
||||
|
||||
export function ShopInfoOrderStatusComponent({ bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
const { OEConnection } = useTreatments(
|
||||
["OEConnection"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
return (
|
||||
<LayoutFormRow header={t("bodyshop.labels.orderstatuses")}>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_bo")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_bo"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_ordered")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_ordered"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
export function ShopInfoOrderStatusComponent({bodyshop, form}) {
|
||||
const {t} = useTranslation();
|
||||
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_received")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_received"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_returned")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_returned"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{OEConnection.treatment === "on" && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_quote")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_quote"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
);
|
||||
const {treatments: {OEConnection}} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["OEConnection"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<LayoutFormRow header={t("bodyshop.labels.orderstatuses")}>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_bo")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_bo"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_ordered")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_ordered"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_received")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_received"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_returned")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_returned"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
{OEConnection.treatment === "on" && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_quote")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_order_statuses", "default_quote"]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,411 +1,415 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Button, Form, Select, Space } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { ChromePicker } from "react-color";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {DeleteFilled} from "@ant-design/icons";
|
||||
import {Button, Form, Select, Space} from "antd";
|
||||
import React, {useState} from "react";
|
||||
import {ChromePicker} from "react-color";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ShopInfoROStatusComponent);
|
||||
|
||||
const SelectorDiv = styled.div`
|
||||
.ant-form-item .ant-select {
|
||||
width: 200px;
|
||||
}
|
||||
.ant-form-item .ant-select {
|
||||
width: 200px;
|
||||
}
|
||||
`;
|
||||
export function ShopInfoROStatusComponent({ bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
const { Production_List_Status_Colors } = useTreatments(
|
||||
["Production_List_Status_Colors"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const [options, setOptions] = useState(
|
||||
form.getFieldValue(["md_ro_statuses", "statuses"]) || []
|
||||
);
|
||||
export function ShopInfoROStatusComponent({bodyshop, form}) {
|
||||
|
||||
const handleBlur = () => {
|
||||
setOptions(form.getFieldValue(["md_ro_statuses", "statuses"]));
|
||||
};
|
||||
const {t} = useTranslation();
|
||||
|
||||
return (
|
||||
<SelectorDiv id="jobstatus">
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "statuses"]}
|
||||
label={t("bodyshop.labels.alljobstatuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="tags" onBlur={handleBlur} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "active_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.active_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "pre_production_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.pre_production_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "production_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.production_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "post_production_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.post_production_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "ready_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.ready_statuses")}
|
||||
rules={[
|
||||
{
|
||||
//required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "additional_board_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.additional_board_statuses")}
|
||||
rules={[
|
||||
{
|
||||
//required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<LayoutFormRow noDivider>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_scheduled")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_scheduled"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_arrived")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_arrived"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_exported")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_exported"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_imported")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_imported"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_invoiced")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_invoiced"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_completed")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_completed"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_delivered")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_delivered"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_void")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_void"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
{Production_List_Status_Colors.treatment === "on" && (
|
||||
<LayoutFormRow
|
||||
grow
|
||||
header={t("bodyshop.fields.statuses.production_colors")}
|
||||
id="production_colors"
|
||||
>
|
||||
<Form.List name={["md_ro_statuses", "production_colors"]}>
|
||||
{(fields, { add, remove, move }) => {
|
||||
return (
|
||||
<div>
|
||||
<LayoutFormRow>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item key={field.key}>
|
||||
<Space direction="vertical">
|
||||
<div style={{ display: "flex" }}>
|
||||
<Form.Item
|
||||
style={{ flex: 1 }}
|
||||
label={t("jobs.fields.status")}
|
||||
key={`${index}status`}
|
||||
name={[field.name, "status"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.color")}
|
||||
key={`${index}color`}
|
||||
name={[field.name, "color"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ColorPicker />
|
||||
</Form.Item>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
const { treatments: {Production_List_Status_Colors} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Production_List_Status_Colors"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const [options, setOptions] = useState(
|
||||
form.getFieldValue(["md_ro_statuses", "statuses"]) || []
|
||||
);
|
||||
|
||||
const handleBlur = () => {
|
||||
setOptions(form.getFieldValue(["md_ro_statuses", "statuses"]));
|
||||
};
|
||||
|
||||
return (
|
||||
<SelectorDiv id="jobstatus">
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "statuses"]}
|
||||
label={t("bodyshop.labels.alljobstatuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="tags" onBlur={handleBlur}/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "active_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.active_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</LayoutFormRow>
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{t("general.actions.add")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
</LayoutFormRow>
|
||||
)}
|
||||
</SelectorDiv>
|
||||
);
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "pre_production_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.pre_production_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "production_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.production_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "post_production_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.post_production_statuses")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "ready_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.ready_statuses")}
|
||||
rules={[
|
||||
{
|
||||
//required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ro_statuses", "additional_board_statuses"]}
|
||||
label={t("bodyshop.fields.statuses.additional_board_statuses")}
|
||||
rules={[
|
||||
{
|
||||
//required: true,
|
||||
//message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="multiple">
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<LayoutFormRow noDivider>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_scheduled")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_scheduled"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_arrived")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_arrived"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_exported")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_exported"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_imported")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_imported"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_invoiced")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_invoiced"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_completed")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_completed"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_delivered")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_delivered"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.default_void")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_ro_statuses", "default_void"]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
{Production_List_Status_Colors.treatment === "on" && (
|
||||
<LayoutFormRow
|
||||
grow
|
||||
header={t("bodyshop.fields.statuses.production_colors")}
|
||||
id="production_colors"
|
||||
>
|
||||
<Form.List name={["md_ro_statuses", "production_colors"]}>
|
||||
{(fields, {add, remove, move}) => {
|
||||
return (
|
||||
<div>
|
||||
<LayoutFormRow>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item key={field.key}>
|
||||
<Space direction="vertical">
|
||||
<div style={{display: "flex"}}>
|
||||
<Form.Item
|
||||
style={{flex: 1}}
|
||||
label={t("jobs.fields.status")}
|
||||
key={`${index}status`}
|
||||
name={[field.name, "status"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select>
|
||||
{options.map((item, idx) => (
|
||||
<Select.Option key={idx} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.statuses.color")}
|
||||
key={`${index}color`}
|
||||
name={[field.name, "color"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ColorPicker/>
|
||||
</Form.Item>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
))}
|
||||
</LayoutFormRow>
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{width: "100%"}}
|
||||
>
|
||||
{t("general.actions.add")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
</LayoutFormRow>
|
||||
)}
|
||||
</SelectorDiv>
|
||||
);
|
||||
}
|
||||
|
||||
export const ColorPicker = ({ value, onChange, style, ...restProps }) => {
|
||||
const handleChange = (color) => {
|
||||
if (onChange) onChange(color.rgb);
|
||||
};
|
||||
return (
|
||||
<ChromePicker
|
||||
{...restProps}
|
||||
color={value}
|
||||
onChangeComplete={handleChange}
|
||||
/>
|
||||
);
|
||||
export const ColorPicker = ({value, onChange, style, ...restProps}) => {
|
||||
const handleChange = (color) => {
|
||||
if (onChange) onChange(color.rgb);
|
||||
};
|
||||
return (
|
||||
<ChromePicker
|
||||
{...restProps}
|
||||
color={value}
|
||||
onChangeComplete={handleChange}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ export function TechJobPrintTickets({ technician, event, attendacePrint }) {
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
ranges={DatePIckerRanges}
|
||||
presets={DatePIckerRanges}
|
||||
format={"MM/DD/YYYY"}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
@@ -41,7 +41,7 @@ export default function TimeTicketsDatesSelector() {
|
||||
end ? dayjs(end) : dayjs().endOf("week"),
|
||||
]}
|
||||
format="MM/DD/YYYY"
|
||||
ranges={DatePickerRanges}
|
||||
presets={DatePickerRanges}
|
||||
onCalendarChange={handleChange}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -187,7 +187,7 @@ export function TimeTicketList({
|
||||
return (
|
||||
<div>
|
||||
{dayjs(record.clockoff)
|
||||
.diff(dayjs(record.clockon), "hours", true)
|
||||
.diff(dayjs(record.clockon), "hour", true)
|
||||
.toFixed(2)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -124,7 +124,7 @@ const JobRelatedTicketsTable = ({
|
||||
if (!!val.clockoff && !!val.clockon)
|
||||
return (
|
||||
acc +
|
||||
dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
|
||||
dayjs(val.clockoff).diff(dayjs(val.clockon), "hour", true)
|
||||
);
|
||||
return acc;
|
||||
}, 0);
|
||||
@@ -251,7 +251,7 @@ const ShiftRelatedTicketsTable = ({
|
||||
const clockHrs = item.tickets.reduce((acc, val) => {
|
||||
if (!!val.clockoff && !!val.clockon)
|
||||
return (
|
||||
acc + dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
|
||||
acc + dayjs(val.clockoff).diff(dayjs(val.clockon), "hour", true)
|
||||
);
|
||||
return acc;
|
||||
}, 0);
|
||||
|
||||
@@ -1,262 +1,249 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {
|
||||
Button,
|
||||
Divider,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Space,
|
||||
Switch,
|
||||
} from "antd";
|
||||
import {DeleteFilled} from "@ant-design/icons";
|
||||
import {useApolloClient} from "@apollo/client";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
import {Button, Divider, Form, Input, InputNumber, Space, Switch,} from "antd";
|
||||
import {PageHeader} from "@ant-design/pro-layout";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CHECK_VENDOR_NAME } from "../../graphql/vendors.queries";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {CHECK_VENDOR_NAME} from "../../graphql/vendors.queries";
|
||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||
import PhoneFormItem, {
|
||||
PhoneItemFormatterValidation,
|
||||
} from "../form-items-formatted/phone-form-item.component";
|
||||
import PhoneFormItem, {PhoneItemFormatterValidation,} from "../form-items-formatted/phone-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import VendorsPhonebookAdd from "../vendors-phonebook-add/vendors-phonebook-add.component";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(VendorsFormComponent);
|
||||
|
||||
export function VendorsFormComponent({
|
||||
bodyshop,
|
||||
form,
|
||||
formLoading,
|
||||
handleDelete,
|
||||
responsibilityCenters,
|
||||
selectedvendor,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const client = useApolloClient();
|
||||
const { DmsAp } = useTreatments(
|
||||
["DmsAp"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
export function VendorsFormComponent({bodyshop, form, formLoading, handleDelete, responsibilityCenters, selectedvendor}) {
|
||||
const {t} = useTranslation();
|
||||
const client = useApolloClient();
|
||||
|
||||
const { getFieldValue } = form;
|
||||
return (
|
||||
<div>
|
||||
<PageHeader
|
||||
title={
|
||||
<Form.Item shouldUpdate>{() => form.getFieldValue("name")}</Form.Item>
|
||||
}
|
||||
extra={
|
||||
<Space>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.active")}
|
||||
name="active"
|
||||
initialValue={true}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Button
|
||||
onClick={() => form.submit()}
|
||||
type="primary"
|
||||
loading={formLoading}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
<Button
|
||||
type="danger"
|
||||
disabled={selectedvendor === "new"}
|
||||
onClick={handleDelete}
|
||||
loading={formLoading}
|
||||
>
|
||||
{t("general.actions.delete")}
|
||||
</Button>
|
||||
|
||||
<VendorsPhonebookAdd
|
||||
form={form}
|
||||
disabled={form.isFieldsTouched()}
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
<FormFieldsChanged form={form} />
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.name")}
|
||||
name="name"
|
||||
validateTrigger="onBlur"
|
||||
hasFeedback
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
async validator(rule, value) {
|
||||
if (value) {
|
||||
const response = await client.query({
|
||||
query: CHECK_VENDOR_NAME,
|
||||
variables: {
|
||||
name: value,
|
||||
},
|
||||
});
|
||||
const {treatments: {DmsAp}} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["DmsAp"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid
|
||||
});
|
||||
|
||||
if (response.data.vendors_aggregate.aggregate.count === 0) {
|
||||
return Promise.resolve();
|
||||
} else if (
|
||||
response.data.vendors_aggregate.nodes.length === 1 &&
|
||||
response.data.vendors_aggregate.nodes[0].id ===
|
||||
form.getFieldValue("id")
|
||||
) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(
|
||||
t("vendors.validation.unique_vendor_name")
|
||||
);
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
|
||||
const {getFieldValue} = form;
|
||||
return (
|
||||
<div>
|
||||
<PageHeader
|
||||
title={
|
||||
<Form.Item shouldUpdate>{() => form.getFieldValue("name")}</Form.Item>
|
||||
}
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
extra={
|
||||
<Space>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.active")}
|
||||
name="active"
|
||||
initialValue={true}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch/>
|
||||
</Form.Item>
|
||||
<Button
|
||||
onClick={() => form.submit()}
|
||||
type="primary"
|
||||
loading={formLoading}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
<Button
|
||||
type="danger"
|
||||
disabled={selectedvendor === "new"}
|
||||
onClick={handleDelete}
|
||||
loading={formLoading}
|
||||
>
|
||||
{t("general.actions.delete")}
|
||||
</Button>
|
||||
|
||||
<Form.Item
|
||||
label={t("vendors.fields.email")}
|
||||
rules={
|
||||
[
|
||||
// {
|
||||
// type: "email",
|
||||
// message: t("general.validation.invalidemail"),
|
||||
// },
|
||||
]
|
||||
}
|
||||
name="email"
|
||||
>
|
||||
<FormItemEmail email={getFieldValue("email")} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.phone")}
|
||||
name="phone"
|
||||
rules={[
|
||||
({ getFieldValue }) =>
|
||||
PhoneItemFormatterValidation(getFieldValue, "phone"),
|
||||
]}
|
||||
>
|
||||
<PhoneFormItem />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item label={t("vendors.fields.street1")} name="street1">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.street2")} name="street2">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.city")} name="city">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item label={t("vendors.fields.state")} name="state">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.zip")} name="zip">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.country")} name="country">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item label={t("vendors.fields.discount")} name="discount">
|
||||
<InputNumber min={0} max={1} precision={2} step={0.01} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.due_date")} name="due_date">
|
||||
<InputNumber min={0} />
|
||||
</Form.Item>
|
||||
{
|
||||
// <Form.Item
|
||||
// label={t("vendors.fields.cost_center")}
|
||||
// rules={[
|
||||
// { required: true, message: t("general.validation.required") },
|
||||
// ]}
|
||||
// name="cost_center"
|
||||
// >
|
||||
// <Select style={{ width: "150px" }}>
|
||||
// {responsibilityCenters.costs.map((item) => (
|
||||
// <Select.Option key={item.name}>{item.name}</Select.Option>
|
||||
// ))}
|
||||
// </Select>
|
||||
// </Form.Item>
|
||||
}
|
||||
</LayoutFormRow>
|
||||
|
||||
{DmsAp.treatment === "on" && (
|
||||
<Form.Item label={t("vendors.fields.dmsid")} name="dmsid">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
<Divider align="left">{t("vendors.labels.preferredmakes")}</Divider>
|
||||
<Form.List name="favorite">
|
||||
{(fields, { add, remove }) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item key={field.key}>
|
||||
<Space wrap>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.make")}
|
||||
key={`${index}make`}
|
||||
name={[field.name]}
|
||||
rules={[
|
||||
<VendorsPhonebookAdd
|
||||
form={form}
|
||||
disabled={form.isFieldsTouched()}
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
<FormFieldsChanged form={form}/>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.name")}
|
||||
name="name"
|
||||
validateTrigger="onBlur"
|
||||
hasFeedback
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
({getFieldValue}) => ({
|
||||
async validator(rule, value) {
|
||||
if (value) {
|
||||
const response = await client.query({
|
||||
query: CHECK_VENDOR_NAME,
|
||||
variables: {
|
||||
name: value,
|
||||
},
|
||||
});
|
||||
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
if (response.data.vendors_aggregate.aggregate.count === 0) {
|
||||
return Promise.resolve();
|
||||
} else if (
|
||||
response.data.vendors_aggregate.nodes.length === 1 &&
|
||||
response.data.vendors_aggregate.nodes[0].id ===
|
||||
form.getFieldValue("id")
|
||||
) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(
|
||||
t("vendors.validation.unique_vendor_name")
|
||||
);
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
}
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
{t("vendors.actions.newpreferredmake")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
</div>
|
||||
);
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("vendors.fields.email")}
|
||||
rules={
|
||||
[
|
||||
// {
|
||||
// type: "email",
|
||||
// message: t("general.validation.invalidemail"),
|
||||
// },
|
||||
]
|
||||
}
|
||||
name="email"
|
||||
>
|
||||
<FormItemEmail email={getFieldValue("email")}/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.phone")}
|
||||
name="phone"
|
||||
rules={[
|
||||
({getFieldValue}) =>
|
||||
PhoneItemFormatterValidation(getFieldValue, "phone"),
|
||||
]}
|
||||
>
|
||||
<PhoneFormItem/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item label={t("vendors.fields.street1")} name="street1">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.street2")} name="street2">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.city")} name="city">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item label={t("vendors.fields.state")} name="state">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.zip")} name="zip">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.country")} name="country">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item label={t("vendors.fields.discount")} name="discount">
|
||||
<InputNumber min={0} max={1} precision={2} step={0.01}/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t("vendors.fields.due_date")} name="due_date">
|
||||
<InputNumber min={0}/>
|
||||
</Form.Item>
|
||||
{
|
||||
// <Form.Item
|
||||
// label={t("vendors.fields.cost_center")}
|
||||
// rules={[
|
||||
// { required: true, message: t("general.validation.required") },
|
||||
// ]}
|
||||
// name="cost_center"
|
||||
// >
|
||||
// <Select style={{ width: "150px" }}>
|
||||
// {responsibilityCenters.costs.map((item) => (
|
||||
// <Select.Option key={item.name}>{item.name}</Select.Option>
|
||||
// ))}
|
||||
// </Select>
|
||||
// </Form.Item>
|
||||
}
|
||||
</LayoutFormRow>
|
||||
|
||||
{DmsAp.treatment === "on" && (
|
||||
<Form.Item label={t("vendors.fields.dmsid")} name="dmsid">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Divider align="left">{t("vendors.labels.preferredmakes")}</Divider>
|
||||
<Form.List name="favorite">
|
||||
{(fields, {add, remove}) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item key={field.key}>
|
||||
<Space wrap>
|
||||
<Form.Item
|
||||
label={t("vendors.fields.make")}
|
||||
key={`${index}make`}
|
||||
name={[field.name]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{width: "100%"}}
|
||||
>
|
||||
{t("vendors.actions.newpreferredmake")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
// import { useNavigate } from 'react-router-dom';
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import Dinero from "dinero.js";
|
||||
import dayjs from "../../utils/day";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -51,16 +51,12 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
// const history = useHistory();
|
||||
const [closeJob] = useMutation(UPDATE_JOB);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { Qb_Multi_Ar } = useTreatments(
|
||||
["Qb_Multi_Ar"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
const { ClosingPeriod } = useTreatments(
|
||||
["ClosingPeriod"],
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
|
||||
const { treatments: {Qb_Multi_Ar,ClosingPeriod} } = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Qb_Multi_Ar", "ClosingPeriod"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
const handleFinish = async ({ removefromproduction, ...values }) => {
|
||||
setLoading(true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {BackTop, Layout} from "antd";
|
||||
import {FloatButton, Layout} from "antd";
|
||||
import preval from "preval.macro";
|
||||
import React, {lazy, Suspense, useEffect} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
@@ -371,7 +371,7 @@ export function Manage({conflict, bodyshop}) {
|
||||
{PageContent}
|
||||
</Sentry.ErrorBoundary>
|
||||
|
||||
<BackTop/>
|
||||
<FloatButton.BackTop/>
|
||||
<Footer>
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BackTop, Layout } from "antd";
|
||||
import {FloatButton, Layout} from "antd";
|
||||
import React, { Suspense, lazy, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -90,7 +90,7 @@ export function TechPage({ technician }) {
|
||||
</FeatureWrapper>
|
||||
</Suspense>
|
||||
</ErrorBoundary>
|
||||
<BackTop />
|
||||
<FloatButton.BackTop />
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
|
||||
@@ -1,27 +1,62 @@
|
||||
import dayjs from "./day";
|
||||
const range = {
|
||||
Today: [dayjs(), dayjs()],
|
||||
"Last 14 days": [dayjs().subtract(14, "day"), dayjs()],
|
||||
"Last 7 days": [dayjs().subtract(7, "day"), dayjs()],
|
||||
"Next 7 days": [dayjs(), dayjs().add(7, "day")],
|
||||
"Next 14 days": [dayjs(), dayjs().add(14, "day")],
|
||||
"Last Month": [
|
||||
dayjs().startOf("month").subtract(1, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month"),
|
||||
],
|
||||
"This Month": [dayjs().startOf("month"), dayjs().endOf("month")],
|
||||
"Next Month": [
|
||||
dayjs().startOf("month").add(1, "month"),
|
||||
dayjs().startOf("month").add(1, "month").endOf("month"),
|
||||
],
|
||||
"Last Quarter": [
|
||||
dayjs().startOf("quarter").subtract(1, "quarter"),
|
||||
dayjs().startOf("quarter").subtract(1, "day"),
|
||||
],
|
||||
"This Quarter": [
|
||||
dayjs().startOf("quarter"),
|
||||
dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day"),
|
||||
],
|
||||
"Last 90 Days": [dayjs().add(-90, "day"), dayjs()],
|
||||
};
|
||||
|
||||
const range = [
|
||||
{
|
||||
label: 'Today',
|
||||
value: [dayjs(), dayjs()]
|
||||
},
|
||||
{
|
||||
label: 'Last 14 days',
|
||||
value: [dayjs().subtract(14, "day"), dayjs()]
|
||||
},
|
||||
{
|
||||
label: 'Last 7 days',
|
||||
value: [dayjs().subtract(7, "day"), dayjs()]
|
||||
},
|
||||
{
|
||||
label: 'Next 7 days',
|
||||
value: [dayjs(), dayjs().add(7, "day")]
|
||||
},
|
||||
{
|
||||
label: 'Next 14 days',
|
||||
value: [dayjs(), dayjs().add(14, "day")],
|
||||
},
|
||||
{
|
||||
label: 'Last Month',
|
||||
value: [
|
||||
dayjs().startOf("month").subtract(1, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month"),
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'This Month',
|
||||
value: [dayjs().startOf("month"), dayjs().endOf("month")]
|
||||
},
|
||||
{
|
||||
label: 'Next Month',
|
||||
value: [
|
||||
dayjs().startOf("month").add(1, "month"),
|
||||
dayjs().startOf("month").add(1, "month").endOf("month"),
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Last Quarter',
|
||||
value: [
|
||||
dayjs().startOf("quarter").subtract(1, "quarter"),
|
||||
dayjs().startOf("quarter").subtract(1, "day"),
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'This Quarter',
|
||||
value: [
|
||||
dayjs().startOf("quarter"),
|
||||
dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day"),
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Last 90 Days',
|
||||
value: [dayjs().add(-90, "day"), dayjs()],
|
||||
}
|
||||
]
|
||||
|
||||
export default range;
|
||||
|
||||
@@ -54,27 +54,27 @@ function functionMapper(f, timezone) {
|
||||
case "date.yesterday":
|
||||
return moment().tz(timezone).subtract(1, "day").format(isoFormat);
|
||||
case "date.3daysago":
|
||||
return moment().tz(timezone).subtract(3, "days").format(isoFormat);
|
||||
return moment().tz(timezone).subtract(3, "day").format(isoFormat);
|
||||
case "date.7daysago":
|
||||
return moment().tz(timezone).subtract(7, "days").format(isoFormat);
|
||||
return moment().tz(timezone).subtract(7, "day").format(isoFormat);
|
||||
case "date.tomorrow":
|
||||
return moment().tz(timezone).add(1, "day").format(isoFormat);
|
||||
case "date.3daysfromnow":
|
||||
return moment().tz(timezone).add(3, "days").format(isoFormat);
|
||||
return moment().tz(timezone).add(3, "day").format(isoFormat);
|
||||
case "date.7daysfromnow":
|
||||
return moment().tz(timezone).add(7, "days").format(isoFormat);
|
||||
return moment().tz(timezone).add(7, "day").format(isoFormat);
|
||||
case "date.yesterdaytz":
|
||||
return moment().tz(timezone).subtract(1, "day");
|
||||
case "date.3daysagotz":
|
||||
return moment().tz(timezone).subtract(3, "days");
|
||||
return moment().tz(timezone).subtract(3, "day");
|
||||
case "date.7daysagotz":
|
||||
return moment().tz(timezone).subtract(7, "days");
|
||||
return moment().tz(timezone).subtract(7, "day");
|
||||
case "date.tomorrowtz":
|
||||
return moment().tz(timezone).add(1, "day");
|
||||
case "date.3daysfromnowtz":
|
||||
return moment().tz(timezone).add(3, "days");
|
||||
return moment().tz(timezone).add(3, "day");
|
||||
case "date.7daysfromnowtz":
|
||||
return moment().tz(timezone).add(7, "days");
|
||||
return moment().tz(timezone).add(7, "day");
|
||||
|
||||
case "date.now":
|
||||
return moment().tz(timezone);
|
||||
|
||||
Reference in New Issue
Block a user