Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
a5f7ff3089 IO-3491 QBO SALESTERMSREF
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2025-12-31 09:25:12 -08:00
3 changed files with 9 additions and 32 deletions

View File

@@ -1,7 +1,6 @@
import { useLazyQuery } from "@apollo/client";
import { useSplitTreatments } from "@splitsoftware/splitio-react";
import { Card, Form, Input, InputNumber, Select, Space, Switch } from "antd";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -34,9 +33,7 @@ export function TimeTicketModalComponent({
authLevel,
employeeAutoCompleteOptions,
disabled,
employeeSelectDisabled,
lineTicketRefreshKey,
isOpen
employeeSelectDisabled
}) {
const { t } = useTranslation();
const {
@@ -51,18 +48,6 @@ export function TimeTicketModalComponent({
fetchPolicy: "network-only",
nextFetchPolicy: "network-only"
});
// Watch the jobid field so we can refetch the bottom section without relying on jobid changes
const watchedJobId = Form.useWatch("jobid", form);
useEffect(() => {
if (!isOpen) return;
if (!watchedJobId) return;
if (!lineTicketRefreshKey) return;
loadLineTicketData({ variables: { id: watchedJobId } });
}, [lineTicketRefreshKey, watchedJobId, isOpen]);
const CostCenterSelect = ({ emps, value, ...props }) => {
return (
<Select
@@ -319,7 +304,6 @@ export function TimeTicketModalComponent({
)}
</Form.Item>
</LayoutFormRow>
<Form.Item dependencies={["jobid"]}>
{() => {
const jobid = form.getFieldValue("jobid");

View File

@@ -29,9 +29,6 @@ export function TimeTicketModalContainer({ timeTicketModal, toggleModalVisible,
const [loading, setLoading] = useState(false);
const { t } = useTranslation();
const [enterAgain, setEnterAgain] = useState(false);
const [lineTicketRefreshKey, setLineTicketRefreshKey] = useState(0);
const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET);
const [updateTicket] = useMutation(UPDATE_TIME_TICKET);
const {
@@ -88,17 +85,11 @@ export function TimeTicketModalContainer({ timeTicketModal, toggleModalVisible,
notification["success"]({
message: t("timetickets.successes.created")
});
// Refresh parent screens (Job Labor tab, etc.)
if (timeTicketModal.actions.refetch) timeTicketModal.actions.refetch();
// Refresh the modal "bottom section" (allocations + embedded ticket list) for the current job
setLineTicketRefreshKey((k) => k + 1);
if (enterAgain) {
// Capture existing information and repopulate it.
// (Include jobid so Save & New stays on the same RO if it was selected in-form.)
const prev = form.getFieldsValue(["jobid", "date", "employeeid", "flat_rate"]);
//Capture the existing information and repopulate it.
const prev = form.getFieldsValue(["date", "employeeid", "flat_rate"]);
form.resetFields();
@@ -238,7 +229,6 @@ export function TimeTicketModalContainer({ timeTicketModal, toggleModalVisible,
</Space>
}
/>
<TimeTicketModalComponent
isEdit={timeTicketModal.context.id}
form={form}
@@ -248,8 +238,6 @@ export function TimeTicketModalContainer({ timeTicketModal, toggleModalVisible,
timeTicketModal.context?.timeticket?.committed_at ||
(timeTicketModal.context?.timeticket?.employeeid && !timeTicketModal.context.id ? true : false)
}
lineTicketRefreshKey={lineTicketRefreshKey}
isOpen={timeTicketModal.open}
/>
</Form>
</Modal>

View File

@@ -283,6 +283,11 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop)
VendorRef: {
value: vendor.Id
},
...(vendor.TermRef && {
SalesTermRef: {
value: vendor.TermRef.value
}
}),
TxnDate: moment(bill.date)
//.tz(bill.job.bodyshop.timezone)
.format("YYYY-MM-DD"),