Skip to content

Commit

Permalink
Merge pull request #12 from amansinghbais/7-redirect-to-facilities
Browse files Browse the repository at this point in the history
Improved: added support to redirect user to find facilities page with productStoreId, oms and token as query
  • Loading branch information
ymaheshwari1 authored May 31, 2024
2 parents 302b796 + c788184 commit 155ff9d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
VUE_APP_LOGIN_URL="https://launchpad.hotwax.io/login"
VUE_APP_FACILITIES_LOGIN_URL="https://facilities.hotwax.io/login"
1 change: 1 addition & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const routes: Array<RouteRecordRaw> = [
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)
Expand Down
5 changes: 5 additions & 0 deletions src/views/CreateProductStore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 9 additions & 1 deletion src/views/ProductStore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ion-item>

<div class="tablet" @click.stop="">
<ion-chip outline>
<ion-chip outline @click.stop="viewFacilities(store.productStoreId)" :disabled="!store.facilityCount">
<ion-label>{{ translate(store.facilityCount > 1 ? "facilities" : "facility", { count: store.facilityCount }) }}</ion-label>
<ion-icon :icon="openOutline" color="primary"/>
</ion-chip>
Expand Down Expand Up @@ -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");
Expand All @@ -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")
}
</script>

<style scoped>
Expand Down

0 comments on commit 155ff9d

Please sign in to comment.