|
|
@ -60,8 +60,6 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m |
|
|
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useRoles() |
|
|
|
const { isUIAllowed } = useRoles() |
|
|
|
|
|
|
|
|
|
|
|
const isSaving = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// getters
|
|
|
|
// getters
|
|
|
|
const displayValue = computed(() => { |
|
|
|
const displayValue = computed(() => { |
|
|
|
if (row?.value?.row) { |
|
|
|
if (row?.value?.row) { |
|
|
@ -131,7 +129,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const saveComment = async (scrollToCreateComment?: any) => { |
|
|
|
const saveComment = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (!row.value || !comment.value) return |
|
|
|
if (!row.value || !comment.value) return |
|
|
|
|
|
|
|
|
|
|
@ -139,42 +137,19 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m |
|
|
|
|
|
|
|
|
|
|
|
if (!rowId) return |
|
|
|
if (!rowId) return |
|
|
|
|
|
|
|
|
|
|
|
isSaving.value = true |
|
|
|
await api.utils.commentRow({ |
|
|
|
|
|
|
|
|
|
|
|
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({ |
|
|
|
|
|
|
|
fk_model_id: meta.value?.id as string, |
|
|
|
fk_model_id: meta.value?.id as string, |
|
|
|
row_id: rowId, |
|
|
|
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() |
|
|
|
reloadTrigger?.trigger() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await loadCommentsAndLogs() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comment.value = '' |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
|
message.error(e.message) |
|
|
|
message.error(e.message) |
|
|
|
} finally { |
|
|
|
|
|
|
|
isSaving.value = false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$e('a:row-expand:comment') |
|
|
|
$e('a:row-expand:comment') |
|
|
|