- the great reformat

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-06 18:20:58 -05:00
parent 30c530bcc4
commit e83badb454
912 changed files with 108516 additions and 107493 deletions

View File

@@ -1,64 +1,65 @@
import React from "react";
import { useMutation } from "@apollo/client";
import { UPDATE_JOB } from "../../graphql/jobs.queries";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { Dropdown, notification } from "antd";
import { DownOutlined } from "@ant-design/icons";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {useMutation} from "@apollo/client";
import {UPDATE_JOB} from "../../graphql/jobs.queries";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {Dropdown, notification} from "antd";
import {DownOutlined} from "@ant-design/icons";
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 function JobAltTransportChange({ bodyshop, job }) {
const [updateJob] = useMutation(UPDATE_JOB);
const { t } = useTranslation();
export function JobAltTransportChange({bodyshop, job}) {
const [updateJob] = useMutation(UPDATE_JOB);
const {t} = useTranslation();
const onClick = async ({ key }) => {
const result = await updateJob({
variables: {
jobId: job.id,
job: { alt_transport: key === "null" ? null : key },
},
});
const onClick = async ({key}) => {
const result = await updateJob({
variables: {
jobId: job.id,
job: {alt_transport: key === "null" ? null : key},
},
});
if (!!!result.errors) {
// notification["success"]({ message: t("appointments.successes.saved") });
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
};
if (!!!result.errors) {
// notification["success"]({ message: t("appointments.successes.saved") });
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
};
const menu = {
items: [
...(bodyshop.appt_alt_transport || []).map((alt) => ({
key: alt,
label: alt,
})),
{ key: "null", label: t("general.actions.clear") },
],
onClick: onClick,
defaultSelectedKeys: [job && job.alt_transport]
};
const menu = {
items: [
...(bodyshop.appt_alt_transport || []).map((alt) => ({
key: alt,
label: alt,
})),
{key: "null", label: t("general.actions.clear")},
],
onClick: onClick,
defaultSelectedKeys: [job && job.alt_transport]
};
return (
<Dropdown menu={menu}>
<a href=" #" onClick={(e) => e.preventDefault()}>
<DownOutlined />
</a>
</Dropdown>
);
return (
<Dropdown menu={menu}>
<a href=" #" onClick={(e) => e.preventDefault()}>
<DownOutlined/>
</a>
</Dropdown>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(JobAltTransportChange);