diff --git a/public/style/signature.css b/public/style/signature.css index 2596cea..f2c6b83 100755 --- a/public/style/signature.css +++ b/public/style/signature.css @@ -1221,9 +1221,7 @@ body { background: white; padding: 20px; border-radius: 8px; - width: 90%; - max-width: 600px; - max-height: 90vh; + width: 97%; } .modal-header { diff --git a/src/pages/signature/signature.ts b/src/pages/signature/signature.ts index b7ecc8d..ee59750 100755 --- a/src/pages/signature/signature.ts +++ b/src/pages/signature/signature.ts @@ -782,20 +782,33 @@ function showRoleDocuments(role: { const detailsArea = document.createElement('div'); detailsArea.id = `role-documents-${displayRole.name}`; detailsArea.className = 'process-details'; - + // Filtrer les documents accessibles + const accessibleDocuments = (displayRole.documents || []).filter((doc: { + name: string; + visibility: string; + createdAt: string | null | undefined; + deadline: string | null | undefined; + signatures: DocumentSignature[]; + id: number; + description?: string; + status?: string; + }) => + canUserAccessDocument(doc, displayRole.name, currentUser.processRoles?.[0]?.role || '') + ); + detailsArea.innerHTML = ` -
-

${displayRole.name} Documents

-
- + -
-
-

Documents

-
- ${(displayRole.documents || []).length > 0 ? - (displayRole.documents || []).map((document: { +
+
+

Documents

+
+ ${accessibleDocuments.map((document: { name: string; visibility: string; createdAt: string | null | undefined; @@ -844,21 +857,22 @@ function showRoleDocuments(role: {
` : `

Document vierge - En attente de création

- + ${canUserAccessDocument(document, displayRole.name, currentUser.processRoles?.[0]?.role || '') ? ` + + ` : ''} `}
`; - }).join('') - : '

No documents available for this role

' - } + }).join('')} +
@@ -1585,7 +1599,7 @@ function signDocument(documentId: number, processId: number, isCommonDocument: b ${Array.isArray(targetDoc.files) && targetDoc.files.length > 0 ? targetDoc.files.map((file: any) => `
- ��� + ${file.name} @@ -1755,10 +1769,10 @@ if (typeof window !== 'undefined') { // Ajouter cette fonction helper function canUserAccessDocument(document: any, roleId: string, currentUserRole: string): boolean { - // Si l'utilisateur a le même rôle, il peut voir tous les documents + // Si l'utilisateur a le même rôle, il peut voir et modifier tous les documents if (roleId === currentUserRole) { return true; } - // Sinon, il ne peut voir que les documents publics + // Pour les autres rôles, il ne peut que voir les documents publics return document.visibility === 'public'; }