Skip to content

Commit e3b8246

Browse files
authored
Merge pull request #20 from chechojgb/responsive
style: agregar detalles de colas por operaciones
2 parents bdcc6c3 + 9bf90ff commit e3b8246

File tree

13 files changed

+177
-58
lines changed

13 files changed

+177
-58
lines changed

app/Http/Controllers/PostProxyController.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function pauseExtension(Request $request): JsonResponse
190190
$interface = "SIP/{$extension}";
191191
$queues = [];
192192
for ($i = 1; $i <= 120; $i++) {
193-
$queues[] = 'Q' . str_pad($i, 3, '0', STR_PAD_LEFT);
193+
$queues[] = 'Q' . $i;
194194
}
195195
$paused = 1;
196196
$reason = 'ACW';
@@ -216,7 +216,7 @@ public function unpauseExtension(Request $request): JsonResponse
216216
$interface = "SIP/{$extension}";
217217
$queues = [];
218218
for ($i = 1; $i <= 120; $i++) {
219-
$queues[] = 'Q' . str_pad($i, 3, '0', STR_PAD_LEFT);
219+
$queues[] = 'Q' . $i;
220220
}
221221
$paused = 0;
222222
$reason = 'ACW';
@@ -353,7 +353,7 @@ public function rankingCalls()
353353

354354
$baseUrl = $isOperationAR
355355
? "http://98.85.112.126:13009"
356-
: "http://10.57.251.181:13011";
356+
: "http://10.57.251.181:3009";
357357

358358
$response = Http::get("{$baseUrl}/api/llamadas/ranking?operation_id={$selectedOperation}");
359359

@@ -388,6 +388,15 @@ public function operationState($area): JsonResponse
388388
$data = $response->json();
389389
return response()->json($data);
390390
}
391+
public function operationQueueState($area): JsonResponse
392+
{
393+
$response = Http::get("http://10.57.251.181:3014/operacion/{$area}");
394+
if (!$response->successful()) {
395+
return response()->json(['error' => 'No se pudo obtener los datos'], 500);
396+
}
397+
$data = $response->json();
398+
return response()->json($data);
399+
}
391400

392401

393402

resources/js/components/agentsModalWrapper.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const AgentModalWrapper = ({ children, closeModal }) => {
3232
>
3333
<div
3434
onClick={(e) => e.stopPropagation()}
35-
className={`transform transition-all duration-300 ease-out ${
35+
className={`mx-2 transform transition-all duration-300 ease-out ${
3636
show ? 'opacity-100 scale-100' : 'opacity-0 scale-95'
3737
} bg-white dark:bg-gray-800 border rounded-xl p-4 shadow max-w-sm w-full`}
3838
>

resources/js/components/buttonPurple.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
import { useLoadStatus } from "./context/loadContext";
2+
import { themeByProject } from "./utils/theme";
3+
import { usePage } from "@inertiajs/react";
4+
15
function ButtonPurple({ content, onClick }) {
6+
const { props } = usePage();
7+
const proyecto = props?.auth?.user?.proyecto || 'AZZU';
8+
const theme = themeByProject[proyecto];
9+
210
return (
311
<button
412
onClick={onClick} // ← esto lo hace funcional
5-
className="text-sm font-medium text-purple-light-20 hover:underline dark:text-cyan-400 cursor-pointer"
13+
className={`text-sm font-medium ${theme.text} hover:underline cursor-pointer`}
614
>
715
{content}
816
</button>

resources/js/components/contentTableAgents.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function ContentTableAgents({ data, search, openModal, getStatusClass }) {
9191
<div className="overflow-x-auto">
9292

9393
<table className="min-w-[600px] w-full text-sm text-left text-gray-500 dark:text-gray-400 ">
94-
<thead className="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
94+
<thead className="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-800 dark:text-gray-400">
9595
{table.getHeaderGroups().map(headerGroup => (
9696
<tr key={headerGroup.id}>
9797
{headerGroup.headers.map(header => (
@@ -108,7 +108,7 @@ function ContentTableAgents({ data, search, openModal, getStatusClass }) {
108108
</thead>
109109
<tbody>
110110
{table.getRowModel().rows.map(row => (
111-
<tr key={row.id} className="bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600">
111+
<tr key={row.id} className="bg-white dark:bg-[#011111] border-b dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600">
112112
{row.getVisibleCells().map(cell => (
113113
<td key={cell.id} className="px-6 py-4">
114114
{flexRender(cell.column.columnDef.cell, cell.getContext())}

resources/js/components/tableAgents.jsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import React, { useState, useEffect } from 'react';
2+
import { usePage } from "@inertiajs/react";
23
import { Dropdown, DropdownDivider, DropdownItem } from "flowbite-react";
34
import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from "flowbite-react";
45
import AgentModalWrapper from '@/components/agentsModalWrapper';
56
import AgentModalContent from '@/components/agentsModalContent';
67
import ContentTableAgents from '@/components/contentTableAgents';
8+
import { useLoadStatus } from './context/loadContext';
9+
import { themeByProject } from './utils/theme';
10+
711
import axios from 'axios';
812

913
const AgentPanel = () => {
14+
const { props } = usePage();
15+
const proyecto = props?.auth?.user?.proyecto || 'AZZU';
16+
const theme = themeByProject[proyecto];
1017
const [modalOpen, setModalOpen] = useState(false);
1118
const [activeExtension, setActiveExtension] = useState(null);
1219
const [search, setSearch] = useState('');
@@ -94,7 +101,7 @@ const AgentPanel = () => {
94101
base: 'relative inline-block text-left',
95102
},
96103
floating: {
97-
target: 'bg-blue-400 hover:bg-blue-500/80 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-400 dark:border-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center z-50',
104+
target: `${theme.bgHard} ${theme.bgHover}/80 focus:ring-none dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-400 dark:border-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center z-50`,
98105
item: {
99106
base: 'block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white w-full text-left z-50',
100107
},
@@ -114,21 +121,21 @@ const AgentPanel = () => {
114121
return (
115122
<div className="rounded-lg mt-4 relative shadow-md sm:rounded-lg px-4 mb-16">
116123

117-
<div className="flex flex-wrap items-center px-4 py-2 text-sm dark:bg-gray-800 break-words max-w-full">
118-
<a href="/table/agents" className="text-purple-light-20">Tablas</a>
124+
<div className="flex flex-wrap items-center px-4 py-2 text-sm dark:bg-gray-900 break-words max-w-full">
125+
<a href="/table/agents" className={`${theme.text} `}>Tablas</a>
119126
<span className="mx-2 text-gray-500">/</span>
120127
<span>Agentes</span>
121128
<span className="mx-2 text-gray-500">{operation ? `/` : ''}</span>
122129
<span>{operation ? ` ${operation}` : ''}</span>
123130
</div>
124131

125-
<div className=" overflow-hidden shadow-sm pb-60">
126-
<div className="flex flex-col lg:flex-row flex-wrap items-start lg:items-center justify-between gap-4 px-4 pb-4 pt-2 bg-white dark:bg-gray-900">
132+
<div className="overflow-hidden shadow-sm pb-60">
133+
<div className="flex flex-col lg:flex-row flex-wrap items-start lg:items-center justify-between gap-4 px-4 pb-4 pt-2 ">
127134
<div className="w-full lg:w-auto mb-2 relative [&_.dropdown-menu]:w-auto [&_.dropdown-menu]:max-w-xs [&_.dropdown-menu]:mx-auto [&_.dropdown-menu]:z-50">
128135
<Dropdown
129136
label="Selecciona la operación"
130137
theme={customTheme}
131-
className="w-full"
138+
className={`w-full dark:bg-gray-900 `}
132139
>
133140
{userOps.map((op) => (
134141
<DropdownItem
@@ -137,7 +144,7 @@ const AgentPanel = () => {
137144
startPolling(op);
138145
setOperation(op);
139146
}}
140-
className='z-99'
147+
className='z-99 '
141148
>
142149
{op}
143150
</DropdownItem>
@@ -149,7 +156,7 @@ const AgentPanel = () => {
149156
{Object.entries(stats).map(([key, value]) => (
150157
<div
151158
key={key}
152-
className="text-center bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
159+
className="text-center border border-gray-200 dark:border-gray-700
153160
rounded-xl px-4 py-2 shadow"
154161
>
155162
<p className="text-xs text-gray-500 dark:text-gray-400">{key}</p>
@@ -169,7 +176,7 @@ const AgentPanel = () => {
169176
type="text"
170177
value={search}
171178
onChange={(e) => setSearch(e.target.value)}
172-
className="w-full sm:w-64 block p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white"
179+
className="w-full sm:w-64 block p-2 pl-10 text-sm text-gray-900 border border-gray-200 rounded-xl bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-900 dark:border-gray-700 dark:placeholder-gray-400 dark:text-white shadow"
173180
placeholder="Buscar agente..."
174181
/>
175182
</div>

resources/js/components/utils/theme.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const themeByProject = {
44
textSafe: 'text-purple-400',
55
bg: 'bg-purple-light-20',
66
bgSafe: 'bg-purple-100',
7+
bgHard: 'bg-purple-400',
78
bgHover: 'hover-bg-purple-light-20',
89
border: 'border-purple-light-20',
910
},
@@ -12,6 +13,7 @@ export const themeByProject = {
1213
textSafe: 'text-green-400',
1314
bg: 'bg-green-200',
1415
bgSafe: 'bg-green-100',
16+
bgHard: 'bg-green-400',
1517
bgHover: 'hover:bg-green-300',
1618
border: 'border-green-500',
1719
},
@@ -20,6 +22,7 @@ export const themeByProject = {
2022
textSafe: 'text-red-400',
2123
bg: 'bg-red-200',
2224
bgSafe: 'bg-red-100',
25+
bgHard: 'bg-red-400',
2326
bgHover: 'hover:bg-red-300',
2427
border: 'border-red-500',
2528
},

resources/js/components/welcome/callPerOperationChart.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Link } from "@inertiajs/react";
1+
import { Link,usePage } from "@inertiajs/react";
22
import {
33
Chart as ChartJS,
44
CategoryScale,
@@ -10,10 +10,10 @@ import {
1010
} from 'chart.js';
1111
import { Bar } from 'react-chartjs-2';
1212
import { useEffect, useState } from 'react';
13-
import { useLoadStatus } from "../context/loadContext";
1413
import DiscordLoader from '@/components/discordloader';
1514
import axios from "axios";
16-
15+
import { useLoadStatus } from "../context/loadContext";
16+
import { themeByProject } from "../utils/theme";
1717
ChartJS.register(
1818
CategoryScale,
1919
LinearScale,
@@ -58,6 +58,9 @@ const options = {
5858
const labels = ['Soporte', 'Trámites', 'Retención', 'Móvil', 'Pruebas'];
5959

6060
export default function CallsPerOperationChart() {
61+
const { props } = usePage();
62+
const proyecto = props?.auth?.user?.proyecto || 'AZZU';
63+
const theme = themeByProject[proyecto];
6164
const [loading, setLoading] = useState(true);
6265
const { allLoaded, markLoaded } = useLoadStatus();
6366
const [callData, setCallData] = useState({
@@ -117,15 +120,15 @@ export default function CallsPerOperationChart() {
117120
};
118121

119122
return (
120-
<div className="absolute inset-0 p-6 flex flex-col justify-between">
123+
<div className="absolute inset-0 p-6 flex flex-col justify-between ">
121124
{!allLoaded ? (
122125
<DiscordLoader />
123126
) : (
124127
<>
125128
<div className="flex justify-between items-center mb-4">
126129
<h3 className="text-lg font-semibold text-gray-900 dark:text-white">Llamadas por operación</h3>
127130
<span className="text-sm text-gray-500">
128-
<Link className='text-purple-light-20' href={route('showOperationState')}>Hoy</Link>
131+
<Link className={`${theme.text}`} href={route('showOperationState')}>Hoy</Link>
129132
</span>
130133
</div>
131134
<Bar options={options} data={chartData} className="h-full w-full" />

resources/js/components/welcome/dashboard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function Dashboard() {
4040
<AgentRankingWidget/>
4141
</div>
4242
<div className="border-sidebar-border/70 dark:border-sidebar-border relative overflow-hidden rounded-xl border ">
43-
{/* <CallsPerOperationChart/> */}
43+
<CallsPerOperationChart/>
4444
</div>
4545
</div>
4646

resources/js/components/welcome/prevTable.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ function PrevTable() {
6666
<td className="px-4 py-2 text-gray-700 dark:text-gray-300">{p.extension}</td>
6767
<td className="px-4 py-2 text-gray-700 dark:text-gray-300">{p.accountcode}</td>
6868
<td className="px-4 py-2">
69-
<span className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-700 dark:text-green-100">
70-
● Activo ({p.member?.estado || 'Desconocido'})
69+
<span className="inline-flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-700 dark:text-green-100 whitespace-nowrap">
70+
<span className="text-sm"></span>
71+
Activo ({p.member?.estado || 'Desconocido'})
7172
</span>
7273
</td>
7374
</tr>

resources/js/pages/agentState.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export default function TableAgents() {
3434
</div>
3535

3636
<div className="grid grid-cols-1 xl:grid-cols-3 gap-8">
37-
<div className="xl:col-span-2 bg-white dark:bg-gray-900 rounded-2xl shadow-lg border border-gray-100 dark:border-gray-800 p-6 flex flex-col">
37+
<div className="xl:col-span-2 rounded-2xl shadow-lg border border-gray-100 dark:border-gray-800 p-6 flex flex-col">
3838
<h2 className="text-xl font-semibold text-indigo-700 dark:text-indigo-300 mb-4">Tabla de Ranking</h2>
3939
<div className="flex-1">
40-
<LoadProvider total={1}>
40+
{/* <LoadProvider total={1}>
4141
<AgentRankingWidget />
42-
</LoadProvider>
42+
</LoadProvider> */}
4343
</div>
4444
</div>
45-
<div className="bg-gradient-to-br from-purple-100 via-white to-indigo-100 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900 rounded-2xl shadow-lg border border-gray-100 dark:border-gray-800 p-6 flex flex-col justify-between">
45+
<div className=" from-purple-100 via-white to-indigo-100 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900 rounded-2xl shadow-lg border border-gray-100 dark:border-gray-800 p-6 flex flex-col justify-between">
4646
<h3 className="text-lg font-bold text-purple-700 dark:text-purple-300 mb-2">Resumen del Día</h3>
4747
<ul className="space-y-3 text-base text-gray-700 dark:text-gray-200">
4848
<li>
@@ -64,7 +64,7 @@ export default function TableAgents() {
6464
</div>
6565
</div>
6666

67-
<div className="bg-white dark:bg-gray-900 rounded-2xl shadow-lg border border-gray-100 dark:border-gray-800 p-8 mt-8">
67+
<div className=" rounded-2xl shadow-lg border border-gray-100 dark:border-gray-800 p-8 mt-8">
6868
<h2 className="text-xl font-semibold text-indigo-700 dark:text-indigo-300 mb-4">📈 Evolución Horaria</h2>
6969
<p className="text-base text-gray-700 dark:text-gray-300 mb-4">
7070
Visualiza el comportamiento de las llamadas a lo largo del día para identificar tendencias y optimizar recursos.

0 commit comments

Comments
 (0)