diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index ede70c75..47587b87 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -16,7 +16,8 @@ {{ translate("Generate") }} - + + @@ -49,6 +50,7 @@ import { IonInput, IonItem, IonLabel, + IonSpinner, IonTitle, IonToolbar, modalController @@ -76,6 +78,7 @@ export default defineComponent({ IonInput, IonItem, IonLabel, + IonSpinner, IonTitle, IonToolbar, }, @@ -87,7 +90,8 @@ export default defineComponent({ props: ['facilityId'], data() { return { - geoPoint: {} as any + geoPoint: {} as any, + isGeneratingLatLong: false } }, beforeMount() { @@ -98,6 +102,7 @@ export default defineComponent({ modalController.dismiss() }, async generateLatLong() { + this.isGeneratingLatLong = true const payload = { json: { params: { @@ -120,6 +125,7 @@ export default defineComponent({ showToast(translate("Failed to generate latitude and longitude.")) logger.error(err) } + this.isGeneratingLatLong = false }, async saveGeoPoint() { if(!this.geoPoint.latitude || !this.geoPoint.longitude) { @@ -157,4 +163,10 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index d9945661..98d20039 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -118,6 +118,7 @@ "Groups": "Groups", "Identification": "Identification", "Internal ID": "Internal ID", + "Internal ID cannot be more than 20 characters.": "Internal ID cannot be more than 20 characters.", "Instance Url": "Instance Url", "Language": "Language", "Latitude": "Latitude", @@ -153,6 +154,8 @@ "OMS": "OMS", "OMS instance": "OMS instance", "Online Order Fulfillment": "Online Order Fulfillment", + "Online inventory turned on for": "Online inventory turned on for {facilityName}", + "Online inventory turned off for": "Online inventory turned off for {facilityName}", "Open and close time": "Open and close time", "Opening Time": "Opening Time", "Operating hours": "Operating hours", @@ -186,7 +189,6 @@ "Reset": "Reset", "Role": "Role", "role": "role", - "Role(s) updated successfully.": "Role(s) updated successfully.", "Saturday": "Saturday", "Save": "Save", "Save address": "Save address", @@ -245,6 +247,7 @@ "Unlink": "Unlink", "Update days to ship": "Update days to ship", "Username": "Username", + "Username is required.": "Username is required.", "Uses native fulfillment app": "Uses native fulfillment app", "Version: ": "Version: { appVersion }", "View order count history": "View order count history", @@ -252,4 +255,4 @@ "Wednesday": "Wednesday", "Would you like to update your time zone to . Your profile is currently set to . This setting can always be changed from the settings menu.": "Would you like to update your time zone to {localTimeZone}. Your profile is currently set to {profileTimeZone}. This setting can always be changed from the settings menu.", "Zipcode": "Zipcode" - } \ No newline at end of file +} \ No newline at end of file diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index cba17a13..8c2fbf93 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -136,13 +136,18 @@ const actions: ActionTree = { facility.orderCount = facilityOrderCount[facility.facilityId] ? facilityOrderCount[facility.facilityId] : 0; const facilityGroupInfo = facilityGroupInformation[facility.facilityId] - - if(facilityGroupInfo.length) { + if (facilityGroupInfo?.length) { facility.groupInformation = facilityGroupInfo facility.sellOnline = (facilityGroupInfo.some((facilityGroup: any) => facilityGroup.facilityGroupId === 'FAC_GRP')) facility.useOMSFulfillment = (facilityGroupInfo.some((facilityGroup: any) => facilityGroup.facilityGroupId === 'OMS_FULFILLMENT')) facility.generateShippingLabel = (facilityGroupInfo.some((facilityGroup: any) => facilityGroup.facilityGroupId === 'AUTO_SHIPPING_LABEL')) facility.allowPickup = (facilityGroupInfo.some((facilityGroup: any) => facilityGroup.facilityGroupId === 'PICKUP')) + } else { + facility.groupInformation = [] + facility.sellOnline = false + facility.useOMSFulfillment = false + facility.generateShippingLabel = false + facility.allowPickup = false } commit(types.FACILITY_CURRENT_UPDATED, facility) diff --git a/src/views/AddFacilityConfig.vue b/src/views/AddFacilityConfig.vue index c47604f1..55ddf1df 100644 --- a/src/views/AddFacilityConfig.vue +++ b/src/views/AddFacilityConfig.vue @@ -64,29 +64,39 @@ {{ translate("Sell Inventory Online") }} - - - - {{ translate("Uses native fulfillment app") }} - + {{ translate("Allow pickup") }} - + - {{ translate("Create login credentials") }} - - - - - {{ translate('Password') }} * - - - - {{ translate('Password should be at least 5 characters long, it contains at least one number, one alphabet and one special character.') }} - + {{ translate("Uses native fulfillment app") }} + + @@ -190,6 +200,7 @@ export default defineComponent({ } as any, createLoginCreds: false as any, password: '', + username: '', selectedProductStores: [] as any, primaryProductStoreId: '' } @@ -198,13 +209,9 @@ export default defineComponent({ async ionViewWillEnter() { await this.store.dispatch('facility/fetchCurrentFacility', { facilityId: this.facilityId }) await this.store.dispatch('util/fetchProductStores') + this.username = this.current.facilityName }, methods: { - async updateFulfillmentSettings(event: any, facilityGroupId: string) { - // Using `not` as the click event returns the current status of toggle, - // but on click we want to change the toggle status - this.fulfillmentSettings[facilityGroupId] = !event.target.checked - }, async saveFulfillmentSettings() { const responses = [] if (this.fulfillmentSettings.PICKUP) { @@ -237,9 +244,13 @@ export default defineComponent({ } }, async createFacilityUser() { + if (!this.username) { + showToast(translate('Username is required.')) + return + } try { const payload = { - "groupName": this.current.facilityName, + "groupName": this.username, "facilityId": this.facilityId, "loginPassword": this.password, "partyTypeId": "PARTY_GROUP", diff --git a/src/views/CreateFacility.vue b/src/views/CreateFacility.vue index 0879ae5e..640a7729 100644 --- a/src/views/CreateFacility.vue +++ b/src/views/CreateFacility.vue @@ -27,11 +27,14 @@ - + {{ translate('Internal ID') }} - + + + {{ translate('Internal ID cannot be more than 20 characters.') }} + @@ -67,6 +70,7 @@ import { IonItem, IonLabel, IonList, + IonNote, IonPage, IonText, IonTitle, @@ -97,6 +101,7 @@ export default defineComponent({ IonItem, IonLabel, IonList, + IonNote, IonPage, IonText, IonTitle, @@ -149,6 +154,11 @@ export default defineComponent({ return } + if (this.formData.facilityId.length > 20) { + showToast(translate('Internal ID cannot be more than 20 characters.')) + return + } + // In case the user does not lose focus from the facility name input // and click on create the button, we need to set the internal id manually if (!this.formData.facilityId) { @@ -193,7 +203,21 @@ export default defineComponent({ } return facilityTypesByParentTypeId }, {}) : this.facilityTypes - } + }, + validateFacilityId(event: any) { + const value = event.target.value; + (this as any).$refs.facilityId.$el.classList.remove('ion-valid'); + (this as any).$refs.facilityId.$el.classList.remove('ion-invalid'); + + if (value === '') return; + + this.formData.facilityId.length <= 20 + ? (this as any).$refs.facilityId.$el.classList.add('ion-valid') + : (this as any).$refs.facilityId.$el.classList.add('ion-invalid'); + }, + markFacilityIdTouched() { + (this as any).$refs.facilityId.$el.classList.add('ion-touched'); + }, }, setup() { const store = useStore(); diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index ac283625..ac569f6d 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -158,6 +158,10 @@ {{ translate("Sell Inventory Online") }} + + {{ translate("Allow pickup") }} + + {{ translate("Uses native fulfillment app") }} @@ -166,10 +170,6 @@ {{ translate("Generate shipping labels") }} - - {{ translate("Allow pickup") }} - - {{ translate("Days to ship") }} diff --git a/src/views/FindFacilities.vue b/src/views/FindFacilities.vue index 10bef319..f0ffb114 100644 --- a/src/views/FindFacilities.vue +++ b/src/views/FindFacilities.vue @@ -300,7 +300,7 @@ export default defineComponent({ return facilityData }) this.store.dispatch('facility/updateFacilities', updatedFacilities) - showToast(translate('Fulfillment setting updated successfully')) + showToast(translate(`Online inventory turned ${facility.sellOnline ? 'off' : 'on'} for`, { facilityName: facility.facilityName })) } else { throw resp.data }