bsuiness
This commit is contained in:
parent
1f4050fbe3
commit
eed25b773b
21
src/auth.js
21
src/auth.js
@ -1,17 +1,16 @@
|
||||
export const isAutheticated = () => {
|
||||
if (typeof window == "undefined") {
|
||||
return true;
|
||||
}
|
||||
if (localStorage.getItem("authToken")) {
|
||||
|
||||
return (localStorage.getItem("authToken"));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (typeof window == "undefined") {
|
||||
return true;
|
||||
}
|
||||
if (localStorage.getItem("authToken")) {
|
||||
return localStorage.getItem("authToken");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const signout = () => {
|
||||
localStorage.removeItem("authToken");
|
||||
localStorage.removeItem("authToken");
|
||||
|
||||
return true;
|
||||
return true;
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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,21 +266,23 @@ const Businesses = () => {
|
||||
</button>
|
||||
</td> */}
|
||||
<td className=" text-center">
|
||||
{/* <OverLayButton data={{ url: i?.url }} />
|
||||
<OverLayButton data={{ url: i?.url }} />
|
||||
|
||||
<Link to={`/business/products/${i._id}`}>
|
||||
<button
|
||||
style={{ color: 'white' }}
|
||||
type="button"
|
||||
className="
|
||||
<Link
|
||||
to={`/healthcare/providers/view/${i._id}`}
|
||||
>
|
||||
<button
|
||||
style={{ color: "white" }}
|
||||
type="button"
|
||||
className="
|
||||
btn btn-primary btn-sm
|
||||
waves-effect waves-light
|
||||
ms-2
|
||||
"
|
||||
>
|
||||
Products
|
||||
</button>
|
||||
</Link> */}
|
||||
>
|
||||
View
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
<Link
|
||||
to={`/healthcare/providers/edit/${i._id}`}
|
||||
|
146
src/views/Business/ViewHealthCareProvider.js
Normal file
146
src/views/Business/ViewHealthCareProvider.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user