Skip to content

Commit f5318a7

Browse files
committed
Fix: adjustment value custom summary row
1 parent f5838d8 commit f5318a7

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

server/routes/comments.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,24 +305,32 @@ commentsRouter.get("/invoice/summary/:id", async (req, res) => {
305305
if (!groupedComments[bookingId]) {
306306
groupedComments[bookingId] = {
307307
...comment,
308-
comments: comment.comment ? [comment.comment] : [],
309-
adjustmentValues: [{
308+
comments: [],
309+
adjustmentValues: [],
310+
total: []
311+
};
312+
313+
if (comment.adjustmentType !== "total") {
314+
groupedComments[bookingId].adjustmentValues.push({
310315
id: comment.commentId,
311316
type: comment.adjustmentType,
312-
value: comment.adjustmentValue,
313-
}],
314-
total: comment.adjustmentType === "total" ? [{
317+
value: comment.adjustmentValue
318+
});
319+
}
320+
321+
if(comment.adjustmentType === "total"){
322+
groupedComments[bookingId].total.push({
315323
id: comment.commentId,
316324
value: comment.adjustmentValue,
317325
comment: comment.comment,
318326
date: comment.datetime
319-
}] : []
320-
};
327+
})
328+
}
321329
} else {
322330
// Add comment if it's not empty
323-
if (comment.comment && comment.adjustmentType !== "total") {
324-
groupedComments[bookingId].comments.push(comment.comment);
325-
}
331+
// if (comment.comment && comment.adjustmentType !== "total") {
332+
// groupedComments[bookingId].comments.push(comment.comment);
333+
// }
326334

327335
// Add adjustment value if not already included
328336
const adjustmentExists = groupedComments[bookingId].adjustmentValues.some(

0 commit comments

Comments
 (0)