Skip to content

Commit

Permalink
Merge pull request #36 from k2maan/improvements
Browse files Browse the repository at this point in the history
Improved: facility creation by creating default location and updating sell online setting on find page
  • Loading branch information
ravilodhi authored Nov 30, 2023
2 parents 209bb0f + e37b58a commit 19a2cc7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/views/CreateFacility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ export default defineComponent({
logger.error(error)
showToast(translate('Failed to create facility.'))
}
// creating default facility location
await FacilityService.createFacilityLocation({
facilityId: this.formData.facilityId,
locationTypeEnumId: "FLT_PICKLOC",
areaId: "TL",
aisleId: "TL",
sectionId: "TL",
levelId: "LL",
positionId: "01",
})
},
getFacilityTypesByParentTypeId(parentTypeId: string) {
return parentTypeId ? Object.keys(this.facilityTypes).reduce((facilityTypesByParentTypeId: any, facilityTypeId: string) => {
Expand Down
4 changes: 2 additions & 2 deletions src/views/FacilityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@
<ion-item lines="full">
<ion-label>{{ shopifyFacilityMapping.shopifyLocationId }}</ion-label>
</ion-item>
<ion-item lines="full">
<ion-item v-if="shopifyFacilityMapping.myshopifyDomain" lines="full">
<ion-label>{{ shopifyFacilityMapping.myshopifyDomain + '/admin' }}</ion-label>
<ion-button color="medium" fill="clear" @click="goToLink(`${shopifyFacilityMapping.myshopifyDomain + '/admin'}`)">
<ion-icon :icon="openOutline" />
</ion-button>
</ion-item>
<ion-item lines="full">
<ion-item v-if="shopifyFacilityMapping.myshopifyDomain" lines="full">
<ion-label>{{ shopifyFacilityMapping.myshopifyDomain }}</ion-label>
<ion-button color="medium" fill="clear" @click="goToLink(shopifyFacilityMapping.myshopifyDomain)">
<ion-icon :icon="openOutline" />
Expand Down
34 changes: 32 additions & 2 deletions src/views/FindFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</ion-item>
<div class="tablet">
<ion-chip outline>
<ion-chip outline @click.stop="updateSellOnlineStatus(facility)">
<ion-label>{{ translate('Sell Online') }}</ion-label>
<ion-icon :icon="shareOutline" :color="facility.sellOnline ? 'primary' : ''"/>
</ion-chip>
Expand Down Expand Up @@ -157,6 +157,7 @@ import { FacilityService } from '@/services/FacilityService'
import { showToast } from '@/utils';
import logger from '@/logger';
import Filters from '@/components/Filters.vue'
import { DateTime } from 'luxon';
export default defineComponent({
name: 'FindFacilities',
Expand Down Expand Up @@ -260,7 +261,36 @@ export default defineComponent({
showToast(translate('Failed to update fulfillment capacity for ', { facilityName: facility.facilityName }))
logger.error('Failed to update facility', err)
}
}
},
async updateSellOnlineStatus(facility: any) {
try {
let resp
if (!facility.sellOnline) {
resp = await FacilityService.addFacilityToGroup({
"facilityId": facility.facilityId,
"facilityGroupId": 'FAC_GRP'
})
} else {
const groupInformation = facility.groupInformation.find((group: any) => group.facilityGroupId === 'FAC_GRP')
resp = await FacilityService.updateFacilityToGroup({
"facilityId": facility.facilityId,
"facilityGroupId": 'FAC_GRP',
"fromDate": groupInformation.fromDate,
"thruDate": DateTime.now().toMillis()
})
}
if (!hasError(resp)) {
showToast(translate('Fulfillment setting updated successfully'))
await this.fetchFacilities();
} else {
throw resp.data
}
} catch (error) {
showToast(translate('Failed to update fulfillment setting'))
logger.error('Failed to update fulfillment setting', error)
}
},
},
setup() {
const router = useRouter();
Expand Down

0 comments on commit 19a2cc7

Please sign in to comment.