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,118 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block title %}{{ _('Documents') }} - Admin{% endblock %}
|
||||
{% block page_title %}{{ _('Document management') }}{% endblock %}
|
||||
{% block breadcrumb %}<span class="breadcrumb">Home / <a href="{{ url_for('admin.dashboard') }}">Admin</a> / {{ _('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-plus-circle"></i> {{ _('Create a document') }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" data-ajax action="{{ url_for('admin.create_document') }}" class="form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
<div class="form-group">
|
||||
<label for="title">{{ _('Title') }}</label>
|
||||
<input type="text" id="title" name="title" class="form-control" required
|
||||
placeholder="{{ _('e.g. Player contract 2026-2027') }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="kind">{{ _('Type') }}</label>
|
||||
<select id="kind" name="kind" class="form-select" required>
|
||||
<option value="">{{ _('-- Select a type --') }}</option>
|
||||
{% for kind in kinds %}
|
||||
<option value="{{ kind }}">{{ kind_labels.get(kind, kind) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<small class="form-text text-muted">
|
||||
{{ _('The type decides who must complete the document and how.') }}
|
||||
</small>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-plus"></i> {{ _('Create document') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-file-contract"></i> {{ _('Existing documents') }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-container">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ _('Title') }}</th>
|
||||
<th>{{ _('Type') }}</th>
|
||||
<th>{{ _('Version') }}</th>
|
||||
<th>{{ _('Availability') }}</th>
|
||||
<th>{{ _('Progress') }}</th>
|
||||
<th>{{ _('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for document in documents %}
|
||||
<tr>
|
||||
<td><a href="{{ url_for('admin.document_detail', doc_id=document.id) }}">{{ document.title }}</a></td>
|
||||
<td>{{ kind_labels.get(document.kind, document.kind) }}</td>
|
||||
<td>
|
||||
{% if document.current_version %}
|
||||
{{ _('v%(number)s', number=document.current_version.version) }}
|
||||
{% else %}{{ _('None') }}{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if document.is_published %}
|
||||
<span class="badge badge-success">{{ _('Downloadable') }}</span>
|
||||
{% else %}
|
||||
<span class="badge badge-secondary">{{ _('Hidden') }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% set completed, pending = document.completion_counts() %}
|
||||
<span class="badge badge-info">{{ _('%(completed)s done', completed=completed) }}</span>
|
||||
<span class="badge badge-warning">{{ _('%(pending)s pending', pending=pending) }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="{{ url_for('admin.document_detail', doc_id=document.id) }}" class="btn btn-sm btn-primary" title="{{ _('Manage') }}">
|
||||
<i class="fas fa-cog"></i> {{ _('Manage') }}
|
||||
</a>
|
||||
<form method="POST" data-ajax action="{{ url_for('admin.toggle_document_published', doc_id=document.id) }}" class="inline-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
{% if document.is_published %}
|
||||
<button type="submit" class="btn btn-sm btn-secondary" title="{{ _('Hide') }}">
|
||||
<i class="fas fa-eye-slash"></i> {{ _('Hide') }}
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="submit" class="btn btn-sm btn-success" title="{{ _('Make downloadable') }}">
|
||||
<i class="fas fa-eye"></i> {{ _('Publish') }}
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6" class="text-muted">{{ _('No documents yet. Create one above.') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user