régler problème de dispos des coachs
This commit is contained in:
@@ -128,14 +128,13 @@ def configure_logging(app):
|
|||||||
app.logger.addHandler(app_handler)
|
app.logger.addHandler(app_handler)
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# 4. Console Handler (for development)
|
# 4. Console Handler (always enabled for debugging in both dev and production)
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
if os.getenv('FLASK_DEBUG', 'false').lower() == 'true':
|
console_handler = logging.StreamHandler()
|
||||||
console_handler = logging.StreamHandler()
|
console_handler.setLevel(log_level)
|
||||||
console_handler.setLevel(logging.DEBUG)
|
console_handler.setFormatter(formatter)
|
||||||
console_handler.setFormatter(formatter)
|
console_handler.addFilter(sensitive_filter)
|
||||||
console_handler.addFilter(sensitive_filter)
|
app.logger.addHandler(console_handler)
|
||||||
app.logger.addHandler(console_handler)
|
|
||||||
|
|
||||||
# Log startup information
|
# Log startup information
|
||||||
app.logger.info('Logging configured - Level: %s, Log directory: %s', log_level_name, log_dir)
|
app.logger.info('Logging configured - Level: %s, Log directory: %s', log_level_name, log_dir)
|
||||||
|
|||||||
@@ -85,12 +85,6 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.role == 'coach' %}
|
{% if current_user.role == 'coach' %}
|
||||||
<li>
|
|
||||||
<a href="{{ url_for('users.manage_coach_availability') }}" class="{% if request.endpoint == 'users.manage_coach_availability' %}active{% endif %}">
|
|
||||||
<i class="fas fa-clock"></i>
|
|
||||||
<span>Availability</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ url_for('users.notes_dashboard') }}" class="{% if request.endpoint == 'users.notes_dashboard' or request.endpoint == 'users.manage_team_notes' or request.endpoint == 'users.manage_personal_notes' %}active{% endif %}">
|
<a href="{{ url_for('users.notes_dashboard') }}" class="{% if request.endpoint == 'users.notes_dashboard' or request.endpoint == 'users.manage_team_notes' or request.endpoint == 'users.manage_personal_notes' %}active{% endif %}">
|
||||||
<i class="fas fa-sticky-note"></i>
|
<i class="fas fa-sticky-note"></i>
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions mt-4">
|
<div class="form-actions mt-4">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveAvailability()">
|
||||||
|
<i class="fas fa-save"></i> Save Availability
|
||||||
|
</button>
|
||||||
<button type="button" class="btn btn-secondary" onclick="clearAllAvailability()">
|
<button type="button" class="btn btn-secondary" onclick="clearAllAvailability()">
|
||||||
<i class="fas fa-trash"></i> Clear All
|
<i class="fas fa-trash"></i> Clear All
|
||||||
</button>
|
</button>
|
||||||
@@ -168,13 +171,18 @@ function saveAvailability() {
|
|||||||
|
|
||||||
fetch('{{ url_for("users.manage_coach_availability") }}', {
|
fetch('{{ url_for("users.manage_coach_availability") }}', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRFToken': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
body: JSON.stringify({ slots: slots })
|
body: JSON.stringify({ slots: slots })
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
flash('Availability saved!', 'success');
|
flash('Availability saved!', 'success');
|
||||||
|
} else {
|
||||||
|
flash(data.error || 'Error saving availability.', 'danger');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
@@ -188,7 +196,10 @@ function clearAllAvailability() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('{{ url_for("users.clear_coach_availability") }}', { method: 'POST' })
|
fetch('{{ url_for("users.clear_coach_availability") }}', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'X-CSRFToken': '{{ csrf_token() }}' }
|
||||||
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
|
|||||||
@@ -357,7 +357,10 @@ function saveCoachAvailability() {
|
|||||||
}
|
}
|
||||||
fetch('{{ url_for("users.manage_coach_availability") }}', {
|
fetch('{{ url_for("users.manage_coach_availability") }}', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRFToken': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
body: JSON.stringify({ slots: slots })
|
body: JSON.stringify({ slots: slots })
|
||||||
})
|
})
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
@@ -376,7 +379,10 @@ function saveCoachAvailability() {
|
|||||||
|
|
||||||
function clearAllAvailability() {
|
function clearAllAvailability() {
|
||||||
if (!confirm('Are you sure you want to clear all your availability slots?')) return;
|
if (!confirm('Are you sure you want to clear all your availability slots?')) return;
|
||||||
fetch('{{ url_for("users.clear_coach_availability") }}', { method: 'POST' })
|
fetch('{{ url_for("users.clear_coach_availability") }}', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'X-CSRFToken': '{{ csrf_token() }}' }
|
||||||
|
})
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user