diff --git a/app/package.json b/app/package.json index 7d6979f..85dcd33 100644 --- a/app/package.json +++ b/app/package.json @@ -16,7 +16,7 @@ "@fortawesome/free-regular-svg-icons": "^6.5.2", "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/react-fontawesome": "^0.2.2", - "@noahspan/noahspan-components": "^0.3.1", + "@noahspan/noahspan-components": "^0.3.5", "axios": "^1.7.2", "framer-motion": "^11.1.7", "react": "^18.2.0", diff --git a/app/src/App.tsx b/app/src/App.tsx index 3eb41b1..671b8d1 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -88,9 +88,9 @@ const App: React.FC = () => { <> - {useFeatureFlag('flying-pilots')?.enabled && ( - } /> - )} + {/* {useFeatureFlag('flying-pilots')?.enabled && ( */} + } /> + {/* )} */} ); diff --git a/app/src/components/pilotForm/PilotForm.tsx b/app/src/components/pilotForm/PilotForm.tsx index edda7c0..822895c 100644 --- a/app/src/components/pilotForm/PilotForm.tsx +++ b/app/src/components/pilotForm/PilotForm.tsx @@ -4,9 +4,15 @@ import { Accordion, AccordionBody, AccordionHeader, - Input + ChevronDown, + ChevronUp, + DatePicker, + Input, + Option, + Select } from '@noahspan/noahspan-components'; -// import PilotFormCertificates from '../pilotFormCertificates/PilotFormCertificates'; +import PilotFormCertificates from '../pilotFormCertificates/PilotFormCertificates'; +import PilotFormEndorsements from '../pilotFormEndorsements/PilotFormEndorsements'; const PilotForm: React.FC = () => { const [open, setOpen] = useState(0); @@ -23,25 +29,28 @@ const PilotForm: React.FC = () => { return (
- + : } + > handleOpen(1)}>Info
-
+
( )} />
-
+
= () => { disabled={field.disabled} label="Last Name" value={field.value} - variant="standard" /> )} />
-
+
= () => { disabled={field.disabled} label="Address" value={field.value} - variant="standard" /> )} />
-
+
= () => { )} />
-
+
= () => { )} />
-
+
= () => {
- - {/* - - - + : } + > + handleOpen(2)}> + Certificates + + + + - - - - + : } + > + handleOpen(3)}> + Endorsements + + + + - - -
-
- -
-
- ( - - )} - /> -
-
- -
-
- } - /> -
+ : } + > + handleOpen(4)}> + Medical + + +
+ ( + + )} + />
- -
*/} +
+ } + /> +
+ + ); diff --git a/app/src/components/pilotFormCertificates/PilotFormCertificates.tsx b/app/src/components/pilotFormCertificates/PilotFormCertificates.tsx index bff5d84..560cff1 100644 --- a/app/src/components/pilotFormCertificates/PilotFormCertificates.tsx +++ b/app/src/components/pilotFormCertificates/PilotFormCertificates.tsx @@ -1,104 +1,98 @@ -// import { IPilotFormCertificates } from './IPilotFormCertificates'; +import { IPilotFormCertificates } from './IPilotFormCertificates'; // import { Button, DatePicker, Input, Select, SelectItem } from '@nextui-org/react'; -// import { Controller, useFieldArray, useFormContext } from 'react-hook-form' +import { + Button, + DatePicker, + Input, + Option, + Select +} from '@noahspan/noahspan-components'; +import { Controller, useFieldArray, useFormContext } from 'react-hook-form'; -// const PilotFormCertificates: React.FC = ({ certificates }: IPilotFormCertificates) => { -// const { control, formState: { errors } } = useFormContext(); +const PilotFormCertificates: React.FC = ({ + certificates +}: IPilotFormCertificates) => { + const { + control, + formState: { errors } + } = useFormContext(); -// const { fields, append, remove } = useFieldArray({ -// name: 'certificates', -// control -// }) + const { fields, append, remove } = useFieldArray({ + name: 'certificates', + control + }); -// return ( -//
-//
-// -//
-//
-// -//
-//
-// -//
-//
+ return ( +
+ {fields.map((field, index) => { + return ( + <> + {/* //
*/} +
+ { + return ( + + ); + }} + /> +
+
+ { + return ; + }} + /> +
+
+ { + return ; + }} + /> +
+
+ +
+ {/*
*/} + + ); + })} + +
+ ); +}; -//
- -// {fields.map((field, index) => { -// return ( -// <> -// {/* //
*/} -//
-// { -// console.log(field) -// return ( -// -// ) -// }} -// /> -//
-//
-// { -// return ( -// -// ) -// }} -// /> -//
-//
-// { -// return ( -// -// ) -// }} -// /> -//
-//
-// -//
-// {/*
*/} -// -// ) -// })} -// -//
-// ) -// } - -// export default PilotFormCertificates; +export default PilotFormCertificates; diff --git a/app/src/components/pilotFormEndorsements/IPilotFormEndorsements.ts b/app/src/components/pilotFormEndorsements/IPilotFormEndorsements.ts new file mode 100644 index 0000000..7644692 --- /dev/null +++ b/app/src/components/pilotFormEndorsements/IPilotFormEndorsements.ts @@ -0,0 +1,5 @@ +import { Endorsement } from './endorsement.type'; + +export interface IPilotFormEndorsements { + endorsements: Endorsement[]; +} diff --git a/app/src/components/pilotFormEndorsements/PilotFormEndorsements.tsx b/app/src/components/pilotFormEndorsements/PilotFormEndorsements.tsx new file mode 100644 index 0000000..79e1fab --- /dev/null +++ b/app/src/components/pilotFormEndorsements/PilotFormEndorsements.tsx @@ -0,0 +1,95 @@ +import { IPilotFormEndorsements } from './IPilotFormEndorsements'; +// import { Button, DatePicker, Input, Select, SelectItem } from '@nextui-org/react'; +import { + Button, + DatePicker, + Input, + Option, + Select +} from '@noahspan/noahspan-components'; +import { Controller, useFieldArray, useFormContext } from 'react-hook-form'; + +const PilotFormEndorsements: React.FC = ({ + endorsements +}: IPilotFormEndorsements) => { + const { + control, + formState: { errors } + } = useFormContext(); + + const { fields, append, remove } = useFieldArray({ + name: 'endorsements', + control + }); + + return ( +
+ {fields.map((field, index) => { + return ( + <> + {/* //
*/} +
+ { + return ( + + ); + }} + /> +
+
+ { + return ; + }} + /> +
+
+ { + return ; + }} + /> +
+
+ +
+ {/*
*/} + + ); + })} + +
+ ); +}; + +export default PilotFormEndorsements; diff --git a/app/src/components/pilotFormEndorsements/endorsement.type.ts b/app/src/components/pilotFormEndorsements/endorsement.type.ts new file mode 100644 index 0000000..1ace233 --- /dev/null +++ b/app/src/components/pilotFormEndorsements/endorsement.type.ts @@ -0,0 +1,5 @@ +export type Endorsement = { + type: string; + number: string; + dateOfIssue: Date; +}; diff --git a/app/src/components/pilots/Pilots.tsx b/app/src/components/pilots/Pilots.tsx index e71b0fe..42c839f 100644 --- a/app/src/components/pilots/Pilots.tsx +++ b/app/src/components/pilots/Pilots.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import PilotForm from '../pilotForm/PilotForm'; -import { Button, Drawer } from '@noahspan/noahspan-components'; +import { Button, DatePicker, Drawer } from '@noahspan/noahspan-components'; const Pilots: React.FC = () => { const [isDrawerOpen, setIsDrawerOpen] = useState(false); @@ -20,6 +20,7 @@ const Pilots: React.FC = () => { > New + = () => { data-testid="pilot-drawer" > + {/*

Add Pilot

diff --git a/package-lock.json b/package-lock.json index cdafd14..c3d13de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -77,7 +77,7 @@ "@fortawesome/free-regular-svg-icons": "^6.5.2", "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/react-fontawesome": "^0.2.2", - "@noahspan/noahspan-components": "^0.3.1", + "@noahspan/noahspan-components": "^0.3.5", "axios": "^1.7.2", "framer-motion": "^11.1.7", "react": "^18.2.0", @@ -3503,9 +3503,9 @@ "link": true }, "node_modules/@noahspan/noahspan-components": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@noahspan/noahspan-components/-/noahspan-components-0.3.1.tgz", - "integrity": "sha512-KTYndPCABLFPhhhRuZJrl8O25ex4q671lDpiEZ7sOSSXVi85tPcBjsBWo6KiC2+skIwBC58Iuek9Y8Mi1z/QYw==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@noahspan/noahspan-components/-/noahspan-components-0.3.5.tgz", + "integrity": "sha512-7sRZO7rs5/WhCmio7ex0z9iAB6/xH+zomAJjGgUfs5IAVxKIOVy1euSe9d3Re9tg9BS3pLecXkO0kNKsJaGuUQ==", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.5.2", "@fortawesome/free-brands-svg-icons": "^6.5.2", @@ -3514,7 +3514,9 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@material-tailwind/react": "^2.1.9", "@tanstack/react-table": "^8.17.3", - "framer-motion": "^11.1.9" + "date-fns": "^3.6.0", + "framer-motion": "^11.1.9", + "react-day-picker": "^8.10.1" }, "engines": { "node": ">=18.0.0" @@ -3524,6 +3526,15 @@ "react-dom": "^18.2.0" } }, + "node_modules/@noahspan/noahspan-components/node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/@noahspan/noahspan-modules": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/@noahspan/noahspan-modules/-/noahspan-modules-0.3.4.tgz", @@ -6041,7 +6052,6 @@ "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", - "dev": true, "dependencies": { "@babel/runtime": "^7.21.0" }, @@ -11025,6 +11035,19 @@ "node": ">=0.10.0" } }, + "node_modules/react-day-picker": { + "version": "8.10.1", + "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-8.10.1.tgz", + "integrity": "sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/gpbl" + }, + "peerDependencies": { + "date-fns": "^2.28.0 || ^3.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-dom": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",