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

Issue resolved "Handle the 0 Input in the Pressure sore and Pain Scale component" #7391

Merged
merged 5 commits into from Mar 19, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(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