import React from 'react'; import { useHistory } from 'react-router-dom'; import Button from '../../components/Button'; import { patch, baseURL } from '../../requests'; import { PanelProps } from '../../lib/ServiceContext'; import { Waybill } from '../types'; const WaybillPanel: React.FC> = ({ item, mutate }) => { const history = useHistory(); const handleChangeStatus = (status: Waybill['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;