diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 190587f..288d60d 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -359,6 +359,7 @@ "requiredLastName": true, "requiredEmail": true, "requiredExcelValidator": true, - "requiredImageValidator": true + "requiredImageValidator": true, + "requiredName": true } } diff --git a/auto-imports.d.ts b/auto-imports.d.ts index cfebfb4..4be24c0 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -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 readonly requiredImageValidator: UnwrapRef readonly requiredLastName: UnwrapRef + readonly requiredName: UnwrapRef readonly requiredPhone: UnwrapRef readonly requiredValidator: UnwrapRef readonly resolveComponent: UnwrapRef @@ -841,6 +843,7 @@ declare module '@vue/runtime-core' { readonly requiredFirstName: UnwrapRef readonly requiredImageValidator: UnwrapRef readonly requiredLastName: UnwrapRef + readonly requiredName: UnwrapRef readonly requiredPhone: UnwrapRef readonly requiredValidator: UnwrapRef readonly resolveComponent: UnwrapRef diff --git a/resources/js/store.js b/resources/js/store.js index f66f885..a15a577 100644 --- a/resources/js/store.js +++ b/resources/js/store.js @@ -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 => { diff --git a/resources/js/views/pages/account-settings/AccountSettingsAccount.vue b/resources/js/views/pages/account-settings/AccountSettingsAccount.vue index de5ff09..d7fd702 100644 --- a/resources/js/views/pages/account-settings/AccountSettingsAccount.vue +++ b/resources/js/views/pages/account-settings/AccountSettingsAccount.vue @@ -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'); } };