diff --git a/.env.example b/.env.example index 1da37f3..747a70b 100644 --- a/.env.example +++ b/.env.example @@ -5,4 +5,5 @@ VUE_APP_VIEW_SIZE=10 VUE_APP_PERMISSION_ID= VUE_APP_DEFAULT_LOG_LEVEL="error" VUE_APP_COMPANY_PARTY_ID="COMPANY" -VUE_APP_LOGIN_URL="https://launchpad.hotwax.io/login" \ No newline at end of file +VUE_APP_LOGIN_URL="https://launchpad.hotwax.io/login" +VUE_APP_FACILITIES_LOGIN_URL="https://facilities.hotwax.io/login" \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index ce97b3d..98830d4 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -63,6 +63,7 @@ const routes: Array = [ path: "/add-configurations/:productStoreId", name: "AddConfigurations", component: AddConfigurations, + props: true, beforeEnter: (to, from, next) => { if(from.path === "/create-product-store") next() else router.push(from.path) diff --git a/src/views/CreateProductStore.vue b/src/views/CreateProductStore.vue index bedc347..1cb50b0 100644 --- a/src/views/CreateProductStore.vue +++ b/src/views/CreateProductStore.vue @@ -89,6 +89,11 @@ async function manageConfigurations() { formData.value.productStoreId = generateInternalId(formData.value.storeName) } + if (formData.value.productStoreId.length > 20) { + showToast(translate("Product store ID cannot be more than 20 characters.")) + return + } + let resp; try { diff --git a/src/views/ProductStore.vue b/src/views/ProductStore.vue index 2865ced..ae7f08a 100644 --- a/src/views/ProductStore.vue +++ b/src/views/ProductStore.vue @@ -18,7 +18,7 @@
- + {{ translate(store.facilityCount > 1 ? "facilities" : "facility", { count: store.facilityCount }) }} @@ -49,11 +49,14 @@ import { translate } from "@/i18n"; import { useRouter } from "vue-router"; import { computed } from "vue"; import { useStore } from "vuex"; +import { useAuthStore } from '@hotwax/dxp-components' const store = useStore(); const router = useRouter(); +const authStore = useAuthStore(); const productStores = computed(() => store.getters["productStore/getProductStores"]) +const omsRedirectionInfo = computed(() => store.getters["user/getOmsRedirectionInfo"]) onIonViewWillEnter(async () => { await store.dispatch("productStore/fetchProductStores"); @@ -66,6 +69,11 @@ async function viewProductStoreDetails(productStoreId: string) { function createStore() { router.push("/create-product-store") } + +function viewFacilities(productStoreId: string) { + const facilitiesListUrl = `${process.env.VUE_APP_FACILITIES_LOGIN_URL}?oms=${omsRedirectionInfo.value.url}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}&productStoreId=${productStoreId}` + window.open(facilitiesListUrl, "_blank") +}