Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59b478f262 | ||
|
|
e4f14a24b7 | ||
|
|
3bd0d055d9 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.5.9",
|
"version": "1.6.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useMemo, useRef, useCallback, useEffect } from "react";
|
import { useMemo, useRef, useCallback, useLayoutEffect } from "react";
|
||||||
import ReactQuill from "react-quill-new";
|
import ReactQuill from "react-quill-new";
|
||||||
import "react-quill-new/dist/quill.snow.css";
|
import "react-quill-new/dist/quill.snow.css";
|
||||||
|
|
||||||
@@ -96,11 +96,14 @@ export default function RichEditor({
|
|||||||
[onChange],
|
[onChange],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!quillRef.current) return;
|
if (!quillRef.current) return;
|
||||||
const editor = quillRef.current.getEditor();
|
const editor = quillRef.current.getEditor();
|
||||||
editor.format("font", "tahoma");
|
editor.format("font", "tahoma");
|
||||||
editor.format("size", "14px");
|
editor.format("size", "14px");
|
||||||
|
// Quill auto-focuses on mount with existing content, which scrolls
|
||||||
|
// the page to the editor. Blur to prevent unwanted scroll.
|
||||||
|
editor.blur();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -491,10 +491,69 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.offers-items-table .admin-table td .admin-form-input {
|
||||||
|
font-size: 16px;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 9px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Give the description column more room by shrinking numeric columns */
|
||||||
|
.offers-col-qty {
|
||||||
|
width: 4rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-unit {
|
||||||
|
width: 4rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-price {
|
||||||
|
width: 5.5rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-included {
|
||||||
|
width: 3.5rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-total {
|
||||||
|
width: 5.5rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-del {
|
||||||
|
width: 2.5rem !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.offers-items-table {
|
.offers-items-table {
|
||||||
margin: 0 -1rem;
|
margin: 0 -1rem;
|
||||||
width: calc(100% + 2rem);
|
width: calc(100% + 2rem);
|
||||||
|
border-radius: 0;
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offers-items-table .admin-table {
|
||||||
|
min-width: 700px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offers-items-table .admin-table td {
|
||||||
|
padding: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offers-items-table .admin-table th {
|
||||||
|
font-size: 10px;
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Further reduce numeric columns on very small screens */
|
||||||
|
.offers-col-qty {
|
||||||
|
width: 3.5rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-unit {
|
||||||
|
width: 3.5rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-price {
|
||||||
|
width: 5rem !important;
|
||||||
|
}
|
||||||
|
.offers-col-total {
|
||||||
|
width: 5rem !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,9 +274,10 @@ function loadOfferDraft(): {
|
|||||||
sections?: unknown[];
|
sections?: unknown[];
|
||||||
} | null {
|
} | null {
|
||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem("boha_offer_draft");
|
const raw = localStorage.getItem(DRAFT_KEY);
|
||||||
return raw ? JSON.parse(raw) : null;
|
return raw ? JSON.parse(raw) : null;
|
||||||
} catch {
|
} catch (e) {
|
||||||
|
console.error("Failed to load offer draft:", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,17 +354,28 @@ export default function OfferDetail() {
|
|||||||
const draft = loadOfferDraft();
|
const draft = loadOfferDraft();
|
||||||
if (draft?.form) {
|
if (draft?.form) {
|
||||||
return {
|
return {
|
||||||
...emptyForm,
|
quotation_number:
|
||||||
|
(draft.form.quotation_number as string) || emptyForm.quotation_number,
|
||||||
project_code:
|
project_code:
|
||||||
(draft.form.project_code as string) || emptyForm.project_code,
|
(draft.form.project_code as string) || emptyForm.project_code,
|
||||||
|
customer_id:
|
||||||
|
(draft.form.customer_id as number | null) ?? emptyForm.customer_id,
|
||||||
customer_name:
|
customer_name:
|
||||||
(draft.form.customer_name as string) || emptyForm.customer_name,
|
(draft.form.customer_name as string) || emptyForm.customer_name,
|
||||||
created_at: (draft.form.created_at as string) || emptyForm.created_at,
|
created_at: (draft.form.created_at as string) || emptyForm.created_at,
|
||||||
valid_until:
|
valid_until:
|
||||||
(draft.form.valid_until as string) || emptyForm.valid_until,
|
(draft.form.valid_until as string) || emptyForm.valid_until,
|
||||||
currency: (draft.form.currency as string) || emptyForm.currency,
|
currency: (draft.form.currency as string) || emptyForm.currency,
|
||||||
customer_id:
|
language: (draft.form.language as string) || emptyForm.language,
|
||||||
(draft.form.customer_id as number | null) ?? emptyForm.customer_id,
|
vat_rate: (draft.form.vat_rate as number) ?? emptyForm.vat_rate,
|
||||||
|
apply_vat: (draft.form.apply_vat as boolean) ?? emptyForm.apply_vat,
|
||||||
|
exchange_rate:
|
||||||
|
(draft.form.exchange_rate as string) || emptyForm.exchange_rate,
|
||||||
|
scope_title:
|
||||||
|
(draft.form.scope_title as string) || emptyForm.scope_title,
|
||||||
|
scope_description:
|
||||||
|
(draft.form.scope_description as string) ||
|
||||||
|
emptyForm.scope_description,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return emptyForm;
|
return emptyForm;
|
||||||
@@ -590,22 +602,27 @@ export default function OfferDetail() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEdit) return;
|
if (isEdit) return;
|
||||||
try {
|
try {
|
||||||
|
const data = JSON.parse(debouncedDraft);
|
||||||
const draft = {
|
const draft = {
|
||||||
form: {
|
form: {
|
||||||
project_code: form.project_code,
|
project_code: data.form.project_code ?? "",
|
||||||
customer_id: form.customer_id,
|
customer_id: data.form.customer_id ?? null,
|
||||||
customer_name: form.customer_name,
|
customer_name: data.form.customer_name ?? "",
|
||||||
created_at: form.created_at,
|
created_at: data.form.created_at ?? "",
|
||||||
valid_until: form.valid_until,
|
valid_until: data.form.valid_until ?? "",
|
||||||
currency: form.currency,
|
currency: data.form.currency ?? "CZK",
|
||||||
|
language: data.form.language ?? "EN",
|
||||||
|
vat_rate: data.form.vat_rate ?? 21,
|
||||||
|
apply_vat: data.form.apply_vat ?? false,
|
||||||
|
exchange_rate: data.form.exchange_rate ?? "",
|
||||||
},
|
},
|
||||||
items,
|
items: data.items,
|
||||||
sections,
|
sections: data.sections,
|
||||||
savedAt: new Date().toISOString(),
|
savedAt: new Date().toISOString(),
|
||||||
};
|
};
|
||||||
localStorage.setItem(DRAFT_KEY, JSON.stringify(draft));
|
localStorage.setItem(DRAFT_KEY, JSON.stringify(draft));
|
||||||
} catch {
|
} catch (e) {
|
||||||
/* localStorage full or unavailable */
|
console.error("Failed to save offer draft:", e);
|
||||||
}
|
}
|
||||||
}, [debouncedDraft]); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [debouncedDraft]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
@@ -697,8 +714,8 @@ export default function OfferDetail() {
|
|||||||
if (!isEdit) {
|
if (!isEdit) {
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem(DRAFT_KEY);
|
localStorage.removeItem(DRAFT_KEY);
|
||||||
} catch {
|
} catch (e) {
|
||||||
/* ignore */
|
console.error("Failed to remove offer draft:", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isEdit && result.data?.id) {
|
if (!isEdit && result.data?.id) {
|
||||||
@@ -1283,7 +1300,7 @@ export default function OfferDetail() {
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="admin-table-responsive">
|
<div className="offers-items-table">
|
||||||
<DndContext
|
<DndContext
|
||||||
sensors={dndSensors}
|
sensors={dndSensors}
|
||||||
collisionDetection={closestCenter}
|
collisionDetection={closestCenter}
|
||||||
@@ -1316,18 +1333,42 @@ export default function OfferDetail() {
|
|||||||
<th style={{ width: "2.5rem", textAlign: "center" }}>
|
<th style={{ width: "2.5rem", textAlign: "center" }}>
|
||||||
#
|
#
|
||||||
</th>
|
</th>
|
||||||
<th>Popis</th>
|
<th className="offers-col-desc">Popis</th>
|
||||||
<th style={{ width: "5rem" }}>Množství</th>
|
<th
|
||||||
<th style={{ width: "5rem" }}>Jednotka</th>
|
className="offers-col-qty"
|
||||||
<th style={{ width: "7rem" }}>Cena/ks</th>
|
style={{ width: "5rem" }}
|
||||||
<th style={{ width: "4rem", textAlign: "center" }}>
|
>
|
||||||
|
Množství
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
className="offers-col-unit"
|
||||||
|
style={{ width: "5rem" }}
|
||||||
|
>
|
||||||
|
Jednotka
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
className="offers-col-price"
|
||||||
|
style={{ width: "7rem" }}
|
||||||
|
>
|
||||||
|
Cena/ks
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
className="offers-col-included"
|
||||||
|
style={{ width: "4rem", textAlign: "center" }}
|
||||||
|
>
|
||||||
V ceně
|
V ceně
|
||||||
</th>
|
</th>
|
||||||
<th style={{ width: "7rem", textAlign: "right" }}>
|
<th
|
||||||
|
className="offers-col-total"
|
||||||
|
style={{ width: "7rem", textAlign: "right" }}
|
||||||
|
>
|
||||||
Celkem
|
Celkem
|
||||||
</th>
|
</th>
|
||||||
{!isInvalidated && !isLockedByOther && (
|
{!isInvalidated && !isLockedByOther && (
|
||||||
<th style={{ width: "3rem" }} />
|
<th
|
||||||
|
className="offers-col-del"
|
||||||
|
style={{ width: "3rem" }}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -221,10 +221,16 @@ export default async function attendanceRoutes(
|
|||||||
isAdmin,
|
isAdmin,
|
||||||
authUserId: authData.userId,
|
authUserId: authData.userId,
|
||||||
month: query.month
|
month: query.month
|
||||||
? Number(String(query.month).split("-")[1])
|
? String(query.month).includes("-")
|
||||||
|
? Number(String(query.month).split("-")[1])
|
||||||
|
: Number(query.month)
|
||||||
: undefined,
|
: undefined,
|
||||||
year: query.month
|
year: query.month
|
||||||
? Number(String(query.month).split("-")[0])
|
? String(query.month).includes("-")
|
||||||
|
? Number(String(query.month).split("-")[0])
|
||||||
|
: query.year
|
||||||
|
? Number(query.year)
|
||||||
|
: undefined
|
||||||
: query.year
|
: query.year
|
||||||
? Number(query.year)
|
? Number(query.year)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|||||||
@@ -632,14 +632,6 @@ ${indentCSS}
|
|||||||
border: none;
|
border: none;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
.logo-header {
|
|
||||||
text-align: right;
|
|
||||||
padding-bottom: 4mm;
|
|
||||||
}
|
|
||||||
.first-content {
|
|
||||||
margin-top: -26mm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- Page break helpers ---- */
|
/* ---- Page break helpers ---- */
|
||||||
table.page-layout thead { display: table-header-group; }
|
table.page-layout thead { display: table-header-group; }
|
||||||
table.items tbody tr { break-inside: avoid; }
|
table.items tbody tr { break-inside: avoid; }
|
||||||
@@ -696,30 +688,16 @@ ${indentCSS}
|
|||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.first-content {
|
|
||||||
margin-top: 0 !important;
|
|
||||||
}
|
|
||||||
.logo-header {
|
|
||||||
text-align: right;
|
|
||||||
padding-bottom: 0;
|
|
||||||
margin-bottom: -18mm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- ============ QUOTATION (logo repeats via thead, full header only on first page) ============ -->
|
<!-- ============ QUOTATION (full header in thead repeats on every page) ============ -->
|
||||||
<div class="quotation-page">
|
<div class="quotation-page">
|
||||||
<table class="page-layout">
|
<table class="page-layout">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<div class="logo-header">${logoImg}</div>
|
|
||||||
</td></tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr><td>
|
|
||||||
<div class="first-content">
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="page-title">${escapeHtml(t("title"))}</div>
|
<div class="page-title">${escapeHtml(t("title"))}</div>
|
||||||
@@ -727,9 +705,13 @@ ${indentCSS}
|
|||||||
${quotation.project_code ? `<div class="project-code">${escapeHtml(quotation.project_code)}</div>` : ""}
|
${quotation.project_code ? `<div class="project-code">${escapeHtml(quotation.project_code)}</div>` : ""}
|
||||||
<div class="valid-until">${escapeHtml(t("valid_until"))}: ${escapeHtml(formatDate(quotation.valid_until))}</div>
|
<div class="valid-until">${escapeHtml(t("valid_until"))}: ${escapeHtml(formatDate(quotation.valid_until))}</div>
|
||||||
</div>
|
</div>
|
||||||
|
${logoImg ? `<div class="right">${logoImg}</div>` : ""}
|
||||||
</div>
|
</div>
|
||||||
<hr class="separator" />
|
<hr class="separator" />
|
||||||
|
</td></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>
|
||||||
<div class="addresses">
|
<div class="addresses">
|
||||||
<div class="address-block left">
|
<div class="address-block left">
|
||||||
<div class="address-label">${escapeHtml(t("customer"))}</div>
|
<div class="address-label">${escapeHtml(t("customer"))}</div>
|
||||||
@@ -763,7 +745,6 @@ ${indentCSS}
|
|||||||
${totalsHtml}
|
${totalsHtml}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user