Skip to content
Merged

redes #279

Show file tree
Hide file tree
Changes from all 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
223 changes: 117 additions & 106 deletions client/features/auth/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,116 +44,127 @@ const Profile = () => {
const expertiseOptions = ["Student", "Resident", "Fellow", "Physician Assistant", "Nurse", "Nurse Practitioner", "Pharmacist", "Internal Med", "Other"];

return (
<Container>
<Row className="d-flex justify-content-center align-items-center" style={{ paddingTop: "5rem" }}>
<Col md={10} lg={6} s={10} xs={12}>
<Card className="mx-auto" id="edit-profile-card">
<Card.Header className="text-center" id="edit-profile-card-header">
Edit My Profile
<Container fluid className="profile-container bg-light">
<Row className="d-flex justify-content-center align-items-center min-vh-100">
<Col md={10} lg={7} xs={12}>
<Card className="border-0 shadow-lg rounded-4">
<Card.Header className="text-center border-0 pt-4 pb-3 bg-white">
<h3 className="fw-bold text-primary mb-0">Edit My Profile</h3>
</Card.Header>
<Card.Body>
<Col>
<Form noValidate validated={validated} onSubmit={handleSubmit}>
<Row className="mb-3">
<Form.Group as={Col} controlId="firstName">
<Form.Label className="">
First Name <span className="asterisk">*</span>
</Form.Label>
<Form.Control
onClick={clearText}
type="text"
defaultValue={userFirstName}
onChange={(e) => {
setUserFirstName(e.target.value);
}}
onBlur={(e) => (e.target.placeholder = userFirstName)}
/>
</Form.Group>
<Card.Body className="px-4 py-4">
<Form noValidate validated={validated} onSubmit={handleSubmit}>
<Row className="mb-4">
<Form.Group as={Col} md={6} className="mb-3 mb-md-0">
<Form.Label className="text-secondary fw-semibold">
First Name <span className="text-danger">*</span>
</Form.Label>
<Form.Control
onClick={clearText}
type="text"
defaultValue={userFirstName}
onChange={(e) => setUserFirstName(e.target.value)}
onBlur={(e) => (e.target.placeholder = userFirstName)}
className="form-control-lg border-secondary-subtle rounded-3"
/>
</Form.Group>

<Form.Group as={Col} controlId="lastName">
<Form.Label className="">
Last Name <span className="asterisk">*</span>
</Form.Label>
<Form.Control
onClick={clearText}
type="text"
defaultValue={userLastName}
onChange={(e) => {
setUserLastName(e.target.value);
}}
onBlur={(e) => (e.target.placeholder = userLastName)}
/>
</Form.Group>
</Row>
<Row className="mb-3">
<Form.Group as={Col} controlId="school">
<Form.Label className="">School</Form.Label>
<Form.Control
type="text"
defaultValue={school}
onClick={clearText}
onChange={(e) => {
setUserSchool(e.target.value);
}}
onBlur={(e) => (school && school.length ? (e.target.placeholder = userSchool) : (e.target.placeholder = ""))}
/>
</Form.Group>
<Form.Group as={Col} md={6}>
<Form.Label className="text-secondary fw-semibold">
Last Name <span className="text-danger">*</span>
</Form.Label>
<Form.Control
onClick={clearText}
type="text"
defaultValue={userLastName}
onChange={(e) => setUserLastName(e.target.value)}
onBlur={(e) => (e.target.placeholder = userLastName)}
className="form-control-lg border-secondary-subtle rounded-3"
/>
</Form.Group>
</Row>

<Form.Group as={Col} controlId="expertiseLevel">
<Form.Label className="">
Expertise Level <span className="asterisk">*</span>
</Form.Label>
<Form.Select
aria-label="default select example"
onChange={(e) => {
setUserExpertise(e.target.value);
}}
>
{expertiseOptions
.filter((current, expertise) => {
return current !== expertise;
})
.map((level, idx) => {
return (
<option value={level} key={idx}>
{level}
</option>
);
})}
</Form.Select>
</Form.Group>
</Row>
<Row className="mb-3">
<Form.Group as={Col} controlId="email">
<Form.Label className="">Email Address</Form.Label>
<Form.Control
type="email"
disabled
readOnly
aria-describedby="disabled input for email address"
placeholder={email}
></Form.Control>
</Form.Group>
</Row>
<center>
<Button type="submit" variant="success" onClick={handleShow}>
Update
</Button>
</center>
<Row className="mb-4">
<Form.Group as={Col} md={6} className="mb-3 mb-md-0">
<Form.Label className="text-secondary fw-semibold">School</Form.Label>
<Form.Control
type="text"
defaultValue={school}
onClick={clearText}
onChange={(e) => setUserSchool(e.target.value)}
onBlur={(e) => (school && school.length ? (e.target.placeholder = userSchool) : (e.target.placeholder = ""))}
className="form-control-lg border-secondary-subtle rounded-3"
/>
</Form.Group>

<Form.Group as={Col} md={6}>
<Form.Label className="text-secondary fw-semibold">
Expertise Level <span className="text-danger">*</span>
</Form.Label>
<Form.Select
aria-label="Select expertise level"
onChange={(e) => setUserExpertise(e.target.value)}
className="form-select-lg border-secondary-subtle rounded-3"
defaultValue={userExpertise}
>
{expertiseOptions.map((level, idx) => (
<option value={level} key={idx}>
{level}
</option>
))}
</Form.Select>
</Form.Group>
</Row>

<Row className="mb-4">
<Form.Group as={Col}>
<Form.Label className="text-secondary fw-semibold">Email Address</Form.Label>
<Form.Control
type="email"
disabled
readOnly
aria-describedby="disabled input for email address"
placeholder={email}
className="form-control-lg bg-light border-secondary-subtle rounded-3"
/>
</Form.Group>
</Row>

<Modal show={show} onHide={handleClose}>
<Modal.Body>Your changes have been recorded!</Modal.Body>
<Modal.Footer>
<Button variant="success" onClick={handleClose}>
Keep Editing
</Button>
<Button variant="success" onClick={() => navigate("/dashboard")}>
Dashboard
</Button>
</Modal.Footer>
</Modal>
</Form>
</Col>
<div className="text-center mt-4">
<Button
type="submit"
variant="primary"
size="lg"
className="px-5 py-3 rounded-3 fw-semibold"
onClick={handleShow}
>
Save Changes
</Button>
</div>

<Modal show={show} onHide={handleClose} centered className="rounded-4">
<Modal.Body className="text-center py-4">
<i className="bi bi-check-circle-fill text-success fs-1 mb-3"></i>
<h4 className="fw-bold mb-3">Changes Saved Successfully!</h4>
<p className="text-secondary mb-0">Your profile has been updated.</p>
</Modal.Body>
<Modal.Footer className="border-0 justify-content-center pb-4">
<Button
variant="outline-primary"
onClick={handleClose}
className="px-4 py-2 rounded-3 me-2"
>
Continue Editing
</Button>
<Button
variant="primary"
onClick={() => navigate("/dashboard")}
className="px-4 py-2 rounded-3"
>
Go to Dashboard
</Button>
</Modal.Footer>
</Modal>
</Form>
</Card.Body>
</Card>
</Col>
Expand Down
Loading
Loading