some additionals: lines table and other

This commit is contained in:
ekallin 2023-12-19 15:42:57 +04:00
parent ea7da24358
commit 74281891ae
2 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import PropTypes from 'prop-types';
import { Table } from 'react-bootstrap';
const LinesTable = ({ children }) => {
return (
<Table className='table table-sm table-responsive table-bordered border-primary table-hover' id='table' striped responsive>
{/* <thead>
<tr>
<th scope='col'></th>
<th scope='col' className='w-25'>Товар</th>
<th scope='col' className='w-25'>Цена</th>
<th scope='col' className='w-25'>Колич.</th>
<th scope='col' className='w-25'>Сумма</th>
<th scope='col'></th>
<th scope='col'></th>
<th scope='col'></th>
</tr>
</thead> */}
<tr>
<th scope="col"></th>
<th scope="col">Название</th>
<th scope="col">Жанр</th>
<th scope="col" className="text-center">
<span className="d-none d-sm-block">Описание</span><i className="bi bi-clock-history d-block d-sm-none"></i>
</th>
<th scope="col" className="text-center">
<span className="d-none d-sm-block"> Длительность </span><i className="bi bi-clock-history d-block d-sm-none"></i>
</th>
<th scope="col" className="text-center">
<span>Действие</span>
</th>
</tr>
<tbody>
{children}
</tbody >
</Table >
);
};
LinesTable.propTypes = {
children: PropTypes.node,
};
export default LinesTable;

View File

@ -0,0 +1,49 @@
import PropTypes from 'prop-types';
import { PencilSquare, TrashFill } from 'react-bootstrap-icons';
const LinesTableRow = ({
index, line, onDelete, onEdit,
}) => {
const handleAnchorClick = (event, action) => {
event.preventDefault();
action();
};
return (
// <tr>
// <th scope="row">{index + 1}</th>
// <td>{line.type.name}</td>
// <td>{parseFloat(line.price).toFixed(2)}</td>
// <td>{line.count}</td>
// <td>{parseFloat(line.sum).toFixed(2)}</td>
// <td><a href="#" onClick={(event) => handleAnchorClick(event, onEdit)}><PencilFill /></a></td>
// <td><a href="#" onClick={(event) => handleAnchorClick(event, onEditInPage)}><PencilSquare /></a></td>
// <td><a href="#" onClick={(event) => handleAnchorClick(event, onDelete)}><Trash3 /></a></td>
// </tr>
<tr>
<th scope="row">{index + 1}</th>
{/* <td>1</td> */}
<td>{line.type.name}</td>
<td>{line.type.category}</td>
<td>{line.type.description}</td>
<td>{line.type.time}</td>
<td>
<span className="d-flex justify-content-around align-items-center pt-1">
<a href="#" onClick={(event) => handleAnchorClick(event, onEdit)}><PencilSquare /></a>
<a href="#" onClick={(event) => handleAnchorClick(event, onDelete)}><TrashFill /></a>
</span>
</td>
</tr>
);
};
LinesTableRow.propTypes = {
index: PropTypes.number,
line: PropTypes.object,
onDelete: PropTypes.func,
onEdit: PropTypes.func,
};
export default LinesTableRow;