Compare commits
2 Commits
feature/IO
...
bugfix/IO-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
217a0b84ac | ||
|
|
45e143578c |
@@ -90,6 +90,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only fill actual_cost when the user forward-tabs out of Retail (actual_price)
|
||||||
const autofillActualCost = (index) => {
|
const autofillActualCost = (index) => {
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
const retailRaw = form.getFieldValue(["billlines", index, "actual_price"]);
|
const retailRaw = form.getFieldValue(["billlines", index, "actual_price"]);
|
||||||
@@ -164,10 +165,9 @@ export function BillEnterModalLinesComponent({
|
|||||||
}}
|
}}
|
||||||
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
||||||
onSelect={(value, opt) => {
|
onSelect={(value, opt) => {
|
||||||
const d = normalizeDiscount(discount);
|
// IMPORTANT:
|
||||||
const retail = Number(opt.cost);
|
// Do NOT autofill actual_cost here. It should only fill when the user forward-tabs
|
||||||
const computedActual = Number.isFinite(retail) ? round2(retail * (1 - d)) : null;
|
// from Retail (actual_price) -> Actual Cost (actual_cost).
|
||||||
|
|
||||||
setFieldsValue({
|
setFieldsValue({
|
||||||
billlines: (getFieldValue("billlines") || []).map((item, idx) => {
|
billlines: (getFieldValue("billlines") || []).map((item, idx) => {
|
||||||
if (idx !== index) return item;
|
if (idx !== index) return item;
|
||||||
@@ -178,7 +178,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
quantity: opt.part_qty || 1,
|
quantity: opt.part_qty || 1,
|
||||||
actual_price: opt.cost,
|
actual_price: opt.cost,
|
||||||
original_actual_price: opt.cost,
|
original_actual_price: opt.cost,
|
||||||
actual_cost: isBlank(item.actual_cost) ? computedActual : item.actual_cost,
|
// actual_cost intentionally untouched here
|
||||||
cost_center: opt.part_type
|
cost_center: opt.part_type
|
||||||
? bodyshopHasDmsKey(bodyshop)
|
? bodyshopHasDmsKey(bodyshop)
|
||||||
? opt.part_type !== "PAE"
|
? opt.part_type !== "PAE"
|
||||||
@@ -251,9 +251,9 @@ export function BillEnterModalLinesComponent({
|
|||||||
<CurrencyInput
|
<CurrencyInput
|
||||||
min={0}
|
min={0}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onBlur={() => autofillActualCost(index)}
|
// NOTE: Autofill should only happen on forward Tab out of Retail
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Tab") autofillActualCost(index);
|
if (e.key === "Tab" && !e.shiftKey) autofillActualCost(index);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -329,7 +329,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
controls={false}
|
controls={false}
|
||||||
style={{ width: "100%", height: CONTROL_HEIGHT }}
|
style={{ width: "100%", height: CONTROL_HEIGHT }}
|
||||||
onFocus={() => autofillActualCost(index)}
|
// NOTE: No auto-fill on focus/blur; only triggered from Retail on Tab
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,11 +14,8 @@ export default function GlobalSearch() {
|
|||||||
const [callSearch, { loading, error, data }] = useLazyQuery(GLOBAL_SEARCH_QUERY);
|
const [callSearch, { loading, error, data }] = useLazyQuery(GLOBAL_SEARCH_QUERY);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const executeSearch = (variables) => {
|
const executeSearch = (v) => {
|
||||||
if (variables?.search !== "" && variables?.search?.length >= 3)
|
if (v && v.variables.search && v.variables.search !== "" && v.variables.search.length >= 3) callSearch(v);
|
||||||
callSearch({
|
|
||||||
variables
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
||||||
|
|
||||||
@@ -160,9 +157,7 @@ export default function GlobalSearch() {
|
|||||||
return (
|
return (
|
||||||
<AutoComplete
|
<AutoComplete
|
||||||
options={options}
|
options={options}
|
||||||
showSearch={{
|
onSearch={handleSearch}
|
||||||
onSearch: handleSearch
|
|
||||||
}}
|
|
||||||
defaultActiveFirstOption
|
defaultActiveFirstOption
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key !== "Enter") return;
|
if (e.key !== "Enter") return;
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ const OwnerSearchSelect = ({ value, onChange, onBlur, disabled, ref }) => {
|
|||||||
SEARCH_OWNERS_BY_ID_FOR_AUTOCOMPLETE
|
SEARCH_OWNERS_BY_ID_FOR_AUTOCOMPLETE
|
||||||
);
|
);
|
||||||
|
|
||||||
const executeSearch = (variables) => {
|
const executeSearch = (v) => {
|
||||||
if (variables?.search !== "" && variables?.search?.length >= 2) callSearch({ variables });
|
if (v && v.variables?.search !== "" && v.variables.search.length >= 2) callSearch({ variables: v.variables });
|
||||||
};
|
};
|
||||||
|
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
const handleSearch = (value) => {
|
||||||
|
|||||||
@@ -18,10 +18,9 @@ const VehicleSearchSelect = ({ value, onChange, onBlur, disabled, ref }) => {
|
|||||||
SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE
|
SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE
|
||||||
);
|
);
|
||||||
|
|
||||||
const executeSearch = (variables) => {
|
const executeSearch = (v) => {
|
||||||
if (variables?.search !== "" && variables?.search?.length >= 2) callSearch({ variables });
|
if (v && v.variables?.search !== "" && v.variables.search.length >= 2) callSearch({ variables: v.variables });
|
||||||
};
|
};
|
||||||
|
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
const handleSearch = (value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user