Skip to content
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

Improved: code for using facility switcher from dxp-components (#138) #264

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 58 additions & 98 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@casl/ability": "^6.0.0",
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.1.0",
"@hotwax/dxp-components": "^1.5.3",
"@hotwax/dxp-components": "file:../dxp-components",
"@hotwax/oms-api": "^1.9.0",
"@ionic/core": "6.7.5",
"@ionic/vue": "6.7.5",
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_INFO_UPDATED, userProfile);
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, preferredStore);
commit(types.USER_CURRENT_FACILITY_UPDATED, payload.facility);
this.dispatch('shipment/clearShipments');
await dispatch('getFacilityLocations', payload.facility.facilityId)
},

Expand Down
29 changes: 2 additions & 27 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,8 @@
</ion-item>
</ion-card>

<ion-card>
<ion-card-header>
<ion-card-title>
{{ $t("Facility") }}
</ion-card-title>
</ion-card-header>
<ion-card-content>
{{ $t('Specify which facility you want to operate from. Order, inventory and other configuration data will be specific to the facility you select.') }}
</ion-card-content>
<ion-item lines="none">
<ion-label>{{ $t("Select facility") }}</ion-label>
<ion-select interface="popover" :value="currentFacility.facilityId" @ionChange="setFacility($event)">
<ion-select-option v-for="facility in (userProfile ? userProfile.facilities : [])" :key="facility.facilityId" :value="facility.facilityId" >{{ facility.name }}</ion-select-option>
</ion-select>
</ion-item>
</ion-card>
<DxpFacilitySwitcher />

</section>
<hr />

Expand Down Expand Up @@ -217,17 +203,6 @@ export default defineComponent({
})
}
},
setFacility (facility: any) {
// Checking if current facility is not equal to the facility selected to avoid extra api call on logging in again after logout.
if(this.currentFacility.facilityId != facility['detail'].value && this.userProfile?.facilities) {
this.userProfile?.facilities?.map((fac: any) => {
if (fac.facilityId == facility['detail'].value) {
this.store.dispatch('shipment/clearShipments');
this.store.dispatch('user/setFacility', {'facility': fac});
}
})
}
},
async presentAlert () {
const alert = await alertController.create({
header: this.$t('Logout'),
Expand Down
11 changes: 10 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path')
require("@hotwax/app-version-info")
module.exports = {
pluginOptions: {
Expand All @@ -12,5 +13,13 @@ module.exports = {
enableInSFC: true
}
},
runtimeCompiler: true
configureWebpack: {
resolve: {
alias: {
vue: path.resolve('./node_modules/vue')
}
}
},
runtimeCompiler: true,
transpileDependencies: ['@hotwax/dxp-components']
}
Loading