diff --git a/api/get_conversation_detail.php b/api/get_conversation_detail.php index e0e1c80..619cf16 100644 --- a/api/get_conversation_detail.php +++ b/api/get_conversation_detail.php @@ -135,7 +135,9 @@ try { 'in_service' => !empty($user['in_service']) ? true : false, 'in_service_by' => isset($user['in_service_by']) ? intval($user['in_service_by']) : null, 'in_service_at' => $user['in_service_at'] ?? null, - 'in_service_by_name' => $inServiceByName + 'in_service_by_name' => $inServiceByName, + 'advisor_requested' => !empty($user['advisor_requested']) ? true : false, + 'on_hold' => !empty($user['on_hold']) ? true : false ], 'conversations' => $conversations, 'total_conversations' => count($conversations) diff --git a/api/get_conversation_list.php b/api/get_conversation_list.php index 17a04f8..1a6a0c2 100644 --- a/api/get_conversation_list.php +++ b/api/get_conversation_list.php @@ -31,6 +31,7 @@ try { c.message_type as last_message_type, c.created_at as last_message_time, c.status as last_message_status, + u.advisor_requested as advisor_requested, COUNT(*) as total_conversations, SUM(CASE WHEN c.direction = 'incoming' AND c.status = 'received' THEN 1 ELSE 0 END) as unread_count FROM users u @@ -40,7 +41,7 @@ try { FROM conversations GROUP BY user_id ) - GROUP BY u.id, u.phone_number, u.name, c.content, c.direction, c.message_type, c.created_at, c.status + GROUP BY u.id, u.phone_number, u.name, c.content, c.direction, c.message_type, c.created_at, c.status, u.advisor_requested ORDER BY c.created_at DESC LIMIT 50" ); @@ -61,6 +62,7 @@ try { 'last_message_type' => $conv['last_message_type'] ?? 'text', 'last_message_time' => $conv['last_message_time'], 'last_message_status' => $conv['last_message_status'] ?? 'sent', + 'advisor_requested' => !empty($conv['advisor_requested']) ? true : false, 'total_conversations' => intval($conv['total_conversations']), 'unread_count' => intval($conv['unread_count']), 'time_ago' => timeAgo($conv['last_message_time']) diff --git a/assets/css/styles.css b/assets/css/styles.css index 185d7fd..b148420 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -1164,6 +1164,15 @@ body { box-shadow: 0 6px 18px rgba(11, 122, 87, 0.25); } +/* Conversation requiring advisor attention */ +.conversation-item.attention { + border-left: 4px solid #dc3545; + background: rgba(220, 53, 69, 0.03); +} +.conversation-item.attention .conversation-avatar { + box-shadow: 0 6px 18px rgba(220, 53, 69, 0.12); +} + /* Notification bell indicator when there are unseen notifications */ #notification-bell.has-notifications { position: relative; diff --git a/assets/js/app_simple.js b/assets/js/app_simple.js index 72713bd..a0e8149 100644 --- a/assets/js/app_simple.js +++ b/assets/js/app_simple.js @@ -515,6 +515,10 @@ class SimpleWhatsAppManager { // Add class to highlight unread conversation (darker green) const unreadClass = (conv.unread_count && conv.unread_count > 0) ? ' unread' : ''; + // Attention badge for advisor requests + const attentionBadge = conv.advisor_requested ? `
` : ''; + const attentionClass = conv.advisor_requested ? ' attention' : ''; + // Status icon const statusIcon = conv.last_direction === 'outgoing' ? '' @@ -528,7 +532,7 @@ class SimpleWhatsAppManager { : ''; html += ` -
+
${userInitial}
@@ -549,6 +553,7 @@ class SimpleWhatsAppManager {
${unreadBadge} + ${attentionBadge}
-
Cargando...
+
Cargando...
En línea -
+