Ajouter les permanences sans modifier les dates existantes
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
650ac39e90
commit
3527adb175
2 changed files with 9 additions and 4 deletions
|
|
@ -49,4 +49,13 @@
|
|||
|
||||
<div class="card"><div class="card-header"><strong>Historique {{ year }}</strong></div><div class="table-responsive"><table class="table table-sm mb-0"><thead><tr><th>Date</th><th>Type</th><th>Prévu</th><th>Réalisé</th><th>Écart</th><th>Note</th></tr></thead><tbody>{% for entry in entries[:50] %}<tr><td>{{ entry.work_date.strftime('%d/%m/%Y') }}</td><td>{{ entry.entry_type }}</td><td>{{ entry.planned_minutes }} min</td><td>{{ entry.actual_minutes }} min</td><td class="{% if entry.variance_minutes < 0 %}text-danger{% elif entry.variance_minutes > 0 %}text-success{% endif %}">{{ '+' if entry.variance_minutes > 0 else '' }}{{ entry.variance_minutes }} min</td><td>{{ entry.note or '—' }}</td></tr>{% else %}<tr><td colspan="6" class="text-muted">Aucune saisie.</td></tr>{% endfor %}</tbody></table></div></div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('input[name="work_dates"][checked]').forEach(function (input) {
|
||||
input.disabled = true;
|
||||
input.closest('label').classList.add('bg-light', 'text-muted');
|
||||
input.closest('label').title = 'Permanence déjà enregistrée — suppression possible dans le récapitulatif.';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -341,10 +341,6 @@ def save_permanences():
|
|||
day.lunch_start, day.lunch_end = template.lunch_start, template.lunch_end
|
||||
day.notes = "Permanence"
|
||||
closure.work_hours_type = "custom"
|
||||
elif current_day.weekday() < 5:
|
||||
existing = ClosureWorkDay.query.filter_by(closure_id=closure.id, work_date=current_day).first()
|
||||
if existing:
|
||||
db.session.delete(existing)
|
||||
current_day += timedelta(days=1)
|
||||
db.session.commit()
|
||||
flash(f"{len(selected_dates)} jour(s) de permanence enregistré(s) avec « {template.name} ».", "success")
|
||||
|
|
|
|||
Loading…
Reference in a new issue