first commit

This commit is contained in:
pawan-dot 2024-07-09 13:50:13 +05:30
parent 00171bd174
commit db94e5a111
4 changed files with 295 additions and 14 deletions

View File

@ -14,8 +14,8 @@ import { cibGmail } from "@coreui/icons";
import { createRoot } from "react-dom/client";
const setupAxios = () => {
//axios.defaults.baseURL = "http://localhost:5000";
axios.defaults.baseURL = "https://pulseayur-api.onrender.com";
axios.defaults.baseURL = "http://localhost:5000";
// axios.defaults.baseURL = "https://pulseayur-api.onrender.com";
axios.defaults.headers = {
"Cache-Control": "no-cache,no-store",

View File

@ -150,6 +150,7 @@ import EditEmployee from "./views/EmployeeAccess/editEmployee";
import ExportToExcel from "./views/exportExcel";
import Currency from "./views/configuration/Currency";
import Patient from "./views/Patients/Patient";
import ViewPatient from "./views/Patients/ViewPatient";
const routes = [
// { path: "/", exact: true, name: "Home", navName: "" },
//dashboard
@ -238,6 +239,12 @@ const routes = [
navName: "Product Management",
},
{
path: "//patient/view/:id",
name: "View Patient",
element: ViewPatient,
navName: "Patients",
},
{
path: "/patients",
name: "Patients",

View File

@ -16,6 +16,7 @@ const Patient = () => {
const nameRef = useRef();
// const categoryRef = useRef();
const mobileRef = useRef()
const VerifyPatientRef = useRef();
const [currentPage, setCurrentPage] = useState(1);
@ -38,12 +39,12 @@ const Patient = () => {
page: currentPage,
show: itemPerPage,
name: nameRef.current.value,
// category: categoryRef.current.value,
mobileNumber: mobileRef.current.value,
isVerified: VerifyPatientRef.current.value,
},
})
.then((res) => {
console.log("res.data?.data", res.data);
// console.log("res.data?.data", res.data);
setPatientsData(res.data?.patient);
setTotalData(res.data?.total_data);
setLoading(false);
@ -272,12 +273,22 @@ const Patient = () => {
<label>Patient Name:</label>
<input
type="text"
placeholder="patient name"
placeholder="Patient name"
className="form-control"
ref={nameRef}
disabled={loading}
/>
</div>
<div className="col-lg-3">
<label>Mobile Number:</label>
<input
type="text"
placeholder="Mobile Number"
className="form-control"
ref={mobileRef}
disabled={loading}
/>
</div>
{/* <div className="col-lg-3">
<label>Filter by Mobile No.:</label>
<select
@ -342,7 +353,7 @@ const Patient = () => {
<th className="text-start">Register On</th>
{/* <th className="text-start">Actions</th> */}
<th className="text-start">Action</th>
</tr>
</thead>
@ -384,6 +395,7 @@ const Patient = () => {
<td className="text-start">{patient?.mobileNumber}</td>
<td className="text-start">{patient?.email ? patient?.email : <><small className="m-0 text-secondary">No Email Added!</small>
</>}</td>
@ -427,8 +439,8 @@ const Patient = () => {
}
)}
</td>
{/* <td className="text-start"> */}
{/* <Link to={`/patients/variants/${patient._id}`}>
<td className="text-start">
{/* <Link to={`/patients/variants/${patient._id}`}>
<button
style={{ color: 'white', marginRight: '1rem' }}
type="button"
@ -443,9 +455,8 @@ const Patient = () => {
Variants
</button>
</Link> */}
{/* <Link
<Link
to={`/patient/view/${patient._id}`}
state={{ currencyDetails }}
// to={`/patient/view/${patient._id}`}
>
<button
@ -464,9 +475,9 @@ const Patient = () => {
>
View
</button>
</Link> */}
</Link>
{/* <Link to={`/patient/edit/${patient._id}`}>
{/* <Link to={`/patient/edit/${patient._id}`}>
<button
style={{
color: "white",
@ -483,7 +494,7 @@ const Patient = () => {
>
Edit
</button>
</Link>
</Link> */}
<Link
to={"#"}
@ -509,7 +520,7 @@ const Patient = () => {
Delete
</button>
</Link>
</td> */}
</td>
</tr>
);
})

View File

@ -0,0 +1,263 @@
import React, { useState, useEffect } from "react";
import axios from "axios";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import { isAutheticated } from "src/auth";
const ViewPatient = () => {
// const id = useParams()?.id;
const location = useLocation();
const { currencyDetails } = location.state || {};
const { id } = useParams();
const token = isAutheticated();
const [patientData, setPatientData] = useState({});
const [SAW, setSAW] = useState([
{ volume: "", weight: "" },
{ volume: "", weight: "" },
{ volume: "", weight: "" },
{ volume: "", weight: "" },
{ volume: "", weight: "" },
]);
const navigate = useNavigate();
const getPatientData = async () => {
axios
.get(`/api/patient/getOne/${id}`, {
headers: {
Authorization: `Bearer ${token}`,
},
})
.then((res) => {
console.log(res.data.data);
setPatientData(res.data.data);
if (res.data.data?.variants) {
setSAW((prev) => [...res.data.data?.variants]);
}
})
.catch((err) => { });
};
useEffect(() => {
getPatientData();
}, []);
const onCancel = () => {
navigate("//patients");
};
let count = 1;
return (
<div className=" main-content">
<div className=" my-3 page-content">
<div className="container-fluid">
{/* <!-- start page title --> */}
<div className="row">
<div className="col-12">
<div className="page-title-box d-flex align-items-center justify-content-between">
<h4 className="mb-3">Patient Details</h4>
<button
onClick={onCancel}
type="button"
className="mb-2 ml-2 btn btn-warning btn-cancel waves-effect waves-light mr-3"
>
Back
</button>
</div>
</div>
</div>
{/* <!-- end page title --> */}
<div className="row">
<div className="col-lg-12">
<div className="card">
<div className="card-body">
<div className="row ml-0 mr-0 mb-10"></div>
<div className="table-responsive table-shoot">
<table className="table table-centered table-nowrap mb-0">
<thead className="thead-light">
<tr>
<th>Name</th>
<td>{patientData?.name}</td>
</tr>
<tr>
<th>Patient Group</th>
<td>{patientData?.category?.categoryName}</td>
</tr>
<tr>
<th>Images</th>
<td>
{patientData?.image &&
patientData?.image?.length !== 0
? patientData?.image.map((e, i) => (
<img
className="p-1"
src={e.url}
width="100"
alt="preview"
key={i}
/>
))
: "No Images Uploaded!"}
</td>
</tr>
<tr>
<th>Description</th>
<td>{patientData?.description}</td>
</tr>
<tr>
<th>Patient Status</th>
<td
className={`badge m-1 ${patientData?.patient_Status === "Active"
? "text-bg-success"
: "text-bg-danger"
}`}
>
{patientData?.patient_Status}
</td>
</tr>
<tr>
<th>Special Instructions</th>
<td>
<p
style={{ whiteSpace: "pre-line" }}
className="m-0 p-0"
>
{patientData?.special_instructions
? patientData?.special_instructions
: "---"}
</p>
</td>
</tr>
</thead>
<tbody></tbody>
</table>
<table className="table table-primary mt-3">
<caption
style={{ captionSide: "top" }}
className="text-dark fw-bold"
>
Varients:
</caption>
<thead>
<tr>
<th className="text-center">Variant Name</th>
<th className="text-center">Price</th>
<th className="text-center">VAT</th>
</tr>
</thead>
<tbody>
{SAW.map(
(r, i) =>
r.variant_Name !== "" && (
<tr key={i}>
<td className="text-center">
{r?.variant_Name}
</td>
<td className="text-center">
{currencyDetails?.CurrencySymbol}
{r?.price}
</td>
<td className="text-center">
{r?.gst_Id?.name + " " + r?.gst_Id?.tax + "%"}
</td>
</tr>
)
)}
{SAW.filter((e) => e.variant_Name !== "").length ===
0 && (
<tr>
<td colSpan={"6"} className="text-center">
No data available
</td>
</tr>
)}
</tbody>
</table>
{/* <div className="mb-2">
<table className="table table-secondary mt-3">
<caption
style={{ captionSide: "top" }}
className="text-dark fw-bold"
>
Patient Fabric:
</caption>
{patientData?.patient_Fabric?.length > 0 ? (
<>
<thead>
<tr>
<th className="text-center">S. No.</th>
<th className="text-center"> Name</th>
<th className="text-center"> Use For Part</th>
</tr>
</thead>
<tbody>
{patientData?.patient_Fabric?.map((r, i) => (
<tr key={i}>
<td className="text-center">{++i}</td>
<td className="text-center">
{r?.fabric_Name}
</td>
<td className="text-center">{r?.for_Part}</td>
</tr>
))}
</tbody>
</>
) : (
<>
<h5>No Fabric Allotted for this patient!</h5>
</>
)}
</table>
</div> */}
{/* <div className="mb-2">
<table className="table table-info mt-3">
<caption
style={{ captionSide: "top" }}
className="text-dark fw-bold"
>
Relevent Patient:
</caption>
{patientData?.relevent_patient?.length > 0 ? (
<>
<thead>
<tr>
<th className="text-center">S. No.</th>
<th className="text-center">Patient Name</th>
</tr>
</thead>
<tbody>
{patientData?.relevent_patient?.map((r, i) => (
<tr key={i}>
<td className="text-center">{count++}</td>
<td className="text-center">{r?.name}</td>
</tr>
))}
</tbody>
</>
) : (
<>
<h5>No relevent item for this patient !</h5>
</>
)}
</table>
</div> */}
</div>
{/* <!-- end table-responsive --> */}
</div>
</div>
</div>
</div>
</div>
{/* <!-- container-fluid --> */}
</div>
</div>
);
};
export default ViewPatient;