Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style

This commit is contained in:
2026-02-27 22:47:08 +01:00
committed by erik
parent 5a70f775f1
commit 93faae5cc8
1463 changed files with 306917 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
<?php
require_once __DIR__ . '/../src/config.php';
require_once __DIR__ . '/../src/auth.php';
require_once __DIR__ . '/../src/db.php';
require_login();
header('Content-Type: application/json');
$q = trim($_GET['q'] ?? '');
if (mb_strlen($q) < 2) {
echo json_encode(['ok' => true, 'results' => []]);
exit;
}
$pdo = get_db();
$like = '%' . $q . '%';
$results = [];
// Rechnungen
$stmt = $pdo->prepare("SELECT i.id, i.invoice_number, i.total_gross, c.name AS customer_name
FROM invoices i
JOIN customers c ON c.id = i.customer_id
WHERE i.invoice_number ILIKE :q OR c.name ILIKE :q2
ORDER BY i.created_at DESC
LIMIT 5");
$stmt->execute([':q' => $like, ':q2' => $like]);
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
$results[] = [
'type' => 'invoice',
'title' => $row['invoice_number'],
'subtitle' => $row['customer_name'] . ' - ' . number_format((float)$row['total_gross'], 2, ',', '.') . ' €',
'url' => url_for('invoice_pdf.php?id=' . $row['id']),
];
}
// Kunden
$stmt = $pdo->prepare("SELECT id, name, city FROM customers
WHERE name ILIKE :q OR city ILIKE :q2
ORDER BY name
LIMIT 5");
$stmt->execute([':q' => $like, ':q2' => $like]);
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
$results[] = [
'type' => 'customer',
'title' => $row['name'],
'subtitle' => $row['city'] ?? '',
'url' => url_for('customers.php?action=edit&id=' . $row['id']),
];
}
// Ausgaben
$stmt = $pdo->prepare("SELECT id, description, amount, category FROM expenses
WHERE description ILIKE :q OR category ILIKE :q2
ORDER BY expense_date DESC
LIMIT 5");
$stmt->execute([':q' => $like, ':q2' => $like]);
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
$results[] = [
'type' => 'expense',
'title' => $row['description'],
'subtitle' => ($row['category'] ?? '') . ' - ' . number_format((float)$row['amount'], 2, ',', '.') . ' €',
'url' => url_for('expenses.php?action=edit&id=' . $row['id']),
];
}
// Journal-Einträge
$stmt = $pdo->prepare("SELECT id, description, amount, entry_date FROM journal_entries
WHERE description ILIKE :q
ORDER BY entry_date DESC
LIMIT 5");
$stmt->execute([':q' => $like]);
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
$results[] = [
'type' => 'journal',
'title' => $row['description'],
'subtitle' => date('d.m.Y', strtotime($row['entry_date'])) . ' - ' . number_format((float)$row['amount'], 2, ',', '.') . ' €',
'url' => url_for('journal_entry.php?id=' . $row['id']),
];
}
echo json_encode(['ok' => true, 'results' => $results]);