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: facility creation by creating default location and updating sell online setting on find page #36

Merged
merged 4 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
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 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
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
Loading