IO-3515 Add shopname to bill ai feedback.
This commit is contained in:
@@ -4,8 +4,15 @@ import axios from "axios";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors.js";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
|
||||||
function BillAiFeedback({ billForm, rawAIData }) {
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop
|
||||||
|
});
|
||||||
|
|
||||||
|
function BillAiFeedback({ billForm, rawAIData, bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
@@ -53,6 +60,7 @@ function BillAiFeedback({ billForm, rawAIData }) {
|
|||||||
formData.append("comments", comments || "");
|
formData.append("comments", comments || "");
|
||||||
formData.append("billFormValues", sanitizeBillFormValues(billFormValues));
|
formData.append("billFormValues", sanitizeBillFormValues(billFormValues));
|
||||||
formData.append("rawAIData", sanitizeBillFormValues(rawAIData));
|
formData.append("rawAIData", sanitizeBillFormValues(rawAIData));
|
||||||
|
formData.append("shopname", bodyshop?.shopname || "");
|
||||||
|
|
||||||
const attachmentFile = getAttachmentFromBillFormUpload();
|
const attachmentFile = getAttachmentFromBillFormUpload();
|
||||||
if (attachmentFile) {
|
if (attachmentFile) {
|
||||||
@@ -107,4 +115,4 @@ function BillAiFeedback({ billForm, rawAIData }) {
|
|||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default BillAiFeedback;
|
export default connect(mapStateToProps, null)(BillAiFeedback);
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ const handleBillAiFeedback = async (req, res) => {
|
|||||||
const rawAIData = safeJsonParse(req.body?.rawAIData);
|
const rawAIData = safeJsonParse(req.body?.rawAIData);
|
||||||
|
|
||||||
const jobid = billFormValues?.jobid || billFormValues?.jobId || "unknown";
|
const jobid = billFormValues?.jobid || billFormValues?.jobId || "unknown";
|
||||||
const subject = `Bill AI Feedback (${rating === "up" ? "+" : "-"}) jobid=${jobid}`;
|
const shopname = req.body?.shopname || "unknown";
|
||||||
|
const subject = `Bill AI Feedback (${rating === "up" ? "+" : "-"}) Shop=${shopname} jobid=${jobid}`;
|
||||||
|
|
||||||
const text = [
|
const text = [
|
||||||
`User: ${req?.user?.email || "unknown"}`,
|
`User: ${req?.user?.email || "unknown"}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user