Bug/accounting suggestion (#456)

* feat: add bike benefit handling and optional vacation accrual

- Introduced bike benefit (cykelförmån) with calculations for annual market value and monthly taxable value.
- Updated schemas to include new benefit types and validation rules.
- Implemented API routes for creating, updating, and deleting employee benefits.
- Enhanced salary calculation logic to accommodate new vacation rule options, including a 'none' option for no accrual.
- Added UI components for managing employee benefits, including input for bike benefit specifics.
- Created database migrations for employee benefits and updated salary line items to support new benefit types.

* chore: remove Langfuse env var checks

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: enhance OAuth callback URL handling and update default scopes for Visma integration

* feat: remove trade_name field and simplify company naming in invoices

* refactor: destructure canWrite from useCanWrite for consistency across components

* feat: enhance PATCH endpoint to validate existing benefits and handle bike benefit updates

* feat: add missing label for bike benefit in salary line item types

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-05-13 00:26:04 +02:00
committed by GitHub
co-authored by Claude Opus 4.7
parent cd96e5ec26
commit 3fa871c742
53 changed files with 1182 additions and 125 deletions
+4 -17
View File
@@ -46,25 +46,12 @@ export function formatOrgNumber(orgNumber: string): string {
return orgNumber
}
/**
* Returns the display name for a company, using trade name as primary
* with legal name in parentheses if both exist.
*/
export function getCompanyDisplayName(settings: { trade_name?: string | null; company_name?: string | null }): string {
const tradeName = settings.trade_name?.trim()
const legalName = settings.company_name?.trim()
if (tradeName && legalName) {
return `${tradeName} (${legalName})`
}
return legalName || tradeName || ''
export function getCompanyDisplayName(settings: { company_name?: string | null }): string {
return settings.company_name?.trim() || ''
}
/**
* Returns just the primary name for contexts where a short name is needed
* (e.g. email from name). Uses trade name if set, otherwise legal name.
*/
export function getCompanyPrimaryName(settings: { trade_name?: string | null; company_name?: string | null }): string {
return settings.trade_name?.trim() || settings.company_name?.trim() || ''
export function getCompanyPrimaryName(settings: { company_name?: string | null }): string {
return settings.company_name?.trim() || ''
}
export function generateInvoiceNumber(): string {