Skip to content

Commit 9d07d1f

Browse files
Revert "Request count is displayed, Not logged in message"
1 parent abf85d0 commit 9d07d1f

File tree

13 files changed

+515
-470
lines changed

13 files changed

+515
-470
lines changed

pages/charges/ParticularSiteCharges.js

+57-75
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import Cookies from "js-cookie";
1212
import { useSnackbar } from "notistack";
1313
import axios from "axios";
1414
import * as ReactBootStrap from "react-bootstrap";
15-
import NotLoggedIn from "../notLoggedIn/NotLoggedIn";
1615

1716
export default function ParticularSiteCharges() {
1817
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
1918
const router = useRouter();
2019
const { dispatch, state } = useContext(Store);
2120
const [loading, setLoading] = useState(false);
21+
2222
// console.log(router.query?.site_id);
2323
// var address =
2424
// state.?.site_id?.address?.first_line +
@@ -88,88 +88,70 @@ export default function ParticularSiteCharges() {
8888

8989
return (
9090
<>
91-
{!Cookies.get("userInfo") ? (
92-
// <NotLoggedIn />
93-
<span>You are not logged in</span>
94-
) : (
95-
<div>
96-
<Head>
97-
<title>Site Charges</title>
98-
</Head>
99-
{loading ? (
100-
<>
101-
<div className="Parent">
102-
<Taskbar />
103-
<div className="S_right">
91+
<Head>
92+
<title>Site Charges</title>
93+
</Head>
94+
{loading ? (
95+
<>
96+
<div className="Parent">
97+
<Taskbar />
98+
<div className="S_right">
99+
<div>
100+
<link
101+
rel="stylesheet"
102+
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
103+
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
104+
crossOrigin="anonymous"
105+
></link>
106+
<link
107+
rel="stylesheet"
108+
href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
109+
integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p"
110+
crossOrigin="anonymous"
111+
/>
112+
{state.particularSiteCharges?.length <= 0 ? (
104113
<div>
105-
<link
106-
rel="stylesheet"
107-
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
108-
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
109-
crossOrigin="anonymous"
110-
></link>
111-
<link
112-
rel="stylesheet"
113-
href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
114-
integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p"
115-
crossOrigin="anonymous"
114+
<Header header="Total Charges" />
115+
No charges to display
116+
</div>
117+
) : (
118+
<div className="p_right">
119+
<Header header="Total Charges" />
120+
121+
<NameLabel
122+
label="Alias Name"
123+
details={
124+
state.particularSiteCharges[0]?.site_id?.alias_name
125+
}
116126
/>
117-
{!router.query?.site_id ? (
118-
<div>
119-
<Header header="Total Charges" />
120-
<div className="container shadow text-center p-5 mt-5">
121-
<strong>Site Not Found</strong>
122-
</div>
123-
</div>
124-
) : state.particularSiteCharges?.length <= 0 ? (
125-
<div>
126-
<Header header="Total Charges" />
127-
<div className="container shadow text-center p-5 mt-5">
128-
<strong>No charges to display</strong>
129-
</div>
130-
</div>
131-
) : (
132-
<div className="p_right">
133-
<Header header="Total Charges" />
127+
<NameLabel
128+
label="Type"
129+
details={state.particularSiteCharges[0]?.site_id?.Type}
130+
/>
131+
<NameLabel label="Address" details={getAddress()} />
134132

135-
<NameLabel
136-
label="Alias Name"
137-
details={
138-
state.particularSiteCharges[0]?.site_id?.alias_name
139-
}
140-
/>
141-
<NameLabel
142-
label="Type"
143-
details={
144-
state.particularSiteCharges[0]?.site_id?.Type
145-
}
133+
{state.particularSiteCharges.map((data, index) => {
134+
console.log(data);
135+
return (
136+
<TotalchargesCard
137+
key={index}
138+
description={data.description}
139+
siteDetails={data.site_id}
146140
/>
147-
<NameLabel label="Address" details={getAddress()} />
148-
149-
{state.particularSiteCharges.map((data, index) => {
150-
console.log(data);
151-
return (
152-
<TotalchargesCard
153-
key={index}
154-
description={data.description}
155-
siteDetails={data.site_id}
156-
/>
157-
);
158-
})}
159-
</div>
160-
)}
161-
<div className="tc">
162-
<Image src={Total_Charges} alt="TC" />
163-
</div>
141+
);
142+
})}
164143
</div>
144+
)}
145+
<div className="tc">
146+
<Image src={Total_Charges} alt="TC" />
165147
</div>
166148
</div>
167-
</>
168-
) : (
169-
<div className="p_spinner">
170-
<ReactBootStrap.Spinner animation="border" />
171149
</div>
172-
)}
150+
</div>
151+
</>
152+
) : (
153+
<div className="p_spinner">
154+
<ReactBootStrap.Spinner animation="border" />
173155
</div>
174156
)}
175157
</>

0 commit comments

Comments
 (0)