Compare commits

4 Commits

Author SHA1 Message Date
BOHA
495fdf6da2 1.3.2 2026-03-27 10:42:29 +01:00
BOHA
7d29f40ab2 fix: offers table PDF button opens blob from NAS instead of print page
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 10:42:29 +01:00
BOHA
6b9f1dee87 1.3.1 2026-03-27 10:33:15 +01:00
BOHA
687dcb9371 fix: OfferDetail uses default currency from system settings
The useEffect checked prev.currency === "EUR" but initial default was
changed to "CZK", so the settings default was never applied.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 10:33:15 +01:00
4 changed files with 14 additions and 18 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "app-ts",
"version": "1.3.0",
"version": "1.3.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "app-ts",
"version": "1.3.0",
"version": "1.3.2",
"license": "ISC",
"dependencies": {
"@dnd-kit/core": "^6.3.1",

View File

@@ -1,6 +1,6 @@
{
"name": "app-ts",
"version": "1.3.0",
"version": "1.3.2",
"description": "",
"main": "dist/server.js",
"scripts": {

View File

@@ -356,7 +356,7 @@ export default function OfferDetail() {
setForm((prev) => ({
...prev,
currency:
prev.currency === "EUR"
prev.currency === "CZK"
? companySettings.default_currency || "CZK"
: prev.currency,
vat_rate:

View File

@@ -223,24 +223,20 @@ export default function Offers() {
if (pdfLoading) return;
setPdfLoading(quotation.id);
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.ok) {
alert.error("Nepodařilo se vygenerovat PDF");
alert.error("PDF soubor nenalezen — otevřete nabídku a uložte ji");
return;
}
const html = await response.text();
const w = window.open("", "_blank");
if (w) {
w.document.open();
w.document.write(html);
w.document.close();
w.onload = () => w.print();
} else {
alert.error("Prohlížeč zablokoval vyskakovací okno");
}
const blob = await response.blob();
const url = URL.createObjectURL(blob);
window.open(url, "_blank");
setTimeout(() => URL.revokeObjectURL(url), 60000);
} catch {
alert.error("Chyba při generování PDF");
alert.error("Chyba připojení");
} finally {
setPdfLoading(null);
}
@@ -753,7 +749,7 @@ export default function Offers() {
<button
onClick={() => handlePdf(q)}
className="admin-btn-icon"
title="PDF"
title="Zobrazit nabídku"
disabled={pdfLoading === q.id}
>
{pdfLoading === q.id ? (