alert_ok
This commit is contained in:
parent
6652354b33
commit
b64adb3a9a
@ -50,25 +50,6 @@ let isAddingRow = false;
|
|||||||
let currentRow: HTMLTableRowElement | null = null;
|
let currentRow: HTMLTableRowElement | null = null;
|
||||||
let currentMode: keyof typeof STORAGE_KEYS = 'pairing';
|
let currentMode: keyof typeof STORAGE_KEYS = 'pairing';
|
||||||
|
|
||||||
export function showAlert(message: string): void {
|
|
||||||
// Créer la popup si elle n'existe pas
|
|
||||||
let alertPopup = document.querySelector('.alert-popup');
|
|
||||||
if (!alertPopup) {
|
|
||||||
alertPopup = document.createElement('div');
|
|
||||||
alertPopup.className = 'alert-popup';
|
|
||||||
document.body.appendChild(alertPopup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Définir le message et afficher la popup
|
|
||||||
alertPopup.textContent = message;
|
|
||||||
(alertPopup as HTMLElement).style.display = 'block';
|
|
||||||
|
|
||||||
// Cacher la popup après 3 secondes
|
|
||||||
setTimeout(() => {
|
|
||||||
(alertPopup as HTMLElement).style.display = 'none';
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class AccountElement extends HTMLElement {
|
class AccountElement extends HTMLElement {
|
||||||
private dom: Node;
|
private dom: Node;
|
||||||
@ -250,6 +231,25 @@ class AccountElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private showAlert(message: string): void {
|
||||||
|
// Créer la popup si elle n'existe pas
|
||||||
|
let alertPopup = this.shadowRoot?.querySelector('.alert-popup');
|
||||||
|
if (!alertPopup) {
|
||||||
|
alertPopup = document.createElement('div');
|
||||||
|
alertPopup.className = 'alert-popup';
|
||||||
|
this.shadowRoot?.appendChild(alertPopup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définir le message et afficher la popup
|
||||||
|
alertPopup.textContent = message;
|
||||||
|
(alertPopup as HTMLElement).style.display = 'block';
|
||||||
|
|
||||||
|
// Cacher la popup après 3 secondes
|
||||||
|
setTimeout(() => {
|
||||||
|
(alertPopup as HTMLElement).style.display = 'none';
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fonctions de gestion des comptes et de l'interface utilisateur
|
// Fonctions de gestion des comptes et de l'interface utilisateur
|
||||||
private confirmDeleteAccount(): void {
|
private confirmDeleteAccount(): void {
|
||||||
@ -573,13 +573,13 @@ private confirmRow(): void {
|
|||||||
|
|
||||||
// Vérification des champs vides
|
// Vérification des champs vides
|
||||||
if (values.some(value => value === '')) {
|
if (values.some(value => value === '')) {
|
||||||
showAlert('Please fill in all fields');
|
this.showAlert('Please fill in all fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérification de la longueur de l'adresse SP
|
// Vérification de la longueur de l'adresse SP
|
||||||
if (values[0].length !== 118) {
|
if (values[0].length !== 118) {
|
||||||
showAlert('SP Address must be exactly 118 characters long');
|
this.showAlert('SP Address must be exactly 118 characters long');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ private deleteRow(button: HTMLButtonElement): void {
|
|||||||
// Vérifier le nombre de lignes restantes
|
// Vérifier le nombre de lignes restantes
|
||||||
const remainingRows = table.getElementsByTagName('tr').length;
|
const remainingRows = table.getElementsByTagName('tr').length;
|
||||||
if (remainingRows <= 2) {
|
if (remainingRows <= 2) {
|
||||||
showAlert('You must keep at least 2 devices paired');
|
this.showAlert('You must keep at least 2 devices paired');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1090,7 +1090,7 @@ private confirmWalletRow(): void {
|
|||||||
currentRow = null;
|
currentRow = null;
|
||||||
this.showWallet();
|
this.showWallet();
|
||||||
} else {
|
} else {
|
||||||
showAlert('Please complete all fields before confirming.');
|
this.showAlert('Please complete all fields before confirming.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,25 +40,6 @@ interface LocalNotification {
|
|||||||
time: string;
|
time: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showAlert(message: string): void {
|
|
||||||
// Créer la popup si elle n'existe pas
|
|
||||||
let alertPopup = document.querySelector('.alert-popup');
|
|
||||||
if (!alertPopup) {
|
|
||||||
alertPopup = document.createElement('div');
|
|
||||||
alertPopup.className = 'alert-popup';
|
|
||||||
document.body.appendChild(alertPopup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Définir le message et afficher la popup
|
|
||||||
alertPopup.textContent = message;
|
|
||||||
(alertPopup as HTMLElement).style.display = 'block';
|
|
||||||
|
|
||||||
// Cacher la popup après 3 secondes
|
|
||||||
setTimeout(() => {
|
|
||||||
(alertPopup as HTMLElement).style.display = 'none';
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class SignatureElement extends HTMLElement {
|
class SignatureElement extends HTMLElement {
|
||||||
private selectedMemberId: string | null = null;
|
private selectedMemberId: string | null = null;
|
||||||
@ -75,6 +56,25 @@ class SignatureElement extends HTMLElement {
|
|||||||
roleName: 'Default Role'
|
roleName: 'Default Role'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
private showAlert(message: string): void {
|
||||||
|
// Créer la popup si elle n'existe pas
|
||||||
|
let alertPopup = this.shadowRoot?.querySelector('.alert-popup');
|
||||||
|
if (!alertPopup) {
|
||||||
|
alertPopup = document.createElement('div');
|
||||||
|
alertPopup.className = 'alert-popup';
|
||||||
|
this.shadowRoot?.appendChild(alertPopup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définir le message et afficher la popup
|
||||||
|
alertPopup.textContent = message;
|
||||||
|
(alertPopup as HTMLElement).style.display = 'block';
|
||||||
|
|
||||||
|
// Cacher la popup après 3 secondes
|
||||||
|
setTimeout(() => {
|
||||||
|
(alertPopup as HTMLElement).style.display = 'none';
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
private signDocument(documentId: number, processId: number, isCommonDocument: boolean = false): void {
|
private signDocument(documentId: number, processId: number, isCommonDocument: boolean = false): void {
|
||||||
try {
|
try {
|
||||||
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
||||||
@ -112,7 +112,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
this.canUserSignDocument(targetDoc, currentUser?.name, currentUser);
|
this.canUserSignDocument(targetDoc, currentUser?.name, currentUser);
|
||||||
|
|
||||||
if (!canSign) {
|
if (!canSign) {
|
||||||
showAlert("You do not have the necessary rights to sign this document.");
|
this.showAlert("You do not have the necessary rights to sign this document.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error displaying modal:', error);
|
console.error('Error displaying modal:', error);
|
||||||
showAlert(error instanceof Error ? error.message : 'Error displaying modal');
|
this.showAlert(error instanceof Error ? error.message : 'Error displaying modal');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1220,7 +1220,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
// Add parameter validation
|
// Add parameter validation
|
||||||
if (!params || !params.processId) {
|
if (!params || !params.processId) {
|
||||||
console.error('Paramètres invalides:', params);
|
console.error('Paramètres invalides:', params);
|
||||||
showAlert('Invalid parameters for new request');
|
this.showAlert('Invalid parameters for new request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
const process = groupsMock.find(g => g.id === params.processId);
|
const process = groupsMock.find(g => g.id === params.processId);
|
||||||
if (!process) {
|
if (!process) {
|
||||||
console.error('Processus non trouvé:', params.processId);
|
console.error('Processus non trouvé:', params.processId);
|
||||||
showAlert('Process not found');
|
this.showAlert('Process not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,7 +1257,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error retrieving members:', error);
|
console.error('Error retrieving members:', error);
|
||||||
showAlert('Error retrieving members');
|
this.showAlert('Error retrieving members');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1401,7 +1401,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
|
|
||||||
const form = document.getElementById('newDocumentForm') as HTMLFormElement;
|
const form = document.getElementById('newDocumentForm') as HTMLFormElement;
|
||||||
if (!form) {
|
if (!form) {
|
||||||
showAlert('Form not found');
|
this.showAlert('Form not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,7 +1425,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
if (!documentName || !description || !deadline) {
|
if (!documentName || !description || !deadline) {
|
||||||
showAlert('Please fill in all required fields');
|
this.showAlert('Please fill in all required fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,7 +1435,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
const group = groups.find((g: Group) => g.id === processId);
|
const group = groups.find((g: Group) => g.id === processId);
|
||||||
|
|
||||||
if (!group) {
|
if (!group) {
|
||||||
showAlert('Process not found');
|
this.showAlert('Process not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1444,7 +1444,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!role) {
|
if (!role) {
|
||||||
showAlert('Role not found');
|
this.showAlert('Role not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1496,11 +1496,11 @@ class SignatureElement extends HTMLElement {
|
|||||||
|
|
||||||
// Reload the documents view with the updated data
|
// Reload the documents view with the updated data
|
||||||
this.showRoleDocuments(role, group);
|
this.showRoleDocuments(role, group);
|
||||||
showAlert('Document updated successfully!');
|
this.showAlert('Document updated successfully!');
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error saving:', error);
|
console.error('Error saving:', error);
|
||||||
showAlert('An error occurred while saving');
|
this.showAlert('An error occurred while saving');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1509,7 +1509,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
|
|
||||||
const form = document.getElementById('newDocumentForm') as HTMLFormElement;
|
const form = document.getElementById('newDocumentForm') as HTMLFormElement;
|
||||||
if (!form) {
|
if (!form) {
|
||||||
showAlert('Form not found');
|
this.showAlert('Form not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1521,7 +1521,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
const visibility = (form.querySelector('#visibility') as HTMLSelectElement)?.value;
|
const visibility = (form.querySelector('#visibility') as HTMLSelectElement)?.value;
|
||||||
|
|
||||||
if (!documentName || !description || !deadline) {
|
if (!documentName || !description || !deadline) {
|
||||||
showAlert('Please fill in all required fields');
|
this.showAlert('Please fill in all required fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1530,7 +1530,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
const group = groups.find((g: Group) => g.id === processId);
|
const group = groups.find((g: Group) => g.id === processId);
|
||||||
|
|
||||||
if (!group) {
|
if (!group) {
|
||||||
showAlert('Process not found');
|
this.showAlert('Process not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1577,18 +1577,18 @@ class SignatureElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.showProcessDetails(group, group.id);
|
this.showProcessDetails(group, group.id);
|
||||||
showAlert('Document common updated successfully!');
|
this.showAlert('Document common updated successfully!');
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error saving:', error);
|
console.error('Error saving:', error);
|
||||||
showAlert('An error occurred while saving');
|
this.showAlert('An error occurred while saving');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private submitRequest() {
|
private submitRequest() {
|
||||||
|
|
||||||
showAlert("Request submitted!");
|
this.showAlert("Request submitted!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private closeNewRequest() {
|
private closeNewRequest() {
|
||||||
@ -1610,7 +1610,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
).map(checkbox => (checkbox as HTMLInputElement).value);
|
).map(checkbox => (checkbox as HTMLInputElement).value);
|
||||||
|
|
||||||
if (!createdAt || !deadline || selectedMembers.length === 0) {
|
if (!createdAt || !deadline || selectedMembers.length === 0) {
|
||||||
showAlert('Please fill in all required fields and select at least one member.');
|
this.showAlert('Please fill in all required fields and select at least one member.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,7 +1623,7 @@ class SignatureElement extends HTMLElement {
|
|||||||
selectedMembers
|
selectedMembers
|
||||||
});
|
});
|
||||||
|
|
||||||
showAlert('Document request submitted successfully!');
|
this.showAlert('Document request submitted successfully!');
|
||||||
this.closeNewRequest();
|
this.closeNewRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1687,11 +1687,11 @@ class SignatureElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showAlert('Document signed successfully!');
|
this.showAlert('Document signed successfully!');
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error signing document:', error);
|
console.error('Error signing document:', error);
|
||||||
showAlert(error instanceof Error ? error.message : 'Error signing document');
|
this.showAlert(error instanceof Error ? error.message : 'Error signing document');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user