diff --git a/src/views/CreateFacility.vue b/src/views/CreateFacility.vue index a107527c..0879ae5e 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: "01", + }) }, getFacilityTypesByParentTypeId(parentTypeId: string) { return parentTypeId ? Object.keys(this.facilityTypes).reduce((facilityTypesByParentTypeId: any, facilityTypeId: string) => { diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue index 225b8c7e..71d4a024 100644 --- a/src/views/FacilityDetails.vue +++ b/src/views/FacilityDetails.vue @@ -277,13 +277,13 @@ {{ shopifyFacilityMapping.shopifyLocationId }} - + {{ shopifyFacilityMapping.myshopifyDomain + '/admin' }} - + {{ shopifyFacilityMapping.myshopifyDomain }} diff --git a/src/views/FindFacilities.vue b/src/views/FindFacilities.vue index 4705b445..d8caf059 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,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();