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: used warehouse type icon for warehouse facilities on find page, replaced div tags with template tags in case of v-ifs and increased view size to 20 #41

Merged
merged 5 commits into from
Nov 30, 2023
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VUE_APP_I18N_LOCALE=en-US
VUE_APP_I18N_FALLBACK_LOCALE=en-US
VUE_APP_CACHE_MAX_AGE=3600
VUE_APP_VIEW_SIZE=10
VUE_APP_VIEW_SIZE=20
VUE_APP_BASE_URL=
VUE_APP_PERMISSION_ID=
VUE_APP_LOCALES={"en-US": "English"}
Expand Down
28 changes: 14 additions & 14 deletions src/components/AddStaffMemberModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
</ion-chip>
</ion-row>

<ion-list>
<div class="ion-padding" v-if="!parties.length">
{{ translate("No party found") }}
</div>
<ion-list v-else>
<ion-list-header>{{ translate("Staff") }}</ion-list-header>
<div class="ion-padding" v-if="!parties.length">{{ translate("No party found") }}</div>
<div v-else>
<ion-item v-for="(party, index) in parties" :key="index">
<ion-label>
{{ party.fullName }}
<p>{{ party.partyId }}</p>
</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" :value="getPartyRoleTypeId(party.partyId)" @ion-change="updateSelectedParties($event, party.partyId)" required>
<ion-select-option v-for="(description, roleTypeId) in partyRoles" :key='roleTypeId' :value="roleTypeId">{{ description }}</ion-select-option>
</ion-select>
</ion-item>
</div>
<ion-item v-for="(party, index) in parties" :key="index">
<ion-label>
{{ party.fullName }}
<p>{{ party.partyId }}</p>
</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" :value="getPartyRoleTypeId(party.partyId)" @ion-change="updateSelectedParties($event, party.partyId)" required>
<ion-select-option v-for="(description, roleTypeId) in partyRoles" :key='roleTypeId' :value="roleTypeId">{{ description }}</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
</ion-content>

Expand Down Expand Up @@ -100,7 +100,7 @@ export default defineComponent({
props: ['facilityId', 'selectedParties'],
data() {
return {
parties: [],
parties: [] as any,
queryString: '',
selectedPartyValues: JSON.parse(JSON.stringify(this.selectedParties))
}
Expand Down
4 changes: 3 additions & 1 deletion src/store/modules/facility/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const actions: ActionTree<FacilityState, RootState> = {
},

async fetchFacilityLocations({ commit }, payload) {
let facilityLocations = []
try {
const params = {
inputFields: {
Expand All @@ -277,13 +278,14 @@ const actions: ActionTree<FacilityState, RootState> = {
const resp = await FacilityService.fetchFacilityLocations(params)

if(!hasError(resp) && resp.data.count > 0) {
commit(types.FACILITY_LOCATIONS_UPDATED, resp.data.docs)
facilityLocations = resp.data.docs
} else {
throw resp.data
}
} catch(err) {
logger.error('Failed to find the facility locations', err)
}
commit(types.FACILITY_LOCATIONS_UPDATED, facilityLocations)
},

async fetchFacilityCalendar({commit}, payload) {
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/facility/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const SN_FACILITY = 'facility'
export const FACILITY_LIST_UPDATED = SN_FACILITY + '/LIST_UPDATED'
export const FACILITY_QUERY_UPDATED = SN_FACILITY + '/QUERY_UPDATED'
export const FACILITY_CURRENT_UPDATED = SN_FACILITY + '/CURRENT_UPDATED'
export const FACILITY_CURRENT_LOCATION_UPDATED = SN_FACILITY + '/CURRENT_LOCATION_UPDATED'
export const FACILITY_LOCATIONS_UPDATED = SN_FACILITY + '/LOCATIONS_UPDATED'
export const FACILITY_POSTAL_ADDRESS_UPDATED = SN_FACILITY + '/POSTAL_ADDRESS_UPDATED'
export const FACILITY_MAPPINGS_UPDATED = SN_FACILITY + '/MAPPINGS_UPDATED'
Expand Down
3 changes: 0 additions & 3 deletions src/store/modules/facility/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ const mutations: MutationTree <FacilityState> = {
[types.FACILITY_CURRENT_UPDATED](state, payload) {
state.current = payload
},
[types.FACILITY_CURRENT_LOCATION_UPDATED](state, payload) {
state.current.locations = payload
},
[types.FACILITY_POSTAL_ADDRESS_UPDATED](state, payload) {
state.current.postalAddress = payload
},
Expand Down
4 changes: 2 additions & 2 deletions src/views/AddFacilityConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ translate("Add") }}
</ion-button>
</ion-card-header>
<div v-if="selectedProductStores.length">
<template v-if="selectedProductStores.length">
<ion-list>
<ion-item v-for="store in selectedProductStores" :key="store.productStoreId">
<ion-label>
Expand Down Expand Up @@ -49,7 +49,7 @@
</ion-popover>
</ion-item>
</ion-list>
</div>
</template>
<div v-else class="empty-state">
<p>{{ translate("No product stores added.") }}</p>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/views/FacilityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{ translate("Address") }}
</ion-card-title>
</ion-card-header>
<div v-if="postalAddress?.address1">
<template v-if="postalAddress?.address1">
<ion-item lines="full">
<ion-label>
<h3>{{ postalAddress.address1 }}</h3>
Expand All @@ -33,7 +33,7 @@
</ion-label>
</ion-item>
<ion-button fill="clear" @click="openAddressModal">{{ translate("Edit") }}</ion-button>
</div>
</template>
<ion-button v-else expand="block" fill="outline" @click="openAddressModal">
{{ translate("Add") }}
<ion-icon slot="end" :icon="addCircleOutline" />
Expand All @@ -46,7 +46,7 @@
{{ translate("Latitude & Longitude") }}
</ion-card-title>
</ion-card-header>
<div v-if="postalAddress?.latitude">
<template v-if="postalAddress?.latitude">
<ion-card-content>
{{ translate("These values are used to help customers lookup how close they are to your stores when they are finding nearby stores.") }}
</ion-card-content>
Expand All @@ -59,7 +59,7 @@
<p>{{ postalAddress.longitude }}</p>
</ion-item>
<ion-button fill="clear" :disabled="!postalAddress.address1" @click="openGeoPointModal">{{ translate("Edit") }}</ion-button>
</div>
</template>
<ion-button v-else expand="block" fill="outline" :disabled="!postalAddress.address1" @click="openGeoPointModal">
{{ translate("Add") }}
<ion-icon slot="end" :icon="addCircleOutline" />
Expand Down Expand Up @@ -784,7 +784,7 @@
},
async revokePrimaryStatusFromStore() {
try {
const resp = await FacilityService.updateFacilityToGroup({

Check warning on line 787 in src/views/FacilityDetails.vue

View workflow job for this annotation

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

'resp' is assigned a value but never used
"facilityId": this.facilityId,
"facilityGroupId": this.primaryMember.facilityGroupId,
"fromDate": this.primaryMember.fromDate,
Expand Down
20 changes: 10 additions & 10 deletions src/views/FindFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<main v-if="facilities?.length">
<div class="list-item" v-for="(facility, index) in facilities" :key="index" @click="viewFacilityDetails(facility.facilityId)">
<ion-item lines="none">
<ion-icon slot="start" :icon="storefrontOutline" />
<ion-icon slot="start" :icon="facilityTypes[facility.facilityTypeId].parentTypeId === 'DISTRIBUTION_CENTER' ? businessOutline : storefrontOutline" />
<ion-label>
<p class="overline">{{ facility.facilityTypeId ? facilityTypes[facility.facilityTypeId] ? facilityTypes[facility.facilityTypeId].description : facilityTypes.facilityTypeId : '' }}</p>
{{ facility.facilityName }}
Expand Down Expand Up @@ -252,12 +252,12 @@ export default defineComponent({

if (!hasError(resp)) {
// updating the facilities state instead of refetching
const updatedFacilities = JSON.parse(JSON.stringify(this.facilities)).map((fac: any) => {
if (facility.facilityId === fac.facilityId) {
fac.maximumOrderLimit = maximumOrderLimit === "" ? null : maximumOrderLimit
fac.orderLimitType = fac.maximumOrderLimit === null ? 'unlimited' : (fac.maximumOrderLimit === 0 ? 'no-capacity' : 'custom')
const updatedFacilities = JSON.parse(JSON.stringify(this.facilities)).map((facilityData: any) => {
if (facility.facilityId === facilityData.facilityId) {
facilityData.maximumOrderLimit = maximumOrderLimit === "" ? null : maximumOrderLimit
facilityData.orderLimitType = facilityData.maximumOrderLimit === null ? 'unlimited' : (facilityData.maximumOrderLimit === 0 ? 'no-capacity' : 'custom')
}
return fac
return facilityData
})
this.store.dispatch('facility/updateFacilities', updatedFacilities)
showToast(translate('Fulfillment capacity updated successfully for ', { facilityName: facility.facilityName }))
Expand Down Expand Up @@ -289,11 +289,11 @@ export default defineComponent({

if (!hasError(resp)) {
// updating the facilities state instead of refetching
const updatedFacilities = JSON.parse(JSON.stringify(this.facilities)).map((fac: any) => {
if (facility.facilityId === fac.facilityId) {
fac.sellOnline = !facility.sellOnline
const updatedFacilities = JSON.parse(JSON.stringify(this.facilities)).map((facilityData: any) => {
if (facility.facilityId === facilityData.facilityId) {
facilityData.sellOnline = !facility.sellOnline
}
return fac
return facilityData
})
this.store.dispatch('facility/updateFacilities', updatedFacilities)
showToast(translate('Fulfillment setting updated successfully'))
Expand Down
Loading