premiere iteration de la gestion des documents
CI - Security, Lint & Tests / validate (push) Failing after 1m20s
CI - Security, Lint & Tests / validate (push) Failing after 1m20s
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block title %}{{ _('My Documents') }} - UdeS team manager{% endblock %}
|
||||
{% block page_title %}{{ _('My Documents') }}{% endblock %}
|
||||
{% block breadcrumb %}<span class="breadcrumb">Home / <a href="{{ url_for('users.profile') }}">Profile</a> / {{ _('My Documents') }}</span>{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% set kind_labels = {
|
||||
'player': _('Player contract'),
|
||||
'coach': _('Coach contract'),
|
||||
'manager': _('Manager contract'),
|
||||
'team': _('Team agreement'),
|
||||
'code_of_conduct': _('Code of conduct'),
|
||||
'ethics_code': _('Ethics code'),
|
||||
} %}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-file-contract"></i> {{ _('Documents to sign or acknowledge') }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if documents %}
|
||||
<div class="table-container">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ _('Document') }}</th>
|
||||
<th>{{ _('Type') }}</th>
|
||||
<th>{{ _('Version') }}</th>
|
||||
<th>{{ _('Status') }}</th>
|
||||
<th>{{ _('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in documents %}
|
||||
<tr>
|
||||
<td>{{ entry.document.title }}</td>
|
||||
<td>{{ kind_labels.get(entry.document.kind, entry.document.kind) }}</td>
|
||||
<td>
|
||||
{% if entry.document.current_version %}
|
||||
{{ _('Version %(number)s', number=entry.document.current_version.version) }}
|
||||
{% else %}—{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% set assignment = entry.assignment %}
|
||||
{% if assignment is not none and assignment.status == 'signed' %}
|
||||
<span class="badge badge-success">{{ _('Signed') }}</span>
|
||||
{% elif assignment is not none and assignment.status == 'acknowledged' %}
|
||||
<span class="badge badge-success">{{ _('Acknowledged') }}</span>
|
||||
{% else %}
|
||||
<span class="badge badge-warning">{{ _('Pending') }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{% if entry.document.current_version %}
|
||||
<a href="{{ url_for('users.download_document', version_id=entry.document.current_version.id) }}" class="btn btn-sm btn-primary" title="{{ _('Download') }}">
|
||||
<i class="fas fa-download"></i> {{ _('Download') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if assignment is not none and assignment.status == 'pending' %}
|
||||
{% if entry.document.requires_signature %}
|
||||
<button class="btn btn-sm btn-warning" data-action="show-sign-document" data-assignment-id="{{ assignment.id }}" title="{{ _('Return signed') }}">
|
||||
<i class="fas fa-upload"></i> {{ _('Sign') }}
|
||||
</button>
|
||||
{% else %}
|
||||
<form method="POST" data-ajax action="{{ url_for('users.acknowledge_document', assignment_id=assignment.id) }}" class="inline-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
<button type="submit" class="btn btn-sm btn-success" data-confirm="{{ _('Confirm that you have read and understood this document') }}">
|
||||
<i class="fas fa-check"></i> {{ _('Acknowledge') }}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% elif not teams_progress %}
|
||||
<div class="empty-state">
|
||||
<i class="fas fa-file-contract"></i>
|
||||
<h4>{{ _('No documents for now') }}</h4>
|
||||
<p>{{ _('Nothing has been published for you yet. Check back later.') }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if teams_progress %}
|
||||
{% for block in teams_progress %}
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-users"></i> {{ _('Team progress') }} — {{ block.team.name }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-container">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ _('Member') }}</th>
|
||||
<th>{{ _('Role') }}</th>
|
||||
{% for doc in block.documents %}<th>{{ doc.title }}</th>{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for member in block.members %}
|
||||
<tr>
|
||||
<td>{{ member.user.username }}</td>
|
||||
<td>{{ member.user.role | capitalize }}</td>
|
||||
{% for doc in block.documents %}
|
||||
{% set status = member.statuses.get(doc.id) %}
|
||||
<td>
|
||||
{% if status == 'signed' %}<span class="badge badge-success">{{ _('Signed') }}</span>
|
||||
{% elif status == 'acknowledged' %}<span class="badge badge-success">{{ _('Acknowledged') }}</span>
|
||||
{% elif status == 'pending' %}<span class="badge badge-warning">{{ _('Pending') }}</span>
|
||||
{% else %}<span class="text-muted">{{ _('Not required') }}</span>{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Upload signed document modal -->
|
||||
<div id="signDocumentModal" class="modal hidden">
|
||||
<div class="modal-backdrop" data-action="hide-sign-document"></div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3>{{ _('Upload Signed Document') }}</h3>
|
||||
<button class="modal-close" data-action="hide-sign-document">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="signDocumentForm" method="POST" enctype="multipart/form-data" class="form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
<div class="form-group">
|
||||
<label for="signed_file">{{ _('Select Signed Document File') }}</label>
|
||||
<input type="file" id="signed_file" name="signed_file" accept=".pdf" required>
|
||||
<small class="form-text text-muted">{{ _('Accepted format: PDF') }}</small>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn btn-secondary" data-action="hide-sign-document">{{ _('Cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ _('Upload Signed Document') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script nonce="{{ csp_nonce }}">
|
||||
function showSignDocumentForm(assignmentId) {
|
||||
document.getElementById('signDocumentForm').action = '/users/documents/assignments/' + assignmentId + '/sign';
|
||||
document.getElementById('signDocumentModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
function hideSignDocumentForm() {
|
||||
document.getElementById('signDocumentModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
registerActions({
|
||||
'show-sign-document': function (element) {
|
||||
showSignDocumentForm(element.getAttribute('data-assignment-id'));
|
||||
},
|
||||
'hide-sign-document': hideSignDocumentForm,
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user