From 483e34cea967b89b6100d01c8c12a81e55a7c9a8 Mon Sep 17 00:00:00 2001 From: k2maan Date: Wed, 29 Nov 2023 19:23:36 +0530 Subject: [PATCH 1/4] Improved: create flow by adding location creation logic --- src/views/CreateFacility.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/views/CreateFacility.vue b/src/views/CreateFacility.vue index a107527c..797d69ae 100644 --- a/src/views/CreateFacility.vue +++ b/src/views/CreateFacility.vue @@ -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: "04", + }) }, getFacilityTypesByParentTypeId(parentTypeId: string) { return parentTypeId ? Object.keys(this.facilityTypes).reduce((facilityTypesByParentTypeId: any, facilityTypeId: string) => { From 563f090b1e96b0b6acace9929a45c0bed4faaf1a Mon Sep 17 00:00:00 2001 From: k2maan Date: Wed, 29 Nov 2023 19:24:16 +0530 Subject: [PATCH 2/4] Improved: update sell online setting on find page via chip click --- src/views/FindFacilities.vue | 56 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/views/FindFacilities.vue b/src/views/FindFacilities.vue index 4705b445..7bc47d27 100644 --- a/src/views/FindFacilities.vue +++ b/src/views/FindFacilities.vue @@ -55,7 +55,7 @@
- + {{ translate('Sell Online') }} @@ -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', @@ -260,7 +261,58 @@ 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) { + if (!facility.sellOnline) { + this.addFacilityToGroup(facility.facilityId) + } else { + this.updateFacilityToGroup(facility) + } + }, + async addFacilityToGroup(facilityId: string) { + let resp; + try { + resp = await FacilityService.addFacilityToGroup({ + facilityId, + "facilityGroupId": 'FAC_GRP' + }) + + if (!hasError(resp)) { + showToast(translate('Fulfillment setting updated successfully')) + await this.fetchFacilities(); + } else { + throw resp.data + } + } catch (err) { + showToast(translate('Failed to update fulfillment setting')) + logger.error('Failed to update fulfillment setting', err) + } + }, + async updateFacilityToGroup(facility: any) { + let resp; + const groupInformation = facility.groupInformation.find((group: any) => group.facilityGroupId === 'FAC_GRP') + + try { + resp = await FacilityService.updateFacilityToGroup({ + "facilityId": facility.facilityId, + "facilityGroupId": 'FAC_GRP', + "fromDate": groupInformation.fromDate, + "thruDate": DateTime.now().toMillis() + }) + + console.log('resp', resp) + + if (!hasError(resp)) { + showToast(translate('Fulfillment setting updated successfully')) + await this.fetchFacilities(); + } else { + throw resp.data + } + } catch (err) { + showToast(translate('Failed to update fulfillment setting')) + logger.error('Failed to update fulfillment setting', err) + } + }, }, setup() { const router = useRouter(); From cc69b60c12124b1293c3eaaf2e98969b3f6cc1a1 Mon Sep 17 00:00:00 2001 From: k2maan Date: Thu, 30 Nov 2023 10:53:02 +0530 Subject: [PATCH 3/4] Improved: handling for updating sell online config --- src/views/CreateFacility.vue | 2 +- src/views/FindFacilities.vue | 52 +++++++++++------------------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/src/views/CreateFacility.vue b/src/views/CreateFacility.vue index 797d69ae..0879ae5e 100644 --- a/src/views/CreateFacility.vue +++ b/src/views/CreateFacility.vue @@ -183,7 +183,7 @@ export default defineComponent({ aisleId: "TL", sectionId: "TL", levelId: "LL", - positionId: "04", + positionId: "01", }) }, getFacilityTypesByParentTypeId(parentTypeId: string) { diff --git a/src/views/FindFacilities.vue b/src/views/FindFacilities.vue index 7bc47d27..d8caf059 100644 --- a/src/views/FindFacilities.vue +++ b/src/views/FindFacilities.vue @@ -263,44 +263,22 @@ export default defineComponent({ } }, async updateSellOnlineStatus(facility: any) { - if (!facility.sellOnline) { - this.addFacilityToGroup(facility.facilityId) - } else { - this.updateFacilityToGroup(facility) - } - }, - async addFacilityToGroup(facilityId: string) { - let resp; try { - resp = await FacilityService.addFacilityToGroup({ - facilityId, - "facilityGroupId": 'FAC_GRP' - }) - - if (!hasError(resp)) { - showToast(translate('Fulfillment setting updated successfully')) - await this.fetchFacilities(); + let resp + if (!facility.sellOnline) { + resp = await FacilityService.addFacilityToGroup({ + "facilityId": facility.facilityId, + "facilityGroupId": 'FAC_GRP' + }) } else { - throw resp.data + 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() + }) } - } catch (err) { - showToast(translate('Failed to update fulfillment setting')) - logger.error('Failed to update fulfillment setting', err) - } - }, - async updateFacilityToGroup(facility: any) { - let resp; - const groupInformation = facility.groupInformation.find((group: any) => group.facilityGroupId === 'FAC_GRP') - - try { - resp = await FacilityService.updateFacilityToGroup({ - "facilityId": facility.facilityId, - "facilityGroupId": 'FAC_GRP', - "fromDate": groupInformation.fromDate, - "thruDate": DateTime.now().toMillis() - }) - - console.log('resp', resp) if (!hasError(resp)) { showToast(translate('Fulfillment setting updated successfully')) @@ -308,9 +286,9 @@ export default defineComponent({ } else { throw resp.data } - } catch (err) { + } catch (error) { showToast(translate('Failed to update fulfillment setting')) - logger.error('Failed to update fulfillment setting', err) + logger.error('Failed to update fulfillment setting', error) } }, }, From e37b58a89a50de5611b91e5c3faaf2314c47aaa6 Mon Sep 17 00:00:00 2001 From: k2maan Date: Thu, 30 Nov 2023 11:01:34 +0530 Subject: [PATCH 4/4] Improved: added conditional rendering for shopify mapping domain --- src/views/FacilityDetails.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 3326eeab..f6dcff37 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -277,13 +277,13 @@ {{ shopifyFacilityMapping.shopifyLocationId }} - + {{ shopifyFacilityMapping.myshopifyDomain + '/admin' }} - + {{ shopifyFacilityMapping.myshopifyDomain }}