Merge remote-tracking branch 'origin/rome/release/2024-01-26' into rome/test-beta

# Conflicts:
#	.circleci/config.yml
#	client/package-lock.json
#	client/src/components/header/header.component.jsx
#	client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx
#	client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx
#	client/src/components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component.jsx
#	client/src/components/jobs-admin-unvoid/jobs-admin-unvoid.component.jsx
#	client/src/components/production-list-detail/production-list-detail.component.jsx
#	client/src/components/report-center-modal/report-center-modal.component.jsx
#	client/src/pages/jobs-admin/jobs-admin.page.jsx
#	client/src/pages/jobs-detail/jobs-detail.page.component.jsx
#	client/src/utils/TemplateConstants.js
#	client/yarn.lock
#	package-lock.json
#	server.js
This commit is contained in:
Dave Richer
2024-01-30 18:42:45 -05:00
114 changed files with 55358 additions and 4954 deletions

View File

@@ -4,111 +4,65 @@ import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import { UNVOID_JOB } from "../../graphql/jobs.queries";
import {insertAuditTrail} from "../../redux/application/application.actions";
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
import AuditTrailMapping from "../../utils/AuditTrailMappings";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
});
const mapDispatchToProps = (dispatch) => ({
insertAuditTrail: ({jobid, operation}) =>
dispatch(insertAuditTrail({jobid, operation})),
insertAuditTrail: ({ jobid, operation }) =>
dispatch(insertAuditTrail({ jobid, operation })),
});
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminUnvoid);
export function JobsAdminUnvoid({
insertAuditTrail,
bodyshop,
job,
currentUser,
}) {
const {t} = useTranslation();
const [loading, setLoading] = useState(false);
const [updateJob] = useMutation(gql`
mutation UNVOID_JOB($jobId: uuid!) {
update_jobs_by_pk(pk_columns: {id: $jobId}, _set: {voided: false, status: "${
bodyshop.md_ro_statuses.default_imported
}", date_void: null}) {
id
date_void
voided
status
}
insert_notes(objects: {jobid: $jobId, audit: true, created_by: "${
currentUser.email
}", text: "${t("jobs.labels.unvoidnote")}"}) {
returning {
id
}
}
}
insertAuditTrail,
bodyshop,
job,
currentUser,
}) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const [mutationUnvoidJob] = useMutation(UNVOID_JOB);
`);
const handleUpdate = async (values) => {
setLoading(true);
const result = await mutationUnvoidJob({
variables: {
jobId: job.id,
default_imported: bodyshop.md_ro_statuses.default_imported,
currentUserEmail: currentUser.email,
text: t("jobs.labels.unvoidnote"),
},
});
// const result = await voidJob({
// variables: {
// jobId: job.id,
// job: {
// status: bodyshop.md_ro_statuses.default_void,
// voided: true,
// },
// note: [
// {
// jobid: job.id,
// created_by: currentUser.email,
// audit: true,
// text: t("jobs.labels.voidnote", {
// date: dayjs().format("MM/DD/yyy"),
// time: dayjs().format("hh:mm a"),
// }),
// },
// ],
// },
// });
if (!result.errors) {
notification["success"]({ message: t("jobs.successes.save") });
// if (!!!result.errors) {
// notification["success"]({
// message: t("jobs.successes.voided"),
// });
// //go back to jobs list.
// history.push(`/manage/`);
// } else {
// notification["error"]({
// message: t("jobs.errors.voiding", {
// error: JSON.stringify(result.errors),
// }),
// });
// }
insertAuditTrail({
jobid: job.id,
operation: AuditTrailMapping.admin_jobunvoid(),
});
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
setLoading(false);
//Get the owner details, populate it all back into the job.
};
const handleUpdate = async (values) => {
setLoading(true);
const result = await updateJob({
variables: {jobId: job.id},
});
if (!result.errors) {
notification["success"]({message: t("jobs.successes.save")});
insertAuditTrail({
jobid: job.id,
operation: AuditTrailMapping.admin_jobunvoid(),
});
} else {
notification["error"]({
message: t("jobs.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
setLoading(false);
//Get the owner details, populate it all back into the job.
};
return (
<Button loading={loading} disabled={!job.voided} onClick={handleUpdate}>
{t("jobs.actions.unvoid")}
</Button>
);
return (
<>
<Button loading={loading} disabled={!job.voided} onClick={handleUpdate}>
{t("jobs.actions.unvoid")}
</Button>
</>
);
}