fix: address modal not opening on second try
This commit is contained in:
parent
187b887c8d
commit
2a5d88b2e5
@ -42,12 +42,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<AddressModal v-model="showAddressModal" v-model:address="_address" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import FieldLayout from '@/components/FieldLayout.vue'
|
import FieldLayout from '@/components/FieldLayout.vue'
|
||||||
import AddressModal from '@/components/Modals/AddressModal.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 { capture } from '@/telemetry'
|
import { capture } from '@/telemetry'
|
||||||
@ -69,6 +67,8 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['openAddressModal'])
|
||||||
|
|
||||||
const { isManager } = usersStore()
|
const { isManager } = usersStore()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -77,9 +77,6 @@ const show = defineModel()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
let _contact = ref({})
|
let _contact = ref({})
|
||||||
let _address = ref({})
|
|
||||||
|
|
||||||
const showAddressModal = ref(false)
|
|
||||||
|
|
||||||
async function createContact() {
|
async function createContact() {
|
||||||
if (_contact.value.email_id) {
|
if (_contact.value.email_id) {
|
||||||
@ -133,16 +130,13 @@ const tabs = createResource({
|
|||||||
} else if (field.name == 'address') {
|
} else if (field.name == 'address') {
|
||||||
field.create = (value, close) => {
|
field.create = (value, close) => {
|
||||||
_contact.value.address = value
|
_contact.value.address = value
|
||||||
_address.value = {}
|
emit('openAddressModal')
|
||||||
showAddressModal.value = true
|
show.value = false
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
field.edit = async (addr) => {
|
field.edit = (address) => {
|
||||||
_address.value = await call('frappe.client.get', {
|
emit('openAddressModal', address)
|
||||||
doctype: 'Address',
|
show.value = false
|
||||||
name: addr,
|
|
||||||
})
|
|
||||||
showAddressModal.value = true
|
|
||||||
}
|
}
|
||||||
} else if (field.type === 'Table') {
|
} else if (field.type === 'Table') {
|
||||||
_contact.value[field.name] = []
|
_contact.value[field.name] = []
|
||||||
|
|||||||
@ -42,12 +42,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<AddressModal v-model="showAddressModal" v-model:address="_address" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import FieldLayout from '@/components/FieldLayout.vue'
|
import FieldLayout from '@/components/FieldLayout.vue'
|
||||||
import AddressModal from '@/components/Modals/AddressModal.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 { capture } from '@/telemetry'
|
import { capture } from '@/telemetry'
|
||||||
@ -65,6 +63,8 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['openAddressModal'])
|
||||||
|
|
||||||
const { isManager } = usersStore()
|
const { isManager } = usersStore()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -74,8 +74,6 @@ const organization = defineModel('organization')
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const title = ref(null)
|
const title = ref(null)
|
||||||
|
|
||||||
let _address = ref({})
|
|
||||||
|
|
||||||
let _organization = ref({
|
let _organization = ref({
|
||||||
organization_name: '',
|
organization_name: '',
|
||||||
website: '',
|
website: '',
|
||||||
@ -84,8 +82,6 @@ let _organization = ref({
|
|||||||
industry: '',
|
industry: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const showAddressModal = ref(false)
|
|
||||||
|
|
||||||
let doc = ref({})
|
let doc = ref({})
|
||||||
|
|
||||||
async function createOrganization() {
|
async function createOrganization() {
|
||||||
@ -128,16 +124,13 @@ const tabs = createResource({
|
|||||||
if (field.name == 'address') {
|
if (field.name == 'address') {
|
||||||
field.create = (value, close) => {
|
field.create = (value, close) => {
|
||||||
_organization.value.address = value
|
_organization.value.address = value
|
||||||
_address.value = {}
|
emit('openAddressModal')
|
||||||
showAddressModal.value = true
|
show.value = false
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
field.edit = (addr) => {
|
field.edit = (address) => {
|
||||||
_address.value = await call('frappe.client.get', {
|
emit('openAddressModal', address)
|
||||||
doctype: 'Address',
|
show.value = false
|
||||||
name: addr,
|
|
||||||
})
|
|
||||||
showAddressModal.value = true
|
|
||||||
}
|
}
|
||||||
} else if (field.type === 'Table') {
|
} else if (field.type === 'Table') {
|
||||||
_organization.value[field.name] = []
|
_organization.value[field.name] = []
|
||||||
|
|||||||
@ -60,16 +60,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ContactModal
|
<ContactModal
|
||||||
v-if="showContactModal"
|
|
||||||
v-model="showContactModal"
|
v-model="showContactModal"
|
||||||
v-model:showQuickEntryModal="showQuickEntryModal"
|
v-model:showQuickEntryModal="showQuickEntryModal"
|
||||||
:contact="{}"
|
:contact="{}"
|
||||||
|
@openAddressModal="(_address) => openAddressModal(_address)"
|
||||||
/>
|
/>
|
||||||
<QuickEntryModal
|
<QuickEntryModal
|
||||||
v-if="showQuickEntryModal"
|
v-if="showQuickEntryModal"
|
||||||
v-model="showQuickEntryModal"
|
v-model="showQuickEntryModal"
|
||||||
doctype="Contact"
|
doctype="Contact"
|
||||||
/>
|
/>
|
||||||
|
<AddressModal v-model="showAddressModal" v-model:address="address" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -79,11 +80,13 @@ import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
|||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import ContactModal from '@/components/Modals/ContactModal.vue'
|
import ContactModal from '@/components/Modals/ContactModal.vue'
|
||||||
import QuickEntryModal from '@/components/Modals/QuickEntryModal.vue'
|
import QuickEntryModal from '@/components/Modals/QuickEntryModal.vue'
|
||||||
|
import AddressModal from '@/components/Modals/AddressModal.vue'
|
||||||
import ContactsListView from '@/components/ListViews/ContactsListView.vue'
|
import ContactsListView from '@/components/ListViews/ContactsListView.vue'
|
||||||
import ViewControls from '@/components/ViewControls.vue'
|
import ViewControls from '@/components/ViewControls.vue'
|
||||||
import { getMeta } from '@/stores/meta'
|
import { getMeta } from '@/stores/meta'
|
||||||
import { organizationsStore } from '@/stores/organizations.js'
|
import { organizationsStore } from '@/stores/organizations.js'
|
||||||
import { formatDate, timeAgo } from '@/utils'
|
import { formatDate, timeAgo } from '@/utils'
|
||||||
|
import { call } from 'frappe-ui'
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
|
|
||||||
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
|
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
|
||||||
@ -92,11 +95,13 @@ const { getOrganization } = organizationsStore()
|
|||||||
|
|
||||||
const showContactModal = ref(false)
|
const showContactModal = ref(false)
|
||||||
const showQuickEntryModal = ref(false)
|
const showQuickEntryModal = ref(false)
|
||||||
|
const showAddressModal = ref(false)
|
||||||
|
|
||||||
const contactsListView = ref(null)
|
const contactsListView = ref(null)
|
||||||
|
|
||||||
// contacts data is loaded in the ViewControls component
|
// contacts data is loaded in the ViewControls component
|
||||||
const contacts = ref({})
|
const contacts = ref({})
|
||||||
|
const address = ref({})
|
||||||
const loadMore = ref(1)
|
const loadMore = ref(1)
|
||||||
const triggerResize = ref(1)
|
const triggerResize = ref(1)
|
||||||
const updatedPageCount = ref(20)
|
const updatedPageCount = ref(20)
|
||||||
@ -158,4 +163,15 @@ const rows = computed(() => {
|
|||||||
return _rows
|
return _rows
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function openAddressModal(_address) {
|
||||||
|
if (_address) {
|
||||||
|
_address = await call('frappe.client.get', {
|
||||||
|
doctype: 'Address',
|
||||||
|
name: _address,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
showAddressModal.value = true
|
||||||
|
address.value = _address || {}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -60,15 +60,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<OrganizationModal
|
<OrganizationModal
|
||||||
v-if="showOrganizationModal"
|
|
||||||
v-model="showOrganizationModal"
|
v-model="showOrganizationModal"
|
||||||
v-model:showQuickEntryModal="showQuickEntryModal"
|
v-model:showQuickEntryModal="showQuickEntryModal"
|
||||||
|
@openAddressModal="(_address) => openAddressModal(_address)"
|
||||||
/>
|
/>
|
||||||
<QuickEntryModal
|
<QuickEntryModal
|
||||||
v-if="showQuickEntryModal"
|
v-if="showQuickEntryModal"
|
||||||
v-model="showQuickEntryModal"
|
v-model="showQuickEntryModal"
|
||||||
doctype="CRM Organization"
|
doctype="CRM Organization"
|
||||||
/>
|
/>
|
||||||
|
<AddressModal v-model="showAddressModal" v-model:address="address" />
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import ViewBreadcrumbs from '@/components/ViewBreadcrumbs.vue'
|
import ViewBreadcrumbs from '@/components/ViewBreadcrumbs.vue'
|
||||||
@ -77,10 +78,12 @@ import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
|
|||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import QuickEntryModal from '@/components/Modals/QuickEntryModal.vue'
|
import QuickEntryModal from '@/components/Modals/QuickEntryModal.vue'
|
||||||
|
import AddressModal from '@/components/Modals/AddressModal.vue'
|
||||||
import OrganizationsListView from '@/components/ListViews/OrganizationsListView.vue'
|
import OrganizationsListView from '@/components/ListViews/OrganizationsListView.vue'
|
||||||
import ViewControls from '@/components/ViewControls.vue'
|
import ViewControls from '@/components/ViewControls.vue'
|
||||||
import { getMeta } from '@/stores/meta'
|
import { getMeta } from '@/stores/meta'
|
||||||
import { formatDate, timeAgo, website } from '@/utils'
|
import { formatDate, timeAgo, website } from '@/utils'
|
||||||
|
import { call } from 'frappe-ui'
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
|
|
||||||
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
|
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
|
||||||
@ -89,9 +92,11 @@ const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
|
|||||||
const organizationsListView = ref(null)
|
const organizationsListView = ref(null)
|
||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
const showQuickEntryModal = ref(false)
|
const showQuickEntryModal = ref(false)
|
||||||
|
const showAddressModal = ref(false)
|
||||||
|
|
||||||
// organizations data is loaded in the ViewControls component
|
// organizations data is loaded in the ViewControls component
|
||||||
const organizations = ref({})
|
const organizations = ref({})
|
||||||
|
const address = ref({})
|
||||||
const loadMore = ref(1)
|
const loadMore = ref(1)
|
||||||
const triggerResize = ref(1)
|
const triggerResize = ref(1)
|
||||||
const updatedPageCount = ref(20)
|
const updatedPageCount = ref(20)
|
||||||
@ -154,4 +159,15 @@ const rows = computed(() => {
|
|||||||
return _rows
|
return _rows
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function openAddressModal(_address) {
|
||||||
|
if (_address) {
|
||||||
|
_address = await call('frappe.client.get', {
|
||||||
|
doctype: 'Address',
|
||||||
|
name: _address,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
showAddressModal.value = true
|
||||||
|
address.value = _address || {}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user