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, "requiredLastName": true,
"requiredEmail": true, "requiredEmail": true,
"requiredExcelValidator": 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 requiredFirstName: typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']
const requiredImageValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator'] const requiredImageValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']
const requiredLastName: typeof import('./resources/js/@core/utils/validators.js')['requiredLastName'] 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 requiredPhone: typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']
const requiredValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredValidator'] const requiredValidator: typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']
const resolveComponent: typeof import('vue')['resolveComponent'] 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 requiredFirstName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']>
readonly requiredImageValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']> 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 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 requiredPhone: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']>
readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']> readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']> 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 requiredFirstName: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredFirstName']>
readonly requiredImageValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredImageValidator']> 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 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 requiredPhone: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredPhone']>
readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']> readonly requiredValidator: UnwrapRef<typeof import('./resources/js/@core/utils/validators.js')['requiredValidator']>
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']> readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>

View File

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

View File

@ -15,14 +15,14 @@ const profileData = ref([]);
const errors = ref({ const errors = ref({
name: undefined, name: undefined,
email: undefined, email: undefined,
phone:undefined, phone_no:undefined,
}) })
const accountData = { const accountData = {
avatarImg: avatar1, avatarImg: avatar1,
name: '', name: '',
last_name: '', last_name: '',
email: '', email: '',
phone: '', phone_no: '',
} }
const refVForm = ref() const refVForm = ref()
@ -37,18 +37,6 @@ const resetForm = () => {
accountDataLocal.value = structuredClone(accountData) 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 changeAvatar = file => {
const fileReader = new FileReader() const fileReader = new FileReader()
const { files } = file.target const { files } = file.target
@ -65,16 +53,11 @@ const changeAvatar = file => {
} }
onMounted(async () => { onMounted(async () => {
await store.dispatch('adminDetial'); await store.dispatch('adminDetial');
// profileData.value =
let list = await store.getters.getAdminDetail let list = await store.getters.getAdminDetail
accountDataLocal.value.email = list.email accountDataLocal.value.email = list.email
// accountData.name = profileData.value.name;
accountDataLocal.value.name = list.name accountDataLocal.value.name = list.name
// accountData.lastName = profileData.value.last_name;
accountDataLocal.value.lastName = list.last_name; accountDataLocal.value.lastName = list.last_name;
// accountData.phone = profileData.value.phone_no; accountDataLocal.value.phone_no = list.phone_no
accountDataLocal.value.phone = list.phone_no
// accountData.avatarImg = profileData.value.profile_image ? profileData.value.profile_image : avatar1;
if(!list.image_path){ if(!list.image_path){
accountDataLocal.value.avatarImg = avatar1; accountDataLocal.value.avatarImg = avatar1;
}else{ }else{
@ -154,19 +137,19 @@ const onSubmit = async () => {
await store.dispatch('profileUpdate',{ await store.dispatch('profileUpdate',{
name: accountDataLocal.value.name, name: accountDataLocal.value.name,
last_name: accountDataLocal.value.last_name, last_name: accountDataLocal.value.last_name,
phone: accountDataLocal.value.phone, phone_no: accountDataLocal.value.phone_no,
image: ImageBase64.value, //ecelData, image: ImageBase64.value, //ecelData,
}) })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
await store.dispatch('siteSetting'); await store.dispatch('adminDetial');
let list = await store.getters.getSiteSetting let list = await store.getters.getAdminDetail
console.log('list',list) console.log('list',list)
accountDataLocal.value.avatarImg = list.logo accountDataLocal.value.avatarImg = list.image_path
accountDataLocal.value.name = list.first_name accountDataLocal.value.name = list.name
accountDataLocal.value.last_name = list.last_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 = () => { const formatPhoneNumber = () => {
// Remove non-numeric characters from the input // 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 // Apply formatting logic
if (numericValue.length <= 10) { 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 { } else {
// Limit the input to a maximum of 14 characters // Limit the input to a maximum of 14 characters
const truncatedValue = numericValue.slice(0, 10); 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> </script>
<template> <template>
<VRow> <VRow>
<VCol cols="12"> <VCol cols="12">
<VCard> <VCard>
<VCardText> <VCardText>
@ -236,7 +221,7 @@ const formatPhoneNumber = () => {
</div> </div>
<!-- 👉 Form --> <!-- 👉 Form -->
<VForm ref="refVForm" @submit.prevent="onSubmit"> <VForm ref="refVForm">
<VRow> <VRow>
<!-- 👉 First Name --> <!-- 👉 First Name -->
<VCol <VCol
@ -257,7 +242,7 @@ const formatPhoneNumber = () => {
cols="12" cols="12"
> >
<VTextField <VTextField
v-model="accountDataLocal.lastName" v-model="accountDataLocal.last_name"
placeholder="Doe" placeholder="Doe"
label="Last Name" label="Last Name"
/> />
@ -279,18 +264,7 @@ const formatPhoneNumber = () => {
</VCol> </VCol>
<!-- 👉 Organization --> <!-- 👉 Organization -->
<VCol
cols="12"
md="6"
style="display: none;"
>
<VTextField
v-model="accountDataLocal.org"
label="Organization"
placeholder="ThemeSelection"
/>
</VCol>
<!-- 👉 Phone --> <!-- 👉 Phone -->
<VCol <VCol
@ -298,7 +272,7 @@ const formatPhoneNumber = () => {
md="6" md="6"
> >
<VTextField <VTextField
v-model="accountDataLocal.phone" v-model="accountDataLocal.phone_no"
label="Phone Number" label="Phone Number"
placeholder="+1 (917) 543-9876" placeholder="+1 (917) 543-9876"
:rules="[requiredPhone, validUSAPhone]" :rules="[requiredPhone, validUSAPhone]"
@ -309,115 +283,21 @@ const formatPhoneNumber = () => {
/> />
</VCol> </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 --> <!-- 👉 Form Actions -->
<VCol <VCol
cols="12" cols="12"
class="d-flex flex-wrap gap-4" class="d-flex flex-wrap gap-4"
> >
<VBtn type="submit">Save changes</VBtn> <VBtn @click.prevent="onSubmit">Save changes</VBtn>
</VCol> </VCol>
</VRow> </VRow>
</VForm> </VForm>
@ -425,30 +305,6 @@ const formatPhoneNumber = () => {
</VCard> </VCard>
</VCol> </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> </VRow>
<!-- Confirm Dialog --> <!-- Confirm Dialog -->