From a39efcdfd88eee3d060ec4a623271e3f3850aa7b Mon Sep 17 00:00:00 2001
From: rakesh
Date: Sat, 13 May 2023 17:08:49 +0530
Subject: [PATCH] address fixes
---
.../address/ShippingAddressFormComponent.vue | 145 +++++++++++-------
src/routes/retailer/edit_account_info.vue | 124 ++++-----------
2 files changed, 119 insertions(+), 150 deletions(-)
diff --git a/src/components/retailer/address/ShippingAddressFormComponent.vue b/src/components/retailer/address/ShippingAddressFormComponent.vue
index 9025d00..049e30e 100644
--- a/src/components/retailer/address/ShippingAddressFormComponent.vue
+++ b/src/components/retailer/address/ShippingAddressFormComponent.vue
@@ -7,9 +7,19 @@
already registered?
click here to login
-
+
You can create an account after checkout.
-
+
@@ -18,9 +28,10 @@
label="First Name"
ref="firstName"
v-model="firstname"
- outlined
- dense
- :rules="hideAndShowFields? textRules:[]"
+ color="primary"
+ density="compact"
+ variant="outlined"
+ :rules="hideAndShowFields ? textRules : []"
v-show="hideAndShowFields"
@input="verifyAddress"
>
@@ -28,9 +39,10 @@
label="Last Name"
ref="lastName"
v-model="lastname"
- outlined
- dense
- :rules="hideAndShowFields? textRules:[]"
+ color="primary"
+ density="compact"
+ variant="outlined"
+ :rules="hideAndShowFields ? textRules : []"
v-show="hideAndShowFields"
@input="verifyAddress"
>
@@ -38,8 +50,9 @@
label="Street Address"
ref="streetAddressOne"
v-model="streetNoOne"
- outlined
- dense
+ color="primary"
+ density="compact"
+ variant="outlined"
required
:rules="textRules"
@input="verifyAddress"
@@ -49,16 +62,18 @@
label="Apt, Suite, Co., C/O etc."
ref="streetAddressTwo"
v-model="streetNoTwo"
- outlined
- dense
+ color="primary"
+ density="compact"
+ variant="outlined"
required
@change="checkPOBoxAddress()"
@input="verifyAddress"
>
- This field is required
+ This field is required
@@ -117,11 +143,11 @@
//import { mapState } from "vuex";
import { createHelpers } from "vuex-map-fields";
import { fetchStates } from "@/services/util.service";
-import { VueTelInput } from 'vue3-tel-input'
+import { VueTelInput } from "vue3-tel-input";
const { mapFields } = createHelpers({
getterType: "accountOne/getField",
- mutationType: "accountOne/updateField"
+ mutationType: "accountOne/updateField",
});
export default {
name: "ShippingAddressFormComponent",
@@ -137,24 +163,25 @@ export default {
valid: true,
lazy: false,
textRules: [
- v => !!v || "This field is required",
- v => (v && v.length >= 3) || "This field must be at least 3 characters"
+ (v) => !!v || "This field is required",
+ (v) => (v && v.length >= 3) || "This field must be at least 3 characters",
],
zipCodeRules: [
- v => !!v || "Zip code is required",
- v => (v && v.length >= 5) || "This field must be at least 5 characters"
+ (v) => !!v || "Zip code is required",
+ (v) => (v && v.length >= 5) || "This field must be at least 5 characters",
],
emailRules: [
- v => !!v || "E-mail is required",
- v => /.+@.+\..+/.test(v) || "E-mail must be valid"
+ (v) => !!v || "E-mail is required",
+ (v) => /.+@.+\..+/.test(v) || "E-mail must be valid",
],
phoneNumberRules: [
- v => !!v || "This field is required",
- v => (v && v.length >= 8) || "Phone Number must be at least 8 characters"
- ]
+ (v) => !!v || "This field is required",
+ (v) =>
+ (v && v.length >= 8) || "Phone Number must be at least 8 characters",
+ ],
}),
components: {
- VueTelInput
+ VueTelInput,
},
computed: {
...mapFields([
@@ -171,36 +198,36 @@ export default {
"address.streetNoOne",
"address.streetNoTwo",
"address.firstname",
- "address.lastname"
+ "address.lastname",
]),
- allCountries: function() {
- return this.$store.state.accountOne.allCountries.map(countries => {
+ allCountries: function () {
+ return this.$store.state.accountOne.allCountries.map((countries) => {
return {
value: countries.id,
- label: countries.fullNameEnglish
+ label: countries.fullNameEnglish,
};
});
},
- add: function() {
+ add: function () {
return this.$store.state.accountOne.address;
},
countryAndStatesList() {
return this.$store.state.accountOne.allCountries;
},
- userAuth: function() {
+ userAuth: function () {
return this.$store.state.auth.userAuth;
- }
+ },
},
watch: {
/*countryId: function() {
this.updateRegionList();
},*/
- regionId: function() {
+ regionId: function () {
this.fetchStates(this.countryId);
},
valid() {
this.$emit("actionValid", this.valid);
- }
+ },
},
methods: {
verifyAddress() {
@@ -210,7 +237,7 @@ export default {
if (this.regionId) {
this.regionId = this.regionId.toString();
- let regionName = this.regionList.filter(obj => {
+ let regionName = this.regionList.filter((obj) => {
if (obj.value == this.regionId) return obj;
});
this.$emit("regionDetails", regionName);
@@ -221,9 +248,9 @@ export default {
/*eslint-disable*/
// this.$refs.shippingAddressform.resetValidation();
this.regionList = fetchStates(countryId, this.countryAndStatesList);
- this.regionId = this.regionId ? this.regionId.toString(): '';
+ this.regionId = this.regionId ? this.regionId.toString() : "";
if (this.regionId) {
- let regionName = this.regionList.filter(obj => {
+ let regionName = this.regionList.filter((obj) => {
if (obj.value == this.regionId) return obj;
});
this.$emit("regionDetails", regionName);
@@ -248,19 +275,19 @@ export default {
this.regionList = fetchStates(this.countryId, this.countryAndStatesList);
},
validateNumber(number, data) {
- if (data&&data.possible && data.valid) this.phoneNumberError = false;
+ if (data && data.possible && data.valid) this.phoneNumberError = false;
else this.phoneNumberError = true;
},
- async checkPOBoxAddress(){
+ async checkPOBoxAddress() {
let street = [];
street[0] = this.streetNoOne ? this.streetNoOne : "";
- if(this.streetNoTwo)
+ if (this.streetNoTwo)
street[1] = this.streetNoTwo ? this.streetNoTwo : "";
let address = {
- street: street
- }
+ street: street,
+ };
await this.$store.dispatch("accountOne/checkPOBoxAddress", address);
- }
+ },
},
async created() {
await this.$store.dispatch("accountOne/fetchCountries");
@@ -273,6 +300,6 @@ export default {
this.$emit("actionValid", this.valid);
this.$emit("verifyAddress");
}
- }
+ },
};
diff --git a/src/routes/retailer/edit_account_info.vue b/src/routes/retailer/edit_account_info.vue
index 0ed2b63..4722ea5 100644
--- a/src/routes/retailer/edit_account_info.vue
+++ b/src/routes/retailer/edit_account_info.vue
@@ -9,12 +9,12 @@
dense
v-if="wrongPasswordMessage"
>{{wrongPasswordMessage}}
- Edit Account Information
+ Edit Account Information
-
Account Information
+
Account Information
@@ -40,43 +43,21 @@
-
+
- Change Password
+ Change Password
-
+
-
+
-
+
SAVE
@@ -224,8 +164,9 @@ export default {
},*/
},
methods: {
- submit() {
- if (this.$refs.form.validate() && !this.password) {
+ async submit() {
+ let validate = await this.$refs.form.validate();
+ if (validate && validate.valid && !this.password) {
this.$store
.dispatch("accountOne/changeBasicInfo")
.then(() => {
@@ -254,7 +195,8 @@ export default {
});
}, 3000);
});
- } else if (this.$refs.form.validate() && this.password) {
+ }
+ else if (validate && validate.valid && this.password) {
localStorage.setItem("cr_changePassowrd", true);
this.$store
.dispatch("accountOne/changeBasicInfo", {