fix
This commit is contained in:
@@ -15,14 +15,14 @@ const profileData = ref([]);
|
||||
const errors = ref({
|
||||
name: undefined,
|
||||
email: undefined,
|
||||
phone:undefined,
|
||||
phone_no:undefined,
|
||||
})
|
||||
const accountData = {
|
||||
avatarImg: avatar1,
|
||||
name: '',
|
||||
last_name: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
phone_no: '',
|
||||
}
|
||||
|
||||
const refVForm = ref()
|
||||
@@ -37,18 +37,6 @@ const resetForm = () => {
|
||||
accountDataLocal.value = structuredClone(accountData)
|
||||
}
|
||||
|
||||
// const changeAvatar = file => {
|
||||
// const fileReader = new FileReader()
|
||||
// const { files } = file.target
|
||||
// if (files && files.length) {
|
||||
// fileReader.readAsDataURL(files[0])
|
||||
// fileReader.onload = () => {
|
||||
// if (typeof fileReader.result === 'string')
|
||||
// accountDataLocal.value.avatarImg = fileReader.result
|
||||
// console.log("daas",accountDataLocal.value.avatarImg);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
const changeAvatar = file => {
|
||||
const fileReader = new FileReader()
|
||||
const { files } = file.target
|
||||
@@ -65,16 +53,11 @@ const changeAvatar = file => {
|
||||
}
|
||||
onMounted(async () => {
|
||||
await store.dispatch('adminDetial');
|
||||
// profileData.value =
|
||||
let list = await store.getters.getAdminDetail
|
||||
accountDataLocal.value.email = list.email
|
||||
// accountData.name = profileData.value.name;
|
||||
accountDataLocal.value.name = list.name
|
||||
// accountData.lastName = profileData.value.last_name;
|
||||
accountDataLocal.value.lastName = list.last_name;
|
||||
// accountData.phone = profileData.value.phone_no;
|
||||
accountDataLocal.value.phone = list.phone_no
|
||||
// accountData.avatarImg = profileData.value.profile_image ? profileData.value.profile_image : avatar1;
|
||||
accountDataLocal.value.phone_no = list.phone_no
|
||||
if(!list.image_path){
|
||||
accountDataLocal.value.avatarImg = avatar1;
|
||||
}else{
|
||||
@@ -154,19 +137,19 @@ const onSubmit = async () => {
|
||||
await store.dispatch('profileUpdate',{
|
||||
name: accountDataLocal.value.name,
|
||||
last_name: accountDataLocal.value.last_name,
|
||||
phone: accountDataLocal.value.phone,
|
||||
phone_no: accountDataLocal.value.phone_no,
|
||||
image: ImageBase64.value, //ecelData,
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
await store.dispatch('siteSetting');
|
||||
let list = await store.getters.getSiteSetting
|
||||
await store.dispatch('adminDetial');
|
||||
let list = await store.getters.getAdminDetail
|
||||
console.log('list',list)
|
||||
accountDataLocal.value.avatarImg = list.logo
|
||||
accountDataLocal.value.name = list.first_name
|
||||
accountDataLocal.value.avatarImg = list.image_path
|
||||
accountDataLocal.value.name = list.name
|
||||
accountDataLocal.value.last_name = list.last_name
|
||||
accountDataLocal.value.phone = list.phone
|
||||
accountDataLocal.value.phone_no = list.phone_no
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,21 +157,23 @@ console.log('list',list)
|
||||
|
||||
const formatPhoneNumber = () => {
|
||||
// Remove non-numeric characters from the input
|
||||
const numericValue = accountDataLocal.value.phone.replace(/\D/g, '');
|
||||
const numericValue = accountDataLocal.value.phone_no.replace(/\D/g, '');
|
||||
|
||||
// Apply formatting logic
|
||||
if (numericValue.length <= 10) {
|
||||
accountDataLocal.value.phone = numericValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
|
||||
accountDataLocal.value.phone_no = numericValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
|
||||
} else {
|
||||
// Limit the input to a maximum of 14 characters
|
||||
const truncatedValue = numericValue.slice(0, 10);
|
||||
accountDataLocal.value.phone = truncatedValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
|
||||
accountDataLocal.value.phone_no = truncatedValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<VRow>
|
||||
|
||||
<VCol cols="12">
|
||||
<VCard>
|
||||
<VCardText>
|
||||
@@ -236,7 +221,7 @@ const formatPhoneNumber = () => {
|
||||
</div>
|
||||
|
||||
<!-- 👉 Form -->
|
||||
<VForm ref="refVForm" @submit.prevent="onSubmit">
|
||||
<VForm ref="refVForm">
|
||||
<VRow>
|
||||
<!-- 👉 First Name -->
|
||||
<VCol
|
||||
@@ -257,7 +242,7 @@ const formatPhoneNumber = () => {
|
||||
cols="12"
|
||||
>
|
||||
<VTextField
|
||||
v-model="accountDataLocal.lastName"
|
||||
v-model="accountDataLocal.last_name"
|
||||
placeholder="Doe"
|
||||
label="Last Name"
|
||||
/>
|
||||
@@ -279,18 +264,7 @@ const formatPhoneNumber = () => {
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Organization -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VTextField
|
||||
v-model="accountDataLocal.org"
|
||||
label="Organization"
|
||||
placeholder="ThemeSelection"
|
||||
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
|
||||
<!-- 👉 Phone -->
|
||||
<VCol
|
||||
@@ -298,7 +272,7 @@ const formatPhoneNumber = () => {
|
||||
md="6"
|
||||
>
|
||||
<VTextField
|
||||
v-model="accountDataLocal.phone"
|
||||
v-model="accountDataLocal.phone_no"
|
||||
label="Phone Number"
|
||||
placeholder="+1 (917) 543-9876"
|
||||
:rules="[requiredPhone, validUSAPhone]"
|
||||
@@ -309,115 +283,21 @@ const formatPhoneNumber = () => {
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Address -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VTextField
|
||||
v-model="accountDataLocal.address"
|
||||
label="Address"
|
||||
placeholder="123 Main St, New York, NY 10001"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 State -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VTextField
|
||||
v-model="accountDataLocal.state"
|
||||
label="State"
|
||||
placeholder="New York"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Zip Code -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VTextField
|
||||
v-model="accountDataLocal.zip"
|
||||
label="Zip Code"
|
||||
placeholder="10001"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
|
||||
|
||||
<!-- 👉 Country -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VSelect
|
||||
v-model="accountDataLocal.country"
|
||||
multiple
|
||||
chips
|
||||
closable-chips
|
||||
label="Country"
|
||||
:items="['USA', 'Canada', 'UK', 'India', 'Australia']"
|
||||
placeholder="Select Country"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
|
||||
<!-- 👉 Language -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VSelect
|
||||
v-model="accountDataLocal.language"
|
||||
label="Language"
|
||||
multiple
|
||||
chips
|
||||
closable-chips
|
||||
placeholder="Select Language"
|
||||
:items="['English', 'Spanish', 'Arabic', 'Hindi', 'Urdu']"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Timezone -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VSelect
|
||||
v-model="accountDataLocal.timezone"
|
||||
label="Timezone"
|
||||
placeholder="Select Timezone"
|
||||
:items="timezones"
|
||||
:menu-props="{ maxHeight: 200 }"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Currency -->
|
||||
<VCol
|
||||
cols="12"
|
||||
md="6"
|
||||
style="display: none;"
|
||||
>
|
||||
<VSelect
|
||||
v-model="accountDataLocal.currency"
|
||||
label="Currency"
|
||||
placeholder="Select Currency"
|
||||
:items="currencies"
|
||||
:menu-props="{ maxHeight: 200 }"
|
||||
/>
|
||||
</VCol>
|
||||
|
||||
<!-- 👉 Form Actions -->
|
||||
<VCol
|
||||
cols="12"
|
||||
class="d-flex flex-wrap gap-4"
|
||||
>
|
||||
<VBtn type="submit">Save changes</VBtn>
|
||||
<VBtn @click.prevent="onSubmit">Save changes</VBtn>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
@@ -425,30 +305,6 @@ const formatPhoneNumber = () => {
|
||||
</VCard>
|
||||
</VCol>
|
||||
|
||||
<VCol cols="12" style="display: none;">
|
||||
<!-- 👉 Delete Account -->
|
||||
<VCard title="Delete Account">
|
||||
<VCardText>
|
||||
<!-- 👉 Checkbox and Button -->
|
||||
<div>
|
||||
<VCheckbox
|
||||
v-model="isAccountDeactivated"
|
||||
:rules="validateAccountDeactivation"
|
||||
label="I confirm my account deactivation"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<VBtn
|
||||
:disabled="!isAccountDeactivated"
|
||||
color="error"
|
||||
class="mt-3"
|
||||
@click="isConfirmDialogOpen = true"
|
||||
>
|
||||
Deactivate Account
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VCol>
|
||||
</VRow>
|
||||
|
||||
<!-- Confirm Dialog -->
|
||||
|
Reference in New Issue
Block a user