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

Fixed: Miscellaneous issues in new facility group UI (#293) #300

Merged
merged 5 commits into from
Aug 23, 2024
Merged
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
4 changes: 3 additions & 1 deletion src/components/FacilityGroupDescriptionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
<div slot="label">{{ translate("Name") }} <ion-text color="danger">*</ion-text></div>
</ion-input>
</ion-item>
<ion-item>
<ion-item lines="none">
<ion-textarea :label="translate('Description')" label-placement="floating"
:placeholder="translate('group description')"
:auto-grow="true"
:counter="true"
:maxlength="255"
v-model="facilityGroupDescription"
>
</ion-textarea>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.",
"No facilities available to select": "No facilities available to select",
"No facilities found": "No facilities found",
"No facilities selected." : "No facilities selected.",
"No facility found": "No facility found",
"No fulfillment capacity": "No fulfillment capacity",
"No groups found": "No groups found",
Expand Down
11 changes: 10 additions & 1 deletion src/views/CreateFacilityGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
</ion-select>
</ion-item>
<ion-item lines="none">
<ion-input :label="translate('Description')" label-placement="floating" v-model="formData.description"/>
<ion-textarea :label="translate('Description')" label-placement="floating"
:placeholder="translate('group description')"
:auto-grow="true"
:counter="true"
:maxlength="255"
v-model="formData.description"
>
</ion-textarea>
</ion-item>
</ion-list>
</form>
Expand Down Expand Up @@ -72,6 +79,7 @@
IonSelect,
IonSelectOption,
IonText,
IonTextarea,
IonTitle,
IonToolbar,
alertController
Expand Down Expand Up @@ -105,6 +113,7 @@
IonSelect,
IonSelectOption,
IonText,
IonTextarea,
IonTitle,
IonToolbar
},
Expand Down Expand Up @@ -190,7 +199,7 @@
)
const hasFailedResponse = responses.some((response: any) => response.status === 'rejected')
if (hasFailedResponse) {
console.log("Error in associating group to some of the product stores")

Check warning on line 202 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

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

Unexpected console statement

Check warning on line 202 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

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

Unexpected console statement
}
} catch (error) {
logger.error(error)
Expand All @@ -205,13 +214,13 @@
buttons: [
{
text: translate("Skip"),
handler: async (data: any) => {

Check warning on line 217 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

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

'data' is defined but never used

Check warning on line 217 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

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

'data' is defined but never used
this.router.replace({ path: `/tabs/find-groups`})
}
},
{
text: translate("Add"),
handler: async (data: any) => {

Check warning on line 223 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

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

'data' is defined but never used

Check warning on line 223 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

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

'data' is defined but never used
this.router.replace({ path: `/manage-facilities/${facilityGroupId}`})
}
}
Expand Down
67 changes: 15 additions & 52 deletions src/views/FindGroups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ion-header :translucent="true">
<ion-toolbar>
<ion-title>{{ translate("Groups") }}</ion-title>
<ion-segment scrollable v-model="segment" slot="end" @ion-change="resetParentGroupPage()">
<ion-segment v-model="segment" slot="end" @ion-change="resetParentGroupPage()">
<ion-segment-button value="facility-groups" >
<ion-label>{{ translate("Facility groups") }}</ion-label>
</ion-segment-button>
Expand All @@ -14,7 +14,7 @@
</ion-toolbar>
</ion-header>

<ion-content ref="contentRef" :scroll-events="true" @ionScroll="enableScrolling()" id="filter-content">
<ion-content>
<template v-if="segment === 'facility-groups'">
<div class="find">
<section class="search">
Expand Down Expand Up @@ -77,7 +77,7 @@
<h3>{{ getFacilityGroupTypeDescription(currentFacilityGroupTypeId) }}</h3>
<ion-list v-if="groups.length">
<ion-list-header>
<ion-label>{{ translate('Selected groups') }} : 10</ion-label>
<ion-label>{{ translate('Selected groups') }} : {{ getAssociatedFacilityGroupIds(currentFacilityGroupTypeId).length }}</ion-label>
</ion-list-header>
<ion-item v-for="group in groups" :key="group.facilityGroupId">
<ion-checkbox label-placement="end" justify="start" :disabled="!!group.facilityGroupTypeId && group.facilityGroupTypeId !== currentFacilityGroupTypeId" :checked="isFacilityGroupLinked(group.facilityGroupTypeId)" @click="updateFacilityGroup($event, group)">
Expand All @@ -95,17 +95,6 @@
</div>
</div>
</template>
<ion-infinite-scroll
@ionInfinite="loadMoreGroups($event)"
threshold="100px"
v-show="isScrollable"
ref="infiniteScrollRef"
>
<ion-infinite-scroll-content
loading-spinner="crescent"
:loading-text="translate('Loading')"
/>
</ion-infinite-scroll>

<ion-fab v-if="segment === 'facility-groups'" vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="createFacilityGroup()">
Expand All @@ -129,8 +118,6 @@ import {
IonFabButton,
IonHeader,
IonIcon,
IonInfiniteScroll,
IonInfiniteScrollContent,
IonItem,
IonLabel,
IonList,
Expand Down Expand Up @@ -172,8 +159,6 @@ export default defineComponent({
IonFabButton,
IonHeader,
IonIcon,
IonInfiniteScroll,
IonInfiniteScrollContent,
IonItem,
IonLabel,
IonList,
Expand All @@ -189,7 +174,6 @@ export default defineComponent({
data() {
return {
segment: "facility-groups",
isScrollingEnabled: false,
currentFacilityGroupTypeId: "",
isParentGroupDetailAnimationCompleted: false,
facilityGroupProductStore: {} as any
Expand All @@ -207,8 +191,8 @@ export default defineComponent({
await this.store.dispatch('util/fetchFacilityGroupTypes')
},
async ionViewWillEnter() {
this.segment = "facility-groups"
await this.fetchGroups();
this.isScrollingEnabled = false;
},
methods: {
resetParentGroupPage() {
Expand Down Expand Up @@ -260,39 +244,18 @@ export default defineComponent({
await this.store.dispatch('facility/updateGroupQuery', this.query)
this.fetchGroups();
},
async fetchGroups(vSize?: any, vIndex?: any) {
const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE;
const viewIndex = vIndex ? vIndex : 0;
const payload = {
viewSize,
viewIndex
};
await this.store.dispatch('facility/fetchFacilityGroups', payload)
},
enableScrolling() {
const parentElement = (this as any).$refs.contentRef.$el
const scrollEl = parentElement.shadowRoot.querySelector("main[part='scroll']")
let scrollHeight = scrollEl.scrollHeight, infiniteHeight = (this as any).$refs.infiniteScrollRef.$el.offsetHeight, scrollTop = scrollEl.scrollTop, threshold = 100, height = scrollEl.offsetHeight
const distanceFromInfinite = scrollHeight - infiniteHeight - scrollTop - threshold - height
if(distanceFromInfinite < 0) {
this.isScrollingEnabled = false;
} else {
this.isScrollingEnabled = true;
}
},
async loadMoreGroups(event: any) {
// Added this check here as if added on infinite-scroll component the Loading content does not gets displayed
if(!(this.isScrollingEnabled && this.isScrollable)) {
await event.target.complete();
async fetchGroups() {
const viewSize = process.env.VUE_APP_VIEW_SIZE;
let viewIndex = 0;
do {
const payload = {
viewSize,
viewIndex
};
await this.store.dispatch('facility/fetchFacilityGroups', payload)
viewIndex++;
}
this.fetchGroups(
undefined,
Math.ceil(
this.groups?.length / (process.env.VUE_APP_VIEW_SIZE as any)
).toString()
).then(async () => {
await event.target.complete();
});
while (this.isScrollable);
},
getAssociatedFacilityGroupIds(facilityGroupTypeId: any) {
const associatedfacilityGroupIds = [] as any
Expand Down
6 changes: 5 additions & 1 deletion src/views/ManageFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
</ion-reorder-group>
</ion-list>
</main>
<main v-else>
<p class="empty-state"> {{ translate('No facilities selected.') }}</p>
</main>
</div>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
Expand Down Expand Up @@ -133,8 +136,9 @@
}
},
props: ['facilityGroupId'],
async mounted() {
async ionViewWillEnter() {
emitter.emit('presentLoader')
this.isSavingDetail = false
await Promise.all([this.fetchFacilities(), this.fetchFacilityGroup()])
await this.fetchMemberFacilities();
await this.getFilteredFacilities();
Expand Down
2 changes: 1 addition & 1 deletion src/views/Parking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default defineComponent({
isScrollable: "facility/isVirtualFacilitiesScrollable",
})
},
async mounted() {
async ionViewWillEnter() {
await this.fetchArchivedFacilities();
await this.fetchFacilities();
},
Expand Down
Loading