Add audit trail and resolve status update.
This commit is contained in:
@@ -46,7 +46,9 @@ exports.payall = async function (req, res) {
|
||||
//Every iteration is what we would need to insert into the time ticket hash
|
||||
//so that it would match the employee hash exactly.
|
||||
const path = diffParser(diff);
|
||||
|
||||
if (diff.op === "add") {
|
||||
console.log(Object.keys(diff.val));
|
||||
if (typeof diff.val === "object" && Object.keys(diff.val).length > 1) {
|
||||
//Multiple values to add.
|
||||
Object.keys(diff.val).forEach((key) => {
|
||||
@@ -63,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 unclaimed hours. (${req.user.email})`,
|
||||
memo: `*SYS-PAY* Add unflagged hours. (${req.user.email})`,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -81,7 +83,7 @@ exports.payall = async function (req, res) {
|
||||
job.bodyshop.md_responsibility_centers.defaults.costs[
|
||||
path.mod_lbr_ty
|
||||
],
|
||||
memo: `*SYS-PAY* Add unclaimed hours. (${req.user.email})`,
|
||||
memo: `*SYS-PAY* Add unflagged hours. (${req.user.email})`,
|
||||
});
|
||||
}
|
||||
} else if (diff.op === "update") {
|
||||
@@ -100,7 +102,7 @@ exports.payall = async function (req, res) {
|
||||
job.bodyshop.md_responsibility_centers.defaults.costs[
|
||||
path.mod_lbr_ty
|
||||
],
|
||||
memo: `*SYS-PAY* Adjust claimed hours per assignment. (${req.user.email})`,
|
||||
memo: `*SYS-PAY* Adjust flagged hours per assignment. (${req.user.email})`,
|
||||
});
|
||||
} else {
|
||||
//Has to be a delete
|
||||
@@ -122,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 claimed hours per assignment. (${req.user.email})`,
|
||||
memo: `*SYS-PAY* Remove flagged hours per assignment. (${req.user.email})`,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -140,7 +142,7 @@ exports.payall = async function (req, res) {
|
||||
path.mod_lbr_ty
|
||||
],
|
||||
flat_rate: true,
|
||||
memo: `*SYS-PAY* Remove claimed hours per assignment. (${req.user.email})`,
|
||||
memo: `*SYS-PAY* Remove flagged hours per assignment. (${req.user.email})`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -203,7 +205,14 @@ function diffParser(diff) {
|
||||
) {
|
||||
hours = diff.val;
|
||||
} else if (diff.val !== null && diff.val !== undefined) {
|
||||
hours = diff.val[Object.keys(diff.val)[0]];
|
||||
if (diff.path.length === 1) {
|
||||
hours =
|
||||
diff.val[Object.keys(diff.val)[0]][
|
||||
Object.keys(diff.val[Object.keys(diff.val)[0]])
|
||||
];
|
||||
} else {
|
||||
hours = diff.val[Object.keys(diff.val)[0]];
|
||||
}
|
||||
} else if (
|
||||
typeof diff.oldVal === "number" &&
|
||||
diff.oldVal !== null &&
|
||||
|
||||
Reference in New Issue
Block a user