feat(reports): hours by client (CSV + UI), company contracted hours, UI to manage companies; adjust ticket list spacing
This commit is contained in:
parent
3bafcc5a0a
commit
70f91f5bbd
10 changed files with 294 additions and 4 deletions
|
|
@ -16,6 +16,10 @@ export async function PATCH(request: Request, { params }: { params: Promise<{ id
|
|||
if (key in body) updates[key] = body[key] ?? null
|
||||
}
|
||||
if ("isAvulso" in body) updates.isAvulso = Boolean(body.isAvulso)
|
||||
if ("contractedHoursPerMonth" in body) {
|
||||
const raw = body.contractedHoursPerMonth
|
||||
updates.contractedHoursPerMonth = typeof raw === "number" ? raw : raw ? Number(raw) : null
|
||||
}
|
||||
|
||||
try {
|
||||
const company = await prisma.company.update({ where: { id }, data: updates as any })
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export async function POST(request: Request) {
|
|||
if (!session) return NextResponse.json({ error: "Não autorizado" }, { status: 401 })
|
||||
|
||||
const body = await request.json()
|
||||
const { name, slug, isAvulso, cnpj, domain, phone, description, address } = body ?? {}
|
||||
const { name, slug, isAvulso, cnpj, domain, phone, description, address, contractedHoursPerMonth } = body ?? {}
|
||||
if (!name || !slug) {
|
||||
return NextResponse.json({ error: "Nome e slug são obrigatórios" }, { status: 400 })
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ export async function POST(request: Request) {
|
|||
name: String(name),
|
||||
slug: String(slug),
|
||||
isAvulso: Boolean(isAvulso ?? false),
|
||||
contractedHoursPerMonth: typeof contractedHoursPerMonth === "number" ? contractedHoursPerMonth : contractedHoursPerMonth ? Number(contractedHoursPerMonth) : null,
|
||||
cnpj: cnpj ? String(cnpj) : null,
|
||||
domain: domain ? String(domain) : null,
|
||||
phone: phone ? String(phone) : null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue