Ajouter les totaux mensuels au calendrier
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
e97883d99d
commit
dfc182a8a9
2 changed files with 13 additions and 2 deletions
|
|
@ -139,6 +139,9 @@ def index():
|
|||
first_weekday = date(actual_year, month, 1).weekday()
|
||||
|
||||
weeks = []
|
||||
month_planned_minutes = 0
|
||||
month_overtime_minutes = 0
|
||||
month_delay_minutes = 0
|
||||
week = [None] * first_weekday # Cases vides avant le 1er jour
|
||||
|
||||
for day in range(1, days_in_month + 1):
|
||||
|
|
@ -161,6 +164,11 @@ def index():
|
|||
planned_minutes -= (source.lunch_end.hour * 60 + source.lunch_end.minute) - (source.lunch_start.hour * 60 + source.lunch_start.minute)
|
||||
entry = time_entries.get(d)
|
||||
actual_minutes = entry.actual_minutes if entry else 0
|
||||
month_planned_minutes += planned_minutes
|
||||
if entry and entry.entry_type == 'supplementaire':
|
||||
month_overtime_minutes += actual_minutes or 0
|
||||
elif entry and entry.entry_type == 'retard':
|
||||
month_delay_minutes += actual_minutes or 0
|
||||
fmt = lambda minutes: f"{minutes // 60}h{minutes % 60:02d}"
|
||||
deviation_hours = None
|
||||
deviation_class = None
|
||||
|
|
@ -197,7 +205,10 @@ def index():
|
|||
months_data.append({
|
||||
'name': months_names[month - 1],
|
||||
'year': actual_year,
|
||||
'weeks': weeks
|
||||
'weeks': weeks,
|
||||
'planned_hours': fmt(month_planned_minutes),
|
||||
'overtime_hours': fmt(month_overtime_minutes),
|
||||
'delay_hours': fmt(month_delay_minutes),
|
||||
})
|
||||
|
||||
# Statistiques
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
<div class="col-lg-4 col-md-6 mb-4">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
<strong>{{ month.name }} {{ month.year }}</strong>
|
||||
<strong>{{ month.name }} {{ month.year }}</strong><br><small class="text-muted">Prévu {{ month.planned_hours }}{% if month.overtime_hours != '0h00' %} · <span class="text-success">+{{ month.overtime_hours }} sup.</span>{% endif %}{% if month.delay_hours != '0h00' %} · <span class="text-danger">-{{ month.delay_hours }} dû</span>{% endif %}</small>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<table class="table table-sm table-bordered mb-0" style="font-size: 0.8rem;">
|
||||
|
|
|
|||
Loading…
Reference in a new issue