From 5ac1a56a157dc116fd61712ac47c29e6d02f4c0c Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Thu, 18 Mar 2021 01:21:41 +0300
Subject: feat: add print button

---
 src/containers/WaybillPanel.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/containers/WaybillPanel.tsx')

diff --git a/src/containers/WaybillPanel.tsx b/src/containers/WaybillPanel.tsx
index a978ad3..386d8bb 100644
--- a/src/containers/WaybillPanel.tsx
+++ b/src/containers/WaybillPanel.tsx
@@ -3,7 +3,7 @@ import { useHistory } from 'react-router-dom';
 import Input from '../components/Input';
 import Button from '../components/Button';
 import Paper from '../components/Paper';
-import { patch } from '../requests';
+import { patch, get, baseURL } from '../requests';
 import { PanelProps } from './Service/ServiceContext';
 
 
@@ -16,6 +16,8 @@ const WaybillPanel: React.FC<PanelProps> = ({ item, mutate }) => {
       mutate({ ...item, status });
     });
 
+  const handlePrint = () => window.open(`${baseURL}/spreadsheets/${item._id}`, '_blank');
+
   const handleExecute = () => handleChangeStatus('executed');
   const handleCancel = () => handleChangeStatus('cancelled');
 
@@ -29,6 +31,9 @@ const WaybillPanel: React.FC<PanelProps> = ({ item, mutate }) => {
       <Button route={`/contractors/${item.contractorId}`} variant="outlined">
         Перейти к контрагенту
       </Button>
+      <Button onClick={handlePrint}>
+        Печать
+      </Button>
       {
         executed
           ? <Button onClick={handleCancel}>Откатить</Button>
-- 
cgit v1.2.3

