diff --git a/src/components/CreateVirtualFacilityModal.vue b/src/components/CreateVirtualFacilityModal.vue index 155575c..de02d1b 100644 --- a/src/components/CreateVirtualFacilityModal.vue +++ b/src/components/CreateVirtualFacilityModal.vue @@ -91,11 +91,14 @@ export default defineComponent({ facilityId: '', description: '', }, + isAutoGenerateId: true } }, methods: { setFacilityId(event: any) { - this.formData.facilityId = generateInternalId(event.target.value) + if(this.isAutoGenerateId) { + this.formData.facilityId = generateInternalId(event.target.value) + } }, closeModal() { modalController.dismiss(); @@ -157,6 +160,7 @@ export default defineComponent({ this.formData.facilityId.length <= 20 ? (this as any).$refs.facilityId.$el.classList.add('ion-valid') : (this as any).$refs.facilityId.$el.classList.add('ion-invalid'); + this.isAutoGenerateId = false; }, markFacilityIdTouched() { (this as any).$refs.facilityId.$el.classList.add('ion-touched'); diff --git a/src/views/CreateFacility.vue b/src/views/CreateFacility.vue index 0f12eec..dbdb596 100644 --- a/src/views/CreateFacility.vue +++ b/src/views/CreateFacility.vue @@ -110,7 +110,8 @@ export default defineComponent({ externalId: '', }, selectedFacilityTypeId: '' as any, - facilityTypesByParentTypeId: {} as any + facilityTypesByParentTypeId: {} as any, + isAutoGenerateId: true, } }, async ionViewWillEnter() { @@ -138,9 +139,12 @@ export default defineComponent({ facilityId: '', externalId: '', } + this.isAutoGenerateId = true; }, setFacilityId(event: any) { - this.formData.facilityId = generateInternalId(event.target.value) + if(this.isAutoGenerateId) { + this.formData.facilityId = generateInternalId(event.target.value) + } }, async createFacility() { if (!this.formData.facilityName?.trim()) { @@ -214,6 +218,7 @@ export default defineComponent({ this.formData.facilityId.length <= 20 ? (this as any).$refs.facilityId.$el.classList.add('ion-valid') : (this as any).$refs.facilityId.$el.classList.add('ion-invalid'); + this.isAutoGenerateId = false; }, markFacilityIdTouched() { (this as any).$refs.facilityId.$el.classList.add('ion-touched'); diff --git a/src/views/CreateFacilityGroup.vue b/src/views/CreateFacilityGroup.vue index 1650db2..a336c67 100644 --- a/src/views/CreateFacilityGroup.vue +++ b/src/views/CreateFacilityGroup.vue @@ -130,7 +130,8 @@ export default defineComponent({ description: '', }, isFacilityGroupTypeDisabled: false, - selectedProductStoreIds: [] + selectedProductStoreIds: [], + isAutoGenerateId: true } }, props: ['selectedFacilityGroupTypeId'], @@ -147,7 +148,9 @@ export default defineComponent({ this.selectedProductStoreIds = selectedProductStoreIds }, setFacilityGroupId(event: any) { - this.formData.facilityGroupId = generateInternalId(event.target.value) + if(this.isAutoGenerateId) { + this.formData.facilityGroupId = generateInternalId(event.target.value) + } }, async createFacilityGroup() { if (!this.formData.facilityGroupName?.trim()) { @@ -236,6 +239,7 @@ export default defineComponent({ this.formData.facilityGroupId.length <= 20 ? (this as any).$refs.facilityGroupId.$el.classList.add('ion-valid') : (this as any).$refs.facilityGroupId.$el.classList.add('ion-invalid'); + this.isAutoGenerateId = false }, markFacilityGroupIdTouched() { (this as any).$refs.facilityGroupId.$el.classList.add('ion-touched');