summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/containers/WaybillPanel.tsx7
-rw-r--r--src/requests.ts2
2 files changed, 7 insertions, 2 deletions
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>
diff --git a/src/requests.ts b/src/requests.ts
index af77d89..16570cc 100644
--- a/src/requests.ts
+++ b/src/requests.ts
@@ -1,6 +1,6 @@
import axios from 'axios';
-const baseURL = process.env.NODE_ENV === 'production'
+export const baseURL = process.env.NODE_ENV === 'production'
? 'https://commercel-api.herokuapp.com'
: 'http://localhost:3030';