'use client' import { useState, useCallback } from 'react' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' import { useToast } from '@/components/ui/use-toast' import type { CompanySettings } from '@/types' interface PdfPrintSettingsProps { settings: CompanySettings onUpdate: (updates: Partial) => void } export function PdfPrintSettings({ settings, onUpdate }: PdfPrintSettingsProps) { const { toast } = useToast() const [lateFeeText, setLateFeeText] = useState(settings.invoice_late_fee_text || '') const [creditTermsText, setCreditTermsText] = useState(settings.invoice_credit_terms_text || '') const saveToggle = useCallback(async (field: string, value: boolean) => { try { const response = await fetch('/api/settings', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ [field]: value }), }) if (!response.ok) throw new Error() onUpdate({ [field]: value } as Partial) } catch { toast({ title: 'Kunde inte spara', variant: 'destructive' }) } }, [onUpdate, toast]) const saveText = useCallback(async (field: string, value: string) => { try { const response = await fetch('/api/settings', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ [field]: value || null }), }) if (!response.ok) throw new Error() onUpdate({ [field]: value || null } as Partial) } catch { toast({ title: 'Kunde inte spara', variant: 'destructive' }) } }, [onUpdate, toast]) return (

Utskrift & PDF

Avrunda fakturatotal till hel krona

saveToggle('ore_rounding', v)} />

Visa OCR-nummer på fakturautskrift

saveToggle('invoice_show_ocr', v)} />

Visa bankgironummer på fakturautskrift

saveToggle('invoice_show_bankgiro', v)} />

Visa plusgironummer på fakturautskrift

saveToggle('invoice_show_plusgiro', v)} />