Compare commits
2 Commits
v1.3.1
...
495fdf6da2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
495fdf6da2 | ||
|
|
7d29f40ab2 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -223,24 +223,20 @@ export default function Offers() {
|
|||||||
if (pdfLoading) return;
|
if (pdfLoading) return;
|
||||||
setPdfLoading(quotation.id);
|
setPdfLoading(quotation.id);
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(`${API_BASE}/offers-pdf/${quotation.id}`);
|
const response = await apiFetch(
|
||||||
|
`${API_BASE}/offers/${quotation.id}/file`,
|
||||||
|
);
|
||||||
if (response.status === 401) return;
|
if (response.status === 401) return;
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
alert.error("Nepodařilo se vygenerovat PDF");
|
alert.error("PDF soubor nenalezen — otevřete nabídku a uložte ji");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const html = await response.text();
|
const blob = await response.blob();
|
||||||
const w = window.open("", "_blank");
|
const url = URL.createObjectURL(blob);
|
||||||
if (w) {
|
window.open(url, "_blank");
|
||||||
w.document.open();
|
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||||
w.document.write(html);
|
|
||||||
w.document.close();
|
|
||||||
w.onload = () => w.print();
|
|
||||||
} else {
|
|
||||||
alert.error("Prohlížeč zablokoval vyskakovací okno");
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
alert.error("Chyba při generování PDF");
|
alert.error("Chyba připojení");
|
||||||
} finally {
|
} finally {
|
||||||
setPdfLoading(null);
|
setPdfLoading(null);
|
||||||
}
|
}
|
||||||
@@ -753,7 +749,7 @@ export default function Offers() {
|
|||||||
<button
|
<button
|
||||||
onClick={() => handlePdf(q)}
|
onClick={() => handlePdf(q)}
|
||||||
className="admin-btn-icon"
|
className="admin-btn-icon"
|
||||||
title="PDF"
|
title="Zobrazit nabídku"
|
||||||
disabled={pdfLoading === q.id}
|
disabled={pdfLoading === q.id}
|
||||||
>
|
>
|
||||||
{pdfLoading === q.id ? (
|
{pdfLoading === q.id ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user