Merged in feature/IO-3123-Code-Review-Adjustments (pull request #2099)
feature/IO-3123-Code-Review-Adjustments: Make Code review adjustments
This commit is contained in:
@@ -134,10 +134,10 @@ export function JobsDetailHeaderActions({
|
||||
const notification = useNotification();
|
||||
|
||||
const {
|
||||
treatments: { ImEXPay, Share_To_Teams }
|
||||
treatments: { ImEXPay }
|
||||
} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["ImEXPay", "Share_To_Teams"],
|
||||
names: ["ImEXPay"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid
|
||||
});
|
||||
|
||||
@@ -202,7 +202,10 @@ export function JobsDetailHeaderActions({
|
||||
message: t("appointments.successes.created")
|
||||
});
|
||||
} catch (error) {
|
||||
notification.open({ type: "error", message: t("appointments.errors.saving", { error: error.message }) });
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("appointments.errors.saving", { error: error.message })
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
setVisibility(false);
|
||||
@@ -839,7 +842,7 @@ export function JobsDetailHeaderActions({
|
||||
id: "job-actions-addtoproduction",
|
||||
disabled: !job.converted,
|
||||
label: t("jobs.actions.addtoproduction"),
|
||||
onClick: () => AddToProduction(client, job.id, refetch, notification)
|
||||
onClick: () => AddToProduction(client, job.id, refetch, false, notification)
|
||||
}
|
||||
);
|
||||
|
||||
@@ -972,7 +975,7 @@ export function JobsDetailHeaderActions({
|
||||
}
|
||||
);
|
||||
|
||||
if (Share_To_Teams?.treatment === "on") {
|
||||
if (bodyshop?.md_functionality_toggles?.teams) {
|
||||
menuItems.push({
|
||||
key: "sharetoteams",
|
||||
id: "job-actions-sharetoteams",
|
||||
|
||||
@@ -13,6 +13,7 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
import { DateTimeFormatterFunction } from "../../utils/DateFormatter";
|
||||
import FormDateTimePickerComponent from "../form-date-time-picker/form-date-time-picker.component";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component.jsx";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser,
|
||||
@@ -39,7 +40,7 @@ export function JobsDetailHeaderActionsToggleProduction({
|
||||
const [form] = Form.useForm();
|
||||
const notification = useNotification();
|
||||
|
||||
const [getJobDetails] = useLazyQuery(GET_JOB_BY_PK_QUICK_INTAKE, {
|
||||
const [getJobDetails, { loading: jobDetailsLoading }] = useLazyQuery(GET_JOB_BY_PK_QUICK_INTAKE, {
|
||||
variables: { id: job.id },
|
||||
onCompleted: (data) => {
|
||||
if (data?.jobs_by_pk) {
|
||||
@@ -109,65 +110,69 @@ export function JobsDetailHeaderActionsToggleProduction({
|
||||
|
||||
const popMenu = (
|
||||
<div onClick={(e) => e.stopPropagation()}>
|
||||
<Form layout="vertical" form={form} onFinish={handleConvert}>
|
||||
{scenario === "pre" && (
|
||||
<>
|
||||
<Form.Item
|
||||
name={["actual_in"]}
|
||||
label={t("jobs.fields.actual_in")}
|
||||
rules={[
|
||||
{
|
||||
required: true
|
||||
//message: t("general.validation.required"),
|
||||
}
|
||||
]}
|
||||
>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["scheduled_completion"]}
|
||||
label={t("jobs.fields.scheduled_completion")}
|
||||
rules={[
|
||||
{
|
||||
required: true
|
||||
//message: t("general.validation.required"),
|
||||
}
|
||||
]}
|
||||
>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item name={["scheduled_delivery"]} label={t("jobs.fields.scheduled_delivery")}>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
{scenario === "prod" && (
|
||||
<>
|
||||
<Form.Item
|
||||
name={["actual_completion"]}
|
||||
label={t("jobs.fields.actual_completion")}
|
||||
rules={[
|
||||
{
|
||||
required: true
|
||||
//message: t("general.validation.required"),
|
||||
}
|
||||
]}
|
||||
>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
{jobDetailsLoading ? (
|
||||
<LoadingSpinner />
|
||||
) : (
|
||||
<Form layout="vertical" form={form} onFinish={handleConvert}>
|
||||
{scenario === "pre" && (
|
||||
<>
|
||||
<Form.Item
|
||||
name={["actual_in"]}
|
||||
label={t("jobs.fields.actual_in")}
|
||||
rules={[
|
||||
{
|
||||
required: true
|
||||
//message: t("general.validation.required"),
|
||||
}
|
||||
]}
|
||||
>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["scheduled_completion"]}
|
||||
label={t("jobs.fields.scheduled_completion")}
|
||||
rules={[
|
||||
{
|
||||
required: true
|
||||
//message: t("general.validation.required"),
|
||||
}
|
||||
]}
|
||||
>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item name={["scheduled_delivery"]} label={t("jobs.fields.scheduled_delivery")}>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
{scenario === "prod" && (
|
||||
<>
|
||||
<Form.Item
|
||||
name={["actual_completion"]}
|
||||
label={t("jobs.fields.actual_completion")}
|
||||
rules={[
|
||||
{
|
||||
required: true
|
||||
//message: t("general.validation.required"),
|
||||
}
|
||||
]}
|
||||
>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name={["actual_delivery"]} label={t("jobs.fields.actual_delivery")}>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item name={["actual_delivery"]} label={t("jobs.fields.actual_delivery")}>
|
||||
<FormDateTimePickerComponent disabled={jobRO} />
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Space wrap>
|
||||
<Button type="primary" onClick={() => form.submit()} loading={loading}>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
<Space wrap>
|
||||
<Button type="primary" onClick={() => form.submit()} loading={loading}>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ export function PartsOrderListTableComponent({
|
||||
|
||||
const parts_orders = billsQuery.data ? billsQuery.data.parts_orders : [];
|
||||
const { refetch } = billsQuery;
|
||||
// label: <ShareToTeamsButton noIcon={true} urlOverride={`${window.location.origin}${window.location.pathname}`} />
|
||||
const recordActions = (record, showView = false) => (
|
||||
<Space direction="horizontal" wrap>
|
||||
<ShareToTeamsButton
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Button, Input, Space, Spin } from "antd";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -24,19 +23,13 @@ export default connect(mapStateToProps, mapDispatchToProps)(ProductionBoardFilte
|
||||
|
||||
export function ProductionBoardFilters({ bodyshop, filter, setFilter, loading }) {
|
||||
const { t } = useTranslation();
|
||||
const [alertFilter, setAlertFilter] = useState(false);
|
||||
const [unassignedFilter, setUnassignedFilter] = useState(false);
|
||||
|
||||
const toggleAlertFilter = () => {
|
||||
const newAlertFilter = !alertFilter;
|
||||
setAlertFilter(newAlertFilter);
|
||||
setFilter({ ...filter, alert: newAlertFilter });
|
||||
setFilter({ ...filter, alert: !filter.alert });
|
||||
};
|
||||
|
||||
const toggleUnassignedFilter = () => {
|
||||
const newUnassignedFilter = !unassignedFilter;
|
||||
setUnassignedFilter(newUnassignedFilter);
|
||||
setFilter({ ...filter, unassigned: newUnassignedFilter });
|
||||
setFilter({ ...filter, unassigned: !filter.unassigned });
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -58,16 +51,16 @@ export function ProductionBoardFilters({ bodyshop, filter, setFilter, loading })
|
||||
allowClear
|
||||
/>
|
||||
<Button
|
||||
type={alertFilter ? "primary" : "default"}
|
||||
type={filter?.alert ? "primary" : "default"}
|
||||
onClick={toggleAlertFilter}
|
||||
icon={alertFilter ? <ExclamationCircleFilled /> : <ExclamationCircleOutlined />}
|
||||
icon={filter?.alert ? <ExclamationCircleFilled /> : <ExclamationCircleOutlined />}
|
||||
>
|
||||
{t("production.labels.alerts")}
|
||||
</Button>
|
||||
<Button
|
||||
type={unassignedFilter ? "primary" : "default"}
|
||||
type={filter?.unassigned ? "primary" : "default"}
|
||||
onClick={toggleUnassignedFilter}
|
||||
icon={unassignedFilter ? <UserDeleteOutlined /> : <UsergroupDeleteOutlined />}
|
||||
icon={filter?.unassigned ? <UserDeleteOutlined /> : <UsergroupDeleteOutlined />}
|
||||
>
|
||||
{t("production.labels.unassigned")}
|
||||
</Button>
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Button } from "antd";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { SiMicrosoftteams } from "react-icons/si";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors.js";
|
||||
@@ -43,14 +42,6 @@ const ShareToTeamsComponent = ({
|
||||
const location = useLocation();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const {
|
||||
treatments: { Share_To_Teams }
|
||||
} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Share_To_Teams"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid
|
||||
});
|
||||
|
||||
const currentUrl =
|
||||
urlOverride ||
|
||||
encodeURIComponent(`${window.location.origin}${location.pathname}${location.search}${location.hash}`);
|
||||
@@ -78,7 +69,8 @@ const ShareToTeamsComponent = ({
|
||||
window.open(teamsShareUrl, "_blank", windowFeatures);
|
||||
};
|
||||
|
||||
if (Share_To_Teams?.treatment !== "on") {
|
||||
// Feature is disabled
|
||||
if (!bodyshop?.md_functionality_toggles?.teams) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||
import PhoneFormItem, { PhoneItemFormatterValidation } from "../form-items-formatted/phone-form-item.component";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
// TODO: Client Update, this might break
|
||||
|
||||
const timeZonesList = Intl.supportedValuesOf("timeZone");
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
@@ -642,6 +642,15 @@ export function ShopInfoGeneral({ form, bodyshop }) {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow header={t("bodyshop.labels.shop_enabled_features")} id="sharing">
|
||||
<Form.Item
|
||||
label={t("general.actions.sharetoteams")}
|
||||
valuePropName="checked"
|
||||
name={["md_functionality_toggles", "teams"]}
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow grow header={t("bodyshop.labels.messagingpresets")} id="messagingpresets">
|
||||
<Form.List name={["md_messaging_presets"]}>
|
||||
{(fields, { add, remove, move }) => {
|
||||
|
||||
@@ -269,7 +269,7 @@ function TaskListComponent({
|
||||
<Space direction="horizontal">
|
||||
<ShareToTeamsButton
|
||||
linkText=""
|
||||
urlOverride={`https://localhost:3000/manage/tasks/alltasks?taskid=${record.id}`}
|
||||
urlOverride={`${window.location.origin}/manage/tasks/alltasks?taskid=${record.id}`}
|
||||
/>
|
||||
<Button
|
||||
title={t("tasks.buttons.edit")}
|
||||
|
||||
@@ -235,7 +235,12 @@ export function* signInSuccessSaga({ payload }) {
|
||||
|
||||
try {
|
||||
window.$crisp.push(["set", "user:nickname", [payload.displayName || payload.email]]);
|
||||
window.$crisp.push(["set", "session:segments", [["user"]]]);
|
||||
const currentUserSegment = InstanceRenderManager({
|
||||
imex: "imex-online-user",
|
||||
rome: "rome-online-user"
|
||||
});
|
||||
window.$crisp.push(["set", "session:segments", [[currentUserSegment]]]);
|
||||
|
||||
InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
args: [],
|
||||
|
||||
@@ -712,7 +712,8 @@
|
||||
"ssbuckets": "Job Size Definitions",
|
||||
"systemsettings": "System Settings",
|
||||
"task-presets": "Task Presets",
|
||||
"workingdays": "Working Days"
|
||||
"workingdays": "Working Days",
|
||||
"shop_enabled_features": "Shop Enabled Features"
|
||||
},
|
||||
"operations": {
|
||||
"contains": "Contains",
|
||||
|
||||
@@ -712,7 +712,8 @@
|
||||
"ssbuckets": "",
|
||||
"systemsettings": "",
|
||||
"task-presets": "",
|
||||
"workingdays": ""
|
||||
"workingdays": "",
|
||||
"shop_enabled_features": ""
|
||||
},
|
||||
"operations": {
|
||||
"contains": "",
|
||||
|
||||
@@ -712,7 +712,8 @@
|
||||
"ssbuckets": "",
|
||||
"systemsettings": "",
|
||||
"task-presets": "",
|
||||
"workingdays": ""
|
||||
"workingdays": "",
|
||||
"shop_enabled_features": ""
|
||||
},
|
||||
"operations": {
|
||||
"contains": "",
|
||||
|
||||
Reference in New Issue
Block a user