- base.css: var(--danger-color) (undefined, no fallback -> inherited color) -> var(--danger) - attendanceHelpers: re-export formatDate from formatters instead of a byte-identical copy - dashboard.ts: remove dead duplicate require2FAOptions (canonical copy is in settings.ts) - settings.ts: remove unused @deprecated systemSettingsOptions alias - PlanWork: drop redundant per-page plan.css import (loaded globally in AdminApp) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
85 lines
2.2 KiB
TypeScript
85 lines
2.2 KiB
TypeScript
import { queryOptions } from "@tanstack/react-query";
|
|
import { jsonQuery } from "../apiAdapter";
|
|
|
|
export interface CompanySettingsCustomField {
|
|
name: string;
|
|
value: string;
|
|
showLabel: boolean;
|
|
}
|
|
|
|
export interface CompanySettingsData {
|
|
// Company info
|
|
company_name?: string;
|
|
street?: string;
|
|
city?: string;
|
|
postal_code?: string;
|
|
country?: string;
|
|
company_id?: string;
|
|
vat_id?: string;
|
|
ico?: string;
|
|
dic?: string;
|
|
has_logo?: boolean;
|
|
has_logo_dark?: boolean;
|
|
custom_fields?: CompanySettingsCustomField[];
|
|
supplier_field_order?: string[];
|
|
|
|
// System settings
|
|
require_2fa?: boolean;
|
|
default_currency?: string;
|
|
default_vat_rate?: number;
|
|
available_currencies?: string[];
|
|
available_vat_rates?: number[];
|
|
break_threshold_hours?: number;
|
|
break_duration_short?: number;
|
|
break_duration_long?: number;
|
|
clock_rounding_minutes?: number;
|
|
invoice_alert_email?: string;
|
|
leave_notify_email?: string;
|
|
smtp_from?: string;
|
|
smtp_from_name?: string;
|
|
max_login_attempts?: number;
|
|
lockout_minutes?: number;
|
|
max_requests_per_minute?: number;
|
|
|
|
// Numbering
|
|
quotation_prefix?: string;
|
|
order_type_code?: string;
|
|
invoice_type_code?: string;
|
|
offer_number_pattern?: string;
|
|
order_number_pattern?: string;
|
|
invoice_number_pattern?: string;
|
|
warehouse_receipt_prefix?: string;
|
|
warehouse_receipt_number_pattern?: string;
|
|
warehouse_issue_prefix?: string;
|
|
warehouse_issue_number_pattern?: string;
|
|
warehouse_inventory_prefix?: string;
|
|
warehouse_inventory_number_pattern?: string;
|
|
|
|
// Misc
|
|
app_version?: string;
|
|
}
|
|
|
|
export const companySettingsOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["company-settings"],
|
|
queryFn: () =>
|
|
jsonQuery<CompanySettingsData>("/api/admin/company-settings"),
|
|
staleTime: 5 * 60_000,
|
|
});
|
|
|
|
export const systemInfoOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["settings", "system-info"],
|
|
queryFn: () =>
|
|
jsonQuery<Record<string, unknown>>(
|
|
"/api/admin/company-settings/system-info",
|
|
),
|
|
});
|
|
|
|
export const require2FAOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["settings", "2fa"],
|
|
queryFn: () =>
|
|
jsonQuery<{ require_2fa: boolean }>("/api/admin/totp/required"),
|
|
});
|