-
Notifications
You must be signed in to change notification settings - Fork 0
Admin Add Client to Client List #137
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
Conversation
benson-fm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey guys,
great start on the task, there's some things that need to be fixed like overall flow and some features missing but the base level stuff is there great work! If you need any clarification lmk!
| destination_city: formData.destination_city, | ||
| comments: formData.comments | ||
| }; | ||
| console.log(clientData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this
| // site: formData.site, | ||
| // case_managers: formData.case_managers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not entirely sure if this used, since its commented and you aren't using it you can go ahead and delete it
| homelessness_length: parseInt(formData.homelessness_length || "0", 10), | ||
| chronically_homeless: formData.chronically_homeless === "Yes" ? true : false , | ||
| attending_school_upon_entry: formData.attending_school_upon_entry === "Yes" ? true : false , | ||
| employement_gained: formData.employment_gained, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mispelling right here could lead to unexpected behavior
| const {backend} = useBackendContext() | ||
| const toast = useToast() | ||
|
|
||
| const handleSubmit = async (event: React.FormEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this instance when I press submit, it doesn't directly get loaded, you may want to do a useEffect hook where once submit is ran the a fetch would be made again to the db for the changes to be reflected on the table
| const {backend} = useBackendContext() | ||
| const toast = useToast() | ||
|
|
||
| const handleSubmit = async (event: React.FormEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this instance it needs to say missing fields refer to this figma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also instead of error occurred print the specific words that are listed in the figma for the red pop up
| > | ||
| <DrawerOverlay /> | ||
| <DrawerContent> | ||
| <DrawerCloseButton /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that when the drawer is closed that the following flow happens as seen in the figma where a component pops out saying that there is a new client and they could edit it meaning that you would need to save the data there even if it means you exit out of the pop up the data is still there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there is an issue with this feature is when that I submit a client to be added and I finish, this notification is still there, this needs to be gone when I successfully submit a client so you may want to use a useState here
Furthermore there isn't a option where I can click on the return to editing client, make sure you add this button, you may want to add onClick function for this
benson-fm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on the fixes guys, theres some extra stuff that needs to be fixed just look through my comments but other than that great job!
| homelessness_length: "", | ||
| chronically_homeless: "", | ||
| attending_school_upon_entry: "", | ||
| employment_gained: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically correct, however, there is an issue where currently right now the table in the db is misspelled for right now just change it to employement and the other instances that are considered of this specific column.
| homelessness_length: parseInt(formData.homelessness_length || "0", 10), | ||
| chronically_homeless: formData.chronically_homeless === "Yes" ? true : false , | ||
| attending_school_upon_entry: formData.attending_school_upon_entry === "Yes" ? true : false , | ||
| employment_gained: formData.employment_gained, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here with the employement thing I was talking about above
| > | ||
| <DrawerOverlay /> | ||
| <DrawerContent> | ||
| <DrawerCloseButton /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there is an issue with this feature is when that I submit a client to be added and I finish, this notification is still there, this needs to be gone when I successfully submit a client so you may want to use a useState here
Furthermore there isn't a option where I can click on the return to editing client, make sure you add this button, you may want to add onClick function for this
| <Text fontWeight="medium">First Name</Text> | ||
| <Input placeholder="Short Answer" value={formData.first_name} | ||
| onChange={(e) => {setFormData({ ...formData, first_name: e.target.value }); setFormInProgress(true); setShowUnfinishedAlert(true)}} | ||
| /> | ||
|
|
||
| <Text fontWeight="medium">Last Name</Text> | ||
| <Input placeholder="Short Answer" value={formData.last_name} | ||
| onChange={(e) => {setFormData({ ...formData, last_name: e.target.value }); setFormInProgress(true)}} | ||
| /> | ||
|
|
||
| <Text fontWeight="medium">Status</Text> | ||
| <Select placeholder="Select option" value={formData.status} | ||
| onChange={(e) => {setFormData({ ...formData, status: e.target.value }); setFormInProgress(true)}}> | ||
| <option value="Active">Active</option> | ||
| <option value="Exited">Exited</option> | ||
| </Select> | ||
|
|
||
| <Text fontWeight="medium">Site</Text> | ||
| <Input placeholder="Short Answer" | ||
| onChange={(e) => {setFormData({ ...formData, site: e.target.value }); setFormInProgress(true)}} | ||
| /> | ||
|
|
||
| <Text fontWeight="medium">Unit ID</Text> | ||
| <Input placeholder="Short Answer" value={formData.unit_id} | ||
| onChange={(e) => {setFormData({ ...formData, unit_id: e.target.value }); setFormInProgress(true)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the following stuff below as we want to get more readable code we see some similar patterns here. What I would want you guys to do here is to make a separate component and you can insert some parameters to decrease the amount of lines maybe something like
SomeComponentYesAndNo (title, placeholder, formDataTitle) {
<Text>{title}</Text>
<Input placeholder={placehodler} onCHange{ setFormData({...formData, {formDataTitle}: e.target.value})}>
}
SomeComponentSelect () {
...
}
| </Select> | ||
|
|
||
| <Text fontWeight="medium">Employment Gained</Text> | ||
| <Select placeholder="Select option" value={formData.employment_gained} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what i was talking about employement you might want to change here
|
|
||
| <Text fontWeight="medium">Employment Gained</Text> | ||
| <Select placeholder="Select option" value={formData.employment_gained} | ||
| onChange={(e) => {setFormData({ ...formData, employment_gained: e.target.value }); setFormInProgress(true)}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this too

Description
Added ability for admin to create a new client and add to the client list.
Key Features:
first_name,last_name, etc.).AlertDialogprompts for confirmation before discarding data.backend.post('/clients', clientData), displaying a success or error toast.Screenshots/Media
When "Add New Client" is clicked
Confirmation for cancelling
Issues
Closes #130