refactor: remove unnecessary functions & components

This commit is contained in:
Pratik 2025-06-23 07:35:15 +00:00
parent 34102ef6ef
commit 480cc07cd9
4 changed files with 11 additions and 35 deletions

View File

@ -2,7 +2,7 @@
<Dialog v-model="show" :options="{ size: 'xl' }"> <Dialog v-model="show" :options="{ size: 'xl' }">
<template #body v-if="!confirmDeleteInfo.show"> <template #body v-if="!confirmDeleteInfo.show">
<div class="bg-surface-modal px-4 pb-6 pt-5 sm:px-6"> <div class="bg-surface-modal px-4 pb-6 pt-5 sm:px-6">
<div class="mb-6 flex items-center justify-between"> <div class="mb-4 flex items-center justify-between">
<div> <div>
<h3 class="text-2xl leading-6 text-ink-gray-9 font-semibold"> <h3 class="text-2xl leading-6 text-ink-gray-9 font-semibold">
{{ {{
@ -20,7 +20,7 @@
</div> </div>
<div> <div>
<div v-if="linkedDocs?.length > 0"> <div v-if="linkedDocs?.length > 0">
<span class="text-ink-gray-5"> <span class="text-ink-gray-5 text-base">
{{ {{
__( __(
'Delete or unlink these linked documents before deleting this document', 'Delete or unlink these linked documents before deleting this document',
@ -48,7 +48,7 @@
:unlinkLinkedDoc="unlinkLinkedDoc" :unlinkLinkedDoc="unlinkLinkedDoc"
/> />
</div> </div>
<div v-if="linkedDocs?.length == 0" class="text-ink-gray-5"> <div v-if="linkedDocs?.length == 0" class="text-ink-gray-5 text-base">
{{ {{
__('Are you sure you want to delete {0} - {1}?', [ __('Are you sure you want to delete {0} - {1}?', [
props.doctype, props.doctype,
@ -121,11 +121,11 @@
</Button> </Button>
</div> </div>
</div> </div>
<div class="text-ink-gray-5"> <div class="text-ink-gray-5 text-base">
{{ confirmDeleteInfo.message }} {{ confirmDeleteInfo.message }}
</div> </div>
<div class="flex flex-row-reverse gap-2 mt-6"> <div class="flex flex-row-reverse gap-2 mt-6">
<Button variant="ghost" @click="confirmDeleteInfo.show = false"> <Button variant="ghost" @click="cancel()">
{{ __('Cancel') }} {{ __('Cancel') }}
</Button> </Button>
<Button <Button
@ -199,6 +199,11 @@ const linkedDocs = computed(() => {
) )
}) })
const cancel = () => {
confirmDeleteInfo.value.show = false
viewControls.value.updateSelections([])
}
const unlinkLinkedDoc = (doc) => { const unlinkLinkedDoc = (doc) => {
let selectedDocs = [] let selectedDocs = []
if (viewControls.value.selections.length > 0) { if (viewControls.value.selections.length > 0) {

View File

@ -134,21 +134,6 @@ const viewLinkedDoc = (doc) => {
} }
const getDoctypeName = (doctype) => { const getDoctypeName = (doctype) => {
switch (doctype) { return doctype.replace(/^(CRM|FCRM)\s*/, '')
case 'CRM Lead':
return 'Lead'
case 'CRM Call Log':
return 'Call Log'
case 'CRM Task':
return 'Task'
case 'Contact':
return 'Contact'
case 'CRM Organization':
return 'Organization'
case 'FCRM Note':
return 'Note'
default:
return doctype
}
} }
</script> </script>

View File

@ -172,7 +172,6 @@
:errorTitle="errorTitle" :errorTitle="errorTitle"
:errorMessage="errorMessage" :errorMessage="errorMessage"
/> />
<AddressModal v-model="showAddressModal" v-model:address="_address" />
<DeleteLinkedDocModal <DeleteLinkedDocModal
v-if="showDeleteLinkedDocModal" v-if="showDeleteLinkedDocModal"
v-model="showDeleteLinkedDocModal" v-model="showDeleteLinkedDocModal"

View File

@ -164,12 +164,6 @@
:errorTitle="errorTitle" :errorTitle="errorTitle"
:errorMessage="errorMessage" :errorMessage="errorMessage"
/> />
<QuickEntryModal
v-if="showQuickEntryModal"
v-model="showQuickEntryModal"
doctype="CRM Organization"
/>
<AddressModal v-model="showAddressModal" v-model:address="_address" />
<DeleteLinkedDocModal <DeleteLinkedDocModal
v-if="showDeleteLinkedDocModal" v-if="showDeleteLinkedDocModal"
v-model="showDeleteLinkedDocModal" v-model="showDeleteLinkedDocModal"
@ -306,13 +300,6 @@ async function deleteOrganization() {
showDeleteLinkedDocModal.value = true showDeleteLinkedDocModal.value = true
} }
function validateFile(file) {
let extn = file.name.split('.').pop().toLowerCase()
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
return __('Only PNG and JPG images are allowed')
}
}
async function changeOrganizationImage(file) { async function changeOrganizationImage(file) {
await call('frappe.client.set_value', { await call('frappe.client.set_value', {
doctype: 'CRM Organization', doctype: 'CRM Organization',