Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hotwax/facilities into faci…
Browse files Browse the repository at this point in the history
…lities/#12
  • Loading branch information
amansinghbais committed Nov 23, 2023
2 parents 7c651e9 + 16f82c6 commit 8ca62fc
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 346 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ VUE_APP_CACHE_MAX_AGE=3600
VUE_APP_VIEW_SIZE=10
VUE_APP_BASE_URL=
VUE_APP_PERMISSION_ID=
VUE_APP_ALIAS={}
VUE_APP_LOCALES={"en-US": "English"}
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_LOGIN_URL="http://launchpad.hotwax.io/login"
4 changes: 2 additions & 2 deletions .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"hotwax-digital-commerce": {
"hosting": {
"dev": [
"dev-facilities"
"hotwax-facilities-dev"
],
"uat": [
"uat-facilities"
"hotwax-facilities-uat"
]
}
},
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- main
jobs:
call-workflow-in-another-repo:
uses: hotwax/dxp-components/.github/workflows/common-firebase-hosting-merge.yml@main
with:
config-path: .github/labeler.yml
secrets:
envPAT: ${{ secrets.envPAT }}
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
94 changes: 52 additions & 42 deletions src/components/AddLocationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,43 @@
</ion-header>

<ion-content>
<ion-item>
<ion-label>{{ translate("Type") }}</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" v-model="locationInfo.locationTypeEnumId">
<ion-select-option v-for="(description, type) in locationTypes" :key="type" :value="type">{{ description }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>{{ translate("Area") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('area')" v-model="locationInfo.areaId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Aisle") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('aisle')" v-model="locationInfo.aisleId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Section") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('section')" v-model="locationInfo.sectionId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Level") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('level')" v-model="locationInfo.levelId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Sequence") }}</ion-label>
<ion-input :placeholder="translate('sequence')" v-model="locationInfo.positionId"/>
</ion-item>
</ion-content>
<form @keyup.enter="saveFacilityLocation">
<!-- Using stop for enter key as when using keyboard for opening the select we need to use enter and the same key submits the form
so to prevent form submission on using enter key on select used stop -->
<ion-item @keyup.enter.stop>
<ion-label>{{ translate("Type") }}</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" v-model="locationInfo.locationTypeEnumId">
<ion-select-option v-for="(description, type) in locationTypes" :key="type" :value="type">{{ description }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>{{ translate("Area") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('area')" v-model="locationInfo.areaId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Aisle") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('aisle')" v-model="locationInfo.aisleId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Section") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('section')" v-model="locationInfo.sectionId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Level") }} <ion-text color="danger">*</ion-text></ion-label>
<ion-input :placeholder="translate('level')" v-model="locationInfo.levelId"/>
</ion-item>
<ion-item>
<ion-label>{{ translate("Sequence") }}</ion-label>
<ion-input :placeholder="translate('sequence')" v-model="locationInfo.positionId"/>
</ion-item>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="saveFacilityLocation">
<ion-icon :icon="saveOutline" />
</ion-fab-button>
</ion-fab>
<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="saveFacilityLocation" @keyup.enter.stop>
<ion-icon :icon="saveOutline" />
</ion-fab-button>
</ion-fab>
</form>
</ion-content>
</template>

<script lang="ts">
Expand All @@ -69,7 +73,7 @@ import { defineComponent } from "vue";
import { closeOutline, saveOutline } from "ionicons/icons";
import { translate } from '@hotwax/dxp-components'
import { FacilityService } from "@/services/FacilityService";
import { mapGetters } from 'vuex'
import { mapGetters, useStore } from 'vuex'
import { hasError } from "@/adapter";
import { showToast } from "@/utils";
import logger from "@/logger";
Expand Down Expand Up @@ -109,21 +113,24 @@ export default defineComponent({
})
},
methods: {
closeModal(result?: string) {
modalController.dismiss({ result });
closeModal() {
modalController.dismiss();
},
saveFacilityLocation() {
if(!this.locationInfo.aisleId?.trim() || !this.locationInfo.areaId?.trim() || !this.locationInfo.positionId?.trim() || !this.locationInfo.sectionId?.trim() || !this.locationInfo.levelId?.trim()) {
async saveFacilityLocation() {
if(!this.locationInfo.aisleId?.trim() || !this.locationInfo.areaId?.trim() || !this.locationInfo.sectionId?.trim() || !this.locationInfo.levelId?.trim()) {
showToast(translate('Please fill all the required fields'))
return;
}
// checking for locationSeqId as when adding new facility we won't be having locationSeqId
if(this.location.locationSeqId) {
this.updateFacilityLocation()
if(this.location?.locationSeqId) {
await this.updateFacilityLocation()
} else {
this.addFacilityLocation()
await this.addFacilityLocation()
}
// fetching facility locations after updating/creating a location
await this.store.dispatch('facility/fetchFacilityLocations', { facilityId: this.current.facilityId })
},
async addFacilityLocation() {
const params = {
Expand All @@ -136,7 +143,7 @@ export default defineComponent({
if(!hasError(resp)) {
showToast(translate('Facility location created successfully'))
this.closeModal('success');
this.closeModal();
} else {
throw resp.data
}
Expand All @@ -157,7 +164,7 @@ export default defineComponent({
if(!hasError(resp)) {
showToast(translate('Facility location updated successfully'))
this.closeModal('success');
this.closeModal();
} else {
throw resp.data
}
Expand All @@ -168,9 +175,12 @@ export default defineComponent({
},
},
setup() {
const store = useStore();
return {
closeOutline,
saveOutline,
store,
translate
};
},
Expand Down
94 changes: 94 additions & 0 deletions src/components/Filters.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<template>
<ion-menu type="overlay" side="end">
<ion-header>
<ion-toolbar>
<ion-title>{{ translate("Filters") }}</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-list>
<ion-item lines="none">
<ion-icon :icon="globeOutline" slot="start" />
<ion-label>{{ translate("Product Store") }}</ion-label>
<ion-select interface="popover" v-model="query.productStoreId" @ionChange="updateQuery()">
<ion-select-option value="">{{ translate("All") }}</ion-select-option>
<ion-select-option :value="productStore.productStoreId" :key="index" v-for="(productStore, index) in productStores">{{ productStore.storeName }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item lines="none">
<ion-icon :icon="businessOutline" slot="start" />
<ion-label>{{ translate("Type") }}</ion-label>
<ion-select interface="popover" v-model="query.facilityTypeId" @ionChange="updateQuery()">
<ion-select-option value="">{{ translate("All") }}</ion-select-option>
<ion-select-option :value="facilityType.facilityTypeId" :key="index" v-for="(facilityType, index) in facilityTypes">{{ facilityType.description }}</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
</template>

<script lang="ts">
import {
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonList,
IonMenu,
IonTitle,
IonToolbar,
IonSelect,
IonSelectOption,
menuController
} from '@ionic/vue'
import { businessOutline, globeOutline } from 'ionicons/icons'
import { defineComponent } from 'vue';
import { mapGetters, useStore } from 'vuex';
import { translate } from '@hotwax/dxp-components'
export default defineComponent({
name: 'Filters',
components: {
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonList,
IonMenu,
IonTitle,
IonToolbar,
IonSelect,
IonSelectOption
},
computed: {
...mapGetters({
query: "facility/getQuery",
facilityTypes: "util/getFacilityTypes",
productStores: "util/getProductStores"
})
},
methods: {
closeMenu() {
menuController.close()
},
async updateQuery() {
await this.store.dispatch('facility/updateQuery', this.query)
this.closeMenu();
},
},
setup() {
const store = useStore();
return {
businessOutline,
globeOutline,
store,
translate
};
}
})
</script>
11 changes: 5 additions & 6 deletions src/components/LocationDetailsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ export default defineComponent({
addLocationModal.present()
addLocationModal.onDidDismiss().then((result: any) => {
if(result.data?.result) {
popoverController.dismiss();
}
addLocationModal.onDidDismiss().then(() => {
popoverController.dismiss();
})
},
async removeLocation() {
Expand All @@ -69,15 +67,16 @@ export default defineComponent({
const resp = await FacilityService.deleteFacilityLocation(params)
if(!hasError(resp)) {
this.store.dispatch('facility/fetchFacilityLocation')
popoverController.dismiss();
showToast(translate('Facility location removed successfully'))
await this.store.dispatch('facility/fetchFacilityLocations', { facilityId: this.current.facilityId })
} else {
throw resp.data
}
} catch(err) {
showToast(translate('Failed to remove facility location'))
logger.error('Failed to remove facility location', err)
}
popoverController.dismiss();
}
},
setup() {
Expand Down
Loading

0 comments on commit 8ca62fc

Please sign in to comment.