Skip to content

Commit

Permalink
Merge pull request #119 from ymaheshwari1/facilities/#88
Browse files Browse the repository at this point in the history
Implemented: support to show statistics on the home page(#88)
  • Loading branch information
ravilodhi authored Dec 19, 2023
2 parents 2c66f3a + 0d15796 commit d10a01c
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"area": "area",
"Auto release": "Auto release",
"Back to Launchpad": "Back to Launchpad",
"Backorder parking": "Backorder parking",
"Built: ": "Built: { builtDateTime }",
"Brokering queue": "Brokering queue",
"Cancel": "Cancel",
"Change": "Change",
"Change time zone": "Change time zone",
Expand Down Expand Up @@ -202,6 +204,7 @@
"Online Order Fulfillment": "Online Order Fulfillment",
"Online inventory turned on for": "Online inventory turned on for {facilityName}",
"Online inventory turned off for": "Online inventory turned off for {facilityName}",
"Online facilities": "Online facilities",
"Open and close time": "Open and close time",
"Opening Time": "Opening Time",
"Operating hours": "Operating hours",
Expand All @@ -225,6 +228,9 @@
"Physical Store login": "Physical Store login",
"Please check start time and end time entries. End time cannot be less than start time.": "Please check start time and end time entries. End time cannot be less than start time.",
"Please update atleast one party role.": "Please update atleast one party role.",
"Password": "Password",
"party id": "party id",
"Pickup facilities": "Pickup facilities",
"Please contact the administrator.": "Please contact the administrator.",
"Please enter a valid value": "Please enter a valid value",
"Please fill all the required fields": "Please fill all the required fields",
Expand Down Expand Up @@ -287,6 +293,7 @@
"Start Time": "Start Time",
"State": "State",
"Store": "Store",
"Stores": "Stores",
"store name": "store name",
"Store unlink failed.": "Store unlink failed.",
"Store unlinked successfully.": "Store unlinked successfully.",
Expand Down Expand Up @@ -323,6 +330,7 @@
"View details": "View details",
"View order count history": "View order count history",
"View other schedules": "View other schedules",
"Warehouses": "Warehouses",
"Wednesday": "Wednesday",
"Would you like to update your time zone to . Your profile is currently set to . This setting can always be changed from the settings menu.": "Would you like to update your time zone to {localTimeZone}. Your profile is currently set to {profileTimeZone}. This setting can always be changed from the settings menu.",
"Zipcode": "Zipcode"
Expand Down
114 changes: 114 additions & 0 deletions src/views/FacilityManagement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,58 @@
<ion-icon slot="start" :icon="businessOutline"/>
<h1>{{ translate("Facilities") }}</h1>
</ion-item>
<ion-item>
<ion-label>{{ translate('Stores') }}</ion-label>
<ion-note slot="end">{{ physicalStoresCount }}</ion-note>
</ion-item>
<ion-item>
<ion-label>{{ translate('Warehouses') }}</ion-label>
<ion-note slot="end">{{ warehouseCount }}</ion-note>
</ion-item>
</ion-card>

<ion-card button @click="router.push('/parking')">
<ion-item lines="none">
<ion-icon slot="start" :icon="golfOutline"/>
<h1>{{ translate("Parking") }}</h1>
</ion-item>
<ion-item>
<ion-label>{{ translate('Brokering queue') }}</ion-label>
<ion-note slot="end">{{ brokeringQueueOrderCount }}</ion-note>
</ion-item>
<ion-item>
<ion-label>{{ translate('Backorder parking') }}</ion-label>
<ion-note slot="end">{{ backorderParkingOrderCount }}</ion-note>
</ion-item>
</ion-card>

<ion-card button @click="router.push('/find-groups')">
<ion-item lines="none">
<ion-icon slot="start" :icon="albumsOutline"/>
<h1>{{ translate("Groups") }}</h1>
</ion-item>
<ion-item>
<ion-label>{{ translate('Pickup facilities') }}</ion-label>
<ion-note slot="end">{{ pickupFacilitiesCount }}</ion-note>
</ion-item>
<ion-item>
<ion-label>{{ translate('Online facilities') }}</ion-label>
<ion-note slot="end">{{ onlineFacilitiesCount }}</ion-note>
</ion-item>
</ion-card>

<ion-card button @click="router.push('/settings')">
<ion-item lines="none">
<ion-icon slot="start" :icon="settingsOutline"/>
<h1>{{ translate("Settings") }}</h1>
</ion-item>
<ion-item>
<ion-label>{{ userProfile?.partyName }}</ion-label>
<ion-note slot="end">{{ userProfile?.userLoginId }}</ion-note>
</ion-item>
<ion-item>
<ion-label>{{ instanceUrl }}</ion-label>
</ion-item>
</ion-card>
</main>
</ion-content>
Expand All @@ -47,6 +78,8 @@ import {
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonNote,
IonPage,
IonTitle,
IonToolbar
Expand All @@ -60,6 +93,10 @@ import {
} from 'ionicons/icons';
import { useRouter } from 'vue-router';
import { translate } from '@hotwax/dxp-components'
import { hasError } from '@/adapter';

Check warning on line 96 in src/views/FacilityManagement.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / build_and_deploy

'hasError' is defined but never used

Check warning on line 96 in src/views/FacilityManagement.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'hasError' is defined but never used

Check warning on line 96 in src/views/FacilityManagement.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'hasError' is defined but never used
import logger from '@/logger';
import { FacilityService } from '@/services/FacilityService';
import { mapGetters } from 'vuex';
export default defineComponent({
name: 'FacilityManagement',
Expand All @@ -69,10 +106,87 @@ export default defineComponent({
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonNote,
IonPage,
IonTitle,
IonToolbar
},
computed: {
...mapGetters({
userProfile: 'user/getUserProfile',
instanceUrl: 'user/getInstanceUrl',
})
},
data() {
return {
warehouseCount: 0,
physicalStoresCount: 0,
brokeringQueueOrderCount: 0,
backorderParkingOrderCount: 0,
pickupFacilitiesCount: 0,
onlineFacilitiesCount: 0
}
},
async ionViewWillEnter() {
await Promise.all([this.fetchFacilityTypeCount(), this.fetchOrderCountByParking(), this.fetchFacilitiesCountByGroup()])
},
methods: {
async fetchFacilityTypeCount() {
const warehouseTypePayload = {
"inputFields": {
'parentFacilityTypeId': 'DISTRIBUTION_CENTER',
},
"entityName": "FacilityAndProductStore",
"distinct": "Y",
"fieldList": ['facilityId', 'facilityName', 'facilityTypeId'],
"viewSize": 1
}
const physicalStoreTypePayload = {
"inputFields": {
'parentFacilityTypeId': 'PHYSICAL_STORE',
},
"entityName": "FacilityAndProductStore",
"distinct": "Y",
"fieldList": ['facilityId', 'facilityName', 'facilityTypeId'],
"viewSize": 1
}
try {
const responses = await Promise.allSettled([
FacilityService.fetchFacilities(warehouseTypePayload),
FacilityService.fetchFacilities(physicalStoreTypePayload)
])
// Not checking for error in responses as in case of error we simply will not have 'count' property in response and we will display 0 as the count
// Also, if checking for error then we need to check both the apis separately as there may be a case in which only one api fails
const [warehousesResponse, physicalStoresResponse] = responses.map((response: any) => response.value);
this.warehouseCount = warehousesResponse.data.count || 0
this.physicalStoresCount = physicalStoresResponse.data.count || 0
} catch (error) {
logger.error('Failed to fetch facility types count', error)
}
},
async fetchOrderCountByParking() {
try {
const parkingsOrderCount = await FacilityService.fetchOrderCountsByFacility(['_NA_', 'BACKORDER_PARKING'])
this.brokeringQueueOrderCount = parkingsOrderCount['_NA_'] || 0
this.backorderParkingOrderCount = parkingsOrderCount['BACKORDER_PARKING'] || 0
} catch (error) {
logger.error('Failed to fetch facility types count', error)
}
},
async fetchFacilitiesCountByGroup() {
try {
const groupsFacilityCount = await FacilityService.fetchFacilityCountByGroup(['PICKUP', 'FAC_GRP'])
this.pickupFacilitiesCount = groupsFacilityCount['PICKUP'] || 0
this.onlineFacilitiesCount = groupsFacilityCount['FAC_GRP'] || 0
} catch (error) {
logger.error('Failed to fetch facility count for groups', error)
}
},
},
setup() {
const router = useRouter();
Expand Down

0 comments on commit d10a01c

Please sign in to comment.