1
0

feat(helpdesk): redesign handover edit page sidebar

- JOIN users table in findById for created/updated-by display names
- Fix row mapping to handle merged JOIN results
- Use product name instead of debitor name in page title
- Sidebar: collapsible customer/product sections, status dropdown,
  audit partial with user attribution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-15 21:29:36 +02:00
parent 2600e62a73
commit 9a49e18e27
3 changed files with 73 additions and 33 deletions

View File

@@ -41,7 +41,13 @@ class HandoverRepository
}
$row = DB::selectOne(
'SELECT * FROM helpdesk_handovers WHERE id = ? AND tenant_id = ? LIMIT 1',
'SELECT h.*,'
. ' uc.display_name AS created_by_label, uc.uuid AS created_by_uuid,'
. ' uu.display_name AS updated_by_label, uu.uuid AS updated_by_uuid'
. ' FROM helpdesk_handovers h'
. ' LEFT JOIN users uc ON uc.id = h.created_by'
. ' LEFT JOIN users uu ON uu.id = h.updated_by'
. ' WHERE h.id = ? AND h.tenant_id = ? LIMIT 1',
(string) $id,
(string) $tenantId
);
@@ -140,8 +146,18 @@ class HandoverRepository
if (!is_array($row)) {
return null;
}
$item = $row['helpdesk_handovers'] ?? $row;
if (!is_array($item) || !isset($item['id'])) {
// JOIN queries return nested arrays keyed by table name — merge all sub-arrays
$item = [];
foreach ($row as $key => $value) {
if (is_array($value)) {
$item = array_merge($item, $value);
} else {
$item[$key] = $value;
}
}
if (!isset($item['id'])) {
return null;
}