fix: correzione doppia consuntivazione note. fix: utenti ldap. feat: ricerca per customer useers. feat: possiblità di rimuovere le note
This commit is contained in:
+75
-4
@@ -186,8 +186,8 @@ const App = {
|
||||
if (cached) {
|
||||
try {
|
||||
this.lookups = JSON.parse(cached);
|
||||
if (!this.lookups.config || this.lookups.config.autoTimeMinHour === undefined) {
|
||||
throw new Error('Outdated config cache (missing autoTimeMinHour)');
|
||||
if (!this.lookups.config || this.lookups.config.autoTimeMinHour === undefined || !this.lookups.customerUsers || !this.lookups.customer_users_version_1) {
|
||||
throw new Error('Outdated config cache (missing autoTimeMinHour or customerUsers)');
|
||||
}
|
||||
this.lookupsLoaded = true;
|
||||
return;
|
||||
@@ -198,16 +198,17 @@ const App = {
|
||||
}
|
||||
|
||||
try {
|
||||
const [queues, states, priorities, users, types, config] = await Promise.all([
|
||||
const [queues, states, priorities, users, types, config, customerUsers] = await Promise.all([
|
||||
this.api('/api/queues'),
|
||||
this.api('/api/states'),
|
||||
this.api('/api/priorities'),
|
||||
this.api('/api/users'),
|
||||
this.api('/api/types'),
|
||||
this.api('/api/config').catch(() => ({ defaultAgentLogin: '' })),
|
||||
this.api('/api/customer-users/search?q=').catch(() => []),
|
||||
]);
|
||||
|
||||
this.lookups = { queues, states, priorities, users, types, config };
|
||||
this.lookups = { queues, states, priorities, users, types, config, customerUsers, customer_users_version_1: true };
|
||||
localStorage.setItem('otrs_lookups', JSON.stringify(this.lookups));
|
||||
this.lookupsLoaded = true;
|
||||
} catch (err) {
|
||||
@@ -576,6 +577,76 @@ const App = {
|
||||
console.warn('Failed to update sidebar badges:', e);
|
||||
}
|
||||
},
|
||||
|
||||
/** Custom confirm dialog in the center of the screen */
|
||||
confirm(title, message, options = {}) {
|
||||
return new Promise((resolve) => {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.style.position = 'fixed';
|
||||
overlay.style.top = '0';
|
||||
overlay.style.left = '0';
|
||||
overlay.style.width = '100vw';
|
||||
overlay.style.height = '100vh';
|
||||
overlay.style.background = 'rgba(0, 0, 0, 0.6)';
|
||||
overlay.style.backdropFilter = 'blur(4px)';
|
||||
overlay.style.display = 'flex';
|
||||
overlay.style.alignItems = 'center';
|
||||
overlay.style.justifyContent = 'center';
|
||||
overlay.style.zIndex = '99999';
|
||||
overlay.style.opacity = '0';
|
||||
overlay.style.transition = 'opacity 0.2s ease';
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.style.background = 'var(--bg-card, #1e1e2e)';
|
||||
card.style.border = '1px solid var(--border-subtle, #313244)';
|
||||
card.style.borderRadius = 'var(--radius-lg, 12px)';
|
||||
card.style.padding = 'var(--space-lg, 24px)';
|
||||
card.style.width = '100%';
|
||||
card.style.maxWidth = '400px';
|
||||
card.style.boxShadow = 'var(--shadow-lg, 0 10px 30px rgba(0,0,0,0.5))';
|
||||
card.style.transform = 'scale(0.9)';
|
||||
card.style.transition = 'transform 0.2s ease';
|
||||
card.className = 'confirm-dialog-card';
|
||||
|
||||
card.innerHTML = `
|
||||
<h3 style="margin-top: 0; margin-bottom: var(--space-xs, 8px); color: var(--text-primary, #cdd6f4); font-size: 1.2rem; font-weight: 600;">${title}</h3>
|
||||
<p style="margin-bottom: var(--space-lg, 24px); color: var(--text-muted, #a6adc8); font-size: 0.95rem; line-height: 1.5;">${message}</p>
|
||||
<div style="display: flex; gap: var(--space-sm, 12px); justify-content: flex-end;">
|
||||
<button id="confirm-btn-cancel" class="btn btn-ghost" style="height: 36px; font-size: 0.9rem; padding: 0 16px; border-radius: var(--radius-md, 6px);">${options.cancelText || 'Annulla'}</button>
|
||||
<button id="confirm-btn-ok" class="btn btn-danger" style="height: 36px; font-size: 0.9rem; padding: 0 16px; border-radius: var(--radius-md, 6px); font-weight: 500; cursor: pointer;">${options.confirmText || 'Conferma'}</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
overlay.appendChild(card);
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
// Trigger animations
|
||||
requestAnimationFrame(() => {
|
||||
overlay.style.opacity = '1';
|
||||
card.style.transform = 'scale(1)';
|
||||
});
|
||||
|
||||
const cleanUp = (result) => {
|
||||
overlay.style.opacity = '0';
|
||||
card.style.transform = 'scale(0.9)';
|
||||
setTimeout(() => {
|
||||
overlay.remove();
|
||||
resolve(result);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const btnCancel = card.querySelector('#confirm-btn-cancel');
|
||||
const btnOk = card.querySelector('#confirm-btn-ok');
|
||||
|
||||
btnCancel.addEventListener('click', () => cleanUp(false));
|
||||
btnOk.addEventListener('click', () => cleanUp(true));
|
||||
|
||||
// Close on backdrop click
|
||||
overlay.addEventListener('click', (e) => {
|
||||
if (e.target === overlay) cleanUp(false);
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
// Start the app when DOM is ready
|
||||
|
||||
Reference in New Issue
Block a user