IO-2222 Service Side Generation of part price changes.

This commit is contained in:
Patrick Fic
2023-03-16 13:33:20 -07:00
parent c11cef4119
commit 4e2ad3bc62
9 changed files with 200 additions and 18 deletions

View File

@@ -1,12 +1,12 @@
import {
DeleteFilled,
EditFilled,
FilterFilled,
HomeOutlined,
MinusCircleTwoTone,
PlusCircleTwoTone,
SyncOutlined,
WarningFilled,
EditFilled,
PlusCircleTwoTone,
MinusCircleTwoTone,
HomeOutlined,
} from "@ant-design/icons";
import { useMutation } from "@apollo/client";
import {
@@ -38,13 +38,14 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re
// import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
// import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
import _ from "lodash";
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
import JobLinesExpander from "./job-lines-expander.component";
import { selectBodyshop } from "../../redux/user/user.selectors";
import moment from "moment";
import { selectBodyshop } from "../../redux/user/user.selectors";
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
import JobSendPartPriceChangeComponent from "../job-send-parts-price-change/job-send-parts-price-change.component";
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
import JobLinesExpander from "./job-lines-expander.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -103,7 +104,9 @@ export function JobLinesComponent({
fixed: "left",
key: "line_desc",
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
onCell: (record) => ({ className: record.manual_line && "job-line-manual" }),
onCell: (record) => ({
className: record.manual_line && "job-line-manual",
}),
sortOrder:
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
ellipsis: true,
@@ -443,15 +446,6 @@ export function JobLinesComponent({
technician
}
onClick={() => {
// setPartsOrderContext({
// actions: { refetch: refetch },
// context: {
// jobId: job.id,
// job: job,
// linesToOrder: selectedLines,
// },
// });
setBillEnterContext({
actions: { refetch: refetch },
context: {
@@ -558,6 +552,9 @@ export function JobLinesComponent({
>
{t("joblines.actions.new")}
</Button>
{bodyshop.region_config.toLowerCase().startsWith("ca") && (
<JobSendPartPriceChangeComponent job={job} />
)}
<JobCreateIOU job={job} selectedJobLines={selectedLines} />
<Input.Search
placeholder={t("general.labels.search")}

View File

@@ -0,0 +1,31 @@
import { Button, notification } from "antd";
import axios from "axios";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
export default function JobSendPartPriceChangeComponent({ job }) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const handleClick = async () => {
setLoading(true);
try {
const ppcData = await axios.post("/job/ppc", { jobid: job.id });
const result = axios.post("http://localhost:1337/ppc/", ppcData.data);
} catch (error) {
notification.open({
type: "error",
message: t("jobs.errors.partspricechange", {
error: JSON.stringify(error),
}),
});
} finally {
setLoading(false);
}
};
return (
<Button onClick={handleClick} loading={loading}>
{t("jobs.actions.sendpartspricechange")}
</Button>
);
}

View File

@@ -1272,6 +1272,7 @@
"removefromproduction": "Remove from Production",
"schedule": "Schedule",
"sendcsi": "Send CSI",
"sendpartspricechange": "Send Parts Price Change",
"sendtodms": "Send to DMS",
"sync": "Sync",
"uninvoice": "Uninvoice",
@@ -1295,6 +1296,7 @@
"nojobselected": "No job is selected.",
"noowner": "No owner associated.",
"novehicle": "No vehicle associated.",
"partspricechange": "Error sending parts price change. {{error}}.",
"saving": "Error encountered while saving record.",
"scanimport": "Error importing job. {{message}}",
"totalscalc": "Error while calculating new job totals.",

View File

@@ -1272,6 +1272,7 @@
"removefromproduction": "",
"schedule": "Programar",
"sendcsi": "",
"sendpartspricechange": "",
"sendtodms": "",
"sync": "",
"uninvoice": "",
@@ -1295,6 +1296,7 @@
"nojobselected": "No hay trabajo seleccionado.",
"noowner": "Ningún propietario asociado.",
"novehicle": "No hay vehículo asociado.",
"partspricechange": "",
"saving": "Se encontró un error al guardar el registro.",
"scanimport": "",
"totalscalc": "",

View File

@@ -1272,6 +1272,7 @@
"removefromproduction": "",
"schedule": "Programme",
"sendcsi": "",
"sendpartspricechange": "",
"sendtodms": "",
"sync": "",
"uninvoice": "",
@@ -1295,6 +1296,7 @@
"nojobselected": "Aucun travail n'est sélectionné.",
"noowner": "Aucun propriétaire associé.",
"novehicle": "Aucun véhicule associé.",
"partspricechange": "",
"saving": "Erreur rencontrée lors de la sauvegarde de l'enregistrement.",
"scanimport": "",
"totalscalc": "",