From 49a44a5762a2863566267689002834ee88d06abb Mon Sep 17 00:00:00 2001 From: eug-vs Date: Tue, 16 Mar 2021 01:38:54 +0300 Subject: feat: add WaybillPanel --- src/containers/WaybillPanel.tsx | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/containers/WaybillPanel.tsx (limited to 'src/containers/WaybillPanel.tsx') diff --git a/src/containers/WaybillPanel.tsx b/src/containers/WaybillPanel.tsx new file mode 100644 index 0000000..ca40169 --- /dev/null +++ b/src/containers/WaybillPanel.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { useHistory } from 'react-router-dom'; +import Input from '../components/Input'; +import Button from '../components/Button'; +import Paper from '../components/Paper'; +import { post } from '../requests'; +import { PanelProps } from './Service/ServiceContext'; + + +const WaybillPanel: React.FC = ({ item }) => { + const history = useHistory(); + + const handleExecute = () => post(`/waybills/${item._id}/execute`) + .then(() => history.push('/waybills')); + + const handleCancel = () => post(`/waybills/${item._id}/cancel`) + .then(() => history.push('/waybills')); + + const executed = item.status === 'executed'; + const total = item.product.price * item.quantity; + + return ( +
+

+ Итоговая сумма: ${total} +

+
+ + +
+ { + executed + ? + : + } +
+ ); +}; + +export default WaybillPanel; -- cgit v1.2.3