new content notification working for client brief

This commit is contained in:
isUnknown 2024-11-22 09:20:38 +01:00
parent 8ae00d7657
commit c1d2c73118
9 changed files with 277 additions and 70 deletions

View file

@ -183,12 +183,13 @@ function handleSubmit(event = null) {
userUuid: user.uuid,
text: draftComment.value.text,
date,
position:
{
pageIndex: draftComment.value.position.pageIndex,
x: draftComment.value.position?.x,
y: draftComment.value.position?.y,
} ?? false,
position: {
pageIndex: openedComment.value
? openedComment.value.position.pageIndex
: draftComment.value.position.pageIndex,
x: openedComment.value ? false : draftComment.value.position.x,
y: openedComment.value ? false : draftComment.value.position.y,
},
id: uniqid(),
};
if (openedComment.value) {
@ -201,9 +202,7 @@ function handleSubmit(event = null) {
async function replyComment(newComment) {
newComment.parentId = openedComment.value.id;
const newFile = await api.replyComment(newComment);
draftComment.value.text = "";
draftComment.value.position = null;
draftComment.value.padeIndex = null;
resetDraftComment();
isAddOpen.value = false;
dialog.updateFile(newFile);
openedComment.value = newFile.comments.find(
@ -213,12 +212,15 @@ async function replyComment(newComment) {
async function addComment(newComment) {
const newFile = await api.addComment(newComment);
resetDraftComment();
isAddOpen.value = false;
dialog.updateFile(newFile);
}
function resetDraftComment() {
draftComment.value.text = "";
draftComment.value.position = null;
draftComment.value.padeIndex = null;
isAddOpen.value = false;
dialog.updateFile(newFile);
}
function closeComment() {
@ -267,9 +269,7 @@ function handleCommentPositionClick(event) {
}
function openComment(comment) {
if (comment.replies.length) {
openedComment.value = comment;
}
openedComment.value = comment;
}
</script>