Compare commits
2 Commits
495fdf6da2
...
cde560a2c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cde560a2c3 | ||
|
|
e6198e1b67 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"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.2",
|
"version": "1.3.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -975,18 +975,21 @@ export default function InvoiceDetail() {
|
|||||||
|
|
||||||
// ─── Edit mode: PDF export ───
|
// ─── Edit mode: PDF export ───
|
||||||
const handleViewPdf = async (_lang = "cs") => {
|
const handleViewPdf = async (_lang = "cs") => {
|
||||||
|
const newWindow = window.open("", "_blank");
|
||||||
setPdfLoading(true);
|
setPdfLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(`${API_BASE}/invoices/${id}/file`);
|
const response = await apiFetch(`${API_BASE}/invoices/${id}/file`);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("PDF soubor nenalezen — uložte fakturu pro vygenerování");
|
alert.error("PDF soubor nenalezen — uložte fakturu pro vygenerování");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
window.open(url, "_blank");
|
if (newWindow) newWindow.location.href = url;
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||||
} catch {
|
} catch {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("Chyba připojení");
|
alert.error("Chyba připojení");
|
||||||
} finally {
|
} finally {
|
||||||
setPdfLoading(false);
|
setPdfLoading(false);
|
||||||
|
|||||||
@@ -768,19 +768,25 @@ export default function OfferDetail() {
|
|||||||
|
|
||||||
const handlePdf = async () => {
|
const handlePdf = async () => {
|
||||||
if (!isEdit || pdfLoading) return;
|
if (!isEdit || pdfLoading) return;
|
||||||
|
const newWindow = window.open("", "_blank");
|
||||||
setPdfLoading(true);
|
setPdfLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(`${API_BASE}/offers/${id}/file`);
|
const response = await apiFetch(`${API_BASE}/offers/${id}/file`);
|
||||||
if (response.status === 401) return;
|
if (response.status === 401) {
|
||||||
|
newWindow?.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("PDF soubor nenalezen — uložte nabídku pro vygenerování");
|
alert.error("PDF soubor nenalezen — uložte nabídku pro vygenerování");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
window.open(url, "_blank");
|
if (newWindow) newWindow.location.href = url;
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||||
} catch {
|
} catch {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("Chyba při generování PDF");
|
alert.error("Chyba při generování PDF");
|
||||||
} finally {
|
} finally {
|
||||||
setPdfLoading(false);
|
setPdfLoading(false);
|
||||||
|
|||||||
@@ -221,21 +221,27 @@ export default function Offers() {
|
|||||||
|
|
||||||
const handlePdf = async (quotation: Quotation) => {
|
const handlePdf = async (quotation: Quotation) => {
|
||||||
if (pdfLoading) return;
|
if (pdfLoading) return;
|
||||||
|
const newWindow = window.open("", "_blank");
|
||||||
setPdfLoading(quotation.id);
|
setPdfLoading(quotation.id);
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(
|
const response = await apiFetch(
|
||||||
`${API_BASE}/offers/${quotation.id}/file`,
|
`${API_BASE}/offers/${quotation.id}/file`,
|
||||||
);
|
);
|
||||||
if (response.status === 401) return;
|
if (response.status === 401) {
|
||||||
|
newWindow?.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("PDF soubor nenalezen — otevřete nabídku a uložte ji");
|
alert.error("PDF soubor nenalezen — otevřete nabídku a uložte ji");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
window.open(url, "_blank");
|
if (newWindow) newWindow.location.href = url;
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||||
} catch {
|
} catch {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("Chyba připojení");
|
alert.error("Chyba připojení");
|
||||||
} finally {
|
} finally {
|
||||||
setPdfLoading(null);
|
setPdfLoading(null);
|
||||||
|
|||||||
@@ -503,19 +503,22 @@ export default function ReceivedInvoices({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const openFile = async (inv: ReceivedInvoice) => {
|
const openFile = async (inv: ReceivedInvoice) => {
|
||||||
|
const newWindow = window.open("", "_blank");
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(
|
const response = await apiFetch(
|
||||||
`${API_BASE}/received-invoices/${inv.id}/file`,
|
`${API_BASE}/received-invoices/${inv.id}/file`,
|
||||||
);
|
);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("Nepodařilo se načíst soubor");
|
alert.error("Nepodařilo se načíst soubor");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
window.open(url, "_blank");
|
if (newWindow) newWindow.location.href = url;
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||||
} catch {
|
} catch {
|
||||||
|
newWindow?.close();
|
||||||
alert.error("Chyba připojení");
|
alert.error("Chyba připojení");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user