ajout d'un boite de reception et dépot des documents (pour les contrats)
This commit is contained in:
@@ -67,6 +67,12 @@
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{{ url_for('users.list_contracts') }}" class="{% if request.endpoint and 'contracts' in request.endpoint %}active{% endif %}">
|
||||
<i class="fas fa-file-contract"></i>
|
||||
<span>Contracts</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ url_for('users.profile') }}" class="{% if request.endpoint == 'users.profile' %}active{% endif %}">
|
||||
<i class="fas fa-user"></i>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block title %}Contracts - TryoutPro{% endblock %}
|
||||
{% block page_title %}Contracts{% endblock %}
|
||||
{% block breadcrumb %}<span class="breadcrumb">Home / <a href="{{ url_for('users.profile') }}">Profile</a> / Contracts</span>{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
{% if current_user.role in ['president', 'manager', 'coach'] %}
|
||||
<a href="{{ url_for('users.upload_contract') }}" class="btn btn-primary">
|
||||
<i class="fas fa-upload"></i> Upload Contract
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-file-contract"></i> Contract Dropbox</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if contracts %}
|
||||
<div class="table-container">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Player</th>
|
||||
<th>Team</th>
|
||||
<th>Contract</th>
|
||||
<th>Status</th>
|
||||
<th>Uploaded</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for contract in contracts %}
|
||||
<tr>
|
||||
<td>{{ contract.player.full_name }}</td>
|
||||
<td>{{ contract.team.name if contract.team else 'N/A' }}</td>
|
||||
<td>{{ contract.original_filename }}</td>
|
||||
<td>
|
||||
{% if contract.status == 'signed' %}
|
||||
<span class="badge badge-success">Signed</span>
|
||||
{% else %}
|
||||
<span class="badge badge-warning">Pending Signature</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ contract.uploaded_at.strftime('%Y-%m-%d %H:%M') }}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="{{ url_for('users.download_contract', contract_id=contract.id) }}" class="btn btn-sm btn-primary" title="Download">
|
||||
<i class="fas fa-download"></i> Download
|
||||
</a>
|
||||
{% if contract.signed_file_path %}
|
||||
<a href="{{ url_for('users.download_signed_contract', contract_id=contract.id) }}" class="btn btn-sm btn-success" title="Download Signed">
|
||||
<i class="fas fa-file-signature"></i> Signed
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current_user.role == 'player' and contract.status == 'pending' %}
|
||||
<button class="btn btn-sm btn-warning" onclick="showUploadSignedForm({{ contract.id }})" title="Upload Signed Contract">
|
||||
<i class="fas fa-upload"></i> Return Signed
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<i class="fas fa-file-contract"></i>
|
||||
<h4>No contracts found</h4>
|
||||
{% if current_user.role == 'player' %}
|
||||
<p>No contracts have been uploaded for you yet. Contact your coach or manager.</p>
|
||||
{% else %}
|
||||
<p>No contracts have been uploaded yet. Upload a contract using the button above.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if current_user.role == 'player' %}
|
||||
<!-- Upload Signed Contract Modal -->
|
||||
<div id="uploadSignedModal" class="modal hidden">
|
||||
<div class="modal-backdrop" onclick="hideUploadSignedForm()"></div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3>Upload Signed Contract</h3>
|
||||
<button class="modal-close" onclick="hideUploadSignedForm()">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="uploadSignedForm" 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 Contract File</label>
|
||||
<input type="file" id="signed_file" name="signed_file" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png" required>
|
||||
<small class="form-text text-muted">Accepted formats: PDF, DOC, DOCX, JPG, PNG</small>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn btn-secondary" onclick="hideUploadSignedForm()">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Upload Signed Contract</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
function showUploadSignedForm(contractId) {
|
||||
document.getElementById('uploadSignedForm').action = '/users/contracts/' + contractId + '/upload_signed';
|
||||
document.getElementById('uploadSignedModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
function hideUploadSignedForm() {
|
||||
document.getElementById('uploadSignedModal').classList.add('hidden');
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
{% block header_actions %}
|
||||
<div class="header-actions">
|
||||
<a href="{{ url_for('users.list_contracts') }}" class="btn btn-sm btn-info">
|
||||
<i class="fas fa-file-contract"></i> Contracts
|
||||
</a>
|
||||
<a href="{{ url_for('users.edit_profile') }}" class="btn btn-sm btn-primary">
|
||||
<i class="fas fa-edit"></i> Edit Profile
|
||||
</a>
|
||||
@@ -151,5 +154,41 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contracts Card -->
|
||||
{% if user.role == 'player' %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-file-contract"></i> My Contracts</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if contracts %}
|
||||
<div class="detail-grid">
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Contracts Pending</span>
|
||||
<span class="detail-value">
|
||||
{% set pending = contracts | selectattr('status', 'equalto', 'pending') | list %}
|
||||
<span class="badge badge-{{ 'warning' if pending|length > 0 else 'success' }}">{{ pending | length }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Contracts Signed</span>
|
||||
<span class="detail-value">
|
||||
{% set signed = contracts | selectattr('status', 'equalto', 'signed') | list %}
|
||||
<span class="badge {% if signed %}badge-success{% else %}badge-secondary{% endif %}">{{ signed | length }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<a href="{{ url_for('users.list_contracts') }}" class="btn btn-sm btn-primary">
|
||||
<i class="fas fa-folder-open"></i> View All Contracts
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted">No contracts have been uploaded for you yet.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block title %}Upload Contract - TryoutPro{% endblock %}
|
||||
{% block page_title %}Upload Contract{% endblock %}
|
||||
{% block breadcrumb %}<span class="breadcrumb">Home / <a href="{{ url_for('users.list_contracts') }}">Contracts</a> / Upload</span>{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3><i class="fas fa-upload"></i> Upload Contract for Player</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('users.upload_contract') }}" enctype="multipart/form-data" class="form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="player_id">Select Player</label>
|
||||
<select id="player_id" name="player_id" class="form-select" required>
|
||||
<option value="">-- Select a player --</option>
|
||||
{% for player in players %}
|
||||
<option value="{{ player.id }}">{{ player.full_name }}{% if player.org_team %} - {{ player.org_team.name }}{% endif %}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="contract_file">Contract File</label>
|
||||
<input type="file" id="contract_file" name="contract_file" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png" required>
|
||||
<small class="form-text text-muted">Accepted formats: PDF, DOC, DOCX, JPG, PNG</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="notes">Notes (Optional)</label>
|
||||
<textarea id="notes" name="notes" rows="3" placeholder="Add any notes about this contract..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<a href="{{ url_for('users.list_contracts') }}" class="btn btn-secondary">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-upload"></i> Upload Contract
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user