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: Added a flag to prevent auto-population of the facility ID after it has been manually edited(#265) #326

Merged
merged 3 commits into from
Nov 21, 2024
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
6 changes: 5 additions & 1 deletion src/components/CreateVirtualFacilityModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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');
Expand Down
9 changes: 7 additions & 2 deletions src/views/CreateFacility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export default defineComponent({
externalId: '',
},
selectedFacilityTypeId: '' as any,
facilityTypesByParentTypeId: {} as any
facilityTypesByParentTypeId: {} as any,
isAutoGenerateId: true,
}
},
async ionViewWillEnter() {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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');
Expand Down
8 changes: 6 additions & 2 deletions src/views/CreateFacilityGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
description: '',
},
isFacilityGroupTypeDisabled: false,
selectedProductStoreIds: []
selectedProductStoreIds: [],
isAutoGenerateId: true
}
},
props: ['selectedFacilityGroupTypeId'],
Expand All @@ -147,7 +148,9 @@
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()) {
Expand Down Expand Up @@ -197,7 +200,7 @@
)
const hasFailedResponse = responses.some((response: any) => response.status === 'rejected')
if (hasFailedResponse) {
console.log("Error in associating group to some of the product stores")

Check warning on line 203 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

Unexpected console statement

Check warning on line 203 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

Unexpected console statement
}
} catch (error) {
logger.error(error)
Expand All @@ -212,13 +215,13 @@
buttons: [
{
text: translate("Skip"),
handler: async (data: any) => {

Check warning on line 218 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'data' is defined but never used

Check warning on line 218 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'data' is defined but never used
this.router.replace({ path: `/tabs/find-groups`})
}
},
{
text: translate("Add"),
handler: async (data: any) => {

Check warning on line 224 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'data' is defined but never used

Check warning on line 224 in src/views/CreateFacilityGroup.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'data' is defined but never used
this.router.replace({ path: `/manage-facilities/${facilityGroupId}`})
}
}
Expand All @@ -236,6 +239,7 @@
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');
Expand Down
Loading