Fix operator panel color when available (#7815)

This commit is contained in:
frytimo
2026-03-25 22:15:41 -03:00
committed by GitHub
parent 9191d4dfa2
commit 9259aff1a4
3 changed files with 19 additions and 11 deletions

View File

@@ -428,11 +428,11 @@ body.op-dragging, body.op-dragging * {
.op-ext-dnd .op-ext-icon { background-color: #f1b0b7; }
.op-ext-dnd .op-ext-icon .op-ext-status-icon { color: #a71d2a; }
.op-ext-dnd .op-ext-info { background-color: #fce4e7; }
/* registered (no explicit status) — green */
.op-ext-registered { border-color: #28a745; background-color: #d4edda; }
.op-ext-registered .op-ext-icon { background-color: #c3e6cb; }
.op-ext-registered .op-ext-icon .op-ext-status-icon { color: #1e7e34; }
.op-ext-registered .op-ext-info { background-color: #eaf6ec; }
/* registered (no explicit status / no user attached) — blue */
.op-ext-registered { border-color: #4a8cdb; background-color: #d6e9f8; }
.op-ext-registered .op-ext-icon { background-color: #c3ddf2; }
.op-ext-registered .op-ext-icon .op-ext-status-icon { color: #2b6cb0; }
.op-ext-registered .op-ext-info { background-color: #eaf3fc; }
/* user status: logged out — grey */
.op-ext-logged-out { border-color: #9da5ae; background-color: #e2e3e5; }
.op-ext-logged-out .op-ext-icon { background-color: #d6d8db; }

View File

@@ -587,7 +587,7 @@ class operator_panel_service extends base_websocket_system_service implements we
$ext['registered'] = isset($registered_map[$ext_num]);
$ext['registration_count'] = $registered_map[$ext_num] ?? 0;
$ext['user_uuid'] = $user_status_map[$ext_num]['user_uuid'] ?? null;
$ext['user_status'] = $user_status_map[$ext_num]['user_status'] ?? 'Logged Out';
$ext['user_status'] = $user_status_map[$ext_num]['user_status'] ?? '';
}
unset($ext);
$this->debug('extensions_active trace [step6] annotation complete: extensions=' . count($extensions));

View File

@@ -1408,7 +1408,11 @@ function sync_status_buttons() {
if (!Array.isArray(user_own_extensions) || user_own_extensions.length === 0) return;
const ext = extensions_map.get(user_own_extensions[0]);
if (!ext) return;
const current = (ext.user_status || '').trim();
let current = (ext.user_status || '').trim();
// If user has no explicit status but is registered, treat as Available
if (!current && ext.user_uuid && ext.registered === true) {
current = 'Available';
}
if (!current) return;
document.querySelectorAll('.op-status-btn').forEach(b => {
if (b.getAttribute('data-status') === current) {
@@ -1510,8 +1514,11 @@ function render_ext_block(ext, is_mine) {
css_state = 'op-ext-available';
} else if (user_status_raw === 'Logged Out') {
css_state = 'op-ext-logged-out';
} else if (ext.user_uuid && user_status_raw === '') {
// Has a user but no explicit status set — treat as Available when registered
css_state = 'op-ext-available';
} else {
// Registered with no explicit/active status — blue
// Registered with no user attached or unknown status — blue
css_state = 'op-ext-registered';
}
@@ -1564,7 +1571,6 @@ function render_ext_block(ext, is_mine) {
}
const mine_cls = is_mine ? ' op-ext-mine' : '';
const mine_label = is_mine ? `<span class="op-ext-mine-label" title="${esc(text['label-your_extension'] || 'Your extension')}">&#9735;</span>` : '';
const data_uuid = call_uuid ? ` data-call-uuid="${esc(call_uuid)}"` : '';
// Always allow extension-to-extension drag originate; backend routing handles
// availability, call forwarding, follow_me, and voicemail decisions.
@@ -1620,9 +1626,12 @@ function render_ext_block(ext, is_mine) {
status_hover = text['label-status_logged_out_or_unknown'] || text['label-status_logged_out'] || 'Logged Out';
break;
default:
if (reg) {
if (reg && ext.user_uuid) {
status_icon = 'status_available';
status_hover = text['label-status_available'] || 'Available';
} else if (reg) {
status_icon = 'status_available';
status_hover = text['label-status_registered'] || 'Registered';
} else {
status_icon = 'status_logged_out';
status_hover = text['label-status_logged_out_or_unknown'] || text['label-status_logged_out'] || 'Logged Out';
@@ -1686,7 +1695,6 @@ function render_ext_block(ext, is_mine) {
` ondrop="on_ext_drop('${esc(num)}', event)">` +
`<div class="op-ext-icon" title="${esc(status_hover)}"><img class="op-ext-status-icon" src="../operator_panel/resources/images/${status_icon}.png" width="28" height="28" alt="${esc(status_hover)}"></div>` +
`<div class="op-ext-info${has_live_call ? ' op-has-live-call' : ''}">` +
`${mine_label}` +
`<div class="op-ext-number">${esc(num)}</div>` +
dialpad_html +
(show_name ? `<div class="op-ext-name" title="${esc(raw_name)}">${esc(raw_name)}</div>` : '') +