feat(expenses): utlägg as an answer to "Vem betalade?" in Underlag, not a page (#2317)
An out-of-pocket purchase differs from any other receipt only in the credit account, so the Underlag pane now asks one question for an unmatched underlag (Företaget / Jag, privat / En anställd / Ingen ännu) and books a privately paid receipt in place through POST /api/expense-claims, replacing the "Andra sätt att bokföra" dropdown and the deep link into the two-step wizard. The verifikat editor stays reachable below as the escape hatch (BFL 5 kap 6-7 §). The person owed surfaces in Att göra under a new Betala band, one row per person (lib/worklist expense_payout, counted in the total and exposed to agents through the attention resource). The Utlägg nav row is gated on existing claims, the same hybrid gate as Körjournal, since the entry point for a new utlägg is now the Underlag pane. Claude-Session: https://claude.ai/code/session_01P8YsvPqjfGxGZUkGeBVUWQ Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Jakob Wennberg
Claude Fable 5.1
parent
bff44e5757
commit
cbe5580886
@@ -1,8 +1,9 @@
|
||||
import type { SupabaseClient } from '@supabase/supabase-js'
|
||||
import type { SuggestedMatch } from './types'
|
||||
import type { ExpensePayoutDue, SuggestedMatch } from './types'
|
||||
import type { WorklistCounts } from './types'
|
||||
import {
|
||||
countDeadlinesNeedingAction,
|
||||
countExpensePayoutsDue,
|
||||
countInboxDocuments,
|
||||
countOverdueInvoices,
|
||||
countPendingOperations,
|
||||
@@ -32,6 +33,12 @@ export interface GetWorklistCountsOptions {
|
||||
* parallel with the other counts.
|
||||
*/
|
||||
suggestedMatches?: SuggestedMatch[] | Promise<SuggestedMatch[]>
|
||||
/**
|
||||
* People owed for unpaid utlägg the caller is already fetching (Hem
|
||||
* renders one row per person): the count is the list's length instead of
|
||||
* a second scan of expense_claims.
|
||||
*/
|
||||
expensePayoutsDue?: ExpensePayoutDue[] | Promise<ExpensePayoutDue[]>
|
||||
}
|
||||
|
||||
export async function getWorklistCounts(
|
||||
@@ -50,6 +57,7 @@ export async function getWorklistCounts(
|
||||
deadlineAction,
|
||||
pendingOperations,
|
||||
reconciliationDue,
|
||||
expensePayout,
|
||||
] = await Promise.all([
|
||||
countUnbookedTransactions(supabase, companyId),
|
||||
countUnbookedSkattekontoRows(supabase, companyId),
|
||||
@@ -63,6 +71,9 @@ export async function getWorklistCounts(
|
||||
countDeadlinesNeedingAction(supabase, companyId),
|
||||
countPendingOperations(supabase, companyId),
|
||||
countReconciliationDue(supabase, companyId),
|
||||
options.expensePayoutsDue
|
||||
? Promise.resolve(options.expensePayoutsDue).then((p) => p.length)
|
||||
: countExpensePayoutsDue(supabase, companyId),
|
||||
])
|
||||
|
||||
return {
|
||||
@@ -77,6 +88,7 @@ export async function getWorklistCounts(
|
||||
deadline_action: deadlineAction,
|
||||
pending_operations: pendingOperations,
|
||||
reconciliation_due: reconciliationDue,
|
||||
expense_payout: expensePayout,
|
||||
},
|
||||
total:
|
||||
bookTransaction +
|
||||
@@ -87,6 +99,7 @@ export async function getWorklistCounts(
|
||||
overdueInvoice +
|
||||
deadlineAction +
|
||||
pendingOperations +
|
||||
reconciliationDue,
|
||||
reconciliationDue +
|
||||
expensePayout,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user