diff --git a/src/app/profile/dashboard/orientation-details/orientation-details.component.ts b/src/app/profile/dashboard/orientation-details/orientation-details.component.ts index bf8a9e20ac2b3a9d6bdcc08a2558f39805dbc3eb..cb0f98cd93ddedf056d5814ff55dbe4b6808535c 100644 --- a/src/app/profile/dashboard/orientation-details/orientation-details.component.ts +++ b/src/app/profile/dashboard/orientation-details/orientation-details.component.ts @@ -66,13 +66,20 @@ export class OrientationDetailsComponent implements OnInit { const comment = this.commentTextarea?.value || ''; const sanitizedHtml = this.sanitizer.sanitize(SecurityContext.HTML, comment); const sanitizedComment = this.extractPlainText(sanitizedHtml || ''); - this.patchOrientation({ + + const patchData: any = { status: this.selectedStatus, action: null, processingComment: sanitizedComment, - closingDate: isClosed ? null : new Date(), modifiedBy: this.userProfile._id, - }); + }; + + // Only add closingDate if orientation is not already closed + if (!isClosed) { + patchData.closingDate = new Date(); + } + + this.patchOrientation(patchData); } this.isModalOpenned = false; }