Skip to content

Commit

Permalink
Issue resolved "Handle the 0 Input in the Pressure sore and Pain Scal…
Browse files Browse the repository at this point in the history
…e component" (#7391)

* weight and height input columns length are now consistent

* Pain 0 and PressureSore 0 error solved

* Update src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res

Co-authored-by: Rithvik Nishad <rithvikn2001@gmail.com>

---------

Co-authored-by: Rithvik Nishad <rithvikn2001@gmail.com>
  • Loading branch information
r-nikhilkumar and rithviknishad committed Mar 19, 2024
1 parent d866948 commit f00cd02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Expand Up @@ -138,8 +138,12 @@ let make = (
? <button
type_="button"
onClick={e => {
updatePart(state)
hideModal(e)
if (painScale == 0.0) {
hideModal(e)
} else {
updatePart(state)
hideModal(e)
}
}}
className="inline-flex w-full justify-center rounded-md border border-transparent bg-primary-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm">
{str("Apply")}
Expand Down
Expand Up @@ -38,13 +38,17 @@ let make = (
}, [state])

let handleSubmit = e => {
updatePart(state)
hideModal(e)
let region = PressureSore.regionToString(state.region)
if (state.length > 0.0 && state.width == 0.0) || (state.length == 0.0 && state.width > 0.0) {
if(state.length === 0.0 && state.width === 0.0){
hideModal(e)
}
else if (state.length > 0.0 && state.width == 0.0) || (state.length == 0.0 && state.width > 0.0) {
hideModal(e)
Notifications.error({msg: `Please fill in both width and length for ${region} part`})
setState(prev => {...prev, length: 0.0, width: 0.0})
} else {
updatePart(state)
hideModal(e)
Notifications.success({msg: `${region} part updated`})
}
}
Expand Down Expand Up @@ -98,7 +102,7 @@ let make = (
{str(PressureSore.regionToString(state.region))}
</span>
</div>
<div className="flex flex-col sm:flex-row justify-center mt-2">
<div className="flex flex-col sm:flex-row justify-center mt-2 grid grid-cols-2 gap-2">
<div className="w-full">
<label className="block font-medium text-black text-left"> {str("Width")} </label>
<input
Expand Down

0 comments on commit f00cd02

Please sign in to comment.