From 74b03a28c91ce28bb08a7a6c781b99b8067c8a23 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 11 Mar 2024 17:55:03 +0530 Subject: [PATCH 1/2] Implemented: support to allow user to set shipping name for facility address (#154) --- src/components/FacilityAddressModal.vue | 17 +++++++++++++++-- src/locales/en.json | 1 + src/store/modules/facility/actions.ts | 2 +- src/views/AddFacilityAddress.vue | 11 ++++++++++- src/views/CreateFacility.vue | 1 + src/views/FacilityDetails.vue | 3 ++- 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index 8e5ab1e5..656df7c1 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -15,6 +15,10 @@ {{ translate("Address") }} + + {{ translate("Shipping name") }} + + {{ translate("Address line 1") }} * @@ -128,7 +132,7 @@ export default defineComponent({ telecomNumberValue: {} as any } }, - props: ['facilityId'], + props: ['facilityId', 'facilityName'], beforeMount() { this.address = JSON.parse(JSON.stringify(this.postalAddress)) this.telecomNumberValue = this.telecomNumber ? JSON.parse(JSON.stringify(this.telecomNumber)) : {} @@ -139,6 +143,9 @@ export default defineComponent({ const country = this.countries.find((country: any) => country.geoId === this.address.countryGeoId) this.telecomNumberValue.countryCode = getTelecomCountryCode(country.geoCode) } + if(!this.address.toName) { + this.address.toName = this.facilityName + } }, methods: { closeModal() { @@ -242,4 +249,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 2bd0c550..47a7352a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -324,6 +324,7 @@ "Settings": "Settings", "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.": "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.", "Setup Store": "Setup Store", + "Shipping name": "Shipping name", "Shopify": "Shopify", "Shopify facility": "Shopify facility", "Shopify location": "Shopify location", diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index 81ecd3f7..6e31a051 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -237,7 +237,7 @@ const actions: ActionTree = { entityName: "FacilityContactDetailByPurpose", orderBy: 'fromDate DESC', filterByDate: 'Y', - fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoId', 'stateGeoName'], + fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoId', 'stateGeoName', 'toName'], viewSize: 1 } diff --git a/src/views/AddFacilityAddress.vue b/src/views/AddFacilityAddress.vue index 848194c1..ddaeacd3 100644 --- a/src/views/AddFacilityAddress.vue +++ b/src/views/AddFacilityAddress.vue @@ -13,6 +13,12 @@ {{ translate('Address') }} + + + {{ translate('Shipping name') }} + + + {{ translate('Address line 1') }} * @@ -163,12 +169,14 @@ export default defineComponent({ computed: { ...mapGetters({ countries: 'util/getCountries', - states: 'util/getStates' + states: 'util/getStates', + current: 'facility/getCurrent', }) }, data() { return { formData: { + toName: '', address1: '', address2: '', city: '', @@ -184,6 +192,7 @@ export default defineComponent({ }, props: ['facilityId'], async ionViewWillEnter() { + this.formData.toName = this.current.facilityName await this.store.dispatch('util/fetchCountries', { countryGeoId: "USA" }) }, methods: { diff --git a/src/views/CreateFacility.vue b/src/views/CreateFacility.vue index 06d0a3d3..c1f84b9f 100644 --- a/src/views/CreateFacility.vue +++ b/src/views/CreateFacility.vue @@ -184,6 +184,7 @@ export default defineComponent({ if (!hasError(resp)) { const { facilityId } = resp.data showToast(translate("Facility created successfully.")) + this.store.dispatch('facility/updateCurrentFacility', payload), this.router.replace(`/add-facility-address/${facilityId}`) } else { throw resp.data; diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index e052dcea..1671d5ff 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -50,6 +50,7 @@