Skip to content
Draft
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
6 changes: 3 additions & 3 deletions src/components/FacilityAddressModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default defineComponent({
}

try {
if(this.contactDetails.telecomNumber?.contactMechId) {
if(this.contactDetails?.telecomNumber?.contactMechId) {
resp = await FacilityService.updateFacilityTelecomNumber({
...payload,
contactMechId: this.contactDetails.telecomNumber.contactMechId,
Expand All @@ -249,7 +249,7 @@ export default defineComponent({
}

try {
if(this.contactDetails.emailAddress?.contactMechId) {
if(this.contactDetails?.emailAddress?.contactMechId) {
resp = await FacilityService.updateFacilityEmailAddress({
...payload,
contactMechId: this.emailAddress.contactMechId,
Expand Down Expand Up @@ -308,4 +308,4 @@ export default defineComponent({
ion-content {
--padding-bottom: 80px;
}
</style>
</style>
6 changes: 3 additions & 3 deletions src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ const actions: ActionTree<UtilState, RootState> = {

const params = {
inputFields: {
geoIdTo: "DBIC"
geoTypeId: "COUNTRY"
},
entityName: 'GeoAssocAndGeoFrom',
entityName: 'Geo',
fieldList: ['geoName', 'geoId', 'geoCode'],
noConditionFind: 'Y',
viewSize: 250
Expand Down Expand Up @@ -398,4 +398,4 @@ const actions: ActionTree<UtilState, RootState> = {
},
}

export default actions;
export default actions;
4 changes: 2 additions & 2 deletions src/views/AddFacilityConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export default defineComponent({
}

showToast(translate("Facility configurations created successfully."))
this.$router.replace({ path: `/facility-details/${this.facilityId}` })
this.router.replace({ path: `/facility-details/${this.facilityId}` })
} catch (error: any) {
showToast(error.message)
logger.error(error.message)
Expand Down Expand Up @@ -436,4 +436,4 @@ ion-card-header {
margin: auto;
}
}
</style>
</style>
41 changes: 34 additions & 7 deletions src/views/CreateFacility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,18 @@ import {
IonText,
IonTitle,
IonToolbar,
modalController,
} from "@ionic/vue";
import { defineComponent } from "vue";
import { mapGetters, useStore } from "vuex";
import { useRouter } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import { addOutline } from 'ionicons/icons';
import { translate } from "@hotwax/dxp-components";
import { generateInternalId, showToast } from "@/utils";
import { FacilityService } from "@/services/FacilityService";
import { hasError } from "@/adapter";
import logger from "@/logger";
import FacilityAddressModal from '@/components/FacilityAddressModal.vue';

export default defineComponent({
name: "CreateFacility",
Expand Down Expand Up @@ -125,7 +127,7 @@ export default defineComponent({
facilityTypeId_op: 'notEqual'
})
])
this.facilityTypesByParentTypeId = this.getFacilityTypesByParentTypeId(this.$route.query.type as string)
this.facilityTypesByParentTypeId = this.getFacilityTypesByParentTypeId(this.route.query.type as string)

// In accordance with the specified requirements, it is essential to treat RETAIL STORE and WAREHOUSE
// as default elements within the list. These elements may appear at any index within the list structure.
Expand Down Expand Up @@ -174,8 +176,18 @@ export default defineComponent({
if (!hasError(resp)) {
const { facilityId } = resp.data
showToast(translate("Facility created successfully."))
this.store.dispatch('facility/updateCurrentFacility', payload),
this.router.replace(`/add-facility-address/${facilityId}`)
await this.store.dispatch('facility/updateCurrentFacility', payload)
try {
await this.createDefaultFacilityLocation(facilityId)
} catch (err) {
logger.error('Failed to create default facility location', err)
}
try {
await this.openAddressModal(facilityId, payload.facilityName)
} catch (err) {
logger.error('Failed to open address modal', err)
}
this.router.replace(`/add-facility-config/${facilityId}`)
Comment thread
dt2patel marked this conversation as resolved.
} else {
throw resp.data;
}
Expand All @@ -189,9 +201,10 @@ export default defineComponent({
return;
}

// creating default facility location
},
async createDefaultFacilityLocation(facilityId: string) {
await FacilityService.createFacilityLocation({
facilityId: this.formData.facilityId,
facilityId,
locationTypeEnumId: "FLT_PICKLOC",
areaId: "TL",
aisleId: "TL",
Expand All @@ -200,6 +213,18 @@ export default defineComponent({
positionId: "01",
})
},
async openAddressModal(facilityId: string, facilityName: string) {
const addressModal = await modalController.create({
component: FacilityAddressModal,
componentProps: {
facilityId,
facilityName
}
})

addressModal.present()
await addressModal.onDidDismiss()
},
getFacilityTypesByParentTypeId(parentTypeId: string) {
return parentTypeId ? Object.keys(this.facilityTypes).reduce((facilityTypesByParentTypeId: any, facilityTypeId: string) => {
if (this.facilityTypes[facilityTypeId].parentTypeId === parentTypeId) {
Expand All @@ -226,10 +251,12 @@ export default defineComponent({
},
setup() {
const store = useStore();
const route = useRoute();
const router = useRouter();

return {
addOutline,
route,
store,
router,
translate
Expand All @@ -245,4 +272,4 @@ export default defineComponent({
margin: auto;
}
}
</style>
</style>
Loading