-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPublishPaperAd.js
More file actions
242 lines (231 loc) · 7.48 KB
/
PublishPaperAd.js
File metadata and controls
242 lines (231 loc) · 7.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
import React from "react";
import SideNavBar from "../../../components/SideNavigationBar/SideNavBar";
import styles from "./PublishPaperAd.module.css";
import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos";
import {
Container,
Button,
FormControl,
Box,
NativeSelect,
Card,
CardContent,
IconButton,
Paper,
Stack,
TextField,
Typography,
Select,
MenuItem,
InputLabel,
CssBaseline,
} from "@mui/material";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TablePagination from "@mui/material/TablePagination";
import TableRow from "@mui/material/TableRow";
import Grid from "@mui/material/Unstable_Grid2";
import { Link as Routerlink } from "react-router-dom";
import DeleteIcon from "@mui/icons-material/Delete";
import { ClosestPreBidMeetingDate } from "../../../services/CorporateCommittee/CorporateCommitteeServices";
import { useEffect, useState } from "react";
import { DateFormat } from "../../../services/dataFormats";
import { fetchDatatoTable } from "../../../services/CorporateCommittee/CorporateCommitteeServices";
function CreateSubProcurementPlan() {
const columns = [
{ id: "ItemID", label: "Item ID", Width: 300, align: "center" },
{ id: "ItemName", label: "Item Name", Width: 300, align: "center" },
{ id: "Qty", label: "Quantity", Width: 300, align: "center" },
{ id: "Action", label: "Action", Width: 300, align: "center" },
];
function createData(ItemID, ItemName, Qty, Action) {
return { ItemID, ItemName, Qty, Action };
}
const rows = [
createData(
"I0014",
"A4 Papers",
"500",
<Routerlink to={"/publish-papaer-ad-view-item"}>
<Button className={styles.ViewButton} variant="contained">
View
</Button>
</Routerlink>
),
createData(
"P0023",
"Printer Ink Cartridges",
"100",
<Routerlink to={"/publish-papaer-ad-view-item"}>
<Button className={styles.ViewButton} variant="contained">
View
</Button>
</Routerlink>
),
createData(
"C0012",
"Computer Monitors",
"50",
<Routerlink to={"/publish-papaer-ad-view-item"}>
<Button className={styles.ViewButton} variant="contained">
View
</Button>
</Routerlink>
),
];
const list = ["MPPI10000", "MPPI10001", "MPPI10002", "MPPI10003"];
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
const [data, setData] = useState();
const [newdata, setnewdata] = useState();
useEffect(() => {
const fetchData = async () => {
try {
const response = await ClosestPreBidMeetingDate();
const data = response;
setData(data);
console.log(data);
} catch (error) {
console.log(error);
}
};
fetchData();
}, []);
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetchDatatoTable(data);
const newdata = response;
setnewdata(newdata);
console.log(newdata);
} catch (error) {
console.log(error);
}
};
fetchData();
}, [data]);
return (
<div style={{ overflowX: "hidden" }}>
<Container
className={styles.main}
sx={{
ml: { xs: "60px", sm: "65px", md: "65px", lg: "68px", xl: "70px" },
display: "flex",
flexDirection: "column",
}}
>
<div className={styles.upperSection}>
<div className={styles.ManageAuctionPageContainer__header}>
<Routerlink to={-1}>
<IconButton
sx={{ pl: "15px", height: "34px", width: "34px", mt: 3.7 }}
>
<ArrowBackIosIcon sx={{ color: "#ffffff" }} />
</IconButton>
</Routerlink>
<h1 className={styles.Header}>Publish Paper Ad</h1>
</div>
</div>
<div className={styles.OuterMiddle}>
<div className={styles.Ph2}>
<h4>PRE-BID MEETING DATE : {DateFormat(data)}</h4>
</div>
</div>
<div className={styles.downSection}>
<Paper
className={styles.baseTableContainer}
elevation={6}
sx={{
mr: {
xs: "60px",
sm: "65px",
md: "65px",
lg: "68px",
xl: "70px",
},
alignItems: "center",
borderRadius: "31px",
}}
>
<TableContainer className={styles.tableContainer}>
<Table stickyHeader aria-label="sticky table">
<TableHead className={styles.TableHeaders}>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ maxWidth: column.Width }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{newdata &&
newdata
.slice(
page * rowsPerPage,
page * rowsPerPage + rowsPerPage
)
.map((row, index) => (
<TableRow
hover
role="checkbox"
tabIndex={-1}
key={index}
>
<TableCell align="center">{row.itemId}</TableCell>
<TableCell align="center">{row.itemName}</TableCell>
<TableCell align="center">
{row.totalquantity}
</TableCell>
<TableCell align="center">
{" "}
{
<Routerlink
to={
`/publish-papaer-ad-view-item/${row.itemId}`
}
>
<Button
className={styles.ViewButton}
variant="contained"
>
View
</Button>
</Routerlink>
}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 50, 100]}
component="div"
count={data ? data.length : 0}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</div>
</Container>
</div>
);
}
export default CreateSubProcurementPlan;