feature/IO-3255-simplified-parts-management - Bug Fixes

This commit is contained in:
Dave
2025-08-15 13:07:32 -04:00
parent 73e103f2df
commit 5e90504e56
2 changed files with 18 additions and 11 deletions

View File

@@ -134,7 +134,8 @@ export function Manage({ conflict, bodyshop, partsManagementOnly }) {
}); });
}, [t]); }, [t]);
if (partsManagementOnly) { // This is a required safety check to prevent parts management only users from accessing /manage based routes
if (partsManagementOnly && !import.meta.env.DEV) {
// This NEEDS to be done this way, DO NOT use the react router, it will cause a ton of side effects // This NEEDS to be done this way, DO NOT use the react router, it will cause a ton of side effects
window.location = "/parts"; window.location = "/parts";
return null; // Prevent further rendering return null; // Prevent further rendering

View File

@@ -406,18 +406,25 @@ const extractJobLines = (rq) => {
const price = parseFloat(partInfo.PartPrice || partInfo.ListPrice || 0); const price = parseFloat(partInfo.PartPrice || partInfo.ListPrice || 0);
out.push({ out.push({
...base, ...base,
part_type: partInfo.PartType || null, part_type: partInfo.PartType || null ? String(partInfo.PartType).toUpperCase() : null,
part_qty: parseFloat(partInfo.Quantity || 0) || 1, part_qty: parseFloat(partInfo.Quantity || 0) || 1,
oem_partno: partInfo.OEMPartNum || null, oem_partno: partInfo.OEMPartNum || partInfo.PartNum || null,
db_price: price, db_price: price,
act_price: price, act_price: price,
// Labor fields if present on same line // Labor fields only when INCLUDE_LABOR is enabled
mod_lbr_ty: laborInfo.LaborType || null, ...(INCLUDE_LABOR
mod_lb_hrs: parseFloat(laborInfo.LaborHours || 0), ? {
lbr_op: laborInfo.LaborOperation || null, mod_lbr_ty: laborInfo.LaborType || null,
lbr_amt: INCLUDE_LABOR ? parseFloat(laborInfo.LaborAmt || 0) : 0, mod_lb_hrs: parseFloat(laborInfo.LaborHours || 0),
lbr_op: laborInfo.LaborOperation || null,
lbr_amt: parseFloat(laborInfo.LaborAmt || 0)
}
: {}),
// Tax flag from PartInfo.TaxableInd when provided // Tax flag from PartInfo.TaxableInd when provided
...(partInfo.TaxableInd !== undefined ...(partInfo.TaxableInd !== undefined &&
(typeof partInfo.TaxableInd === "string" ||
typeof partInfo.TaxableInd === "number" ||
typeof partInfo.TaxableInd === "boolean")
? { ? {
tax_part: tax_part:
partInfo.TaxableInd === true || partInfo.TaxableInd === true ||
@@ -674,8 +681,7 @@ const vehicleDamageEstimateAddRq = async (req, res) => {
// Insert job // Insert job
const { insert_jobs_one: newJob } = await client.request(INSERT_JOB_WITH_LINES, { job: jobInput }); const { insert_jobs_one: newJob } = await client.request(INSERT_JOB_WITH_LINES, { job: jobInput });
logger.log("parts-job-created", "info", newJob.id, null);
return res.status(200).json({ success: true, jobId: newJob.id }); return res.status(200).json({ success: true, jobId: newJob.id });
} catch (err) { } catch (err) {
logger.log("parts-route-error", "error", null, null, { error: err }); logger.log("parts-route-error", "error", null, null, { error: err });