Upload via GUI (258 Dateien)
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/common.php';
|
||||
|
||||
api_require_method('GET');
|
||||
$staff = api_require_staff();
|
||||
$pdo = get_db();
|
||||
$departmentIds = staff_department_ids($staff);
|
||||
[$filter, $params] = dept_filter_sql($departmentIds, 'id');
|
||||
$stmt = $pdo->prepare('SELECT id, name, is_active FROM departments WHERE 1=1' . $filter . ' ORDER BY name');
|
||||
$stmt->execute($params);
|
||||
$departments = array_map(
|
||||
fn(array $row) => ['id' => (int) $row['id'], 'name' => $row['name'] . ($row['is_active'] ? '' : ' (deaktiviert)')],
|
||||
$stmt->fetchAll()
|
||||
);
|
||||
$priorities = array_map(
|
||||
fn(array $row) => ['id' => (int) $row['id'], 'name' => $row['name'], 'color' => $row['color']],
|
||||
$pdo->query('SELECT id, name, color FROM priorities ORDER BY sort_order')->fetchAll()
|
||||
);
|
||||
$agents = array_map(
|
||||
fn(array $row) => ['id' => (int) $row['id'], 'name' => $row['name']],
|
||||
$pdo->query('SELECT id, name FROM staff WHERE is_active = 1 ORDER BY name')->fetchAll()
|
||||
);
|
||||
$statuses = array_map(function (string $value): array {
|
||||
[$label, $color] = status_label($value);
|
||||
return ['value' => $value, 'label' => $label, 'color' => $color];
|
||||
}, MOBILE_API_STATUSES);
|
||||
|
||||
$tags = array_map(
|
||||
fn(array $row) => ['id' => (int) $row['id'], 'name' => $row['name']],
|
||||
$pdo->query('SELECT id, name FROM tags ORDER BY name')->fetchAll()
|
||||
);
|
||||
|
||||
$health = has_permission($staff, 'manage_email_addresses') ? system_health($pdo) : [];
|
||||
|
||||
api_json([
|
||||
'health' => $health,
|
||||
'staff' => api_staff_payload($staff),
|
||||
'departments' => $departments,
|
||||
'priorities' => $priorities,
|
||||
'agents' => $agents,
|
||||
'statuses' => $statuses,
|
||||
'tags' => $tags,
|
||||
'liveChatEnabled' => get_setting('live_chat_enabled', '0') === '1',
|
||||
]);
|
||||
Reference in New Issue
Block a user