Validation and confirmation messages.

This commit is contained in:
Patrick Fic
2023-08-03 14:14:01 -07:00
parent 1d7f1cccba
commit 3e8660bb61
9 changed files with 127 additions and 39 deletions

View File

@@ -32,7 +32,7 @@ exports.payall = async function (req, res) {
const { employeeHash, assignmentHash } = CalculateExpectedHoursForJob(job);
const ticketHash = CalculateTicketsHoursForJob(job);
if (assignmentHash.unassigned > 0) {
res.json({ success: false, error: "Unassigned hours." });
res.json({ success: false, error: "Not all hours have been assigned." });
return;
}
@@ -65,7 +65,7 @@ exports.payall = async function (req, res) {
cost_center:
job.bodyshop.md_responsibility_centers.defaults.costs[key],
flat_rate: true,
memo: `*SYS-PAY* Add unflagged hours. (${req.user.email})`,
memo: `Add unflagged hours. (${req.user.email})`,
});
});
} else {
@@ -83,7 +83,7 @@ exports.payall = async function (req, res) {
job.bodyshop.md_responsibility_centers.defaults.costs[
path.mod_lbr_ty
],
memo: `*SYS-PAY* Add unflagged hours. (${req.user.email})`,
memo: `Add unflagged hours. (${req.user.email})`,
});
}
} else if (diff.op === "update") {
@@ -102,7 +102,7 @@ exports.payall = async function (req, res) {
job.bodyshop.md_responsibility_centers.defaults.costs[
path.mod_lbr_ty
],
memo: `*SYS-PAY* Adjust flagged hours per assignment. (${req.user.email})`,
memo: `Adjust flagged hours per assignment. (${req.user.email})`,
});
} else {
//Has to be a delete
@@ -124,7 +124,7 @@ exports.payall = async function (req, res) {
cost_center:
job.bodyshop.md_responsibility_centers.defaults.costs[key],
flat_rate: true,
memo: `*SYS-PAY* Remove flagged hours per assignment. (${req.user.email})`,
memo: `Remove flagged hours per assignment. (${req.user.email})`,
});
});
} else {
@@ -142,7 +142,7 @@ exports.payall = async function (req, res) {
path.mod_lbr_ty
],
flat_rate: true,
memo: `*SYS-PAY* Remove flagged hours per assignment. (${req.user.email})`,
memo: `Remove flagged hours per assignment. (${req.user.email})`,
});
}
}
@@ -163,10 +163,10 @@ exports.payall = async function (req, res) {
jobid,
{
jobid: jobid,
error,
error: JSON.stringify(error),
}
);
res.status(503).send();
res.status(400).json({ error: error.message });
}
};