fix: moved note modal in allmodal component

This commit is contained in:
Shariq Ansari 2024-07-19 14:48:21 +05:30
parent 2035fd9420
commit 757c74785d
2 changed files with 25 additions and 23 deletions

View File

@ -35,7 +35,7 @@
</template>
<span>{{ __('Make a Call') }}</span>
</Button>
<Button v-else-if="title == 'Notes'" variant="solid" @click="showNote()">
<Button v-else-if="title == 'Notes'" variant="solid" @click="modalRef.showNote()">
<template #prefix>
<FeatherIcon name="plus" class="h-4 w-4" />
</template>
@ -108,7 +108,7 @@
v-if="title == 'Notes'"
class="grid grid-cols-1 gap-4 px-4 pb-3 sm:px-10 sm:pb-5 lg:grid-cols-2 xl:grid-cols-3"
>
<div v-for="note in activities" @click="showNote(note)">
<div v-for="note in activities" @click="modalRef.showNote(note)">
<NoteArea :note="note" v-model="all_activities" />
</div>
</div>
@ -410,7 +410,7 @@
<Button
v-else-if="title == 'Notes'"
:label="__('Create Note')"
@click="showNote()"
@click="modalRef.showNote()"
/>
<Button
v-else-if="title == 'Emails'"
@ -445,13 +445,6 @@
:doctype="doctype"
@scroll="scroll"
/>
<NoteModal
v-model="showNoteModal"
v-model:reloadNotes="all_activities"
:note="note"
:doctype="doctype"
:doc="doc.data?.name"
/>
<WhatsappTemplateSelectorModal
v-if="whatsappEnabled"
v-model="showWhatsappTemplates"
@ -492,7 +485,6 @@ import InboundCallIcon from '@/components/Icons/InboundCallIcon.vue'
import OutboundCallIcon from '@/components/Icons/OutboundCallIcon.vue'
import FadedScrollableDiv from '@/components/FadedScrollableDiv.vue'
import CommunicationArea from '@/components/CommunicationArea.vue'
import NoteModal from '@/components/Modals/NoteModal.vue'
import WhatsappTemplateSelectorModal from '@/components/Modals/WhatsappTemplateSelectorModal.vue'
import AllModals from '@/components/Activities/AllModals.vue'
import {
@ -656,7 +648,7 @@ const defaultActions = computed(() => {
{
icon: h(NoteIcon, { class: 'h-4 w-4' }),
label: __('New Note'),
onClick: () => showNote(),
onClick: () => modalRef.value.showNote(),
},
{
icon: h(TaskIcon, { class: 'h-4 w-4' }),
@ -815,19 +807,8 @@ function timelineIcon(activity_type, is_lead) {
return markRaw(icon)
}
// Notes
const showNoteModal = ref(false)
const note = ref({})
const emailBox = ref(null)
function showNote(n) {
note.value = n || {
title: '',
content: '',
}
showNoteModal.value = true
}
watch([reload, reload_email], ([reload_value, reload_email_value]) => {
if (reload_value || reload_email_value) {
all_activities.reload()

View File

@ -6,9 +6,17 @@
:doctype="doctype"
:doc="doc.data?.name"
/>
<NoteModal
v-model="showNoteModal"
v-model:reloadNotes="activities"
:note="note"
:doctype="doctype"
:doc="doc.data?.name"
/>
</template>
<script setup>
import TaskModal from '@/components/Modals/TaskModal.vue'
import NoteModal from '@/components/Modals/NoteModal.vue'
import { call } from 'frappe-ui'
import { ref } from 'vue'
@ -54,9 +62,22 @@ function updateTaskStatus(status, task) {
})
}
// Notes
const showNoteModal = ref(false)
const note = ref({})
function showNote(n) {
note.value = n || {
title: '',
content: '',
}
showNoteModal.value = true
}
defineExpose({
showTask,
deleteTask,
updateTaskStatus,
showNote,
})
</script>