choices.js pour la liste déroulante
This commit is contained in:
1 parent
a22344d664
commit
c7c48360fd
8 files changed
+392
-39
No files matched your search
Vendored
+1
@@ -0,0 +1 @@
|
||||
.choices{position:relative;overflow:hidden;margin-bottom:24px;font-size:16px}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices [hidden]{display:none!important}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one] .choices__button{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:focus,.choices[data-type*=select-one] .choices__button:hover{opacity:1}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px #005f75}.choices[data-type*=select-one] .choices__item[data-placeholder] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:#333 transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent #333;margin-top:-7.5px}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices[data-type*=select-multiple] .choices__button,.choices[data-type*=text] .choices__button{position:relative;display:inline-block;margin:0-4px 0 8px;padding-left:16px;border-left:1px solid #003642;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);background-size:8px;width:8px;line-height:1;opacity:.75;border-radius:0}.choices[data-type*=select-multiple] .choices__button:focus,.choices[data-type*=select-multiple] .choices__button:hover,.choices[data-type*=text] .choices__button:focus,.choices[data-type*=text] .choices__button:hover{opacity:1}.choices__inner{display:inline-block;vertical-align:top;width:100%;background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;min-height:44px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:4px 16px 4px 4px;width:100%}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single .choices__item{width:100%}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#005f75;border:1px solid #004a5c;color:#fff;word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:3.75px}.choices__list--multiple .choices__item.is-highlighted{background-color:#004a5c;border:1px solid #003642}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown,.choices__list[aria-expanded]{display:none;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden;word-break:break-all}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{display:block}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:#b7b7b7}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-bLine truncated
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! choices.js v11.1.0 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Choices=t()}(this,(function(){"use strict";var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};function t(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},i.apply(this,arguments)};function n(e,t,i){if(i||2===arguments.length)for(var n,s=0,o=t.length;s<o;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var s,o="ADD_CHOICE",r="REMOVE_CHOICE",c="FILTER_CHOICES",a="ACTIVATE_CHOICES",h="CLEAR_CHOICES",l="ADD_GROUP",u="ADD_ITEM",d="REMOVE_ITEM",p="HIGHLIGHT_ITEM",f="search",m="removeItem",g="highlightItem",v=["fuseOptions","classNames"],_="select-one",y="select-multiple",b=function(e){return{type:o,choice:e}},E=function(e){return{type:u,item:e}},C=function(e){return{type:d,item:e}},S=function(e,t){return{type:p,item:e,highlighted:t}},w=function(e){return Array.from({length:e},(function(){return Math.floor(36*Math.random()+0).toString(36)})).join("")},I=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return I(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,""")},A=(s=document.createElement("div"),function(e){s.innerHTML=e.trim();for(var t=s.children[0];s.firstChild;)s.removeChild(s.firstChild);return t}),x=function(e,t){return"function"==typeof e?e(I(t),t):e},O=function(e){return"function"==typeof e?e():e},L=function(e){if("string"==typeof e)return e;if("object"==typeof e){if("trusted"in e)return e.trusted;if("raw"in e)return e.raw}return""},M=function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""},T=function(e,t){return e?M(t):I(t)},N=function(e,t,i){e.innerHTML=T(t,i)},k=function(e,t){return e.rank-t.rank},F=function(e){return Array.isArray(e)?e:[e]},D=function(e){return e&&Array.isArray(e)?e.map((function(e){return".".concat(e)})).join(""):".".concat(e)},P=function(e,t){var i;(i=e.classList).add.apply(i,F(t))},j=function(e,t){var i;(i=e.classList).remove.apply(i,F(t))},R=function(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}return{}},K=function(){function e(e){var t=e.type,i=e.classNames;this.element=e.element,this.classNames=i,this.type=t,this.isActive=!1}return e.prototype.show=function(){return P(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},e.prototype.hide=function(){return j(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},e}(),V=function(){function e(e){var t=e.type,i=e.classNames,n=e.position;this.element=e.element,this.classNames=i,this.type=t,this.position=n,this.isOpen=!1,this.isFlipped=!1,this.isDisabled=!1,this.isLoading=!1}return e.prototype.shouldFlip=function(e,t){var i=!1;return"auto"===this.position?i=this.element.getBoundingClientRect().top-t>=0&&!window.matchMedia("(min-height: ".concat(e+1,"px)")).matches:"top"===this.position&&(i=!0),i},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype.open=function(e,t){P(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e,t)&&(P(this.element,this.classNames.flippedState),this.isFlipped=!0)},e.prototype.close=function(){j(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(j(this.element,this.classNames.flippedState),this.isFlipped=!1)},e.prototype.addFocusState=function(){P(this.element,this.classNames.focusState)},e.prototype.removeFocusState=function(){j(this.element,this.classNames.focusState)},e.prototype.enable=function(){j(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===_&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},e.prototype.disable=function(){P(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","trueLine truncated
|
||||
@@ -0,0 +1,43 @@
|
||||
# Changelog - SimpleConnect Electron
|
||||
|
||||
## [1.0.1] - 2024-09-04
|
||||
|
||||
### Ajouté
|
||||
- **Intégration de Choices.js** pour améliorer l'expérience utilisateur sur le champ de sélection des postes téléphoniques
|
||||
- Liste déroulante moderne avec recherche instantanée
|
||||
- Support de plus de 100 postes téléphoniques
|
||||
- Interface utilisateur améliorée avec scrollbar personnalisée
|
||||
- Recherche en temps réel pour trouver rapidement un poste
|
||||
|
||||
### Modifié
|
||||
- **Page de connexion** : Remplacement du select HTML natif par Choices.js
|
||||
- Amélioration visuelle avec thème personnalisé (violet #667eea)
|
||||
- Ajout d'animations fluides à l'ouverture/fermeture
|
||||
- Indicateurs visuels pour les éléments sélectionnés
|
||||
- **Chargement des ressources** : Migration des CDN vers des fichiers locaux pour éviter les problèmes CSP
|
||||
- **Gestion des erreurs** : Amélioration du fallback en cas d'échec de chargement de Choices.js
|
||||
|
||||
### Technique
|
||||
- Installation locale de Choices.js via npm
|
||||
- Copie des fichiers CSS/JS dans le répertoire racine
|
||||
- Adaptation du code pour gérer window.Choices dans le contexte Electron
|
||||
- Suppression du groupement par centaine pour simplifier la navigation
|
||||
|
||||
### Corrigé
|
||||
- Résolution des erreurs Content Security Policy (CSP) avec les ressources CDN
|
||||
- Correction de l'initialisation de Choices.js dans l'environnement Electron
|
||||
- Fix des classes CSS pour éviter les erreurs DOMTokenList
|
||||
|
||||
## [1.0.0] - 2024-09-01
|
||||
|
||||
### Fonctionnalités initiales
|
||||
- **Connexion agent** avec authentification locale
|
||||
- **Intégration SignalR** pour la communication avec le serveur CTI
|
||||
- **Récupération dynamique** des postes téléphoniques depuis le serveur
|
||||
- **Multi-centres** : Gestion de plusieurs centres médicaux
|
||||
- **Webviews intégrées** pour afficher les plannings médicaux
|
||||
- **Simulation d'appels** pour les tests et démos
|
||||
- **Interface moderne** avec design violet/blanc
|
||||
- **Statistiques journalières** : Compteurs d'appels et de RDV
|
||||
- **Notes rapides** : Prise de notes pendant les appels
|
||||
- **Indicateurs visuels** : États de connexion SignalR et disponibilité agent
|
||||
+5
-3
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>SimpleConnect - Gestion Centralisée des Plannings</title>
|
||||
<link rel="stylesheet" href="choices.min.css">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -19,9 +20,9 @@
|
||||
<form id="loginForm">
|
||||
<input type="text" id="accessCode" placeholder="Code d'accès" required>
|
||||
<input type="password" id="password" placeholder="Mot de passe" required>
|
||||
<input type="text" id="terminal" list="terminalList" placeholder="Poste téléphonique" required autocomplete="off">
|
||||
<datalist id="terminalList">
|
||||
</datalist>
|
||||
<select id="terminal" required>
|
||||
<option value="" placeholder>Chargement des postes...</option>
|
||||
</select>
|
||||
<button type="submit">Se connecter</button>
|
||||
<div id="loginError" class="error-message"></div>
|
||||
</form>
|
||||
@@ -113,6 +114,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="choices.min.js"></script>
|
||||
<script src="renderer.js"></script>
|
||||
<script src="cti-simulator.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -34,10 +34,10 @@ function createWindow() {
|
||||
// Charger l'interface HTML
|
||||
mainWindow.loadFile('index.html');
|
||||
|
||||
// Ouvrir les DevTools en mode développement
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// Ouvrir les DevTools en mode développement ou toujours pour debug
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
// }
|
||||
|
||||
// Gérer la fermeture de la fenêtre
|
||||
mainWindow.on('closed', () => {
|
||||
|
||||
+2
-1
@@ -67,6 +67,7 @@
|
||||
"url": "https://github.com/simpleconnect/electron-app.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/signalr": "^9.0.6"
|
||||
"@microsoft/signalr": "^9.0.6",
|
||||
"choices.js": "^11.1.0"
|
||||
}
|
||||
}
|
||||
+123
-26
@@ -1,4 +1,5 @@
|
||||
const { ipcRenderer } = require('electron');
|
||||
// Choices est maintenant chargé via CDN dans index.html
|
||||
|
||||
// Variables globales
|
||||
let currentAgent = null;
|
||||
@@ -26,8 +27,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
const initialStatus = await ipcRenderer.invoke('get-signalr-status');
|
||||
updateSignalRIndicator(initialStatus);
|
||||
|
||||
// Toujours charger les terminaux (simulation ou réels)
|
||||
loadTerminals();
|
||||
// Charger immédiatement les terminaux pour la page de login
|
||||
await loadTerminals();
|
||||
|
||||
// Vérifier si un agent est déjà connecté
|
||||
const agentData = await ipcRenderer.invoke('get-current-agent');
|
||||
@@ -438,53 +439,149 @@ async function saveNotes() {
|
||||
|
||||
// === GESTION DES TERMINAUX ===
|
||||
let availableTerminals = []; // Stocker les terminaux disponibles
|
||||
let terminalChoices = null; // Instance Choices.js
|
||||
|
||||
async function loadTerminals() {
|
||||
const terminalInput = document.getElementById('terminal');
|
||||
const terminalDatalist = document.getElementById('terminalList');
|
||||
if (!terminalInput || !terminalDatalist) return;
|
||||
const terminalSelect = document.getElementById('terminal');
|
||||
if (!terminalSelect) {
|
||||
console.log('Element terminal non trouvé');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Chargement des terminaux...');
|
||||
|
||||
try {
|
||||
// Récupérer les terminaux depuis le serveur SignalR
|
||||
const terminals = await ipcRenderer.invoke('get-terminal-list');
|
||||
availableTerminals = terminals || [];
|
||||
console.log(`${terminals.length} terminaux récupérés`);
|
||||
|
||||
// Préparer les options pour Choices.js
|
||||
const choicesData = [];
|
||||
if (terminals && terminals.length > 0) {
|
||||
// Vider la datalist
|
||||
terminalDatalist.innerHTML = '';
|
||||
|
||||
// Ajouter chaque terminal comme option
|
||||
// Afficher tous les terminaux sans groupement
|
||||
terminals.forEach(terminal => {
|
||||
const option = document.createElement('option');
|
||||
option.value = terminal;
|
||||
terminalDatalist.appendChild(option);
|
||||
choicesData.push({
|
||||
value: terminal.toString(),
|
||||
label: `Poste ${terminal}`
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Détruire l'instance existante si elle existe
|
||||
if (terminalChoices) {
|
||||
terminalChoices.destroy();
|
||||
terminalChoices = null;
|
||||
}
|
||||
|
||||
// Vider le select avant d'initialiser Choices
|
||||
terminalSelect.innerHTML = '';
|
||||
|
||||
// Attendre que Choices soit disponible (chargé via CDN)
|
||||
if (typeof window.Choices === 'undefined') {
|
||||
console.log('Choices.js pas encore chargé, utilisation du select natif');
|
||||
// Fallback : utiliser le select natif
|
||||
terminalSelect.innerHTML = '<option value="">Sélectionner un poste...</option>';
|
||||
if (terminals && terminals.length > 0) {
|
||||
terminals.forEach(terminal => {
|
||||
const option = document.createElement('option');
|
||||
option.value = terminal;
|
||||
option.textContent = `Poste ${terminal}`;
|
||||
terminalSelect.appendChild(option);
|
||||
});
|
||||
}
|
||||
// Réessayer après un court délai
|
||||
setTimeout(() => loadTerminals(), 500);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Initialisation de Choices.js avec', choicesData.length, 'options');
|
||||
|
||||
try {
|
||||
// Créer une nouvelle instance Choices.js
|
||||
terminalChoices = new window.Choices(terminalSelect, {
|
||||
searchEnabled: true,
|
||||
searchPlaceholderValue: 'Rechercher un poste...',
|
||||
itemSelectText: '',
|
||||
noResultsText: 'Aucun poste trouvé',
|
||||
noChoicesText: 'Aucun poste disponible',
|
||||
shouldSort: false,
|
||||
searchResultLimit: 20,
|
||||
renderChoiceLimit: -1,
|
||||
placeholder: true,
|
||||
placeholderValue: 'Sélectionner un poste téléphonique',
|
||||
choices: choicesData.length > 0 ? choicesData : [{value: '', label: 'Aucun poste disponible', disabled: true}],
|
||||
searchFields: ['label', 'value'],
|
||||
fuseOptions: {
|
||||
includeScore: true,
|
||||
threshold: 0.3
|
||||
},
|
||||
classNames: {
|
||||
containerOuter: ['choices', 'choices-terminal'],
|
||||
containerInner: 'choices__inner',
|
||||
input: 'choices__input',
|
||||
inputCloned: 'choices__input--cloned',
|
||||
list: 'choices__list',
|
||||
listItems: 'choices__list--multiple',
|
||||
listSingle: 'choices__list--single',
|
||||
listDropdown: 'choices__list--dropdown',
|
||||
item: 'choices__item',
|
||||
itemSelectable: 'choices__item--selectable',
|
||||
itemDisabled: 'choices__item--disabled',
|
||||
itemChoice: 'choices__item--choice',
|
||||
placeholder: 'choices__placeholder',
|
||||
group: 'choices__group',
|
||||
groupHeading: 'choices__heading',
|
||||
button: 'choices__button',
|
||||
activeState: 'is-active',
|
||||
focusState: 'is-focused',
|
||||
openState: 'is-open',
|
||||
disabledState: 'is-disabled',
|
||||
highlightedState: 'is-highlighted',
|
||||
hiddenState: 'is-hidden',
|
||||
flippedState: 'is-flipped',
|
||||
loadingState: 'is-loading',
|
||||
noResults: 'has-no-results',
|
||||
noChoices: 'has-no-choices'
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Choices.js initialisé avec succès');
|
||||
|
||||
// Restaurer la dernière sélection si disponible
|
||||
const lastTerminal = localStorage.getItem('last-terminal');
|
||||
if (lastTerminal && terminals.includes(lastTerminal)) {
|
||||
terminalInput.value = lastTerminal;
|
||||
if (lastTerminal && availableTerminals.map(t => t.toString()).includes(lastTerminal)) {
|
||||
terminalChoices.setChoiceByValue(lastTerminal.toString());
|
||||
}
|
||||
|
||||
// Activer l'input
|
||||
terminalInput.disabled = false;
|
||||
terminalInput.placeholder = 'Poste téléphonique (tapez pour filtrer)';
|
||||
} else {
|
||||
terminalDatalist.innerHTML = '';
|
||||
terminalInput.placeholder = 'Aucun poste disponible';
|
||||
terminalInput.disabled = true;
|
||||
} catch (choicesError) {
|
||||
console.error('Erreur lors de l\'initialisation de Choices.js:', choicesError);
|
||||
console.error('Stack:', choicesError.stack);
|
||||
// En cas d'erreur, utiliser le select natif
|
||||
terminalSelect.innerHTML = '<option value="">Erreur de chargement - voir console</option>';
|
||||
if (terminals && terminals.length > 0) {
|
||||
terminals.forEach(terminal => {
|
||||
const option = document.createElement('option');
|
||||
option.value = terminal;
|
||||
option.textContent = `Poste ${terminal}`;
|
||||
terminalSelect.appendChild(option);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Erreur chargement des terminaux:', error);
|
||||
terminalDatalist.innerHTML = '';
|
||||
terminalInput.placeholder = 'Erreur de chargement';
|
||||
terminalInput.disabled = true;
|
||||
console.error('Erreur générale chargement des terminaux:', error);
|
||||
// En cas d'erreur, utiliser le select natif
|
||||
const terminalSelect = document.getElementById('terminal');
|
||||
if (terminalSelect) {
|
||||
terminalSelect.innerHTML = '<option value="">Erreur de chargement</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Valider que le terminal saisi existe dans la liste
|
||||
function validateTerminal(terminal) {
|
||||
return availableTerminals.includes(terminal);
|
||||
return availableTerminals.map(t => t.toString()).includes(terminal.toString());
|
||||
}
|
||||
|
||||
// === GESTION INDICATEUR SIGNALR ===
|
||||
|
||||
+213
-6
@@ -128,13 +128,220 @@ body {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Style pour l'input avec datalist */
|
||||
#loginForm input[list] {
|
||||
cursor: text;
|
||||
/* === CUSTOMISATION CHOICES.JS === */
|
||||
.choices-terminal {
|
||||
margin-bottom: 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#loginForm input[list]::-webkit-calendar-picker-indicator {
|
||||
display: none;
|
||||
.choices-terminal .choices__inner {
|
||||
background-color: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
padding: 10px 12px;
|
||||
min-height: 44px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__inner:hover {
|
||||
border-color: #b1b1b1;
|
||||
}
|
||||
|
||||
.choices-terminal.is-focused .choices__inner,
|
||||
.choices-terminal.is-open .choices__inner {
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
.choices-terminal.is-open .choices__inner {
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__list--dropdown {
|
||||
border: 1px solid #667eea;
|
||||
border-top: none;
|
||||
border-radius: 0 0 5px 5px;
|
||||
margin-top: 0;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
background: white;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__list--dropdown .choices__list {
|
||||
max-height: 280px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Scrollbar personnalisée */
|
||||
.choices-terminal .choices__list--dropdown .choices__list::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__list--dropdown .choices__list::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__list--dropdown .choices__list::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__list--dropdown .choices__list::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
|
||||
/* Barre de recherche dans le dropdown */
|
||||
.choices-terminal .choices__input {
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #e1e4e8;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
padding: 8px 12px;
|
||||
margin: 8px;
|
||||
width: calc(100% - 16px);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__input::placeholder {
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Items */
|
||||
.choices-terminal .choices__item--choice {
|
||||
padding: 10px 15px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
transition: background-color 0.15s;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__item--choice:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__item--choice.is-highlighted {
|
||||
background-color: #e8efff;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__item--choice.is-highlighted::after {
|
||||
content: '↵';
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
color: #667eea;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__item--choice.is-selected {
|
||||
background-color: #667eea;
|
||||
color: white;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__item--choice.is-selected::after {
|
||||
content: '✓';
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Groupes de postes */
|
||||
.choices-terminal .choices__group {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__heading {
|
||||
padding: 10px 15px 6px 15px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #6c757d;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
background: linear-gradient(to bottom, #f8f9fa, #ffffff);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__group:first-child .choices__heading {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__group .choices__item {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__placeholder {
|
||||
opacity: 0.6;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* Message "aucun résultat" */
|
||||
.choices-terminal .choices__item--disabled {
|
||||
background-color: #f8f9fa;
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
/* Animation d'ouverture */
|
||||
@keyframes choicesSlideDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.choices-terminal.is-open .choices__list--dropdown {
|
||||
animation: choicesSlideDown 0.2s ease-out;
|
||||
}
|
||||
|
||||
/* Flèche du dropdown */
|
||||
.choices-terminal::after {
|
||||
content: '▼';
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
color: #666;
|
||||
font-size: 10px;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.choices-terminal.is-open::after {
|
||||
transform: translateY(-50%) rotate(180deg);
|
||||
}
|
||||
|
||||
/* Bouton de suppression */
|
||||
.choices-terminal .choices__button {
|
||||
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjOTk5IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==');
|
||||
background-size: 8px;
|
||||
padding: 0;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
opacity: 0.5;
|
||||
margin: 0;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.choices-terminal .choices__button:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#loginForm button {
|
||||
@@ -618,4 +825,4 @@ header {
|
||||
.call-details {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
}
|
||||
}.choices{position:relative;overflow:hidden;margin-bottom:24px;font-size:16px}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices [hidden]{display:none!important}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one] .choices__button{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:focus,.choices[data-type*=select-one] .choices__button:hover{opacity:1}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px #005f75}.choices[data-type*=select-one] .choices__item[data-placeholder] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:#333 transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent #333;margin-top:-7.5px}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices[data-type*=select-multiple] .choices__button,.choices[data-type*=text] .choices__button{position:relative;display:inline-block;margin:0-4px 0 8px;padding-left:16px;border-left:1px solid #003642;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);background-size:8px;width:8px;line-height:1;opacity:.75;border-radius:0}.choices[data-type*=select-multiple] .choices__button:focus,.choices[data-type*=select-multiple] .choices__button:hover,.choices[data-type*=text] .choices__button:focus,.choices[data-type*=text] .choices__button:hover{opacity:1}.choices__inner{display:inline-block;vertical-align:top;width:100%;background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;min-height:44px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:4px 16px 4px 4px;width:100%}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single .choices__item{width:100%}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#005f75;border:1px solid #004a5c;color:#fff;word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:3.75px}.choices__list--multiple .choices__item.is-highlighted{background-color:#004a5c;border:1px solid #003642}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown,.choices__list[aria-expanded]{display:none;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden;word-break:break-all}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{display:block}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:#b7b7b7}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-Line truncated
|
||||
Reference in new issue
Block a user