From 3ceb9be4c6580d4db915c6d7c17ac20a9996a6e2 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Thu, 26 Sep 2024 11:34:27 +0530 Subject: [PATCH 1/5] fix: add bed notification --- src/Components/Facility/AddBedForm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/AddBedForm.tsx b/src/Components/Facility/AddBedForm.tsx index 0a612fa776b..620f1acdf8d 100644 --- a/src/Components/Facility/AddBedForm.tsx +++ b/src/Components/Facility/AddBedForm.tsx @@ -127,7 +127,9 @@ export const AddBedForm = ({ facilityId, locationId, bedId }: Props) => { const { res } = await request(routes.createFacilityBed, { body: { ...data, facility: facilityId, location: locationId }, }); - res?.ok && onSuccess("Bed(s) created successfully"); + res?.ok && numberOfBeds>1 + ? onSuccess("Beds created successfully") + : onSuccess("Bed created successfully"); } }; From 28b27c09a78ec93118cd5b7665c5fb6b410505b9 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Thu, 26 Sep 2024 12:21:49 +0530 Subject: [PATCH 2/5] added text in en locale files --- src/Components/Facility/AddBedForm.tsx | 6 +++--- src/Locale/en/Bed.json | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Components/Facility/AddBedForm.tsx b/src/Components/Facility/AddBedForm.tsx index 620f1acdf8d..ca4ca9604a4 100644 --- a/src/Components/Facility/AddBedForm.tsx +++ b/src/Components/Facility/AddBedForm.tsx @@ -127,9 +127,9 @@ export const AddBedForm = ({ facilityId, locationId, bedId }: Props) => { const { res } = await request(routes.createFacilityBed, { body: { ...data, facility: facilityId, location: locationId }, }); - res?.ok && numberOfBeds>1 - ? onSuccess("Beds created successfully") - : onSuccess("Bed created successfully"); + res?.ok && (numberOfBeds>1 + ? onSuccess(t("multiple_bed_created_notification")) + : onSuccess(t("single_bed_created_notification"))) } }; diff --git a/src/Locale/en/Bed.json b/src/Locale/en/Bed.json index 269658be774..00858413a7c 100644 --- a/src/Locale/en/Bed.json +++ b/src/Locale/en/Bed.json @@ -9,5 +9,7 @@ "bed_type": "Bed Type", "make_multiple_beds_label": "Do you want to make multiple beds?", "number_of_beds": "Number of beds", - "number_of_beds_out_of_range_error": "Number of beds cannot be greater than 100" + "number_of_beds_out_of_range_error": "Number of beds cannot be greater than 100", + "single_bed_created_notification": "Bed created successfully", + "multiple_bed_created_notification": "Beds created successfully" } From cfe04392e13381266524f952dbe259b59c83b7ee Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Thu, 26 Sep 2024 12:24:35 +0530 Subject: [PATCH 3/5] format code --- src/Components/Facility/AddBedForm.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/AddBedForm.tsx b/src/Components/Facility/AddBedForm.tsx index ca4ca9604a4..7bca2d67cee 100644 --- a/src/Components/Facility/AddBedForm.tsx +++ b/src/Components/Facility/AddBedForm.tsx @@ -127,9 +127,10 @@ export const AddBedForm = ({ facilityId, locationId, bedId }: Props) => { const { res } = await request(routes.createFacilityBed, { body: { ...data, facility: facilityId, location: locationId }, }); - res?.ok && (numberOfBeds>1 - ? onSuccess(t("multiple_bed_created_notification")) - : onSuccess(t("single_bed_created_notification"))) + res?.ok && + (numberOfBeds > 1 + ? onSuccess(t("multiple_bed_created_notification")) + : onSuccess(t("single_bed_created_notification"))); } }; From 96affc901f38497d710bcf3a6a20b301dee68102 Mon Sep 17 00:00:00 2001 From: Aditya Jindal Date: Tue, 1 Oct 2024 22:35:13 +0530 Subject: [PATCH 4/5] Added count in bed notification --- src/Components/Facility/AddBedForm.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Components/Facility/AddBedForm.tsx b/src/Components/Facility/AddBedForm.tsx index 7bca2d67cee..047549bd652 100644 --- a/src/Components/Facility/AddBedForm.tsx +++ b/src/Components/Facility/AddBedForm.tsx @@ -128,9 +128,7 @@ export const AddBedForm = ({ facilityId, locationId, bedId }: Props) => { body: { ...data, facility: facilityId, location: locationId }, }); res?.ok && - (numberOfBeds > 1 - ? onSuccess(t("multiple_bed_created_notification")) - : onSuccess(t("single_bed_created_notification"))); + onSuccess(t("bed_created_notification", { count: numberOfBeds })); } }; From cce41a08797e9a61921b5d396786f5bdfd1972e4 Mon Sep 17 00:00:00 2001 From: Aditya Jindal Date: Tue, 1 Oct 2024 22:36:14 +0530 Subject: [PATCH 5/5] Update Bed.json --- src/Locale/en/Bed.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Locale/en/Bed.json b/src/Locale/en/Bed.json index 00858413a7c..327a4533353 100644 --- a/src/Locale/en/Bed.json +++ b/src/Locale/en/Bed.json @@ -10,6 +10,6 @@ "make_multiple_beds_label": "Do you want to make multiple beds?", "number_of_beds": "Number of beds", "number_of_beds_out_of_range_error": "Number of beds cannot be greater than 100", - "single_bed_created_notification": "Bed created successfully", - "multiple_bed_created_notification": "Beds created successfully" + "bed_created_notification_one": "{{count}} Bed created successfully", + "bed_created_notification_other": "{{count}} Beds created successfully" }