Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanRahees committed Feb 18, 2024
1 parent 04583ea commit 1aaea88
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 153 deletions.
6 changes: 3 additions & 3 deletions src/components/Icons.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faAward,
faBuilding,
faHospital,
faCircleCheck,
faCircleInfo,
faCloudArrowUp,
Expand Down Expand Up @@ -69,8 +69,8 @@ export const ClinicAddress = () => {
export const School = () => {
return <FontAwesomeIcon icon={faSchool} />;
};
export const Company = () => {
return <FontAwesomeIcon icon={faBuilding} />;
export const Hospital = () => {
return <FontAwesomeIcon icon={faHospital} />;
};
export const Award = () => {
return <FontAwesomeIcon icon={faAward} />;
Expand Down
1 change: 1 addition & 0 deletions src/components/frontend/Doctor/EditExperience.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function EditExperience({ formData, setFormData, formErrors }) {
updatedExperiences[index] = {
...updatedExperiences[index],
present: e,
date_to: e ? "" : updatedExperiences[index].date_to,
};
setExperiences(updatedExperiences);
setFormData({ ...formData, experience: updatedExperiences });
Expand Down
39 changes: 39 additions & 0 deletions src/components/frontend/Doctor/EditTimings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable no-unused-vars */
import { useState } from "react";
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogDescription,
DialogClose,
DialogFooter,
DialogTitle,
} from "@/widgets/ui/dialog";

function AddTimings() {
const [formData, setFormData] = useState([]);
return (
<Dialog>
<DialogTrigger>Add</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle className="text-xl text-gray-900">
Add Time Slots
</DialogTitle>
<DialogDescription className="grid grid-cols-3"></DialogDescription>
<DialogFooter>
<DialogClose className="bg-zinc-600 text-white px-3 py-1 rounded-md text-sm">
Close
</DialogClose>
<button className="bg-ternary text-white px-3 py-1 rounded-md">
Save
</button>
</DialogFooter>
</DialogHeader>
</DialogContent>
</Dialog>
);
}

export default AddTimings;
6 changes: 6 additions & 0 deletions src/func/days.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export const formatLongDate = (input) => {
return formattedDate;
};

export const getYear = (input) => {
let date = new Date(input);
let year = date.getFullYear();
return year;
};

export const getWeekDay = (input) => {
const daysOfWeek = [
"Sunday",
Expand Down
11 changes: 11 additions & 0 deletions src/func/time.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const formatTime = (time) => {
const parsedTime = new Date("2000-01-01T" + time);
const hours = parsedTime.getHours();
const minutes = parsedTime.getMinutes();
const formattedHours = hours % 12 || 12;
const ampm = hours < 12 ? "AM" : "PM";
const formattedMinutes = minutes < 10 ? "0" + minutes : minutes;
const formattedTime = `${formattedHours}:${formattedMinutes} ${ampm}`;

return formattedTime;
};
7 changes: 4 additions & 3 deletions src/pages/frontend/Dashboard/EditProfile.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-unused-vars */
import { useState, useEffect, useContext } from "react";
import { useNavigate } from "react-router-dom";
import { useDispatch } from "react-redux";
import { UploadCloud } from "lucide-react";
import AuthContext from "@/contexts/AuthContext";
Expand Down Expand Up @@ -27,6 +27,7 @@ import EditAwards from "@/components/frontend/Doctor/EditAwards";

const EditProfile = () => {
const api = useAxios();
const navigate = useNavigate();
const { userData } = useContext(AuthContext);
const dispatch = useDispatch();
const [formData, setFormData] = useState({});
Expand Down Expand Up @@ -190,10 +191,10 @@ const EditProfile = () => {
.then((response) => {
dispatch(updateUserInfo(response.data));
setIsSubmitting(false);
navigate(-1);
})
.catch((error) => {
.catch(() => {
setIsSubmitting(false);
console.log(error.response);
});
}
console.log("d: ", formData);
Expand Down
129 changes: 72 additions & 57 deletions src/pages/frontend/Dashboard/Profile.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { useContext } from "react";
import { Link } from "react-router-dom";
import { useSelector } from "react-redux";
Expand All @@ -17,21 +16,26 @@ import {
Clinic,
ClinicAddress,
School,
Company,
Hospital,
Award,
ApprovedIcon,
} from "@/components/Icons";
import { formatDate } from "@/func/days";
import { getYear } from "date-fns";

function Profile() {
const { userData } = useContext(AuthContext);
const { userInfo, loading } = useSelector((state) => state.user);
return (
<Board>
<div className="">
<AlertInfo
type="warningInfo"
message="To get Approval please complete your profile. We'll review manually and approve within 3 days."
classValues="text-yellow-600 bg-yellow-50 border-yellow-100 mb-5"
/>
{!userInfo?.is_approved && (
<AlertInfo
type="warningInfo"
message="To get Approval please complete your profile. We'll review manually and approve within 3 days."
classValues="text-yellow-600 bg-yellow-50 border-yellow-100 mb-5"
/>
)}
<p className="font-bold text-xl mb-2 text-sky-800">
Basic Information{" "}
<Link
Expand All @@ -58,7 +62,9 @@ function Profile() {
)}
<div className="block w-full">
{!loading ? (
<p className="my-1 text-xl font-bold">Dr. {userInfo?.name}</p>
<p className="flex items-center gap-1 my-1 text-xl font-bold">
Dr. {userInfo?.name} <ApprovedIcon />
</p>
) : (
<Skeleton className="w-[250px] h-8 bg-zinc-200 my-1" />
)}
Expand Down Expand Up @@ -132,76 +138,85 @@ function Profile() {
</p>
<hr className="my-4" />
{!loading ? (
<p className="text-secondary my-1 text-xl font-bold">
<Clinic /> Chillex HealthCare
<p className="text-secondary my-1 text-xl font-bold capitalize">
<Clinic /> {userInfo?.clinic_name}
</p>
) : (
<Skeleton className="w-[300px] h-8 bg-zinc-200 my-1" />
)}
{!loading ? (
<p className="text-gray-700 my-1">
<ClinicAddress /> Near Ummer Gate, Madam, Muzhappilanghad
<p className="text-gray-700 my-1 capitalize">
<ClinicAddress /> {userInfo?.clinic_address}
</p>
) : (
<Skeleton className="w-[200px] h-4 bg-zinc-200 my-1" />
)}
{!loading ? (
<div className="flex flex-wrap gap-2 my-2">
{[1, 2, 3, 4, 5].map((img, index) => (
<img
key={index}
src="https://play-lh.googleusercontent.com/toXtzLf25z4cr9VYO6-Job-ArlYd7aYYhhlfZq5rdGa6B41dnaqwukMT9tzL2Tx6Kw=w240-h480-rw"
alt=""
className="w-[60px]"
/>
))}
{userInfo?.clinic_images &&
userInfo?.clinic_images.map((img, index) => (
<img
key={index}
src={apiUrl + img?.clinic_image}
alt=""
className="w-[60px]"
/>
))}
</div>
) : (
<Skeleton className="w-[400px] h-20 bg-zinc-200 my-1" />
)}
<p className="font-bold text-xl mb-2 text-sky-800 my-4">Education</p>
<hr className="my-4" />
{[1, 2, 3, 4].map((ed, index) => (
<div className="w-full md:px-5 my-5" key={index}>
<p className="flex justify-between gap-3">
<span className="font-bold text-lg text-secondary">
Bachelor of Computer Application
</span>
<small className="block text-nowrap">2020-2022</small>
</p>
<p className="text-gray-700">
<School /> Fr.GKM HSS
</p>
</div>
))}
{userInfo?.education &&
userInfo?.education.map((edu, index) => (
<div className="w-full md:px-5 my-5" key={index}>
<p className="flex justify-between gap-3">
<span className="font-bold text-lg text-zinc-700">
{edu?.degree}
</span>
<small className="block text-nowrap">
{getYear(edu?.date_from)}-{getYear(edu?.date_to)}
</small>
</p>
<p className="text-gray-700 capitalize">
<School /> {edu?.institute}
</p>
</div>
))}
<p className="font-bold text-xl mb-2 text-sky-800 my-4">Experience</p>
<hr className="my-4" />
{[1, 2, 3, 4].map((ed, index) => (
<div className="w-full md:px-5 my-5" key={index}>
<p className="flex justify-between gap-3">
<span className="font-bold text-lg text-secondary">
Bachelor of Computer Application
</span>
<small className="block text-nowrap">2020-2022</small>
</p>
<p className="text-gray-700">
<Company /> Fr.GKM HSS
</p>
</div>
))}
{userInfo?.experience &&
userInfo?.experience.map((exp, index) => (
<div className="w-full md:px-5 my-5" key={index}>
<p className="flex justify-between gap-3">
<span className="font-bold text-lg text-zinc-700 capitalize">
{exp?.position}
</span>
<small className="block text-nowrap">
{getYear(exp?.date_from)}-
{exp?.present ? "Present" : exp?.date_to}
</small>
</p>
<p className="text-gray-700 capitalize">
<Hospital /> {exp?.hospital_name}
</p>
</div>
))}
<p className="font-bold text-xl mb-2 text-sky-800 my-4">Awards</p>
<hr className="my-4" />
{[1, 2, 3, 4].map((ed, index) => (
<div className="w-full md:px-5 my-5" key={index}>
<p className="text-secondary">
<Award />{" "}
<span className="text-lg font-bold">
Bachelor of Computer Application
</span>
</p>
<small className="block text-nowrap">23 May, 2023</small>
</div>
))}
{userInfo?.awards &&
userInfo?.awards.map((award, index) => (
<div className="w-full md:px-5 my-5" key={index}>
<p className="text-zinc-700">
<Award />{" "}
<span className="text-lg font-bold">{award?.award_name}</span>
</p>
<small className="block text-nowrap">
{formatDate(award?.award_year)}
</small>
</div>
))}
</div>
</Board>
);
Expand Down
Loading

0 comments on commit 1aaea88

Please sign in to comment.