generated from moevm/nsql-clean-tempate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from moevm/koroleva/auth
Auth page
- Loading branch information
Showing
17 changed files
with
1,412 additions
and
616 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,66 @@ | ||
import { Button, Table, TableBody, TableCell, TableHead, TableRow } from "@mui/material" | ||
import { useNavigate } from "react-router-dom" | ||
import Payment from "./Payment"; | ||
import Payment from "../pages/PaymentPage"; | ||
import { useState } from "react"; | ||
import { Cell } from "../serviceFiles/types"; | ||
import Table from "react-bootstrap/Table"; | ||
import { Button } from "react-bootstrap"; | ||
|
||
export default function CellsTable(props: { isForRent: boolean, isForAdmin: boolean, cells: Cell[] }) { | ||
|
||
let navigate = useNavigate(); | ||
const [showPayment, setShowPayment] = useState(false); | ||
const [cellForRent, setCellForRent] = useState(props.cells[0]); | ||
// let cellForRent: Cell|null = null; | ||
function handleRent(cell: Cell) { | ||
setCellForRent(cell); | ||
console.log(cellForRent); | ||
setShowPayment(!showPayment); | ||
console.log("again", cellForRent); | ||
navigate("/paymentCell", {state: cell}) | ||
// setCellForRent(cell); | ||
// console.log(cellForRent); | ||
// setShowPayment(!showPayment); | ||
// console.log("again", cellForRent); | ||
} | ||
function CloseRent() { | ||
setShowPayment(!showPayment); | ||
} | ||
|
||
const listCells = props.cells.map((cell: Cell, index) => | ||
<TableRow key={cell.cellId}> | ||
<TableCell> | ||
<tr key={cell.cellId}> | ||
<td> | ||
{cell.cellId} | ||
</TableCell> | ||
<TableCell> | ||
</td> | ||
<td> | ||
{cell.isFree ? "Свободна" : "Занята"} | ||
</TableCell> | ||
<TableCell> | ||
</td> | ||
<td> | ||
{cell.endOfRent} | ||
</TableCell> | ||
<TableCell> | ||
</td> | ||
<td> | ||
{cell.warehouse} | ||
</TableCell> | ||
{props.isForRent && <TableCell> <Button variant="contained" onClick={() => handleRent(cell)}> Арендовать </Button></TableCell>} | ||
{props.isForAdmin && <TableCell> {cell.needService ? "Требует" : "Не требует"}</TableCell>} | ||
{props.isForAdmin && <TableCell> <Button variant="contained" > Обслужить </Button> </TableCell>} | ||
</TableRow> | ||
</td> | ||
{props.isForRent && <td> <Button type="button" className="btn" onClick={() => handleRent(cell)}> Арендовать </Button></td>} | ||
{props.isForAdmin && <td> {cell.needService ? "Требует" : "Не требует"}</td>} | ||
{props.isForAdmin && <td> <Button type="button" className="btn" > Обслужить </Button> </td>} | ||
</tr> | ||
) | ||
return (<> | ||
{showPayment && <Payment cell={cellForRent} handleClick={CloseRent} isOpen={showPayment} />} | ||
<Table> | ||
<TableHead> | ||
<TableCell> | ||
{/* {showPayment && <Payment cell={cellForRent} handleClick={CloseRent} isOpen={showPayment} />} */} | ||
<Table striped bordered hover> | ||
<thead> | ||
<th scope="col"> | ||
Номер | ||
</TableCell> | ||
<TableCell> | ||
</th> | ||
<th scope="col"> | ||
Статус | ||
</TableCell> | ||
<TableCell> | ||
</th> | ||
<th scope="col"> | ||
Дата окончания аренды | ||
</TableCell> | ||
<TableCell> | ||
</th> | ||
<th scope="col"> | ||
Склад | ||
</TableCell> | ||
{props.isForAdmin && <TableCell> Тех.обслуживание </TableCell>} | ||
</TableHead> | ||
<TableBody> | ||
</th> | ||
{props.isForAdmin && <th scope="col"> Тех.обслуживание </th>} | ||
</thead> | ||
<tbody> | ||
{listCells} | ||
</TableBody> | ||
</tbody> | ||
</Table> | ||
</>) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Button, Form } from "react-bootstrap" | ||
|
||
export default function AuthPage() { | ||
return (<div> | ||
<h2>Вход</h2> | ||
<Form> | ||
<Form.Group className="mb-3" controlId="formBasicEmail"> | ||
<Form.Label>Логин</Form.Label> | ||
<Form.Control type="email" placeholder="Логин" /> | ||
</Form.Group> | ||
|
||
<Form.Group className="mb-3" controlId="formBasicPassword"> | ||
<Form.Label>Пароль</Form.Label> | ||
<Form.Control type="password" placeholder="Пароль" /> | ||
</Form.Group> | ||
<Form.Group className="mb-3" controlId="formBasicCheckbox"> | ||
<Form.Check type="checkbox" label="Запомнить меня" /> | ||
</Form.Group> | ||
<Button variant="primary" type="submit"> | ||
Вход | ||
</Button> | ||
</Form> | ||
</div>) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useState } from "react"; | ||
import { Cell } from "../serviceFiles/types"; | ||
import { useLocation, useNavigate } from "react-router-dom"; | ||
import { Button } from "react-bootstrap"; | ||
|
||
export default function PaymentPage() { | ||
const {state} = useLocation(); | ||
let navigate = useNavigate(); | ||
function handleClick(){ | ||
navigate("/rentCell") | ||
} | ||
return (<> | ||
{console.log("in payment", state)} | ||
<h2>Оплата аренды ячейки</h2> | ||
<div> | ||
<p>Ячейка номер {state.cellId}</p> | ||
<p>Размер {state.size}</p> | ||
<Button> Оплата по карте </Button> | ||
<Button> Оплата по СБП </Button> | ||
<Button onClick={handleClick}>Отмена</Button> | ||
|
||
</div> | ||
</>) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
import React, { useEffect, useRef, useState } from 'react' | ||
import { BrowserRouter, Routes, Route, Link } from "react-router-dom"; | ||
import MyCellsPage from './MyCellsPage'; | ||
import BookCellPage from './RentCellPage'; | ||
import MyCellsPage from './manyEntity/MyCellsPage'; | ||
import BookCellPage from './manyEntity/RentCellPage'; | ||
import HelpPage from './HelpPage'; | ||
import { List, ListItemButton } from '@mui/material'; | ||
import ListItem from '@mui/material'; | ||
|
||
|
||
export default function PersonalAccount() { | ||
return (<div> | ||
PersonalPage | ||
<nav> | ||
<ListItemButton> | ||
<ul className="list-group"> | ||
<li className="list-group-item"> | ||
{/* сам линк сделать элементом списка, а не вложенным */} | ||
<Link to="/myCells">Мои ячейки</Link> | ||
</ListItemButton> | ||
<ListItemButton> | ||
<Link to="/bookCell">Арендовать ячейку</Link> | ||
</ListItemButton> | ||
<ListItemButton> | ||
</li> | ||
<li className="list-group-item"> | ||
<Link to="/rentCell">Арендовать ячейку</Link> | ||
</li> | ||
<li className="list-group-item"> | ||
<Link to="/help">Поддержка</Link> | ||
</ListItemButton> | ||
<ListItemButton> | ||
</li> | ||
<li className="list-group-item"> | ||
<Link to="/allCells">Все ячейки</Link> | ||
</ListItemButton> | ||
<ListItemButton> | ||
</li> | ||
<li className="list-group-item"> | ||
<Link to="/allEvents">Все события</Link> | ||
</ListItemButton> | ||
</nav> | ||
</li> | ||
</ul> | ||
</div>) | ||
} |
4 changes: 2 additions & 2 deletions
4
client/src/pages/AllCellsPage.tsx → client/src/pages/manyEntity/AllCellsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.