Skip to content

Commit

Permalink
Merge pull request #333 from NUS-Project-SaBai/nathan/use-all-child-a…
Browse files Browse the repository at this point in the history
…ges-for-children-vitals

Nathan/use all child ages for children vitals
  • Loading branch information
nathantew14 authored Dec 9, 2024
2 parents 454bf78 + f39325a commit 2b0a2d3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
13 changes: 10 additions & 3 deletions components/SideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { OFFLINE } from '@/utils/constants';
import VenueOptionsDropdown from '@/components/VenueOptionsDropdown';
import { VillageContext } from '@/context/VillageContext';
import axiosInstance from '@/pages/api/_axiosInstance';

const navigation = [
{
Expand Down Expand Up @@ -77,6 +78,12 @@ export default function SideMenu() {
}
};

const handleGoToNewestSite = async () => {
const response = await axiosInstance.get('https://dub.sh/sabai');
const responseUrl = response.request.responseUrl;
console.log(responseUrl);
};

useEffect(() => {
const updatedNavItems = navItems.map(item => ({
...item,
Expand Down Expand Up @@ -127,13 +134,13 @@ export default function SideMenu() {
</li>
<div className="flex" />
<li className="-mx-6 mt-auto">
<a
href={'https://dub.sh/sabai'}
<button
className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-gray-400 hover:bg-gray-800 w-full"
onClick={handleGoToNewestSite}
>
<ArrowPathIcon className="h-7 w-7" />
<span aria-hidden="true">Go to newest site</span>
</a>
</button>
<button
className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-gray-400 hover:bg-gray-800 w-full"
onClick={handleLogout}
Expand Down
23 changes: 11 additions & 12 deletions components/records/ChildrenVitalsFields.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { InputField, DropDown } from '@/components/TextComponents';
import { ALL_CHILD_AGES } from '@/utils/constants';

export function ChildrenVitalsFields({
handleOnChange,
Expand All @@ -11,8 +12,6 @@ export function ChildrenVitalsFields({
new Date(visit.date).getFullYear() -
new Date(patient.date_of_birth).getFullYear();

console.log(age);

const StatFields = [
{
component: 'dropdown',
Expand All @@ -21,7 +20,7 @@ export function ChildrenVitalsFields({
value: formDetails.gross_motor,
defaultValue: 'Please select...',
options: ['Please select...', 'Yes', 'No'],
age: [2, 3, 4, 5],
age: ALL_CHILD_AGES,
},
{
component: 'dropdown',
Expand All @@ -30,71 +29,71 @@ export function ChildrenVitalsFields({
value: formDetails.gross_motor,
defaultValue: 'Please select...',
options: ['Please select...', 'Yes', 'No'],
age: [6],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'red_reflex',
label: 'Red Reflex',
value: formDetails.red_reflex,
type: 'text',
age: [2, 3, 4, 5, 6],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'scoliosis',
label: 'Scoliosis',
value: formDetails.scoliosis,
type: 'text',
age: [13, 14, 15, 16],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'pallor',
label: 'Pallor',
value: formDetails.pallor,
type: 'text',
age: [2, 3, 4, 5, 7, 8, 11, 12],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'oral_cavity',
label: 'Oral Cavity',
value: formDetails.oral_cavity,
type: 'text',
age: [2, 3, 4, 5, 7, 8, 11, 12],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'heart',
label: 'Heart',
value: formDetails.heart,
type: 'text',
age: [2, 3, 4, 5, 7, 8, 11, 12],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'abdomen',
label: 'Abdomen',
value: formDetails.abdomen,
type: 'text',
age: [2, 3, 4, 5, 7, 8, 11, 12],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'lungs',
label: 'Lungs',
value: formDetails.lungs,
type: 'text',
age: [2, 3, 4, 5, 7, 8, 11, 12],
age: ALL_CHILD_AGES,
},
{
component: 'input',
name: 'hernial_orifices',
label: 'Hernial Orifices',
value: formDetails.hernial_orifices,
type: 'text',
age: [2, 3, 4, 5, 7, 8],
age: ALL_CHILD_AGES,
},
];

Expand Down
19 changes: 10 additions & 9 deletions components/records/VitalsTable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DisplayField } from '@/components/TextComponents';
import { ALL_CHILD_AGES } from '@/utils/constants';

export function VitalsTable({ vitals, patient, visit }) {
const isBloodPressureHigh = vitals.systolic > 140 || vitals.diastolic > 90;
Expand Down Expand Up @@ -53,47 +54,47 @@ export function VitalsTable({ vitals, patient, visit }) {
{
label: 'Gross Motor',
value: vitals.gross_motor,
ageToTest: [2, 3, 4, 5, 6],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Red Reflex',
value: vitals.red_reflex,
ageToTest: [2, 3, 4, 5, 6],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Scoliosis',
value: vitals.scoliosis,
ageToTest: [13, 14, 15, 16],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Pallor',
value: vitals.pallor,
ageToTest: [2, 3, 4, 5, 7, 8, 11, 12],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Oral Cavity',
value: vitals.oral_cavity,
ageToTest: [2, 3, 4, 5, 7, 8, 11, 12],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Heart',
value: vitals.heart,
ageToTest: [2, 3, 4, 5, 7, 8, 11, 12],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Lungs',
value: vitals.lungs,
ageToTest: [2, 3, 4, 5, 7, 8, 11, 12],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Abdomen',
value: vitals.abdomen,
ageToTest: [2, 3, 4, 5, 7, 8, 11, 12],
ageToTest: ALL_CHILD_AGES,
},
{
label: 'Hernial Orifices',
value: vitals.hernial_orifices,
ageToTest: [2, 3, 4, 5, 7, 8],
ageToTest: ALL_CHILD_AGES,
},
];
const PubertyFields = [
Expand Down
4 changes: 4 additions & 0 deletions utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ export const REGISTRATION_FORM_FIELDS = {
sabai: 'No',
village_prefix: '',
};

export const ALL_CHILD_AGES = [
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
];

0 comments on commit 2b0a2d3

Please sign in to comment.