Add TuxiNet branding and document templates

This commit is contained in:
Thomas
2025-10-28 13:56:54 +01:00
parent f956a735ca
commit 3755435890
48 changed files with 1762 additions and 1 deletions

View File

@@ -0,0 +1,115 @@
<?php
/** @var array $invoice */
$invoice = $invoice ?? [];
$lineItems = $invoice['items'] ?? [];
$customer = $invoice['customer'] ?? [];
$invoiceNumber = $invoice['number'] ?? '';
$title = 'Faktura #' . ($invoiceNumber !== '' ? $invoiceNumber : 'Udkast');
ob_start();
?>
<h2 style="margin-top:0;">Faktura <?= htmlspecialchars($invoiceNumber !== '' ? $invoiceNumber : 'Udkast') ?></h2>
<p style="margin:0 0 16px; color:rgba(148,163,184,0.85);">
Fakturadato: <?= htmlspecialchars($invoice['issued_at'] ?? date('Y-m-d')) ?> &middot;
Forfaldsdato: <?= htmlspecialchars($invoice['due_at'] ?? date('Y-m-d', strtotime('+14 days'))) ?>
</p>
<table class="meta">
<tr>
<th style="width:180px;">Kunde</th>
<td><?= htmlspecialchars($customer['name'] ?? 'Angiv kunde') ?></td>
</tr>
<tr>
<th>Kontaktperson</th>
<td><?= htmlspecialchars($customer['contact'] ?? $customer['email'] ?? 'Angiv kontakt') ?></td>
</tr>
<tr>
<th>Reference</th>
<td><?= htmlspecialchars($invoice['reference'] ?? 'Angiv reference') ?></td>
</tr>
</table>
<table style="width:100%; border-collapse:collapse;">
<thead>
<tr style="text-align:left; color:rgba(226,232,240,0.85);">
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25);">Beskrivelse</th>
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25); width:100px;">Antal</th>
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25); width:140px;">Enhedspris</th>
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25); width:140px;">Beløb</th>
</tr>
</thead>
<tbody>
<?php if (empty($lineItems)): ?>
<tr>
<td colspan="4" style="padding:24px 0; color:rgba(148,163,184,0.8); text-align:center;">Tilføj linjeelementer for at færdiggøre fakturaen.</td>
</tr>
<?php else: ?>
<?php foreach ($lineItems as $item): ?>
<?php $qty = (float) ($item['quantity'] ?? 0); $price = (float) ($item['unit_price'] ?? 0); ?>
<tr>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12);">
<strong><?= htmlspecialchars($item['name'] ?? 'Ydelse') ?></strong><br>
<span style="color:rgba(148,163,184,0.75); font-size:0.9rem;">
<?= nl2br(htmlspecialchars($item['description'] ?? 'Beskriv ydelsen.')) ?>
</span>
</td>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12);">
<?= number_format($qty, 2, ',', '.') ?>
</td>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12);">
<?= number_format($price, 2, ',', '.') ?> kr.
</td>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12); font-weight:600;">
<?= number_format($qty * $price, 2, ',', '.') ?> kr.
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<div class="totals">
<?php
$subtotal = array_reduce($lineItems, fn ($carry, $item) => $carry + (float) ($item['quantity'] ?? 0) * (float) ($item['unit_price'] ?? 0), 0.0);
$vatRate = (float) ($invoice['vat_rate'] ?? 25);
$vatAmount = $subtotal * ($vatRate / 100);
$total = $subtotal + $vatAmount;
$paid = (float) ($invoice['paid'] ?? 0);
$balance = $total - $paid;
?>
<table>
<tr>
<td class="label">Subtotal</td>
<td><?= number_format($subtotal, 2, ',', '.') ?> kr.</td>
</tr>
<tr>
<td class="label">Moms (<?= number_format($vatRate, 0) ?>%)</td>
<td><?= number_format($vatAmount, 2, ',', '.') ?> kr.</td>
</tr>
<tr>
<td class="label">Total</td>
<td><?= number_format($total, 2, ',', '.') ?> kr.</td>
</tr>
<tr>
<td class="label">Betalt</td>
<td><?= number_format($paid, 2, ',', '.') ?> kr.</td>
</tr>
<tr>
<td class="label" style="font-weight:600;">Restbeløb</td>
<td style="font-weight:700; color:#facc15;">
<?= number_format($balance, 2, ',', '.') ?> kr.
</td>
</tr>
</table>
</div>
<?php if (!empty($invoice['notes'])): ?>
<section style="margin-top:32px;">
<h3 style="margin-bottom:8px;">Bemærkninger</h3>
<p style="color:rgba(148,163,184,0.85);"><?= nl2br(htmlspecialchars($invoice['notes'])) ?></p>
</section>
<?php endif; ?>
<?php if (!empty($invoice['payment_details'])): ?>
<section style="margin-top:32px;">
<h3 style="margin-bottom:8px;">Betalingsinformation</h3>
<p style="color:rgba(148,163,184,0.85);"><?= nl2br(htmlspecialchars($invoice['payment_details'])) ?></p>
</section>
<?php endif; ?>
<?php
$content = ob_get_clean();
include base_path('resources/views/documents/layout.php');

View File

@@ -0,0 +1,102 @@
<?php
$brand = [
'company' => config('branding.company'),
'domain' => config('branding.domain'),
'logo' => config('branding.logo_path'),
'email_signature' => config('branding.email_signature'),
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?= htmlspecialchars($title ?? $brand['company'] . ' Document') ?></title>
<style>
:root {
color-scheme: dark;
font-family: 'Inter', system-ui, sans-serif;
}
body {
margin: 0;
padding: 48px 64px;
background-color: #0f172a;
color: #e2e8f0;
}
header {
display: flex;
align-items: center;
gap: 24px;
margin-bottom: 48px;
}
header img {
height: 72px;
width: auto;
border-radius: 16px;
background: rgba(15, 23, 42, 0.55);
padding: 0.45rem 0.65rem;
}
header h1 {
margin: 0;
font-size: 2.15rem;
}
header p {
margin: 0;
color: rgba(148, 163, 184, 0.9);
}
main {
background: rgba(30, 41, 59, 0.7);
border: 1px solid rgba(148, 163, 184, 0.18);
border-radius: 18px;
padding: 32px;
box-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
}
footer {
margin-top: 48px;
font-size: 0.85rem;
color: rgba(148, 163, 184, 0.75);
text-align: center;
}
table.meta {
width: 100%;
border-collapse: collapse;
margin-bottom: 32px;
}
table.meta th, table.meta td {
text-align: left;
padding: 8px 0;
border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.totals {
display: flex;
justify-content: flex-end;
margin-top: 32px;
}
.totals table {
border-collapse: collapse;
min-width: 240px;
}
.totals td {
padding: 8px 0;
}
.totals td.label {
color: rgba(148, 163, 184, 0.8);
padding-right: 24px;
}
</style>
</head>
<body>
<header>
<img src="<?= htmlspecialchars($brand['logo']) ?>" alt="<?= htmlspecialchars($brand['company']) ?> logo">
<div>
<h1><?= htmlspecialchars($brand['company']) ?></h1>
<p><?= htmlspecialchars($brand['domain']) ?></p>
</div>
</header>
<main>
<?= $content ?? '' ?>
</main>
<footer>
<?= nl2br(htmlspecialchars($brand['email_signature'])) ?>
</footer>
</body>
</html>

View File

@@ -0,0 +1,97 @@
<?php
/** @var array $offer */
$offer = $offer ?? [];
$lineItems = $offer['items'] ?? [];
$customer = $offer['customer'] ?? [];
$offerNumber = $offer['number'] ?? '';
$title = 'Tilbud #' . ($offerNumber !== '' ? $offerNumber : 'Udkast');
ob_start();
?>
<h2 style="margin-top:0;">Tilbud <?= htmlspecialchars($offerNumber !== '' ? $offerNumber : 'Udkast') ?></h2>
<p style="margin:0 0 16px; color:rgba(148,163,184,0.85);">
Udstedt: <?= htmlspecialchars($offer['issued_at'] ?? date('Y-m-d')) ?> &middot;
Gyldig til: <?= htmlspecialchars($offer['valid_until'] ?? date('Y-m-d', strtotime('+14 days'))) ?>
</p>
<table class="meta">
<tr>
<th style="width:180px;">Kunde</th>
<td><?= htmlspecialchars($customer['name'] ?? 'Angiv kunde') ?></td>
</tr>
<tr>
<th>Kontaktperson</th>
<td><?= htmlspecialchars($customer['contact'] ?? $customer['email'] ?? 'Angiv kontakt') ?></td>
</tr>
<tr>
<th>Projekt</th>
<td><?= htmlspecialchars($offer['project'] ?? 'Angiv projekt') ?></td>
</tr>
</table>
<table style="width:100%; border-collapse:collapse;">
<thead>
<tr style="text-align:left; color:rgba(226,232,240,0.85);">
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25);">Beskrivelse</th>
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25); width:100px;">Antal</th>
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25); width:140px;">Enhedspris</th>
<th style="padding:12px 0; border-bottom:1px solid rgba(148,163,184,0.25); width:140px;">Beløb</th>
</tr>
</thead>
<tbody>
<?php if (empty($lineItems)): ?>
<tr>
<td colspan="4" style="padding:24px 0; color:rgba(148,163,184,0.8); text-align:center;">Tilføj linjeelementer for at færdiggøre tilbuddet.</td>
</tr>
<?php else: ?>
<?php foreach ($lineItems as $item): ?>
<?php $qty = (float) ($item['quantity'] ?? 0); $price = (float) ($item['unit_price'] ?? 0); ?>
<tr>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12);">
<strong><?= htmlspecialchars($item['name'] ?? 'Ydelse') ?></strong><br>
<span style="color:rgba(148,163,184,0.75); font-size:0.9rem;">
<?= nl2br(htmlspecialchars($item['description'] ?? 'Beskriv ydelsen.')) ?>
</span>
</td>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12);">
<?= number_format($qty, 2, ',', '.') ?>
</td>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12);">
<?= number_format($price, 2, ',', '.') ?> kr.
</td>
<td style="padding:16px 0; border-bottom:1px solid rgba(148,163,184,0.12); font-weight:600;">
<?= number_format($qty * $price, 2, ',', '.') ?> kr.
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<div class="totals">
<?php
$subtotal = array_reduce($lineItems, fn ($carry, $item) => $carry + (float) ($item['quantity'] ?? 0) * (float) ($item['unit_price'] ?? 0), 0.0);
$vatRate = (float) ($offer['vat_rate'] ?? 25);
$vatAmount = $subtotal * ($vatRate / 100);
$total = $subtotal + $vatAmount;
?>
<table>
<tr>
<td class="label">Subtotal</td>
<td><?= number_format($subtotal, 2, ',', '.') ?> kr.</td>
</tr>
<tr>
<td class="label">Moms (<?= number_format($vatRate, 0) ?>%)</td>
<td><?= number_format($vatAmount, 2, ',', '.') ?> kr.</td>
</tr>
<tr>
<td class="label" style="font-weight:600;">Total</td>
<td style="font-weight:700;"><?= number_format($total, 2, ',', '.') ?> kr.</td>
</tr>
</table>
</div>
<?php if (!empty($offer['notes'])): ?>
<section style="margin-top:32px;">
<h3 style="margin-bottom:8px;">Bemærkninger</h3>
<p style="color:rgba(148,163,184,0.85);"><?= nl2br(htmlspecialchars($offer['notes'])) ?></p>
</section>
<?php endif; ?>
<?php
$content = ob_get_clean();
include base_path('resources/views/documents/layout.php');