-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented: centralized facility switcher to be used in all app (#138) #159
Closed
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
349c2ca
Implemented: centralized facility switcher to be used in all app (#138)
amansinghbais c2f0a98
Merge branch 'main' of https://github.com/hotwax/dxp-components into …
amansinghbais b9e5f52
Improved: updated to dxp version 1.6.0 (#138)
amansinghbais 139c15b
Merge branch 'main' of https://github.com/hotwax/dxp-components into …
amansinghbais 2ca991f
Merge branch 'main' of https://github.com/hotwax/dxp-components into …
amansinghbais 10595c7
Improved: code to use deep-clone for the computed properties, method …
amansinghbais 525f934
Improved: unwanted changes in package-lock.json
amansinghbais 8437048
Improved: emitting methods from child modal without promise.all (#138)
amansinghbais 37ab41b
Merge branch 'main' of https://github.com/hotwax/dxp-components into …
amansinghbais 1534a58
Improved: facility switcher logic to use before/after emit for apps (…
amansinghbais 902bf7c
Improved: calling normally without the help of finally (#138)
amansinghbais 1c9bdcf
Improved: emitting function without catching them (#138)
amansinghbais 1614a90
Improved: added Dxp prefix in component name (dxp/138)
amansinghbais 40558c4
Improved: emits name and if condition code (#138)
amansinghbais d890841
Merge branch 'main' of https://github.com/hotwax/dxp-components into …
amansinghbais 30c28d4
Improved: variable name and used arrow function in computed(#138)
amansinghbais File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<ion-card> | ||
<ion-card-header> | ||
<ion-card-title> | ||
{{ "Facility" }} | ||
</ion-card-title> | ||
</ion-card-header> | ||
<ion-card-content> | ||
{{ 'Specify which facility you want to operate from. Order, inventory and other configuration data will be specific to the facility you select.' }} | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ion-card-content> | ||
<ion-item lines="none"> | ||
<ion-label>{{ "Select facility" }}</ion-label> | ||
<ion-select interface="popover" :value="appUserState.currentFacility.facilityId" @ionChange="setFacility($event)"> | ||
<ion-select-option v-for="facility in (appUserState.userProfile ? appUserState.userProfile.facilities : [])" :key="facility.facilityId" :value="facility.facilityId" >{{ facility.name }}</ion-select-option> | ||
</ion-select> | ||
</ion-item> | ||
</ion-card> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { IonCard, IonCardContent, IonCardHeader, IonCardTitle, IonItem, IonLabel, IonSelect, IonSelectOption } from '@ionic/vue' | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { appContext } from '../index'; | ||
import { computed } from 'vue'; | ||
|
||
const emit = defineEmits(['facility-change-alert', 'get-facility-details' ,'update-facility-id']) | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const store = appContext.config.globalProperties.$store; | ||
const appUserState = computed(() => { | ||
return { | ||
currentFacility: store.getters['user/getCurrentFacility'], | ||
userProfile: store.getters['user/getUserProfile'], | ||
uploadProducts: store.getters['product/getUploadProducts'] | ||
} | ||
}); | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const setFacility = async (facility: any) => { | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const currentAppUserState = appUserState.value | ||
const selectedFacility = facility['detail'].value | ||
if ( currentAppUserState.currentFacility.facilityId && currentAppUserState.currentFacility.facilityId != selectedFacility && currentAppUserState.userProfile?.facilities) { | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (store.uploadProducts && Object.keys(store.uploadProducts).length > 0 ) { | ||
emit('facility-change-alert', selectedFacility) | ||
} else { | ||
await store.dispatch('user/setFacility', { | ||
'facility': currentAppUserState.userProfile.facilities.find((fac: any) => fac.facilityId == selectedFacility) | ||
}); | ||
Promise.all([emit('update-facility-id', currentAppUserState.currentFacility.facilityId), emit('get-facility-details')]) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the component to DxpFacilitySwticher