summaryrefslogtreecommitdiff
path: root/src/containers/WaybillPanel.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/WaybillPanel.tsx')
-rw-r--r--src/containers/WaybillPanel.tsx42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/containers/WaybillPanel.tsx b/src/containers/WaybillPanel.tsx
deleted file mode 100644
index b90447e..0000000
--- a/src/containers/WaybillPanel.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import React from 'react';
-import { useHistory } from 'react-router-dom';
-import Button from '../components/Button';
-import { patch, baseURL } from '../requests';
-import { PanelProps } from './Service/ServiceContext';
-
-
-const WaybillPanel: React.FC<PanelProps> = ({ 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 (
- <div className="lg:m-4 p-4 flex flex-col lg:pl-16 lg:border-l">
- <div className="grid lg:grid-cols-2">
- <Button route={`/contractors/${item.contractorId}`} variant="outlined">
- Перейти к контрагенту
- </Button>
- <Button onClick={handlePrint} variant="outlined">
- Печать
- </Button>
- <span className="text-lg text-center mt-4">Итоговая сумма: ${item.total}</span>
- <Button onClick={executed ? handleCancel : handleExecute} size="lg">
- {executed ? 'Откатить' : 'Провести'}
- </Button>
- </div>
- </div>
- );
-};
-
-export default WaybillPanel;