This commit is contained in:
nasir@endelospay.com 2024-06-06 05:16:17 +05:00
parent e47a9eed61
commit 409bae9df4
4 changed files with 30 additions and 169 deletions

View File

@ -359,6 +359,7 @@
"requiredLastName": true,
"requiredEmail": true,
"requiredExcelValidator": true,
"requiredImageValidator": true
"requiredImageValidator": true,
"requiredName": true
}
}

3
auto-imports.d.ts vendored
View File

@ -126,6 +126,7 @@ declare global {
const requiredFirstName: typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']
const requiredImageValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']
const requiredLastName: typeof import('./resources/js/@core/utils/validators.js')['requiredLastName']
const requiredName: typeof import('./resources/js/@core/utils/validators.js')['requiredName']
const requiredPhone: typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']
const requiredValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']
const resolveComponent: typeof import('vue')['resolveComponent']
@ -487,6 +488,7 @@ declare module 'vue' {
readonly requiredFirstName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']>
readonly requiredImageValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']>
readonly requiredLastName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredLastName']>
readonly requiredName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredName']>
readonly requiredPhone: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']>
readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
@ -841,6 +843,7 @@ declare module '@vue/runtime-core' {
readonly requiredFirstName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']>
readonly requiredImageValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']>
readonly requiredLastName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredLastName']>
readonly requiredName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredName']>
readonly requiredPhone: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']>
readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>

View File

@ -636,12 +636,13 @@ export default createStore({
async profileUpdate({ commit }, payload) {
commit('setLoading', true)
await axios.post(PROFILE_UPDATE_API, {
name: payload.first_name,
first_name: payload.name,
last_name:payload.last_name,
phone: payload.phone,
phone_no: payload.phone_no,
image:payload.image
}, {
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {

View File

@ -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 -->