Merge branch 'develop' into feat/captain-limits-frontend

This commit is contained in:
Sojan Jose
2025-01-23 01:25:06 +05:30
committed by GitHub
5 changed files with 156 additions and 81 deletions
@@ -35,7 +35,7 @@ const FORM_CONFIG = {
EMAIL_ADDRESS: { field: 'email' },
PHONE_NUMBER: { field: 'phoneNumber' },
CITY: { field: 'additionalAttributes.city' },
COUNTRY: { field: 'additionalAttributes.country' },
COUNTRY: { field: 'additionalAttributes.countryCode' },
BIO: { field: 'additionalAttributes.description' },
COMPANY_NAME: { field: 'additionalAttributes.companyName' },
};
@@ -123,7 +123,7 @@ const prepareStateBasedOnProps = () => {
};
const countryOptions = computed(() =>
countries.map(({ name }) => ({ label: name, value: name }))
countries.map(({ name, id }) => ({ label: name, value: id }))
);
const editDetailsForm = computed(() =>
@@ -205,8 +205,8 @@ const getMessageType = key => {
};
const handleCountrySelection = value => {
const selectedCountry = countries.find(option => option.name === value);
state.additionalAttributes.countryCode = selectedCountry?.id || '';
const selectedCountry = countries.find(option => option.id === value);
state.additionalAttributes.country = selectedCountry?.name || '';
emit('update', state);
};
@@ -242,7 +242,7 @@ defineExpose({
<template v-for="item in editDetailsForm" :key="item.key">
<ComboBox
v-if="item.key === 'COUNTRY'"
v-model="state.additionalAttributes.country"
v-model="state.additionalAttributes.countryCode"
:options="countryOptions"
:placeholder="item.placeholder"
class="[&>div>button]:h-8"
@@ -18,6 +18,7 @@ const attachment = computed(() => {
const hasError = ref(false);
const showGallery = ref(false);
const isDownloading = ref(false);
const handleError = () => {
hasError.value = true;
@@ -26,7 +27,14 @@ const handleError = () => {
const downloadAttachment = async () => {
const { fileType, dataUrl, extension } = attachment.value;
downloadFile({ url: dataUrl, type: fileType, extension });
try {
isDownloading.value = true;
await downloadFile({ url: dataUrl, type: fileType, extension });
} catch (error) {
// error
} finally {
isDownloading.value = false;
}
};
</script>
@@ -60,7 +68,9 @@ const downloadAttachment = async () => {
slate
icon="i-lucide-download"
class="opacity-60"
@click="downloadAttachment"
:is-loading="isDownloading"
:disabled="isDownloading"
@click.stop="downloadAttachment"
/>
</div>
</div>