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

View File

@ -6,9 +6,17 @@
:doctype="doctype" :doctype="doctype"
:doc="doc.data?.name" :doc="doc.data?.name"
/> />
<NoteModal
v-model="showNoteModal"
v-model:reloadNotes="activities"
:note="note"
:doctype="doctype"
:doc="doc.data?.name"
/>
</template> </template>
<script setup> <script setup>
import TaskModal from '@/components/Modals/TaskModal.vue' import TaskModal from '@/components/Modals/TaskModal.vue'
import NoteModal from '@/components/Modals/NoteModal.vue'
import { call } from 'frappe-ui' import { call } from 'frappe-ui'
import { ref } from 'vue' 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({ defineExpose({
showTask, showTask,
deleteTask, deleteTask,
updateTaskStatus, updateTaskStatus,
showNote,
}) })
</script> </script>