diff --git a/src/locales/en.json b/src/locales/en.json index 40d9a7f3..900c4086 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -41,6 +41,7 @@ "Facility ID": "Facility ID", "Facility name": "Facility name", "Facility Management": "Facility Management", + "Failed to fetch facility information": "Failed to fetch facility information", "Fetching TimeZones": "Fetching TimeZones", "Find Facilities": "Find Facilities", "Friday": "Friday", diff --git a/src/store/index.ts b/src/store/index.ts index 9bc4a805..f8bc8d21 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -3,10 +3,10 @@ import mutations from './mutations' import getters from './getters' import actions from './actions' import RootState from './RootState' -import createPersistedState from "vuex-persistedstate"; +import createPersistedState from 'vuex-persistedstate'; import userModule from './modules/user'; import { setPermissions } from '@/authorization' -import facilityModule from "./modules/facility" +import facilityModule from './modules/facility' import utilModule from "./modules/util" diff --git a/src/store/modules/facility/FacilityState.ts b/src/store/modules/facility/FacilityState.ts index 416a59aa..2b9f8839 100644 --- a/src/store/modules/facility/FacilityState.ts +++ b/src/store/modules/facility/FacilityState.ts @@ -9,4 +9,5 @@ export default interface FacilityState { list: Array, total: number }; + current: any; } \ No newline at end of file diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index 88ee6b76..874eb000 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -43,7 +43,7 @@ const actions: ActionTree = { "entityName": "FacilityAndProductStore", "noConditionFind": "Y", "distinct": "Y", - "fieldList": ['facilityId', 'facilityName', 'facilityTypeId', 'maximumOrderLimit'], + "fieldList": ['defaultDaysToShip', 'facilityId', 'facilityName', 'facilityTypeId', 'maximumOrderLimit'], ...payload } @@ -90,6 +90,46 @@ const actions: ActionTree = { commit(types.FACILITY_LIST_UPDATED , { facilities, total }); }, + async fetchCurrentFacility({ commit, state }, payload) { + // checking that if the list contains basic information for facility then not fetching the same information again + const cachedFacilities = JSON.parse(JSON.stringify(state.facilities.list)) + const current = cachedFacilities.find((facility: any) => facility.facilityId === payload.facilityId) + if(current?.facilityId) { + commit(types.FACILITY_CURRENT_UPDATED, current); + return; + } + + emitter.emit("presentLoader"); + + const params = { + inputFields: { + facilityId: payload.facilityId + }, + entityName: "FacilityAndProductStore", + noConditionFind: "Y", + distinct: "Y", + fieldList: ['defaultDaysToShip', 'facilityId', 'facilityName', 'facilityTypeId', 'maximumOrderLimit'], + viewSize: 1 + } + + let facility = {}; + + try { + const resp = await FacilityService.fetchFacilities(params) + + if(!hasError(resp) && resp.data.count > 0) { + facility = resp.data.docs[0] + } else { + throw resp.data + } + } catch(error) { + logger.error(error) + } + + emitter.emit("dismissLoader"); + commit(types.FACILITY_CURRENT_UPDATED, facility); + }, + 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 211686f1..c3582cc9 100644 --- a/src/store/modules/facility/getters.ts +++ b/src/store/modules/facility/getters.ts @@ -14,5 +14,8 @@ const getters: GetterTree = { state.facilities.list?.length > 0 && state.facilities.list?.length < state.facilities.total ); }, + getCurrent(state) { + return state.current ? JSON.parse(JSON.stringify(state.current)) : {} + } } export default getters; \ No newline at end of file diff --git a/src/store/modules/facility/index.ts b/src/store/modules/facility/index.ts index 87d00f40..bc563c53 100644 --- a/src/store/modules/facility/index.ts +++ b/src/store/modules/facility/index.ts @@ -17,7 +17,8 @@ const facilityModule: Module = { facilities: { list: [], total: 0 - } + }, + current: {} }, getters, actions, diff --git a/src/store/modules/facility/mutation-types.ts b/src/store/modules/facility/mutation-types.ts index a6cb0882..4676bdb0 100644 --- a/src/store/modules/facility/mutation-types.ts +++ b/src/store/modules/facility/mutation-types.ts @@ -1,3 +1,4 @@ export const SN_FACILITY = 'facility' export const FACILITY_LIST_UPDATED = SN_FACILITY + '/LIST_UPDATED' -export const FACILITY_QUERY_UPDATED = SN_FACILITY + '/QUERY_UPDATED' \ No newline at end of file +export const FACILITY_QUERY_UPDATED = SN_FACILITY + '/QUERY_UPDATED' +export const FACILITY_CURRENT_UPDATED = SN_FACILITY + '/CURRENT_UPDATED' \ No newline at end of file diff --git a/src/store/modules/facility/mutations.ts b/src/store/modules/facility/mutations.ts index 157649ad..fab0e52c 100644 --- a/src/store/modules/facility/mutations.ts +++ b/src/store/modules/facility/mutations.ts @@ -9,6 +9,9 @@ const mutations: MutationTree = { }, [types.FACILITY_QUERY_UPDATED](state, payload) { state.query = payload + }, + [types.FACILITY_CURRENT_UPDATED](state, payload) { + state.current = payload } } export default mutations; \ No newline at end of file diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 6e4c8890..80f2bc7c 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -7,356 +7,361 @@ - - -

{{ "Facility Name" }}

-

{{ "Facility Id" }}

-
-
- -
-
+
+ + +

{{ current.facilityName }}

+

{{ current.facilityId }}

+
+
+ +
+
+ + + + {{ translate("Address") }} + + + + +

{{ "Address line 1" }}

+

{{ "Address line 2" }}

+

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

+

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

+
+
+ {{ translate("Edit") }} + + {{ translate("Add") }} + + +
+ + + + + {{ translate("Latitude & Longitude") }} + + + + {{ 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("Add") }} + + +
+
+ - {{ translate("Address") }} + {{ translate("Operating hours") }} - - -

{{ "Address line 1" }}

-

{{ "Address line 2" }}

-

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

-

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

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

{{ translate("Monday") }}

+
+ + {{ "7:30am - 8:00pm" }} + +
+ + +

{{ translate("Tuesday") }}

+
+ + + {{ translate("Add timings") }} + +
+ + +

{{ translate("Wednesday") }}

+
+ + + {{ translate("Add timings") }} + +
+ + +

{{ translate("Thursday") }}

+
+ + + {{ translate("Add timings") }} + +
+ + +

{{ translate("Friday") }}

+
+ + + {{ translate("Add timings") }} + +
+ + +

{{ translate("Saturday") }}

+
+ + + {{ translate("Add timings") }} + +
+ + +

{{ translate("Sunday") }}

+
+ + + {{ translate("Add timings") }} + +
+
- {{ translate("Latitude & Longitude") }} + {{ translate("Product Stores") }} + + + {{ translate("Add") }} + - - {{ 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("Add") }} - - -
-
- - - - - {{ translate("Operating hours") }} - - - - - -

{{ translate("Monday") }}

-
- - {{ "7:30am - 8:00pm" }} - -
- + + -

{{ translate("Tuesday") }}

+ {{ "NotNaked" }}
- - - {{ translate("Add timings") }} + {{ translate("primary store") }} + +
- + + -

{{ translate("Wednesday") }}

+ {{ "Wasatch Ski company" }}
- - - {{ translate("Add timings") }} + +
- - -

{{ translate("Thursday") }}

-
- - - {{ translate("Add timings") }} - +
+
+ +
+ + + + {{ translate("Fulfillment Settings") }} + + + + {{ translate("Sell Inventory Online") }} + - - -

{{ translate("Friday") }}

-
- - - {{ translate("Add timings") }} - + + {{ translate("Uses native fulfillment app") }} + - - -

{{ translate("Saturday") }}

-
- - - {{ translate("Add timings") }} - + + {{ translate("Generate shipping labels") }} + - - -

{{ translate("Sunday") }}

-
- - - {{ translate("Add timings") }} - + + {{ translate("Allow pickup") }} + - -
- - - - - {{ translate("Product Stores") }} - - - - {{ translate("Add") }} + + {{ translate("Days to ship") }} + + + + {{ translate("Update days to ship") }} - - - - - {{ "NotNaked" }} - - {{ translate("primary store") }} - - + + + + + + {{ translate("Online Order Fulfillment") }} + + + + {{ translate("Configure the order fulfillment capacity of your facility.") }} +

+ {{ translate("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.") }} +
+ + {{ 10 }} + + {{ 20 }} + + + {{ translate("View order count history") }} + +
+
+ +
+ + + + {{ translate("External mappings") }} + + + + {{ translate("Staff") }} + + + + {{ translate("Locations") }} + + + +
+ + + {{ translate("Map facility to an external system") }} - - - - - {{ "Wasatch Ski company" }} - - - +
+ + + + {{ translate("Shopify facility") }} + + + + + {{ "shop name" }} +

{{ "" }}

+
+ {{"note"}} +
+ + {{ "" }} + {{"note"}} + + + {{ "" }} + + + + + + {{ "" }} + + + + + {{ translate("Edit") }} + {{ translate("Remove") }} +
+
+
+
+ +
+ + + {{ translate("Add staff member to facility") }} - - - - -
- - - - {{ translate("Fulfillment Settings") }} - - - - {{ translate("Sell Inventory Online") }} - - - - {{ translate("Uses native fulfillment app") }} - - - - {{ translate("Generate shipping labels") }} - - - - {{ translate("Allow pickup") }} - - - - {{ translate("Days to ship") }} - - - - {{ translate("Update days to ship") }} - - - - - - - {{ translate("Online Order Fulfillment") }} - - - - {{ translate("Configure the order fulfillment capacity of your facility.") }} -

- {{ translate("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.") }} -
- - {{ 10 }} - - {{ 20 }} - - - {{ translate("View order count history") }} - -
-
- -
- - - - {{ translate("External mappings") }} - - - - {{ translate("Staff") }} - - - - {{ translate("Locations") }} - - - -
- - - {{ translate("Map facility to an external system") }} - -
- - - - {{ translate("Shopify facility") }} - - - + +
+ + - {{ "shop name" }} -

{{ "" }}

+ {{ "party name" }} +

{{ translate("party id") }}

- {{"note"}} -
- - {{ "" }} - {{"note"}} - - - {{ "" }} - - - - - {{ "" }} - - - - - {{ translate("Edit") }} - {{ translate("Remove") }} - -
-
-
-
- - - {{ translate("Add staff member to facility") }} - - -
- - - - {{ "party name" }} -

{{ translate("party id") }}

+ + {{ "fulfillment" }} +

{{ translate("role") }}

-
- - {{ "fulfillment" }} -

{{ translate("role") }}

-
+ + {{ "3rd June 2023" }} +

{{ "added" }}

+
- - {{ "3rd June 2023" }} -

{{ "added" }}

-
+ + + +
+
+
- - +
+ + + {{ translate("Add locations to facility") }} -
-
-
-
- - - {{ translate("Add locations to facility") }} - +
+ + + + {{ "locations id" }} +

{{ "pick/primary" }}

+
+
+ + + AI +

{{ translate("area") }}

+
-
- - - {{ "locations id" }} -

{{ "pick/primary" }}

+ AL +

{{ translate("aisle") }}

-
- - AI -

{{ translate("area") }}

-
- - - AL -

{{ translate("aisle") }}

-
- - - SI -

{{ translate("section") }}

-
- - - SI -

{{ translate("level") }}

-
- - - 1 -

{{ translate("sequence") }}

-
- - - - + + SI +

{{ translate("section") }}

+
+ + + SI +

{{ translate("level") }}

+
+ + + 1 +

{{ translate("sequence") }}

+
+ + + + +
+
-
-
+ +
+ {{ translate("Failed to fetch facility information") }} +
@@ -412,6 +417,7 @@ import SelectProductStoreModal from '@/components/SelectProductStoreModal.vue' import SelectOperatingTimeModal from '@/components/SelectOperatingTimeModal.vue'; import AddLocationModal from '@/components/AddLocationModal.vue'; import AddStaffMemberModal from '@/components/AddStaffMemberModal.vue'; +import { mapGetters, useStore } from 'vuex'; export default defineComponent({ name: 'FacilityDetails', @@ -443,10 +449,21 @@ export default defineComponent({ }, data() { return { - isTimeModalOpen: false, + isTimeModalOpen: false as boolean, + isLoading: true, // shows whether the facility information fetching is completed or not segment: 'external-mappings' } }, + computed: { + ...mapGetters({ + current: 'facility/getCurrent' + }) + }, + props: ["facilityId"], + async ionViewWillEnter() { + await this.store.dispatch('facility/fetchCurrentFacility', { facilityId: this.facilityId }) + this.isLoading = false + }, methods: { async openStorePopover(ev: Event) { const popover = await popoverController.create({ @@ -516,6 +533,8 @@ export default defineComponent({ } }, setup() { + const store = useStore(); + return { addCircleOutline, addOutline, @@ -526,6 +545,7 @@ export default defineComponent({ locationOutline, openOutline, personOutline, + store, translate } }