This commit is contained in:
MD ARIF KHAN 2023-07-28 17:43:55 +05:30
parent 1f4050fbe3
commit eed25b773b
4 changed files with 174 additions and 24 deletions

View File

@ -3,8 +3,7 @@ export const isAutheticated = () => {
return true;
}
if (localStorage.getItem("authToken")) {
return (localStorage.getItem("authToken"));
return localStorage.getItem("authToken");
} else {
return false;
}

View File

@ -79,6 +79,7 @@ import EditPurpose from "./views/configuration/Purpose/EditPurpose.js";
import ViewAppointment from "./views/Appointments/ViewAppointment";
import EditAppointment from "./views/Appointments/EditAppointment";
import AddNewAppointment from "./views/Appointments/AddNewAppointment";
import ViewHealthCareProvider from "./views/Business/ViewHealthCareProvider";
const routes = [
{ path: "/", exact: true, name: "Home" },
{
@ -134,6 +135,11 @@ const routes = [
name: "Edit healthcare providers",
element: EditBusiness,
},
{
path: "/healthcare/providers/view/:id",
name: "view healthcare providers",
element: ViewHealthCareProvider,
},
// { path: '/franchisee/view/:id', name: 'view franchisee', element: ViewFra },
//Contact Requests

View File

@ -31,7 +31,6 @@ const Businesses = () => {
},
})
.then((res) => {
console.log(res.data);
setBusinessesData(res.data?.businesses);
setLoading(false);
})
@ -208,8 +207,6 @@ const Businesses = () => {
</tr>
</thead>
<tbody>
{console.log(showData, "showData")}
{!loading && showData.length === 0 && (
<tr className="text-center">
<td colSpan="6">
@ -269,11 +266,13 @@ const Businesses = () => {
</button>
</td> */}
<td className=" text-center">
{/* <OverLayButton data={{ url: i?.url }} />
<OverLayButton data={{ url: i?.url }} />
<Link to={`/business/products/${i._id}`}>
<Link
to={`/healthcare/providers/view/${i._id}`}
>
<button
style={{ color: 'white' }}
style={{ color: "white" }}
type="button"
className="
btn btn-primary btn-sm
@ -281,9 +280,9 @@ const Businesses = () => {
ms-2
"
>
Products
View
</button>
</Link> */}
</Link>
<Link
to={`/healthcare/providers/edit/${i._id}`}

View File

@ -0,0 +1,146 @@
import axios from "axios";
import React from "react";
import { useState } from "react";
import { useEffect } from "react";
import { useNavigate, useParams } from "react-router-dom";
import Button from "@material-ui/core/Button";
import { isAutheticated } from "src/auth";
const ViewHealthCareProvider = () => {
const [HealthCareData, setHealthCareData] = useState();
const token = isAutheticated();
const [loading, setLoading] = useState(false);
const { id } = useParams();
const getHealthCareProvider = () => {
setLoading(true);
axios
.get(`/api/businesses/get/${id}`, {
headers: {
Authorization: `Bearer ${token}`,
},
})
.then(async (res) => {
console.log(res.data);
setHealthCareData(res.data.businesses);
setLoading(false);
})
.catch((err) => {
swal("Error", "Could not get data", "error");
setLoading(false);
});
};
useEffect(() => {
getHealthCareProvider();
}, []);
const navigate = useNavigate();
return (
<div>
<div className="col-12">
<div
className="
page-title-box
d-flex
align-items-center
justify-content-between
"
>
<div style={{ fontSize: "22px" }} className="fw-bold">
HealthCare Provider Details
</div>
<div className="page-title-right">
<Button
variant="contained"
color="primary"
style={{
fontWeight: "bold",
marginBottom: "1rem",
textTransform: "capitalize",
}}
onClick={() => {
navigate("/healthcare/providers", { replace: true });
}}
>
Back
</Button>
</div>
</div>
</div>
{loading && <div>Loading...</div>}
{!loading && !HealthCareData && <div>No data found</div>}
{!loading && HealthCareData && (
<div>
<table className="table table-striped">
<tbody>
<tr>
<th scope="col">HealthCare Provider ID</th>
<td>{HealthCareData?._id}</td>
</tr>
<tr>
<th scope="col">Provider Type</th>
<td>{HealthCareData?.business}</td>
</tr>
{HealthCareData?.business_name ? (
<tr>
{" "}
<th scope="col">HealthCare Name</th>
<td>{HealthCareData?.business_name}</td>
</tr>
) : (
<tr>
<th scope="col">Specialization</th>
<td>{HealthCareData?.specialization}</td>
</tr>
)}
<tr>
<th scope="col">Contact Person Name</th>
<td>{HealthCareData?.contact_Person_Name}</td>
</tr>
<tr>
<th scope="col"> Phone</th>
<td>{HealthCareData?.contact_Number}</td>
</tr>
<tr>
<th scope="col">Email</th>
<td>{HealthCareData?.email}</td>
</tr>
<tr>
<th scope="col">Url</th>
<td>
{HealthCareData?.url ? (
HealthCareData?.url
) : (
<span className="text-danger">Not Set</span>
)}
</td>
</tr>
<tr>
<th scope="col">Address</th>
<td>
{HealthCareData?.address_Line_1} <br />
{HealthCareData?.address_Line_2}
<br />
{HealthCareData?.city}, {HealthCareData?.state} <br />
{HealthCareData?.country} <br />
{HealthCareData?.pincode}
</td>
</tr>
</tbody>
</table>
</div>
)}
</div>
);
};
export default ViewHealthCareProvider;