Merged in release/2022-05-13 (pull request #475)

Release/2022 05 13
This commit is contained in:
Patrick Fic
2022-05-12 19:41:19 +00:00
15 changed files with 15288 additions and 62 deletions

View File

@@ -3586,6 +3586,27 @@
<folder_node> <folder_node>
<name>fields</name> <name>fields</name>
<children> <children>
<concept_node>
<name>ReceivableCustomField</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>address1</name> <name>address1</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -31747,6 +31768,27 @@
<folder_node> <folder_node>
<name>labels</name> <name>labels</name>
<children> <children>
<concept_node>
<name>addtorelatedro</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>newnoteplaceholder</name> <name>newnoteplaceholder</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

@@ -24,7 +24,7 @@ export function JoblinePresetButton({ bodyshop, form }) {
const menu = ( const menu = (
<Menu> <Menu>
{bodyshop.md_jobline_presets.map((i, idx) => ( {bodyshop.md_jobline_presets.map((i, idx) => (
<Menu.Item onClick={() => handleSelect(i)} key={idx}> <Menu.Item onClick={() => handleSelect(i)} key={idx}>
{i.label} {i.label}
</Menu.Item> </Menu.Item>
))} ))}

View File

@@ -61,6 +61,7 @@ export function JobNotesContainer({ jobId, insertAuditTrail }) {
jobId={jobId} jobId={jobId}
loading={loading} loading={loading}
data={data ? data.jobs_by_pk.notes : null} data={data ? data.jobs_by_pk.notes : null}
relatedRos={data ? data.jobs_by_pk.vehicle.jobs : null}
refetch={refetch} refetch={refetch}
deleteLoading={deleteLoading} deleteLoading={deleteLoading}
handleNoteDelete={handleNoteDelete} handleNoteDelete={handleNoteDelete}

View File

@@ -37,6 +37,7 @@ export function JobNotesComponent({
setNoteUpsertContext, setNoteUpsertContext,
deleteLoading, deleteLoading,
ro_number, ro_number,
relatedRos,
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const Templates = TemplateList("job_special", { const Templates = TemplateList("job_special", {
@@ -149,6 +150,7 @@ export function JobNotesComponent({
actions: { refetch: refetch }, actions: { refetch: refetch },
context: { context: {
jobId: jobId, jobId: jobId,
relatedRos: relatedRos,
}, },
}); });
}} }}

View File

@@ -1,51 +1,92 @@
import { Col, Form, Input, Row, Switch } from "antd"; import { Checkbox, Col, Form, Input, Row, Space, Switch, Tag } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectNoteUpsert } from "../../redux/modals/modals.selectors";
import NotesPresetButton from "../notes-preset-button/notes-preset-button.component"; import NotesPresetButton from "../notes-preset-button/notes-preset-button.component";
export default function NoteUpsertModalComponent({ form }) { const mapStateToProps = createStructuredSelector({
noteUpsertModal: selectNoteUpsert,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(NoteUpsertModalComponent);
export function NoteUpsertModalComponent({ form, noteUpsertModal }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { jobId, existingNote, relatedRos } = noteUpsertModal.context;
const filteredRelatedRos = relatedRos
? relatedRos.filter((j) => j.id !== jobId)
: [];
return ( return (
<Row gutter={[16, 16]}> <>
<Col span={8}> <Row gutter={[16, 16]}>
<Form.Item <Col span={8}>
label={t("notes.fields.critical")} <Form.Item
name="critical" label={t("notes.fields.critical")}
valuePropName="checked" name="critical"
> valuePropName="checked"
<Switch /> >
</Form.Item> <Switch />
</Col> </Form.Item>
<Col span={8}> </Col>
<Form.Item <Col span={8}>
label={t("notes.fields.private")} <Form.Item
name="private" label={t("notes.fields.private")}
valuePropName="checked" name="private"
> valuePropName="checked"
<Switch /> >
</Form.Item> <Switch />
</Col> </Form.Item>
<Col span={8}> </Col>
<NotesPresetButton form={form} /> <Col span={8}>
</Col> <NotesPresetButton form={form} />
<Col span={24}> </Col>
<Form.Item <Col span={24}>
label={t("notes.fields.text")} <Form.Item
name="text" label={t("notes.fields.text")}
rules={[ name="text"
{ rules={[
required: true, {
//message: t("general.validation.required"), required: true,
}, //message: t("general.validation.required"),
]} },
> ]}
<Input.TextArea >
rows={8} <Input.TextArea
placeholder={t("notes.labels.newnoteplaceholder")} rows={8}
/> placeholder={t("notes.labels.newnoteplaceholder")}
</Form.Item> />
</Col> </Form.Item>
</Row> </Col>
</Row>
<div>
<div>{!existingNote && t("notes.labels.addtorelatedro")}</div>
{!existingNote &&
filteredRelatedRos.map((j, idx) => (
<Space key={j.id} align="center">
<Form.Item
noStyle
name={["relatedros", j.id]}
valuePropName="checked"
>
<Checkbox />
</Form.Item>
<Tag>
{`${j.ro_number || "N/A"}${j.clm_no ? ` | ${j.clm_no}` : ""}${
j.status ? ` | ${j.status}` : ""
}`}
</Tag>
</Space>
))}
</div>
</>
); );
} }

View File

@@ -4,14 +4,14 @@ import React, { useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { INSERT_NEW_NOTE, UPDATE_NOTE } from "../../graphql/notes.queries"; import { INSERT_NEW_NOTE, UPDATE_NOTE } from "../../graphql/notes.queries";
import { insertAuditTrail } from "../../redux/application/application.actions";
import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { toggleModalVisible } from "../../redux/modals/modals.actions";
import { selectNoteUpsert } from "../../redux/modals/modals.selectors"; import { selectNoteUpsert } from "../../redux/modals/modals.selectors";
import { selectCurrentUser } from "../../redux/user/user.selectors"; import { selectCurrentUser } from "../../redux/user/user.selectors";
import NoteUpsertModalComponent from "./note-upsert-modal.component";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { insertAuditTrail } from "../../redux/application/application.actions";
import AuditTrailMapping from "../../utils/AuditTrailMappings"; import AuditTrailMapping from "../../utils/AuditTrailMappings";
import NoteUpsertModalComponent from "./note-upsert-modal.component";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser, currentUser: selectCurrentUser,
@@ -48,7 +48,9 @@ export function NoteUpsertModalContainer({
} }
}, [existingNote, form, visible]); }, [existingNote, form, visible]);
const handleFinish = (values) => { const handleFinish = async (formValues) => {
const { relatedros, ...values } = formValues;
if (existingNote) { if (existingNote) {
logImEXEvent("job_note_update"); logImEXEvent("job_note_update");
@@ -70,24 +72,48 @@ export function NoteUpsertModalContainer({
toggleModalVisible(); toggleModalVisible();
} else { } else {
logImEXEvent("job_note_insert"); logImEXEvent("job_note_insert");
const AdditionalNoteInserts = Object.keys(relatedros).filter(
(key) => relatedros[key]
);
console.log(
"🚀 ~ file: note-upsert-modal.container.jsx ~ line 78 ~ handleFinish ~ AdditionalNoteInserts",
AdditionalNoteInserts
);
insertNote({ await insertNote({
variables: { variables: {
noteInput: [ noteInput: [
{ ...values, jobid: jobId, created_by: currentUser.email }, { ...values, jobid: jobId, created_by: currentUser.email },
], ],
}, },
}).then((r) => { });
if (refetch) refetch();
form.resetFields(); if (AdditionalNoteInserts.length > 0) {
toggleModalVisible(); //Insert the others.
notification["success"]({ AdditionalNoteInserts.forEach(async (newJobId) => {
message: t("notes.successes.create"), await insertNote({
}); variables: {
insertAuditTrail({ noteInput: [
jobid: context.jobId, { ...values, jobid: newJobId, created_by: currentUser.email },
operation: AuditTrailMapping.jobnoteadded(), ],
},
});
insertAuditTrail({
jobid: newJobId,
operation: AuditTrailMapping.jobnoteadded(),
});
}); });
}
if (refetch) refetch();
form.resetFields();
toggleModalVisible();
notification["success"]({
message: t("notes.successes.create"),
});
insertAuditTrail({
jobid: context.jobId,
operation: AuditTrailMapping.jobnoteadded(),
}); });
} }
}; };

View File

@@ -24,7 +24,7 @@ export function NotesPresetButton({ bodyshop, form }) {
const menu = ( const menu = (
<Menu> <Menu>
{bodyshop.md_notes_presets.map((i, idx) => ( {bodyshop.md_notes_presets.map((i, idx) => (
<Menu.Item onClick={() => handleSelect(i)} key={idx}> <Menu.Item onClick={() => handleSelect(i)} key={idx}>
{i.label} {i.label}
</Menu.Item> </Menu.Item>
))} ))}

View File

@@ -352,10 +352,27 @@ export default function ShopInfoGeneral({ form }) {
> >
<Switch /> <Switch />
</Form.Item> </Form.Item>
<Form.Item
name={["accountingconfig", "ReceivableCustomField1"]}
label={t("bodyshop.fields.ReceivableCustomField", { number: 1 })}
>
{ReceivableCustomFieldSelect}
</Form.Item>
<Form.Item
name={["accountingconfig", "ReceivableCustomField2"]}
label={t("bodyshop.fields.ReceivableCustomField", { number: 2 })}
>
{ReceivableCustomFieldSelect}
</Form.Item>
<Form.Item
name={["accountingconfig", "ReceivableCustomField3"]}
label={t("bodyshop.fields.ReceivableCustomField", { number: 3 })}
>
{ReceivableCustomFieldSelect}
</Form.Item>
<Form.Item <Form.Item
name={["md_classes"]} name={["md_classes"]}
label={t("bodyshop.fields.md_classes")} label={t("bodyshop.fields.md_classes")}
dependencies={["enforce_class"]}
rules={[ rules={[
({ getFieldValue }) => { ({ getFieldValue }) => {
return { return {
@@ -707,7 +724,7 @@ export default function ShopInfoGeneral({ form }) {
}, },
]} ]}
> >
<Input /> <Input.TextArea rows={3} />
</Form.Item> </Form.Item>
<Space wrap> <Space wrap>
<DeleteFilled <DeleteFilled
@@ -1475,3 +1492,11 @@ export default function ShopInfoGeneral({ form }) {
</div> </div>
); );
} }
const ReceivableCustomFieldSelect = (
<Select>
<Select.Option value="v_vin">VIN</Select.Option>
<Select.Option value="clm_no">Claim No.</Select.Option>
<Select.Option value="ded_amt">Deductible Amount</Select.Option>
</Select>
);

View File

@@ -15,6 +15,14 @@ export const QUERY_NOTES_BY_JOB_PK = gql`
jobs_by_pk(id: $id) { jobs_by_pk(id: $id) {
id id
ro_number ro_number
vehicle{
jobs{
id
ro_number
status
clm_no
}
}
notes { notes {
created_at created_at
created_by created_by

View File

@@ -228,6 +228,7 @@
"saving": "Error encountered while saving. {{message}}" "saving": "Error encountered while saving. {{message}}"
}, },
"fields": { "fields": {
"ReceivableCustomField": "QBO Receivable Custom Field {{number}}",
"address1": "Address 1", "address1": "Address 1",
"address2": "Address 2", "address2": "Address 2",
"appt_alt_transport": "Appointment Alternative Transportation Options", "appt_alt_transport": "Appointment Alternative Transportation Options",
@@ -1865,6 +1866,7 @@
"updatedat": "Updated At" "updatedat": "Updated At"
}, },
"labels": { "labels": {
"addtorelatedro": "Add to Related ROs",
"newnoteplaceholder": "Add a note...", "newnoteplaceholder": "Add a note...",
"notetoadd": "Note to Add" "notetoadd": "Note to Add"
}, },

View File

@@ -228,6 +228,7 @@
"saving": "" "saving": ""
}, },
"fields": { "fields": {
"ReceivableCustomField": "",
"address1": "", "address1": "",
"address2": "", "address2": "",
"appt_alt_transport": "", "appt_alt_transport": "",
@@ -1865,6 +1866,7 @@
"updatedat": "Actualizado en" "updatedat": "Actualizado en"
}, },
"labels": { "labels": {
"addtorelatedro": "",
"newnoteplaceholder": "Agrega una nota...", "newnoteplaceholder": "Agrega una nota...",
"notetoadd": "" "notetoadd": ""
}, },

View File

@@ -228,6 +228,7 @@
"saving": "" "saving": ""
}, },
"fields": { "fields": {
"ReceivableCustomField": "",
"address1": "", "address1": "",
"address2": "", "address2": "",
"appt_alt_transport": "", "appt_alt_transport": "",
@@ -1865,6 +1866,7 @@
"updatedat": "Mis à jour à" "updatedat": "Mis à jour à"
}, },
"labels": { "labels": {
"addtorelatedro": "",
"newnoteplaceholder": "Ajouter une note...", "newnoteplaceholder": "Ajouter une note...",
"notetoadd": "" "notetoadd": ""
}, },

File diff suppressed because one or more lines are too long

View File

@@ -503,7 +503,38 @@ async function InsertInvoice(
bodyshop.accountingconfig.qbo_departmentid.trim() !== "" && { bodyshop.accountingconfig.qbo_departmentid.trim() !== "" && {
DepartmentRef: { value: bodyshop.accountingconfig.qbo_departmentid }, DepartmentRef: { value: bodyshop.accountingconfig.qbo_departmentid },
}), }),
CustomField: [
...(bodyshop.accountingconfig.ReceivableCustomField1
? [
{
DefinitionId: "1",
StringValue:
job[bodyshop.accountingconfig.ReceivableCustomField1],
Type: "StringType",
},
]
: []),
...(bodyshop.accountingconfig.ReceivableCustomField2
? [
{
DefinitionId: "2",
StringValue:
job[bodyshop.accountingconfig.ReceivableCustomField2],
Type: "StringType",
},
]
: []),
...(bodyshop.accountingconfig.ReceivableCustomField3
? [
{
DefinitionId: "3",
StringValue:
job[bodyshop.accountingconfig.ReceivableCustomField3],
Type: "StringType",
},
]
: []),
],
...(bodyshop.accountingconfig && ...(bodyshop.accountingconfig &&
bodyshop.accountingconfig.qbo && bodyshop.accountingconfig.qbo &&
bodyshop.accountingconfig.qbo_usa && bodyshop.accountingconfig.qbo_usa &&

View File

@@ -139,6 +139,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
jobs(where: {id: {_in: $ids}}) { jobs(where: {id: {_in: $ids}}) {
id id
job_totals job_totals
ded_amt
date_invoiced date_invoiced
ro_number ro_number
clm_total clm_total