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

robustify UserCreateForm #9852

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 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
8 changes: 8 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@
"date_of_admission": "Date of Admission",
"date_of_birth": "Date of Birth",
"date_of_birth_age": "Date of Birth/Age",
"date_of_birth_cannot_be_in_future": "Date of birth cannot be in the future",
"date_of_birth_or_age": "Date of Birth or Age",
"date_of_positive_covid_19_swab": "Date of Positive Covid 19 Swab",
"date_of_result": "Covid confirmation date",
Expand Down Expand Up @@ -1457,6 +1458,7 @@
"phone_number": "Phone Number",
"phone_number_at_current_facility": "Phone Number of Contact person at current Facility",
"phone_number_min_error": "Phone number must be at least 10 characters long",
"phone_number_must_start": "Phone number must start with +91 followed by 10 digits",
"phone_number_not_found": "Phone number not found",
"phone_number_verified": "Phone Number Verified",
"pincode": "Pincode",
Expand Down Expand Up @@ -1803,6 +1805,7 @@
"thank_you_for_choosing": "Thank you for choosing our care service",
"the_request_for_resources_placed_by_yourself_is": "The request for resource (details below) placed by yourself is",
"third_party_software_licenses": "Third Party Software Licenses",
"this_field_is_required": "This field is required",
"time": "Time",
"time_slot": "Time Slot",
"title_of_request": "Title of Request",
Expand Down Expand Up @@ -1924,7 +1927,12 @@
"username": "Username",
"username_already_exists": "This username already exists",
"username_available": "Username is available",
"username_consecutive_special_characters": "Username can't contain consecutive special characters",
"username_contain_lowercase_special": "Username can only contain lowercase letters, numbers, and . _ -",
"username_less_than": "Username must be less than 16 characters",
"username_more_than": "Username must be at least 4 characters",
"username_not_available": "Username is not available",
"username_start_end_letter_number": "Username must start and end with a letter or number",
"username_userdetails_not_found": "Unable to fetch details as username or user details not found",
"users": "Users",
"vacant": "Vacant",
Expand Down
6 changes: 5 additions & 1 deletion src/components/Facility/FacilityCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,11 @@ export const FacilityCreate = (props: FacilityProps) => {
>
{t("cancel")}
</Button>
<Button variant="primary" type="submit" disabled={isLoading}>
<Button
variant="primary"
type="submit"
disabled={isLoading || !form.formState.isDirty}
>
rajku-dev marked this conversation as resolved.
Show resolved Hide resolved
{isLoading ? (
<Loading />
) : facilityId ? (
Expand Down
14 changes: 7 additions & 7 deletions src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ export default function PatientRegistration(
</div>
))}
</div>

<br />
<Tabs
value={ageDob}
Expand Down Expand Up @@ -560,15 +559,16 @@ export default function PatientRegistration(
</Label>
<Input
value={form.age ? form.age : undefined}
onChange={(e) =>
onChange={(e) => {
const age = Math.max(0, Number(e.target.value));
setForm((f) => ({
...f,
age: e.target.value,
year_of_birth: e.target.value
? new Date().getFullYear() - Number(e.target.value)
age: String(age),
year_of_birth: age
? new Date().getFullYear() - age
: undefined,
}))
}
}));
}}
rajku-dev marked this conversation as resolved.
Show resolved Hide resolved
type="number"
/>
<div className="mt-1" data-input-error>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Schedule/ScheduleExceptionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ export default function ScheduleExceptionForm({ user, onRefresh }: Props) {
Cancel
</Button>
</SheetClose>
<Button variant="primary" type="submit" disabled={isPending}>
<Button
variant="primary"
type="submit"
disabled={isPending || !form.formState.isDirty}
>
Confirm Unavailability
</Button>
</SheetFooter>
Expand Down
Loading
Loading