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: UI for the select facilities option in the quick user setup page (#252) #258

Merged
merged 2 commits into from
Sep 17, 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
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"Login": "Login",
"Login details": "Login details",
"Logout": "Logout",
"Manage": "Manage",
"Name": "Name",
"Name is required.": "Name is required.",
"New password": "New password",
Expand Down
24 changes: 13 additions & 11 deletions src/views/UserQuickSetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,20 @@
<ion-list-header>
<ion-label>{{ translate('Select Facilities') }}</ion-label>
<ion-button fill="clear" @click="addFacilities()">
{{ translate("Add") }}
<ion-icon slot="end" :icon="addCircleOutline"></ion-icon>
{{ translate(selectedFacilities.length ? "Manage" : "Add") }}
<ion-icon slot="end" :icon="selectedFacilities.length ? settingsOutline : addCircleOutline"></ion-icon>
</ion-button>
</ion-list-header>
<ion-item v-for="facility in facilities" :key="facility.facilityId">
<ion-checkbox v-if="!isFacilityLogin()" :checked="true" @ionChange="toggleFacilitySelection(facility)">
<ion-item v-for="facility in selectedFacilities" :key="facility.facilityId">
<template v-if="!isFacilityLogin()">
<ion-label>
{{ facility.facilityName || facility.facilityId }}
<p>{{ facility.facilityId }}</p>
</ion-label>
</ion-checkbox>
<ion-button slot="end" fill="clear" color="danger" @click="toggleFacilitySelection(facility)">
<ion-icon :icon="closeOutline" slot="icon-only" />
</ion-button>
</template>
<ion-label v-else>
{{ facility.facilityName || facility.facilityId }}
<p>{{ facility.facilityId }}</p>
Expand Down Expand Up @@ -105,7 +108,6 @@
import {
IonBackButton,
IonButton,
IonCheckbox,
IonContent,
IonHeader,
IonIcon,
Expand All @@ -131,9 +133,11 @@ import {
addCircleOutline,
arrowForwardOutline,
caretDownOutline,
closeOutline,
documentTextOutline,
eyeOffOutline,
eyeOutline
eyeOutline,
settingsOutline
} from 'ionicons/icons';
import { copyToClipboard, showToast, isValidPassword, isValidEmail } from '@/utils'
import { translate } from "@hotwax/dxp-components";
Expand All @@ -147,7 +151,6 @@ export default defineComponent({
components: {
IonBackButton,
IonButton,
IonCheckbox,
IonContent,
IonHeader,
IonIcon,
Expand Down Expand Up @@ -176,7 +179,6 @@ export default defineComponent({
return {
userTemplateId: "FULFILLMENT",
selectedUserTemplate: {} as any,
facilities: [] as any,
selectedFacilities: [] as any,
selectedProductStores: [] as any,
showPassword: false,
Expand Down Expand Up @@ -279,7 +281,6 @@ export default defineComponent({
if (this.isFacilityLogin()) {
const addedFacilityIds = this.selectedUser.facilities.map((facility: any) => facility.facilityId);
const addedFacilities = this.allFacilities.filter((facility: any) => addedFacilityIds.includes(facility.facilityId));
this.facilities = addedFacilities;
this.selectedFacilities = addedFacilities;
}
await this.initializeFormData();
Expand Down Expand Up @@ -467,7 +468,6 @@ export default defineComponent({

selectFacilityModal.onDidDismiss().then((result) => {
if (result.data && result.data.value) {
this.facilities = result.data.value.selectedFacilities;
this.selectedFacilities = result.data.value.selectedFacilities;
}
})
Expand Down Expand Up @@ -505,9 +505,11 @@ export default defineComponent({
addCircleOutline,
arrowForwardOutline,
caretDownOutline,
closeOutline,
documentTextOutline,
eyeOffOutline,
eyeOutline,
settingsOutline,
translate
};
}
Expand Down
Loading