From 24dbbf3ba3c473a196c1a8609425c6515908640b Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 20 Nov 2023 16:47:54 +0530 Subject: [PATCH 01/17] Implemented: action, service and state for fetching facility contact details (#20) --- src/services/FacilityService.ts | 9 ++++ src/store/modules/facility/actions.ts | 46 ++++++++++++++++++++ src/store/modules/facility/getters.ts | 8 +++- src/store/modules/facility/mutation-types.ts | 4 +- src/store/modules/facility/mutations.ts | 6 +++ src/views/FacilityDetails.vue | 5 ++- 6 files changed, 75 insertions(+), 3 deletions(-) diff --git a/src/services/FacilityService.ts b/src/services/FacilityService.ts index d5a5a083..ae622dcd 100644 --- a/src/services/FacilityService.ts +++ b/src/services/FacilityService.ts @@ -115,6 +115,14 @@ const fetchFacilityOrderCounts = async(facilityId: string): Promise => { return facilityOrderCounts; } +const fetchFacilityContactDetails = async(payload: any): Promise => { + return api({ + url: "performFind", + method: "post", + data: payload + }); +} + const updateFacility = async (payload: any): Promise => { return api({ url: "service/updateFacility", @@ -124,6 +132,7 @@ const updateFacility = async (payload: any): Promise => { } export const FacilityService = { + fetchFacilityContactDetails, fetchFacilityOnlineGroupInformation, fetchFacilityOrderCounts, fetchFacilitiesOrderCount, diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index 26d197b3..e2efc076 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -6,6 +6,8 @@ import { FacilityService } from '@/services/FacilityService' import { hasError } from '@/adapter' import * as types from './mutation-types' import logger from '@/logger' +import { showToast } from '@/utils' +import { translate } from '@hotwax/dxp-components' const actions: ActionTree = { async fetchFacilities({ commit, state }, payload) { @@ -149,6 +151,50 @@ const actions: ActionTree = { commit(types.FACILITY_CURRENT_UPDATED, facility); }, + async fetchFacilityContactDetails({ commit }, payload) { + let postalAddress = {} + let geoPoint = {} + const params = { + inputFields: { + facilityId: payload.facilityId, + contactMechTypeId: 'POSTAL_ADDRESS', + contactMechPurposeTypeId: 'PRIMARY_LOCATION' + }, + entityName: "FacilityContactDetailByPurpose", + orderBy: 'fromDate DESC', + filterByDate: 'Y' + } + + try { + const resp = await FacilityService.fetchFacilityContactDetails(params) + if(!hasError(resp)) { + const contactInfo = resp.data.docs[0] + + postalAddress = { + address1: contactInfo.address1, + address2: contactInfo.address2, + city: contactInfo.city, + country: contactInfo.countryGeoName, + state: contactInfo.stateGeoName, + zipcode: contactInfo.zipcode, + postalCode: contactInfo.postalCode + } + + geoPoint = { + latitude: contactInfo.latitude, + longitude: contactInfo.longitude + } + } else { + throw resp.data + } + } catch(err) { + logger.error(err) + } + + commit(types.FACILITY_POSTAL_ADDRESS_UPDATED , postalAddress); + commit(types.FACILITY_GEO_POINT_UPDATED , geoPoint); + }, + updateQuery({ commit }, query) { commit(types.FACILITY_QUERY_UPDATED, query) }, diff --git a/src/store/modules/facility/getters.ts b/src/store/modules/facility/getters.ts index c3582cc9..0c9f1e39 100644 --- a/src/store/modules/facility/getters.ts +++ b/src/store/modules/facility/getters.ts @@ -16,6 +16,12 @@ const getters: GetterTree = { }, getCurrent(state) { return state.current ? JSON.parse(JSON.stringify(state.current)) : {} - } + }, + getGeoPoint(state) { + return state.current?.geoPoint + }, + getPostalAddress(state) { + return state.current?.postalAddress + }, } export default getters; \ No newline at end of file diff --git a/src/store/modules/facility/mutation-types.ts b/src/store/modules/facility/mutation-types.ts index 4676bdb0..2e96171b 100644 --- a/src/store/modules/facility/mutation-types.ts +++ b/src/store/modules/facility/mutation-types.ts @@ -1,4 +1,6 @@ export const SN_FACILITY = 'facility' export const FACILITY_LIST_UPDATED = SN_FACILITY + '/LIST_UPDATED' export const FACILITY_QUERY_UPDATED = SN_FACILITY + '/QUERY_UPDATED' -export const FACILITY_CURRENT_UPDATED = SN_FACILITY + '/CURRENT_UPDATED' \ No newline at end of file +export const FACILITY_CURRENT_UPDATED = SN_FACILITY + '/CURRENT_UPDATED' +export const FACILITY_GEO_POINT_UPDATED = SN_FACILITY + '/GEO_POINT_UPDATED' +export const FACILITY_POSTAL_ADDRESS_UPDATED = SN_FACILITY + '/POSTAL_ADDRESS_UPDATED' \ No newline at end of file diff --git a/src/store/modules/facility/mutations.ts b/src/store/modules/facility/mutations.ts index fab0e52c..304a0588 100644 --- a/src/store/modules/facility/mutations.ts +++ b/src/store/modules/facility/mutations.ts @@ -12,6 +12,12 @@ const mutations: MutationTree = { }, [types.FACILITY_CURRENT_UPDATED](state, payload) { state.current = payload + }, + [types.FACILITY_GEO_POINT_UPDATED](state, payload) { + state.current.geoPoint = payload + }, + [types.FACILITY_POSTAL_ADDRESS_UPDATED](state, payload) { + state.current.postalAddress = payload } } export default mutations; \ No newline at end of file diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 574b0573..14007c08 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -470,12 +470,15 @@ export default defineComponent({ }, computed: { ...mapGetters({ - current: 'facility/getCurrent' + current: 'facility/getCurrent', + geoPoint: 'facility/getGeoPoint', + postalAddress: 'facility/getPostalAddress' }) }, props: ["facilityId"], async ionViewWillEnter() { await this.store.dispatch('facility/fetchCurrentFacility', { facilityId: this.facilityId }) + await this.store.dispatch('facility/fetchFacilityContactDetails', { facilityId: this.facilityId }) this.isLoading = false }, methods: { From 12ee9f79eed75dd923fddd0888051d21df6aed21 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 20 Nov 2023 18:21:09 +0530 Subject: [PATCH 02/17] Improved: added support to fetch and display facility contact information (#20) --- ...ressModal.vue => FacilityAddressModal.vue} | 20 ++++--- ...intModal.vue => FacilityGeoPointModal.vue} | 12 +++-- src/store/modules/facility/getters.ts | 4 +- src/views/FacilityDetails.vue | 52 ++++++++++--------- 4 files changed, 52 insertions(+), 36 deletions(-) rename src/components/{AddAddressModal.vue => FacilityAddressModal.vue} (77%) rename src/components/{AddGeoPointModal.vue => FacilityGeoPointModal.vue} (86%) diff --git a/src/components/AddAddressModal.vue b/src/components/FacilityAddressModal.vue similarity index 77% rename from src/components/AddAddressModal.vue rename to src/components/FacilityAddressModal.vue index dd25a63a..48ae2d78 100644 --- a/src/components/AddAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -13,27 +13,27 @@ {{ translate("Address line 1") }} - + {{ translate("Address line 2") }} - + {{ translate("City") }} - + {{ translate("Country") }} - + {{ translate("State") }} - + {{ translate("Zipcode") }} - + @@ -61,11 +61,12 @@ import { modalController } from "@ionic/vue"; import { defineComponent } from "vue"; +import { mapGetters } from "vuex"; import { closeOutline, saveOutline } from "ionicons/icons"; import { translate } from '@hotwax/dxp-components' export default defineComponent({ - name: "AddAddressModal", + name: "FacilityAddressModal", components: { IonButton, IonButtons, @@ -80,6 +81,11 @@ export default defineComponent({ IonTitle, IonToolbar }, + computed: { + ...mapGetters({ + postalAddress: 'facility/getPostalAddress' + }) + }, methods: { closeModal() { modalController.dismiss() diff --git a/src/components/AddGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue similarity index 86% rename from src/components/AddGeoPointModal.vue rename to src/components/FacilityGeoPointModal.vue index 02d57d96..61d3c49b 100644 --- a/src/components/AddGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -20,11 +20,11 @@ {{ translate("Latitude") }} - + {{ translate("Longitude") }} - + @@ -52,11 +52,12 @@ import { modalController } from "@ionic/vue"; import { defineComponent } from "vue"; +import { mapGetters } from "vuex"; import { closeOutline, colorWandOutline, saveOutline } from "ionicons/icons"; import { translate } from '@hotwax/dxp-components' export default defineComponent({ - name: "AddGeoPointModal", + name: "FacilityGeoPointModal", components: { IonButton, IonButtons, @@ -71,6 +72,11 @@ export default defineComponent({ IonTitle, IonToolbar, }, + computed: { + ...mapGetters({ + geoPoint: 'facility/getGeoPoint', + }) + }, methods: { closeModal() { modalController.dismiss() diff --git a/src/store/modules/facility/getters.ts b/src/store/modules/facility/getters.ts index 0c9f1e39..2029660d 100644 --- a/src/store/modules/facility/getters.ts +++ b/src/store/modules/facility/getters.ts @@ -18,10 +18,10 @@ const getters: GetterTree = { return state.current ? JSON.parse(JSON.stringify(state.current)) : {} }, getGeoPoint(state) { - return state.current?.geoPoint + return state.current?.geoPoint ? JSON.parse(JSON.stringify(state.current.geoPoint)) : {} }, getPostalAddress(state) { - return state.current?.postalAddress + return state.current?.postalAddress ? JSON.parse(JSON.stringify(state.current.postalAddress)) : {} }, } export default getters; \ No newline at end of file diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 14007c08..6d868a94 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -23,16 +23,18 @@ {{ translate("Address") }} - - -

{{ "Address line 1" }}

-

{{ "Address line 2" }}

-

{{ "City," }} {{ "Zipcode" }}

-

{{ "State," }} {{ "Country" }}

-
-
- {{ translate("Edit") }} - +
+ + +

{{ postalAddress.address1 }}

+

{{ postalAddress.address2 }}

+

{{ postalAddress.zipcode ? `${postalAddress.city}, ${postalAddress.zipcode}` : postalAddress.city }}

+

{{ postalAddress.country ? `${postalAddress.state}, ${postalAddress.country}` : postalAddress.state }}

+
+
+ {{ translate("Edit") }} +
+ {{ translate("Add") }} @@ -47,16 +49,18 @@ {{ translate("These values are used to help customers lookup how close they are to your stores when they are finding nearby stores.") }} - - {{ translate("Latitude") }} -

{{ "" }}

-
- - {{ translate("Longitude") }} -

{{ "" }}

-
- {{ translate("Edit") }} - +
+ + {{ translate("Latitude") }} +

{{ "" }}

+
+ + {{ translate("Longitude") }} +

{{ "" }}

+
+ {{ translate("Edit") }} +
+ {{ translate("Add") }} @@ -419,8 +423,8 @@ import { translate } from '@hotwax/dxp-components'; import AddExternalMappingPopover from '@/components/AddExternalMappingPopover.vue' import LocationDetailsPopover from '@/components/LocationDetailsPopover.vue'; import OpenStorePopover from '@/components/OpenStorePopover.vue'; -import AddAddressModal from '@/components/AddAddressModal.vue' -import AddGeoPointModal from '@/components/AddGeoPointModal.vue'; +import FacilityAddressModal from '@/components/FacilityAddressModal.vue' +import FacilityGeoPointModal from '@/components/FacilityGeoPointModal.vue'; import SelectProductStoreModal from '@/components/SelectProductStoreModal.vue' import SelectOperatingTimeModal from '@/components/SelectOperatingTimeModal.vue'; import AddLocationModal from '@/components/AddLocationModal.vue'; @@ -492,14 +496,14 @@ export default defineComponent({ }, async addAddress() { const addAddressModal = await modalController.create({ - component: AddAddressModal + component: FacilityAddressModal }) addAddressModal.present() }, async addGeoPoint() { const addGeoPointModal = await modalController.create({ - component: AddGeoPointModal + component: FacilityGeoPointModal }) addGeoPointModal.present() From 7915e743ae39e6ae19f67fa67daf09232d5d23ba Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 21 Nov 2023 12:24:17 +0530 Subject: [PATCH 03/17] Implemented: services for adding and updating address, generating latLong (#20) --- src/components/FacilityAddressModal.vue | 59 +++++++++++++++-- src/components/FacilityGeoPointModal.vue | 80 +++++++++++++++++++++--- src/locales/en.json | 5 ++ src/services/FacilityService.ts | 20 +++++- src/services/UtilService.ts | 12 +++- src/store/modules/facility/actions.ts | 9 +-- src/views/FacilityDetails.vue | 5 +- 7 files changed, 166 insertions(+), 24 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index 48ae2d78..bca2c3bf 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -12,7 +12,7 @@ - {{ translate("Address line 1") }} + {{ translate("Address line 1") }} * @@ -20,7 +20,7 @@ - {{ translate("City") }} + {{ translate("City") }} * @@ -32,12 +32,12 @@ - {{ translate("Zipcode") }} - + {{ translate("ZipCode") }} + - + @@ -61,9 +61,14 @@ import { modalController } from "@ionic/vue"; import { defineComponent } from "vue"; -import { mapGetters } from "vuex"; +import { mapGetters, useStore } from "vuex"; import { closeOutline, saveOutline } from "ionicons/icons"; import { translate } from '@hotwax/dxp-components' +import { FacilityService } from '@/services/FacilityService'; +import { hasError } from "@/adapter"; +import logger from "@/logger"; +import { showToast } from "@/utils"; + export default defineComponent({ name: "FacilityAddressModal", @@ -86,15 +91,57 @@ export default defineComponent({ postalAddress: 'facility/getPostalAddress' }) }, + props: ['facilityId'], methods: { closeModal() { + modalController.dismiss() + }, + async saveAddress() { + let resp; + + if(!this.postalAddress?.address1 || !this.postalAddress?.city) { + showToast("Please fill required fields.") + return + } + + const payload = { + facilityId: this.facilityId, + address1: this.postalAddress.address1, + address2: this.postalAddress.address2, + city: this.postalAddress.city, + country: this.postalAddress.country, + state: this.postalAddress.state, + postalCode: this.postalAddress.postalCode + } + + try { + if(this.postalAddress.contactMechId) { + resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.postalAddress.contactMechId}) + } else { + resp = await FacilityService.createFacilityPostalAddress(payload) + } + + if(!hasError(resp)) { + showToast(translate("Facility address updated successfully.")) + await this.store.dispatch('facility/fetchFacilityContactDetails', { facilityId: this.facilityId }) + } else { + throw resp.data + } + } catch(err) { + showToast(translate("Failed to update facility address.")) + logger.error(err) + } + modalController.dismiss() } }, setup() { + const store = useStore() + return { closeOutline, saveOutline, + store, translate }; }, diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 61d3c49b..2f452caf 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -12,23 +12,23 @@ - {{ "" }} - + + {{ translate("Generate") }} {{ translate("Latitude") }} - + {{ translate("Longitude") }} - + - + @@ -52,9 +52,13 @@ import { modalController } from "@ionic/vue"; import { defineComponent } from "vue"; -import { mapGetters } from "vuex"; +import { mapGetters, useStore } from "vuex"; import { closeOutline, colorWandOutline, saveOutline } from "ionicons/icons"; import { translate } from '@hotwax/dxp-components' +import { showToast, hasError } from "@/utils"; +import { FacilityService } from "@/services/FacilityService"; +import { UtilService } from "@/services/UtilService"; +import logger from "@/logger"; export default defineComponent({ name: "FacilityGeoPointModal", @@ -74,19 +78,81 @@ export default defineComponent({ }, computed: { ...mapGetters({ - geoPoint: 'facility/getGeoPoint', + postalAddress: 'facility/getPostalAddress', }) }, + props: ['facilityId'], methods: { closeModal() { + modalController.dismiss() + }, + async generateLatLong() { + const payload = { + json: { + params: { + q: `postcode: ${this.postalAddress.postalCode}` + } + } + } + + try { + const resp = await UtilService.generateLatLong(payload) + + if(!hasError(resp)) { + const geoPoint = resp.data.response.docs[0] + this.postalAddress.latitude = geoPoint.latitude + this.postalAddress.longitude = geoPoint.longitude + return; + } else { + throw resp.data + } + } catch(err) { + logger.error(err) + } + }, + async saveGeoPoint() { + let resp; + + if(!this.postalAddress?.address1 || !this.postalAddress?.city) { + showToast("Please fill required fields.") + return + } + + const payload = { + facilityId: this.facilityId, + latitude: this.postalAddress.latitude, + longitude: this.postalAddress.longitude + } + + try { + if(this.postalAddress.contactMechId) { + resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.postalAddress.contactMechId}) + } else { + resp = await FacilityService.createFacilityPostalAddress(payload) + } + + if(!hasError(resp)) { + showToast(translate("Facility geoPoint updated successfully.")) + await this.store.dispatch('facility/fetchFacilityContactDetails', { facilityId: this.facilityId }) + } else { + throw resp.data + } + } catch(err) { + showToast(translate("Failed to update facility geoPoint.")) + logger.error(err) + } + modalController.dismiss() } }, setup() { + const store = useStore() + return { closeOutline, colorWandOutline, saveOutline, + store, translate }; }, diff --git a/src/locales/en.json b/src/locales/en.json index ddf814e9..0cd58091 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -37,11 +37,15 @@ "External mappings": "External mappings", "Facilities": "Facilities", "Facility": "Facility", + "Facility address updated successfully.": "Facility address updated successfully.", + "Facility geoPoint updated successfully.": "Facility geoPoint updated successfully.", "Facility details": "Facility details", "Facility ID": "Facility ID", "Facility name": "Facility name", "Facility Management": "Facility Management", "Failed to fetch facility information": "Failed to fetch facility information", + "Failed to update facility address.": "Failed to update facility address.", + "Failed to update facility geoPoint.": "Failed to update facility geoPoint.", "Fetching TimeZones": "Fetching TimeZones", "Find Facilities": "Find Facilities", "Friday": "Friday", @@ -95,6 +99,7 @@ "Party Id": "Party Id", "Password": "Password", "Please contact the administrator.": "Please contact the administrator.", + "Please fill required fields.": "Please fill required fields.", "primary store": "primary store", "Product Store": "Product Store", "Product Stores": "Product Stores", diff --git a/src/services/FacilityService.ts b/src/services/FacilityService.ts index ae622dcd..eb99d797 100644 --- a/src/services/FacilityService.ts +++ b/src/services/FacilityService.ts @@ -131,11 +131,29 @@ const updateFacility = async (payload: any): Promise => { }) } +const createFacilityPostalAddress = async (payload: any): Promise => { + return api({ + url: "service/createFacilityPostalAddress", + method: "post", + data: payload + }) +} + +const updateFacilityPostalAddress = async (payload: any): Promise => { + return api({ + url: "service/updateFacilityPostalAddress", + method: "post", + data: payload + }) +} + export const FacilityService = { + createFacilityPostalAddress, fetchFacilityContactDetails, fetchFacilityOnlineGroupInformation, fetchFacilityOrderCounts, fetchFacilitiesOrderCount, fetchFacilities, - updateFacility + updateFacility, + updateFacilityPostalAddress } \ No newline at end of file diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 85365974..b5385627 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -18,8 +18,18 @@ const fetchProductStores = async (payload: any): Promise => { }) } +const generateLatLong = async (payload: any): Promise => { + return api({ + url: "postcodeLookup", + method: "POST", + data: payload, + cache: true + }) +} + export const UtilService = { fetchFacilityTypes, - fetchProductStores + fetchProductStores, + generateLatLong } diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index e2efc076..a0c7b161 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -153,7 +153,6 @@ const actions: ActionTree = { async fetchFacilityContactDetails({ commit }, payload) { let postalAddress = {} - let geoPoint = {} const params = { inputFields: { facilityId: payload.facilityId, @@ -176,11 +175,8 @@ const actions: ActionTree = { city: contactInfo.city, country: contactInfo.countryGeoName, state: contactInfo.stateGeoName, - zipcode: contactInfo.zipcode, - postalCode: contactInfo.postalCode - } - - geoPoint = { + postalCode: contactInfo.postalCode, + contactMechId: contactInfo.contactMechId, latitude: contactInfo.latitude, longitude: contactInfo.longitude } @@ -192,7 +188,6 @@ const actions: ActionTree = { } commit(types.FACILITY_POSTAL_ADDRESS_UPDATED , postalAddress); - commit(types.FACILITY_GEO_POINT_UPDATED , geoPoint); }, updateQuery({ commit }, query) { diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 6d868a94..3eefcaad 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -28,7 +28,7 @@

{{ postalAddress.address1 }}

{{ postalAddress.address2 }}

-

{{ postalAddress.zipcode ? `${postalAddress.city}, ${postalAddress.zipcode}` : postalAddress.city }}

+

{{ postalAddress.zipCode ? `${postalAddress.city}, ${postalAddress.zipCode}` : postalAddress.city }}

{{ postalAddress.country ? `${postalAddress.state}, ${postalAddress.country}` : postalAddress.state }}

@@ -496,7 +496,8 @@ export default defineComponent({ }, async addAddress() { const addAddressModal = await modalController.create({ - component: FacilityAddressModal + component: FacilityAddressModal, + componentProps: { facilityId: this.facilityId } }) addAddressModal.present() From b0a41c69e04bd4564eb1dea90a2fb20d116de1ed Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 21 Nov 2023 14:50:01 +0530 Subject: [PATCH 04/17] Improved: code for generating geopoints, methods name (#20) --- src/components/FacilityAddressModal.vue | 4 +- src/components/FacilityGeoPointModal.vue | 58 +++++++----------------- src/locales/en.json | 1 + src/views/FacilityDetails.vue | 16 +++---- 4 files changed, 28 insertions(+), 51 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index bca2c3bf..c6ca7e5c 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -32,7 +32,7 @@ - {{ translate("ZipCode") }} + {{ translate("Zipcode") }} @@ -56,6 +56,7 @@ import { IonInput, IonItem, IonLabel, + IonText, IonTitle, IonToolbar, modalController @@ -83,6 +84,7 @@ export default defineComponent({ IonInput, IonItem, IonLabel, + IonText, IonTitle, IonToolbar }, diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 2f452caf..cdb744ff 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -12,7 +12,7 @@ - + {{ translate("Generate") }} @@ -20,15 +20,15 @@ {{ translate("Latitude") }} - + {{ translate("Longitude") }} - + - + @@ -56,7 +56,6 @@ import { mapGetters, useStore } from "vuex"; import { closeOutline, colorWandOutline, saveOutline } from "ionicons/icons"; import { translate } from '@hotwax/dxp-components' import { showToast, hasError } from "@/utils"; -import { FacilityService } from "@/services/FacilityService"; import { UtilService } from "@/services/UtilService"; import logger from "@/logger"; @@ -82,6 +81,14 @@ export default defineComponent({ }) }, props: ['facilityId'], + data() { + return { + geoPoint: {} as any + } + }, + mounted() { + this.geoPoint = this.postalAddress + }, methods: { closeModal() { modalController.dismiss() @@ -99,50 +106,17 @@ export default defineComponent({ const resp = await UtilService.generateLatLong(payload) if(!hasError(resp)) { - const geoPoint = resp.data.response.docs[0] - this.postalAddress.latitude = geoPoint.latitude - this.postalAddress.longitude = geoPoint.longitude + const result = resp.data.response.docs[0] + this.geoPoint.latitude = result.latitude + this.geoPoint.longitude = result.longitude return; } else { throw resp.data } } catch(err) { + showToast(translate("Invalied Zipcode, GeoPoints can't be generated.")) logger.error(err) } - }, - async saveGeoPoint() { - let resp; - - if(!this.postalAddress?.address1 || !this.postalAddress?.city) { - showToast("Please fill required fields.") - return - } - - const payload = { - facilityId: this.facilityId, - latitude: this.postalAddress.latitude, - longitude: this.postalAddress.longitude - } - - try { - if(this.postalAddress.contactMechId) { - resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.postalAddress.contactMechId}) - } else { - resp = await FacilityService.createFacilityPostalAddress(payload) - } - - if(!hasError(resp)) { - showToast(translate("Facility geoPoint updated successfully.")) - await this.store.dispatch('facility/fetchFacilityContactDetails', { facilityId: this.facilityId }) - } else { - throw resp.data - } - } catch(err) { - showToast(translate("Failed to update facility geoPoint.")) - logger.error(err) - } - - modalController.dismiss() } }, setup() { diff --git a/src/locales/en.json b/src/locales/en.json index 0cd58091..bae8bd2c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -59,6 +59,7 @@ "Groups": "Groups", "Identification": "Identification", "Instance Url": "Instance Url", + "Invalied Zipcode, GeoPoints can't be generated.": "Invalied Zipcode, GeoPoints can't be generated.", "Language": "Language", "Latitude": "Latitude", "Latitude & Longitude": "Latitude & Longitude", diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 3eefcaad..3c7b8501 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -32,9 +32,9 @@

{{ postalAddress.country ? `${postalAddress.state}, ${postalAddress.country}` : postalAddress.state }}

- {{ translate("Edit") }} + {{ translate("Edit") }} - + {{ translate("Add") }} @@ -58,9 +58,9 @@ {{ translate("Longitude") }}

{{ "" }}

- {{ translate("Edit") }} + {{ translate("Edit") }} - + {{ translate("Add") }} @@ -494,15 +494,15 @@ export default defineComponent({ }); return popover.present() }, - async addAddress() { - const addAddressModal = await modalController.create({ + async openAddressModal() { + const addressModal = await modalController.create({ component: FacilityAddressModal, componentProps: { facilityId: this.facilityId } }) - addAddressModal.present() + addressModal.present() }, - async addGeoPoint() { + async openGeoPointModal() { const addGeoPointModal = await modalController.create({ component: FacilityGeoPointModal }) From 1c9a328d700fdfee5f244b6fe385020e2831bf40 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 21 Nov 2023 15:11:03 +0530 Subject: [PATCH 05/17] Improved: code syntax, removed unused mutations, alphabetical entries of entries (#20) --- src/components/FacilityAddressModal.vue | 8 +++----- src/components/FacilityGeoPointModal.vue | 3 +-- src/locales/en.json | 2 +- src/services/FacilityService.ts | 16 ++++++++-------- src/store/modules/facility/actions.ts | 17 ++++++++--------- src/store/modules/facility/mutation-types.ts | 1 - src/store/modules/facility/mutations.ts | 3 --- 7 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index c6ca7e5c..8825530d 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -70,7 +70,6 @@ import { hasError } from "@/adapter"; import logger from "@/logger"; import { showToast } from "@/utils"; - export default defineComponent({ name: "FacilityAddressModal", components: { @@ -107,13 +106,13 @@ export default defineComponent({ } const payload = { - facilityId: this.facilityId, address1: this.postalAddress.address1, address2: this.postalAddress.address2, city: this.postalAddress.city, country: this.postalAddress.country, - state: this.postalAddress.state, - postalCode: this.postalAddress.postalCode + facilityId: this.facilityId, + postalCode: this.postalAddress.postalCode, + state: this.postalAddress.state } try { @@ -133,7 +132,6 @@ export default defineComponent({ showToast(translate("Failed to update facility address.")) logger.error(err) } - modalController.dismiss() } }, diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index cdb744ff..c2916300 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -109,12 +109,11 @@ export default defineComponent({ const result = resp.data.response.docs[0] this.geoPoint.latitude = result.latitude this.geoPoint.longitude = result.longitude - return; } else { throw resp.data } } catch(err) { - showToast(translate("Invalied Zipcode, GeoPoints can't be generated.")) + showToast(translate("Invalid Zipcode, GeoPoints can't be generated.")) logger.error(err) } } diff --git a/src/locales/en.json b/src/locales/en.json index bae8bd2c..110383ea 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -59,7 +59,7 @@ "Groups": "Groups", "Identification": "Identification", "Instance Url": "Instance Url", - "Invalied Zipcode, GeoPoints can't be generated.": "Invalied Zipcode, GeoPoints can't be generated.", + "Invalid Zipcode, GeoPoints can't be generated.": "Invalid Zipcode, GeoPoints can't be generated.", "Language": "Language", "Latitude": "Latitude", "Latitude & Longitude": "Latitude & Longitude", diff --git a/src/services/FacilityService.ts b/src/services/FacilityService.ts index eb99d797..ee7f6c20 100644 --- a/src/services/FacilityService.ts +++ b/src/services/FacilityService.ts @@ -2,6 +2,14 @@ import { api, hasError } from '@/adapter'; import logger from '@/logger'; import { DateTime } from 'luxon'; +const createFacilityPostalAddress = async (payload: any): Promise => { + return api({ + url: "service/createFacilityPostalAddress", + method: "post", + data: payload + }) +} + const fetchFacilities = async(query: any): Promise => { return api({ url: "performFind", @@ -131,14 +139,6 @@ const updateFacility = async (payload: any): Promise => { }) } -const createFacilityPostalAddress = async (payload: any): Promise => { - return api({ - url: "service/createFacilityPostalAddress", - method: "post", - data: payload - }) -} - const updateFacilityPostalAddress = async (payload: any): Promise => { return api({ url: "service/updateFacilityPostalAddress", diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index a0c7b161..f89083d2 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -6,8 +6,6 @@ import { FacilityService } from '@/services/FacilityService' import { hasError } from '@/adapter' import * as types from './mutation-types' import logger from '@/logger' -import { showToast } from '@/utils' -import { translate } from '@hotwax/dxp-components' const actions: ActionTree = { async fetchFacilities({ commit, state }, payload) { @@ -155,13 +153,14 @@ const actions: ActionTree = { let postalAddress = {} const params = { inputFields: { - facilityId: payload.facilityId, + contactMechPurposeTypeId: 'PRIMARY_LOCATION', contactMechTypeId: 'POSTAL_ADDRESS', - contactMechPurposeTypeId: 'PRIMARY_LOCATION' + facilityId: payload.facilityId }, entityName: "FacilityContactDetailByPurpose", orderBy: 'fromDate DESC', - filterByDate: 'Y' + filterByDate: 'Y', + fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoName'] } try { @@ -173,12 +172,12 @@ const actions: ActionTree = { address1: contactInfo.address1, address2: contactInfo.address2, city: contactInfo.city, - country: contactInfo.countryGeoName, - state: contactInfo.stateGeoName, - postalCode: contactInfo.postalCode, contactMechId: contactInfo.contactMechId, + country: contactInfo.countryGeoName, latitude: contactInfo.latitude, - longitude: contactInfo.longitude + longitude: contactInfo.longitude, + postalCode: contactInfo.postalCode, + state: contactInfo.stateGeoName } } else { throw resp.data diff --git a/src/store/modules/facility/mutation-types.ts b/src/store/modules/facility/mutation-types.ts index 2e96171b..2c0ccef8 100644 --- a/src/store/modules/facility/mutation-types.ts +++ b/src/store/modules/facility/mutation-types.ts @@ -2,5 +2,4 @@ export const SN_FACILITY = 'facility' export const FACILITY_LIST_UPDATED = SN_FACILITY + '/LIST_UPDATED' export const FACILITY_QUERY_UPDATED = SN_FACILITY + '/QUERY_UPDATED' export const FACILITY_CURRENT_UPDATED = SN_FACILITY + '/CURRENT_UPDATED' -export const FACILITY_GEO_POINT_UPDATED = SN_FACILITY + '/GEO_POINT_UPDATED' export const FACILITY_POSTAL_ADDRESS_UPDATED = SN_FACILITY + '/POSTAL_ADDRESS_UPDATED' \ No newline at end of file diff --git a/src/store/modules/facility/mutations.ts b/src/store/modules/facility/mutations.ts index 304a0588..ab340882 100644 --- a/src/store/modules/facility/mutations.ts +++ b/src/store/modules/facility/mutations.ts @@ -13,9 +13,6 @@ const mutations: MutationTree = { [types.FACILITY_CURRENT_UPDATED](state, payload) { state.current = payload }, - [types.FACILITY_GEO_POINT_UPDATED](state, payload) { - state.current.geoPoint = payload - }, [types.FACILITY_POSTAL_ADDRESS_UPDATED](state, payload) { state.current.postalAddress = payload } From 6196d88ab549c1854261ec4fb0f54e1ca94985d4 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 21 Nov 2023 15:46:00 +0530 Subject: [PATCH 06/17] Implemented: logic to add/update geoPoints, disable lat&long buttons when no address found (#20) --- src/components/FacilityGeoPointModal.vue | 34 ++++++++++++++++++++++-- src/views/FacilityDetails.vue | 4 +-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index c2916300..80ac2740 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -28,7 +28,7 @@ - + @@ -58,6 +58,7 @@ import { translate } from '@hotwax/dxp-components' import { showToast, hasError } from "@/utils"; import { UtilService } from "@/services/UtilService"; import logger from "@/logger"; +import { FacilityService } from '@/services/FacilityService' export default defineComponent({ name: "FacilityGeoPointModal", @@ -87,7 +88,7 @@ export default defineComponent({ } }, mounted() { - this.geoPoint = this.postalAddress + this.geoPoint = JSON.parse(JSON.stringify(this.postalAddress)) }, methods: { closeModal() { @@ -116,6 +117,35 @@ export default defineComponent({ showToast(translate("Invalid Zipcode, GeoPoints can't be generated.")) logger.error(err) } + }, + async saveGeoPoint() { + let resp; + + const payload = { + address1: this.geoPoint.address1, + city: this.geoPoint.city, + latitude: this.geoPoint.latitude, + longitude: this.geoPoint.latitude + } + + try { + if(this.postalAddress.latitude) { + resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.geoPoint.contactMechId}) + } else { + resp = await FacilityService.createFacilityPostalAddress(payload) + } + + if(!hasError(resp)) { + showToast(translate("Facility geoPoint updated successfully.")) + await this.store.dispatch('facility/fetchFacilityContactDetails', { facilityId: this.facilityId }) + } else { + throw resp.data + } + } catch(err) { + showToast(translate("Failed to update facility geoPoint.")) + logger.error(err) + } + modalController.dismiss() } }, setup() { diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 3c7b8501..c5443538 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -58,9 +58,9 @@ {{ translate("Longitude") }}

{{ "" }}

- {{ translate("Edit") }} + {{ translate("Edit") }} - + {{ translate("Add") }} From ce5af3d70fe7f2e25e7718dd479290d81199fe10 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 21 Nov 2023 18:51:24 +0530 Subject: [PATCH 07/17] Improved: code for unused getter, error message, rendering postalCode (#20) --- src/components/FacilityAddressModal.vue | 4 ++-- src/components/FacilityGeoPointModal.vue | 4 ++-- src/store/modules/facility/actions.ts | 5 +++-- src/store/modules/facility/getters.ts | 3 --- src/views/FacilityDetails.vue | 9 ++++----- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index eca3bfff..ef63f918 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -37,8 +37,8 @@ - - + + diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 80ac2740..0791ecb1 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -28,8 +28,8 @@ - - + + diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index 250af08e..5921bb49 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -169,7 +169,8 @@ const actions: ActionTree = { entityName: "FacilityContactDetailByPurpose", orderBy: 'fromDate DESC', filterByDate: 'Y', - fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoName'] + fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoName'], + viewSize: 1 } try { @@ -192,7 +193,7 @@ const actions: ActionTree = { throw resp.data } } catch(err) { - logger.error(err) + logger.error('Failed to fetch the postal address for the facility', err) } commit(types.FACILITY_POSTAL_ADDRESS_UPDATED , postalAddress); diff --git a/src/store/modules/facility/getters.ts b/src/store/modules/facility/getters.ts index 2029660d..ed5b52a3 100644 --- a/src/store/modules/facility/getters.ts +++ b/src/store/modules/facility/getters.ts @@ -17,9 +17,6 @@ const getters: GetterTree = { getCurrent(state) { return state.current ? JSON.parse(JSON.stringify(state.current)) : {} }, - getGeoPoint(state) { - return state.current?.geoPoint ? JSON.parse(JSON.stringify(state.current.geoPoint)) : {} - }, getPostalAddress(state) { return state.current?.postalAddress ? JSON.parse(JSON.stringify(state.current.postalAddress)) : {} }, diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index d47dd1e3..29496604 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -28,7 +28,7 @@

{{ postalAddress.address1 }}

{{ postalAddress.address2 }}

-

{{ postalAddress.zipCode ? `${postalAddress.city}, ${postalAddress.zipCode}` : postalAddress.city }}

+

{{ postalAddress.postalCode ? `${postalAddress.city}, ${postalAddress.postalCode}` : postalAddress.city }}

{{ postalAddress.country ? `${postalAddress.state}, ${postalAddress.country}` : postalAddress.state }}

@@ -49,14 +49,14 @@ {{ translate("These values are used to help customers lookup how close they are to your stores when they are finding nearby stores.") }} -
+
{{ translate("Latitude") }} -

{{ "" }}

+

{{ postalAddress.latitude }}

{{ translate("Longitude") }} -

{{ "" }}

+

{{ postalAddress.longitude }}

{{ translate("Edit") }}
@@ -477,7 +477,6 @@ export default defineComponent({ computed: { ...mapGetters({ current: 'facility/getCurrent', - geoPoint: 'facility/getGeoPoint', locationTypes: 'util/getLocationTypes', postalAddress: 'facility/getPostalAddress' }) From abf669519ac8f4d8e6705c8150c3354689794e85 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 22 Nov 2023 12:59:20 +0530 Subject: [PATCH 08/17] Implemented: state & countries dropdown accessibility and lat-long updation (#20) --- src/components/FacilityAddressModal.vue | 28 +++++++++--- src/components/FacilityGeoPointModal.vue | 17 ++++---- src/locales/en.json | 6 +-- src/services/UtilService.ts | 20 +++++++++ src/store/modules/facility/actions.ts | 8 ++-- src/store/modules/util/UtilState.ts | 2 + src/store/modules/util/actions.ts | 54 ++++++++++++++++++++++++ src/store/modules/util/getters.ts | 6 +++ src/store/modules/util/index.ts | 4 +- src/store/modules/util/mutation-types.ts | 4 +- src/store/modules/util/mutations.ts | 6 +++ src/views/FacilityDetails.vue | 5 ++- 12 files changed, 136 insertions(+), 24 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index ef63f918..4cd1dffc 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -25,11 +25,15 @@ {{ translate("Country") }} - + + {{ country.geoName }} + {{ translate("State") }} - + + {{ state.geoName }} + {{ translate("Zipcode") }} @@ -56,6 +60,8 @@ import { IonInput, IonItem, IonLabel, + IonSelect, + IonSelectOption, IonText, IonTitle, IonToolbar, @@ -83,16 +89,23 @@ export default defineComponent({ IonInput, IonItem, IonLabel, + IonSelect, + IonSelectOption, IonText, IonTitle, IonToolbar }, computed: { ...mapGetters({ - postalAddress: 'facility/getPostalAddress' + postalAddress: 'facility/getPostalAddress', + countries: 'util/getCountries', + states: 'util/getStates' }) }, props: ['facilityId'], + async mounted() { + await this.store.dispatch('util/fetchCountries', { countryGeoId: this.postalAddress?.countryGeoId }) + }, methods: { closeModal() { modalController.dismiss() @@ -109,10 +122,12 @@ export default defineComponent({ address1: this.postalAddress.address1, address2: this.postalAddress.address2, city: this.postalAddress.city, - country: this.postalAddress.country, + countryGeoId: this.postalAddress.countryGeoId, + countryGeoName: this.postalAddress.countryGeoName, facilityId: this.facilityId, postalCode: this.postalAddress.postalCode, - state: this.postalAddress.state + stateGeoName: this.postalAddress.stateGeoName, + stateProvinceGeoId: this.postalAddress.stateGeoId } try { @@ -133,6 +148,9 @@ export default defineComponent({ logger.error(err) } modalController.dismiss() + }, + updateState(ev: CustomEvent) { + this.store.dispatch('util/fetchStates', { geoId: ev.detail.value }) } }, setup() { diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 0791ecb1..191d62c2 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -114,7 +114,7 @@ export default defineComponent({ throw resp.data } } catch(err) { - showToast(translate("Invalid Zipcode, GeoPoints can't be generated.")) + showToast(translate("Failed to generate latitude & Longitude.")) logger.error(err) } }, @@ -124,25 +124,24 @@ export default defineComponent({ const payload = { address1: this.geoPoint.address1, city: this.geoPoint.city, + contactMechId: this.geoPoint.contactMechId, + facilityId: this.facilityId, latitude: this.geoPoint.latitude, - longitude: this.geoPoint.latitude + longitude: this.geoPoint.longitude, + postalCode: this.geoPoint.postalCode } try { - if(this.postalAddress.latitude) { - resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.geoPoint.contactMechId}) - } else { - resp = await FacilityService.createFacilityPostalAddress(payload) - } + resp = await FacilityService.updateFacilityPostalAddress({...payload}) if(!hasError(resp)) { - showToast(translate("Facility geoPoint updated successfully.")) + showToast(translate("Facility latitude & longitude updated successfully.")) await this.store.dispatch('facility/fetchFacilityContactDetails', { facilityId: this.facilityId }) } else { throw resp.data } } catch(err) { - showToast(translate("Failed to update facility geoPoint.")) + showToast(translate("Failed to update facility latitude & longitude.")) logger.error(err) } modalController.dismiss() diff --git a/src/locales/en.json b/src/locales/en.json index 5be41ab5..669587db 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -39,7 +39,7 @@ "Facility": "Facility", "Facility address updated successfully.": "Facility address updated successfully.", "Facility details": "Facility details", - "Facility geoPoint updated successfully.": "Facility geoPoint updated successfully.", + "Facility latitude & longitude updated successfully.": "Facility latitude & longitude updated successfully.", "Facility ID": "Facility ID", "Facility location created successfully": "Facility location created successfully", "Facility location updated successfully": "Facility location updated successfully", @@ -50,7 +50,8 @@ "Failed to find the facility locations": "Failed to find the facility locations", "Failed to remove facility location": "Failed to remove facility location", "Failed to update facility address.": "Failed to update facility address.", - "Failed to update facility geoPoint.": "Failed to update facility geoPoint.", + "Failed to generate latitude & Longitude.": "Failed to generate latitude & Longitude.", + "Failed to update facility latitude & longitude.": "Failed to update facility latitude & longitude.", "Failed to update facility location": "Failed to update facility location", "Fetching TimeZones": "Fetching TimeZones", "Find Facilities": "Find Facilities", @@ -65,7 +66,6 @@ "Groups": "Groups", "Identification": "Identification", "Instance Url": "Instance Url", - "Invalid Zipcode, GeoPoints can't be generated.": "Invalid Zipcode, GeoPoints can't be generated.", "Language": "Language", "Latitude": "Latitude", "Latitude & Longitude": "Latitude & Longitude", diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 55ca51f3..d8ffeb54 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -36,10 +36,30 @@ const fetchLocationTypes = async (payload: any): Promise => { }) } +const fetchCountries = async (payload: any): Promise => { + return api({ + url: "performFind", + method: "POST", + data: payload, + cache: true + }) +} + +const fetchStates = async (payload: any): Promise => { + return api({ + url: "performFind", + method: "POST", + data: payload, + cache: true + }) +} + export const UtilService = { + fetchCountries, fetchFacilityTypes, fetchLocationTypes, fetchProductStores, + fetchStates, generateLatLong } diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index 5921bb49..d34d3489 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -169,7 +169,7 @@ const actions: ActionTree = { entityName: "FacilityContactDetailByPurpose", orderBy: 'fromDate DESC', filterByDate: 'Y', - fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoName'], + fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoId', 'stateGeoName'], viewSize: 1 } @@ -183,11 +183,13 @@ const actions: ActionTree = { address2: contactInfo.address2, city: contactInfo.city, contactMechId: contactInfo.contactMechId, - country: contactInfo.countryGeoName, + countryGeoId: contactInfo.countryGeoId, + countryGeoName: contactInfo.countryGeoName, latitude: contactInfo.latitude, longitude: contactInfo.longitude, postalCode: contactInfo.postalCode, - state: contactInfo.stateGeoName + stateGeoId: contactInfo.stateGeoId, + stateGeoName: contactInfo.stateGeoName } } else { throw resp.data diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts index 63ded06e..6ede8fe1 100644 --- a/src/store/modules/util/UtilState.ts +++ b/src/store/modules/util/UtilState.ts @@ -2,4 +2,6 @@ export default interface UtilState { productStores: any[]; facilityTypes: object; locationTypes: object; + countries: any[]; + states: any[]; } \ No newline at end of file diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index 158c7581..3c5e15a5 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -99,6 +99,60 @@ const actions: ActionTree = { commit(types.UTIL_LOCATION_TYPES_UPDATED, locationTypes) }, + async fetchCountries({ commit, dispatch }, payload) { + let countries = [] as any + + const params = { + inputFields: { + geoIdTo: "DBIC" + }, + entityName: 'GeoAssocAndGeoFrom', + noConditionFind: 'Y', + } as any + + try { + const resp = await UtilService.fetchCountries(params) + + if(!hasError(resp)) { + countries = resp.data.docs + dispatch('fetchStates', { geoId: payload.countryGeoId ? payload.countryGeoId : 'USA'}) + } else { + throw resp.data + } + } catch(err) { + logger.error(err) + } + + commit(types.UTIL_COUNTRIES_UPDATED, countries) + }, + + async fetchStates({ commit, dispatch }, payload) { + let states = [] as any + + const params = { + inputFields: { + geoIdFrom: payload.geoId + }, + entityName: 'GeoAssocAndGeoTo', + noConditionFind: 'Y', + viewSize: 100 + } as any + + try { + const resp = await UtilService.fetchStates(params) + + if(!hasError(resp)) { + states = resp.data.docs + } else { + throw resp.data + } + } catch(err) { + logger.error(err) + } + + commit(types.UTIL_STATES_UPDATED, states) + }, + clearUtilState({ commit }) { commit(types.UTIL_PRODUCT_STORES_UPDATED, []) commit(types.UTIL_FACILITY_TYPES_UPDATED, []) diff --git a/src/store/modules/util/getters.ts b/src/store/modules/util/getters.ts index 73b01c5f..5e4772a5 100644 --- a/src/store/modules/util/getters.ts +++ b/src/store/modules/util/getters.ts @@ -11,6 +11,12 @@ const getters: GetterTree = { }, getLocationTypes(state) { return state.locationTypes + }, + getCountries(state) { + return state.countries + }, + getStates(state) { + return state.states } } export default getters; \ No newline at end of file diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts index b152ff86..d1e3d4dc 100644 --- a/src/store/modules/util/index.ts +++ b/src/store/modules/util/index.ts @@ -10,7 +10,9 @@ const utilModule: Module = { state: { productStores: [], facilityTypes: {}, - locationTypes: {} + locationTypes: {}, + countries: [], + states: [] }, getters, actions, diff --git a/src/store/modules/util/mutation-types.ts b/src/store/modules/util/mutation-types.ts index f5a7f1b6..44006c4b 100644 --- a/src/store/modules/util/mutation-types.ts +++ b/src/store/modules/util/mutation-types.ts @@ -1,4 +1,6 @@ export const SN_UTIL = 'util' export const UTIL_PRODUCT_STORES_UPDATED = SN_UTIL + '/PRODUCT_STORES_UPDATED' export const UTIL_FACILITY_TYPES_UPDATED = SN_UTIL + '/FACILITY_TYPES_UPDATED' -export const UTIL_LOCATION_TYPES_UPDATED = SN_UTIL + '/LOCATION_TYPES_UPDATED' \ No newline at end of file +export const UTIL_LOCATION_TYPES_UPDATED = SN_UTIL + '/LOCATION_TYPES_UPDATED' +export const UTIL_COUNTRIES_UPDATED = SN_UTIL + '/COUNTRIES_UPDATED' +export const UTIL_STATES_UPDATED = SN_UTIL + '/STATES_UPDATED' \ No newline at end of file diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts index 10531900..301b2e06 100644 --- a/src/store/modules/util/mutations.ts +++ b/src/store/modules/util/mutations.ts @@ -11,6 +11,12 @@ const mutations: MutationTree = { }, [types.UTIL_LOCATION_TYPES_UPDATED](state, payload) { state.locationTypes = payload + }, + [types.UTIL_COUNTRIES_UPDATED](state, payload) { + state.countries = payload + }, + [types.UTIL_STATES_UPDATED](state, payload) { + state.states = payload } } export default mutations; \ No newline at end of file diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 29496604..4e6b3164 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -29,7 +29,7 @@

{{ postalAddress.address1 }}

{{ postalAddress.address2 }}

{{ postalAddress.postalCode ? `${postalAddress.city}, ${postalAddress.postalCode}` : postalAddress.city }}

-

{{ postalAddress.country ? `${postalAddress.state}, ${postalAddress.country}` : postalAddress.state }}

+

{{ postalAddress.countryGeoName ? `${postalAddress.stateGeoName}, ${postalAddress.countryGeoName}` : postalAddress.stateGeoName }}

{{ translate("Edit") }} @@ -507,7 +507,8 @@ export default defineComponent({ }, async openGeoPointModal() { const addGeoPointModal = await modalController.create({ - component: FacilityGeoPointModal + component: FacilityGeoPointModal, + componentProps: { facilityId: this.facilityId } }) addGeoPointModal.present() From bb7d31301adcf0e36116e3b2723a62bfe82ea2db Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 22 Nov 2023 14:55:13 +0530 Subject: [PATCH 09/17] Implemented: cacheing for states to avoid multiple api calls (#20) --- src/components/FacilityAddressModal.vue | 89 ++++++++++++++----------- src/store/modules/util/actions.ts | 8 ++- src/store/modules/util/mutations.ts | 2 +- 3 files changed, 56 insertions(+), 43 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index 4cd1dffc..fd95b6eb 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -11,34 +11,37 @@ - - {{ translate("Address line 1") }} * - - - - {{ translate("Address line 2") }} - - - - {{ translate("City") }} * - - - - {{ translate("Country") }} - - {{ country.geoName }} - - - - {{ translate("State") }} - - {{ state.geoName }} - - - - {{ translate("Zipcode") }} - - +
+ + {{ translate("Address line 1") }} * + + + + {{ translate("Address line 2") }} + + + + {{ translate("City") }} * + + + + {{ translate("Country") }} + + {{ country.geoName }} + + + + {{ translate("State") }} + {{ address.countryGeoId }} + + {{ state.geoName }} + + + + {{ translate("Zipcode") }} + + +
@@ -102,9 +105,15 @@ export default defineComponent({ states: 'util/getStates' }) }, + data() { + return { + address: {} as any + } + }, props: ['facilityId'], async mounted() { - await this.store.dispatch('util/fetchCountries', { countryGeoId: this.postalAddress?.countryGeoId }) + this.address = JSON.parse(JSON.stringify(this.postalAddress)) + await this.store.dispatch('util/fetchCountries', { countryGeoId: this.address?.countryGeoId }) }, methods: { closeModal() { @@ -113,26 +122,26 @@ export default defineComponent({ async saveAddress() { let resp; - if(!this.postalAddress?.address1 || !this.postalAddress?.city) { + if(!this.address?.address1 || !this.address?.city) { showToast("Please fill all the required fields.") return } const payload = { - address1: this.postalAddress.address1, - address2: this.postalAddress.address2, - city: this.postalAddress.city, - countryGeoId: this.postalAddress.countryGeoId, - countryGeoName: this.postalAddress.countryGeoName, + address1: this.address.address1, + address2: this.address.address2, + city: this.address.city, + countryGeoId: this.address.countryGeoId, + countryGeoName: this.address.countryGeoName, facilityId: this.facilityId, - postalCode: this.postalAddress.postalCode, - stateGeoName: this.postalAddress.stateGeoName, - stateProvinceGeoId: this.postalAddress.stateGeoId + postalCode: this.address.postalCode, + stateGeoName: this.address.stateGeoName, + stateProvinceGeoId: this.address.stateGeoId } try { - if(this.postalAddress.contactMechId) { - resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.postalAddress.contactMechId}) + if(this.address.contactMechId) { + resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.address.contactMechId}) } else { resp = await FacilityService.createFacilityPostalAddress(payload) } diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index 3c5e15a5..c086f942 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -126,7 +126,11 @@ const actions: ActionTree = { commit(types.UTIL_COUNTRIES_UPDATED, countries) }, - async fetchStates({ commit, dispatch }, payload) { + async fetchStates({ commit, state }, payload) { + if(payload.geoId in state.states){ + commit(types.UTIL_STATES_UPDATED, { countryGeoId: payload.geoId, states: state.states[payload.geoId] }) + return; + } let states = [] as any const params = { @@ -150,7 +154,7 @@ const actions: ActionTree = { logger.error(err) } - commit(types.UTIL_STATES_UPDATED, states) + commit(types.UTIL_STATES_UPDATED, { countryGeoId: payload.geoId, states }) }, clearUtilState({ commit }) { diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts index 301b2e06..aaa4ae23 100644 --- a/src/store/modules/util/mutations.ts +++ b/src/store/modules/util/mutations.ts @@ -16,7 +16,7 @@ const mutations: MutationTree = { state.countries = payload }, [types.UTIL_STATES_UPDATED](state, payload) { - state.states = payload + state.states[payload.countryGeoId] = payload.states } } export default mutations; \ No newline at end of file From eb5aaa3d8aca220dc0fa9edb4904e2f62c72cdf6 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 22 Nov 2023 15:04:57 +0530 Subject: [PATCH 10/17] Improved: code to add keyboard accessibility to form modals (#20) --- src/components/FacilityAddressModal.vue | 4 +-- src/components/FacilityGeoPointModal.vue | 32 +++++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index fd95b6eb..be3f908b 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -24,13 +24,13 @@ {{ translate("City") }} * - + {{ translate("Country") }} {{ country.geoName }} - + {{ translate("State") }} {{ address.countryGeoId }} diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 191d62c2..4951a6bb 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -11,21 +11,23 @@ - - - - {{ translate("Generate") }} - - - - - {{ translate("Latitude") }} - - - - {{ translate("Longitude") }} - - +
+ + + + {{ translate("Generate") }} + + + + + {{ translate("Latitude") }} + + + + {{ translate("Longitude") }} + + +
From 77733d78a04d2c850af02a9ed3963d23a1107536 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 22 Nov 2023 15:18:22 +0530 Subject: [PATCH 11/17] Improved: code to fetch only required fields from api (#20) --- src/components/FacilityAddressModal.vue | 1 - src/components/FacilityGeoPointModal.vue | 2 +- src/store/modules/util/actions.ts | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index be3f908b..dcb7703d 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -32,7 +32,6 @@
{{ translate("State") }} - {{ address.countryGeoId }} {{ state.geoName }} diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index 4951a6bb..f5d7dc19 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -134,7 +134,7 @@ export default defineComponent({ } try { - resp = await FacilityService.updateFacilityPostalAddress({...payload}) + resp = await FacilityService.updateFacilityPostalAddress(payload) if(!hasError(resp)) { showToast(translate("Facility latitude & longitude updated successfully.")) diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index c086f942..12881098 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -107,6 +107,7 @@ const actions: ActionTree = { geoIdTo: "DBIC" }, entityName: 'GeoAssocAndGeoFrom', + fieldList: ['geoName', 'geoId'], noConditionFind: 'Y', } as any @@ -138,6 +139,7 @@ const actions: ActionTree = { geoIdFrom: payload.geoId }, entityName: 'GeoAssocAndGeoTo', + fieldList: ['geoName', 'geoId'], noConditionFind: 'Y', viewSize: 100 } as any @@ -147,6 +149,7 @@ const actions: ActionTree = { if(!hasError(resp)) { states = resp.data.docs + } else { throw resp.data } From bf87bfea24edae691ba83ac3c6cf13881887b2c2 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 22 Nov 2023 15:20:07 +0530 Subject: [PATCH 12/17] Improved: geoPoint modal variable name (#20) --- src/views/FacilityDetails.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 4e6b3164..9f6fe498 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -506,12 +506,12 @@ export default defineComponent({ addressModal.present() }, async openGeoPointModal() { - const addGeoPointModal = await modalController.create({ + const geoPointModal = await modalController.create({ component: FacilityGeoPointModal, componentProps: { facilityId: this.facilityId } }) - addGeoPointModal.present() + geoPointModal.present() }, async addProductStore() { const addProductStoreModal = await modalController.create({ From 3935f5093170331b1285cdc2aef2b81483937e45 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 23 Nov 2023 11:35:32 +0530 Subject: [PATCH 13/17] Improved: ion-select looping logic, states type, payload entries (#20) --- src/components/FacilityAddressModal.vue | 6 ++---- src/store/modules/util/UtilState.ts | 2 +- src/store/modules/util/index.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index dcb7703d..51332048 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -27,13 +27,13 @@ {{ translate("Country") }} - {{ country.geoName }} + {{ country.geoName }} {{ translate("State") }} - {{ state.geoName }} + {{ state.geoName }} @@ -131,10 +131,8 @@ export default defineComponent({ address2: this.address.address2, city: this.address.city, countryGeoId: this.address.countryGeoId, - countryGeoName: this.address.countryGeoName, facilityId: this.facilityId, postalCode: this.address.postalCode, - stateGeoName: this.address.stateGeoName, stateProvinceGeoId: this.address.stateGeoId } diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts index 6ede8fe1..29d5b746 100644 --- a/src/store/modules/util/UtilState.ts +++ b/src/store/modules/util/UtilState.ts @@ -3,5 +3,5 @@ export default interface UtilState { facilityTypes: object; locationTypes: object; countries: any[]; - states: any[]; + states: any; } \ No newline at end of file diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts index d1e3d4dc..805a000d 100644 --- a/src/store/modules/util/index.ts +++ b/src/store/modules/util/index.ts @@ -12,7 +12,7 @@ const utilModule: Module = { facilityTypes: {}, locationTypes: {}, countries: [], - states: [] + states: {} }, getters, actions, From 58d7029f1bb2c15ddc03a3cb280725ad4a79e5c5 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 23 Nov 2023 16:42:49 +0530 Subject: [PATCH 14/17] Improved: code to showToast and return when we save modal without changing any data (#20) --- src/components/FacilityAddressModal.vue | 6 ++++++ src/components/FacilityGeoPointModal.vue | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index 51332048..44539dd2 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -119,6 +119,12 @@ export default defineComponent({ modalController.dismiss() }, async saveAddress() { + const isAddressUpdated = Object.entries(this.postalAddress).filter(([addressKey, addressValue]) => this.address[addressKey] !== addressValue).length + if(!isAddressUpdated) { + showToast(translate("Please fill all the required fields")) + return; + } + let resp; if(!this.address?.address1 || !this.address?.city) { diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index f5d7dc19..acbcc475 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -121,6 +121,11 @@ export default defineComponent({ } }, async saveGeoPoint() { + if(!this.geoPoint.latitude || !this.geoPoint.longitude || !this.geoPoint.postalCode) { + showToast("Please fill all the required fields") + return; + } + let resp; const payload = { From 348fa5ab4f6907842ce0d4cdf234622bec87383d Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 Nov 2023 10:46:38 +0530 Subject: [PATCH 15/17] Improved: payload mapping reduced for optimized code(#20) --- src/components/FacilityAddressModal.vue | 16 +++------------- src/components/FacilityGeoPointModal.vue | 12 +----------- src/store/modules/facility/actions.ts | 19 +++++-------------- 3 files changed, 9 insertions(+), 38 deletions(-) diff --git a/src/components/FacilityAddressModal.vue b/src/components/FacilityAddressModal.vue index 44539dd2..a61bf78e 100644 --- a/src/components/FacilityAddressModal.vue +++ b/src/components/FacilityAddressModal.vue @@ -32,7 +32,7 @@ {{ translate("State") }} - + {{ state.geoName }} @@ -132,21 +132,11 @@ export default defineComponent({ return } - const payload = { - address1: this.address.address1, - address2: this.address.address2, - city: this.address.city, - countryGeoId: this.address.countryGeoId, - facilityId: this.facilityId, - postalCode: this.address.postalCode, - stateProvinceGeoId: this.address.stateGeoId - } - try { if(this.address.contactMechId) { - resp = await FacilityService.updateFacilityPostalAddress({...payload, contactMechId: this.address.contactMechId}) + resp = await FacilityService.updateFacilityPostalAddress({...this.address, facilityId: this.facilityId }) } else { - resp = await FacilityService.createFacilityPostalAddress(payload) + resp = await FacilityService.createFacilityPostalAddress(this.address) } if(!hasError(resp)) { diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index acbcc475..a47d6cff 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -128,18 +128,8 @@ export default defineComponent({ let resp; - const payload = { - address1: this.geoPoint.address1, - city: this.geoPoint.city, - contactMechId: this.geoPoint.contactMechId, - facilityId: this.facilityId, - latitude: this.geoPoint.latitude, - longitude: this.geoPoint.longitude, - postalCode: this.geoPoint.postalCode - } - try { - resp = await FacilityService.updateFacilityPostalAddress(payload) + resp = await FacilityService.updateFacilityPostalAddress(this.geoPoint) if(!hasError(resp)) { showToast(translate("Facility latitude & longitude updated successfully.")) diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index 114c6c9a..c6c0eca3 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -157,7 +157,7 @@ const actions: ActionTree = { }, async fetchFacilityContactDetails({ commit }, payload) { - let postalAddress = {} + let postalAddress = {} as any const params = { inputFields: { contactMechPurposeTypeId: 'PRIMARY_LOCATION', @@ -174,21 +174,12 @@ const actions: ActionTree = { try { const resp = await FacilityService.fetchFacilityContactDetails(params) if(!hasError(resp)) { - const contactInfo = resp.data.docs[0] - + postalAddress = resp.data.docs[0] postalAddress = { - address1: contactInfo.address1, - address2: contactInfo.address2, - city: contactInfo.city, - contactMechId: contactInfo.contactMechId, - countryGeoId: contactInfo.countryGeoId, - countryGeoName: contactInfo.countryGeoName, - latitude: contactInfo.latitude, - longitude: contactInfo.longitude, - postalCode: contactInfo.postalCode, - stateGeoId: contactInfo.stateGeoId, - stateGeoName: contactInfo.stateGeoName + ...postalAddress, + stateProvinceGeoId: postalAddress.stateGeoId } + delete postalAddress.stateGeoId } else { throw resp.data } From 6a351efcc8610086c0c60a2c1099d604672e4da5 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 Nov 2023 10:49:16 +0530 Subject: [PATCH 16/17] Improved: added translation to placeholder (#20) --- src/components/FacilityGeoPointModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index a47d6cff..b3227236 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -13,7 +13,7 @@
- + {{ translate("Generate") }} From 125231e83d5264727117a43019602252d323a0ec Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 Nov 2023 12:17:18 +0530 Subject: [PATCH 17/17] Improved: added facilityId in payload for updating lat-long (#20) --- src/components/FacilityGeoPointModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FacilityGeoPointModal.vue b/src/components/FacilityGeoPointModal.vue index e72f0874..c387653e 100644 --- a/src/components/FacilityGeoPointModal.vue +++ b/src/components/FacilityGeoPointModal.vue @@ -130,7 +130,7 @@ export default defineComponent({ let resp; try { - resp = await FacilityService.updateFacilityPostalAddress(this.geoPoint) + resp = await FacilityService.updateFacilityPostalAddress({...this.geoPoint, facilityId: this.facilityId}) if(!hasError(resp)) { showToast(translate("Facility latitude & longitude updated successfully."))