feature/IO-3255-simplified-parts-management - Packages / Housekeeping
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useApolloClient, useMutation } from "@apollo/client";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Form, Modal } from "antd";
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -43,8 +43,6 @@ export function NoteUpsertModalContainer({ currentUser, noteUpsertModal, toggleM
|
||||
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const { client } = useApolloClient();
|
||||
|
||||
useEffect(() => {
|
||||
//Required to prevent infinite looping.
|
||||
if (existingNote && open) {
|
||||
|
||||
@@ -2,16 +2,13 @@ import { Form, Input, InputNumber, Select } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import PhoneFormItem, { PhoneItemFormatterValidation } from "../form-items-formatted/phone-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const timeZonesList = Intl.supportedValuesOf("timeZone");
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
|
||||
const mapDispatchToProps = () => ({});
|
||||
|
||||
|
||||
@@ -2,21 +2,16 @@ import { Button, Card, Divider, Space } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { useSocket } from "../../contexts/SocketIO/useSocket.js";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import PartsBusinessInfoComponent from "./parts-business-info.component";
|
||||
import PartsLocationsComponent from "./parts-locations.component";
|
||||
import PartsOrderCommentsComponent from "./parts-order-comments.component";
|
||||
import PartsEmailPresetsComponent from "./parts-email-presets.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
|
||||
const mapDispatchToProps = () => ({});
|
||||
|
||||
export function PartsShopManagementComponent({ bodyshop, form, saveLoading }) {
|
||||
const { scenarioNotificationsOn } = useSocket();
|
||||
export function PartsShopManagementComponent({ form, saveLoading }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
@@ -41,13 +36,10 @@ export function PartsShopManagementComponent({ bodyshop, form, saveLoading }) {
|
||||
{/* Parts Orders Comments Section */}
|
||||
<PartsOrderCommentsComponent form={form} />
|
||||
|
||||
<Divider />
|
||||
|
||||
{/* Preset To Emails Section - only show if notifications are enabled */}
|
||||
{scenarioNotificationsOn && (
|
||||
<>
|
||||
<Divider />
|
||||
<PartsEmailPresetsComponent form={form} />
|
||||
</>
|
||||
)}
|
||||
<PartsEmailPresetsComponent form={form} />
|
||||
</Space>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect } from "react";
|
||||
import { useCallback, useEffect } from "react";
|
||||
import { HasFeatureAccess } from "./../feature-wrapper/feature-wrapper.component";
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ export const useFormDataPreservation = (form, bodyshop, featureConfig) => {
|
||||
parent[lastKey] = value;
|
||||
};
|
||||
|
||||
const preserveHiddenFormData = () => {
|
||||
const preserveHiddenFormData = useCallback(() => {
|
||||
const preservationData = {};
|
||||
let hasDataToPreserve = false;
|
||||
|
||||
@@ -51,7 +51,7 @@ export const useFormDataPreservation = (form, bodyshop, featureConfig) => {
|
||||
if (hasDataToPreserve) {
|
||||
form.setFieldsValue(preservationData);
|
||||
}
|
||||
};
|
||||
}, [form, bodyshop, featureConfig]);
|
||||
|
||||
const getCompleteFormValues = () => {
|
||||
const currentFormValues = form.getFieldsValue();
|
||||
@@ -88,7 +88,7 @@ export const useFormDataPreservation = (form, bodyshop, featureConfig) => {
|
||||
|
||||
useEffect(() => {
|
||||
preserveHiddenFormData();
|
||||
}, [bodyshop]);
|
||||
}, [bodyshop, preserveHiddenFormData]);
|
||||
|
||||
return { preserveHiddenFormData, getCompleteFormValues, createSubmissionHandler };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user