feat: allow manually create call logs

This commit is contained in:
Shariq Ansari 2025-01-22 18:11:53 +05:30
parent ae41e50a4c
commit edab3ed65d
3 changed files with 22 additions and 10 deletions

View File

@ -47,8 +47,7 @@
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Status", "label": "Status",
"options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled", "options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled"
"read_only": 1
}, },
{ {
"fieldname": "start_time", "fieldname": "start_time",
@ -83,8 +82,7 @@
"fieldname": "duration", "fieldname": "duration",
"fieldtype": "Duration", "fieldtype": "Duration",
"in_list_view": 1, "in_list_view": 1,
"label": "Duration", "label": "Duration"
"read_only": 1
}, },
{ {
"fieldname": "recording_url", "fieldname": "recording_url",
@ -145,7 +143,8 @@
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Telephony Medium", "label": "Telephony Medium",
"options": "\nManual\nTwilio\nExotel" "options": "\nManual\nTwilio\nExotel",
"read_only": 1
}, },
{ {
"fieldname": "section_break_gyqe", "fieldname": "section_break_gyqe",
@ -154,7 +153,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-01-17 21:46:01.558377", "modified": "2025-01-22 17:57:59.289548",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "FCRM", "module": "FCRM",
"name": "CRM Call Log", "name": "CRM Call Log",

View File

@ -58,6 +58,7 @@ import FieldLayout from '@/components/FieldLayout/FieldLayout.vue'
import EditIcon from '@/components/Icons/EditIcon.vue' import EditIcon from '@/components/Icons/EditIcon.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { isMobileView } from '@/composables/settings' import { isMobileView } from '@/composables/settings'
import { getRandom } from '@/utils'
import { capture } from '@/telemetry' import { capture } from '@/telemetry'
import { FeatherIcon, createResource, ErrorMessage } from 'frappe-ui' import { FeatherIcon, createResource, ErrorMessage } from 'frappe-ui'
import { ref, nextTick, watch, computed } from 'vue' import { ref, nextTick, watch, computed } from 'vue'
@ -92,7 +93,7 @@ let _callLog = ref({
receiver: '', receiver: '',
status: '', status: '',
recording_url: '', recording_url: '',
telephony_medium: '', telephony_medium: 'Manual',
}) })
const dialogOptions = computed(() => { const dialogOptions = computed(() => {
@ -159,6 +160,8 @@ const createCallLog = createResource({
return { return {
doc: { doc: {
doctype: 'CRM Call Log', doctype: 'CRM Call Log',
id: getRandom(6),
telephony_medium: 'Manual',
..._callLog.value, ..._callLog.value,
}, },
} }

View File

@ -8,6 +8,9 @@
v-if="callLogsListView?.customListActions" v-if="callLogsListView?.customListActions"
:actions="callLogsListView.customListActions" :actions="callLogsListView.customListActions"
/> />
<Button variant="solid" :label="__('Create')" @click="createCallLog">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button>
</template> </template>
</LayoutHeader> </LayoutHeader>
<ViewControls <ViewControls
@ -55,7 +58,11 @@
v-model:callLogModal="showCallLogModal" v-model:callLogModal="showCallLogModal"
v-model:callLog="callLog" v-model:callLog="callLog"
/> />
<CallLogModal v-model="showCallLogModal" v-model:callLog="callLog" /> <CallLogModal
v-model="showCallLogModal"
v-model:callLog="callLog"
:options="{ afterInsert: () => callLogs.reload() }"
/>
</template> </template>
<script setup> <script setup>
@ -97,11 +104,9 @@ const rows = computed(() => {
}) })
const showCallLogDetailModal = ref(false) const showCallLogDetailModal = ref(false)
const selectedCallLog = ref(null)
const callLog = ref({}) const callLog = ref({})
function showCallLog(name) { function showCallLog(name) {
selectedCallLog.value = name
showCallLogDetailModal.value = true showCallLogDetailModal.value = true
callLog.value = createResource({ callLog.value = createResource({
url: 'crm.fcrm.doctype.crm_call_log.crm_call_log.get_call_log', url: 'crm.fcrm.doctype.crm_call_log.crm_call_log.get_call_log',
@ -110,4 +115,9 @@ function showCallLog(name) {
auto: true, auto: true,
}) })
} }
function createCallLog() {
callLog.value = {}
showCallLogModal.value = true
}
</script> </script>