|
|
|
@ -60,8 +60,6 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useRoles() |
|
|
|
|
|
|
|
|
|
const isSaving = ref(false) |
|
|
|
|
|
|
|
|
|
// getters
|
|
|
|
|
const displayValue = computed(() => { |
|
|
|
|
if (row?.value?.row) { |
|
|
|
@ -131,7 +129,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const saveComment = async (scrollToCreateComment?: any) => { |
|
|
|
|
const saveComment = async () => { |
|
|
|
|
try { |
|
|
|
|
if (!row.value || !comment.value) return |
|
|
|
|
|
|
|
|
@ -139,42 +137,19 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
|
|
|
|
|
if (!rowId) return |
|
|
|
|
|
|
|
|
|
isSaving.value = true |
|
|
|
|
|
|
|
|
|
const createdDate = new Date().toISOString() |
|
|
|
|
const createdIndex = commentsAndLogs.value.length |
|
|
|
|
|
|
|
|
|
commentsAndLogs.value.push({ |
|
|
|
|
created_at: createdDate, |
|
|
|
|
description: `The following comment has been created: ${comment.value}`, |
|
|
|
|
email: user?.value?.email, |
|
|
|
|
user: user?.value?.email, |
|
|
|
|
id: '', |
|
|
|
|
display_name: user.value?.display_name, |
|
|
|
|
row_id: rowId, |
|
|
|
|
updated_at: createdDate, |
|
|
|
|
op_type: 'COMMENT', |
|
|
|
|
new: true, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const commentValue = comment.value |
|
|
|
|
comment.value = '' |
|
|
|
|
|
|
|
|
|
if (scrollToCreateComment) scrollToCreateComment() |
|
|
|
|
|
|
|
|
|
const createdComment = await api.utils.commentRow({ |
|
|
|
|
await api.utils.commentRow({ |
|
|
|
|
fk_model_id: meta.value?.id as string, |
|
|
|
|
row_id: rowId, |
|
|
|
|
description: `The following comment has been created: ${commentValue}`, |
|
|
|
|
description: `The following comment has been created: ${comment.value}`, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
commentsAndLogs.value[createdIndex] = createdComment |
|
|
|
|
|
|
|
|
|
reloadTrigger?.trigger() |
|
|
|
|
|
|
|
|
|
await loadCommentsAndLogs() |
|
|
|
|
|
|
|
|
|
comment.value = '' |
|
|
|
|
} catch (e: any) { |
|
|
|
|
message.error(e.message) |
|
|
|
|
} finally { |
|
|
|
|
isSaving.value = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$e('a:row-expand:comment') |
|
|
|
|