v1.7.0: fix offer created_at override, invoice PDF translations, remove has_order filter

- Add created_at to offer create/update schemas so user-selected date is stored instead of always defaulting to now()
- Translate payment method in invoice PDF based on language (Příkazem → Bank transfer, etc.)
- Add order_date and cnb_rate translation keys, replace hardcoded inline strings
- Remove duplicate has_order filter from offers backend route

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-05-28 13:35:36 +02:00
parent 1f5885de84
commit 2254a13ad0
6 changed files with 40 additions and 22 deletions

View File

@@ -44,7 +44,6 @@ interface ListOffersParams {
search: string;
status?: string;
customer_id?: number;
has_order?: string;
}
function enrichQuotation(q: any) {
@@ -73,24 +72,13 @@ function enrichQuotation(q: any) {
}
export async function listOffers(params: ListOffersParams) {
const {
page,
limit,
skip,
sort,
order,
search,
status,
customer_id,
has_order,
} = params;
const { page, limit, skip, sort, order, search, status, customer_id } =
params;
const sortField = ALLOWED_SORT_FIELDS.includes(sort) ? sort : "id";
const where: Record<string, unknown> = {};
if (status) where.status = status;
if (customer_id) where.customer_id = customer_id;
if (has_order === "yes") where.order_id = { not: null };
if (has_order === "no") where.order_id = null;
if (search) {
where.OR = [
{ quotation_number: { contains: search } },
@@ -189,6 +177,9 @@ export async function createOffer(body: Record<string, any>) {
quotation_number: quotationNumber,
project_code: body.project_code ? String(body.project_code) : null,
customer_id: body.customer_id ? Number(body.customer_id) : null,
created_at: body.created_at
? new Date(String(body.created_at))
: undefined,
valid_until: body.valid_until
? new Date(String(body.valid_until))
: null,
@@ -251,6 +242,12 @@ export async function updateOffer(id: number, body: Record<string, any>) {
const data = {
customer_id:
body.customer_id !== undefined ? Number(body.customer_id) : undefined,
created_at:
body.created_at !== undefined
? body.created_at
? new Date(String(body.created_at))
: null
: undefined,
valid_until:
body.valid_until !== undefined
? body.valid_until