import React from 'react'; import { useHistory } from 'react-router-dom'; import Input from '../components/Input'; import Button from '../components/Button'; import { patch, get, baseURL } from '../requests'; import { PanelProps } from './Service/ServiceContext'; const WaybillPanel: React.FC = ({ item, mutate }) => { const history = useHistory(); const handleChangeStatus = status => patch(`/waybills/${item._id}`, { status }) .then(() => { history.push('/waybills'); mutate({ ...item, status }); }); const handlePrint = () => window.open(`${baseURL}/spreadsheets/${item._id}`, '_blank'); const handleExecute = () => handleChangeStatus('executed'); const handleCancel = () => handleChangeStatus('cancelled'); const executed = item.status === 'executed'; return (
Итоговая сумма: ${item.total}
); }; export default WaybillPanel;