Skip to content

Commit

Permalink
Merge pull request #78 from nens/reinout-vrije-dagen
Browse files Browse the repository at this point in the history
Vrije dagen overzicht
  • Loading branch information
reinout authored Dec 19, 2024
2 parents 375f176 + 242003d commit 7a6bc9b
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 41 deletions.
69 changes: 53 additions & 16 deletions trs/migrations/0010_auto_20241216_1859.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,75 @@
# Generated by Django 3.2.16 on 2024-12-16 18:59

from django.db import migrations, models
from django.db import migrations
from django.db import models

import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('trs', '0009_auto_20220708_1535'),
("trs", "0009_auto_20220708_1535"),
]

operations = [
migrations.CreateModel(
name='MPC',
name="MPC",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='naam')),
('description', models.CharField(blank=True, max_length=255, verbose_name='omschrijving')),
('target', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='omzetdoelstelling')),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255, verbose_name="naam")),
(
"description",
models.CharField(
blank=True, max_length=255, verbose_name="omschrijving"
),
),
(
"target",
models.DecimalField(
decimal_places=2,
default=0,
max_digits=12,
verbose_name="omzetdoelstelling",
),
),
],
options={
'verbose_name': 'Markt-product-combinatie',
'verbose_name_plural': 'Markt-product-combinaties',
'ordering': ['name'],
"verbose_name": "Markt-product-combinatie",
"verbose_name_plural": "Markt-product-combinaties",
"ordering": ["name"],
},
),
migrations.AddField(
model_name='person',
name='mpc',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='persons', to='trs.mpc', verbose_name='markt-product-combinatie'),
model_name="person",
name="mpc",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="persons",
to="trs.mpc",
verbose_name="markt-product-combinatie",
),
),
migrations.AddField(
model_name='project',
name='mpc',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='trs.mpc', verbose_name='markt-product-combinatie'),
model_name="project",
name="mpc",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="projects",
to="trs.mpc",
verbose_name="markt-product-combinatie",
),
),
]
6 changes: 3 additions & 3 deletions trs/migrations/0011_remove_project_startup_meeting_done.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class Migration(migrations.Migration):

dependencies = [
('trs', '0010_auto_20241216_1859'),
("trs", "0010_auto_20241216_1859"),
]

operations = [
migrations.RemoveField(
model_name='project',
name='startup_meeting_done',
model_name="project",
name="startup_meeting_done",
),
]
6 changes: 3 additions & 3 deletions trs/migrations/0012_remove_project_is_accepted.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class Migration(migrations.Migration):

dependencies = [
('trs', '0011_remove_project_startup_meeting_done'),
("trs", "0011_remove_project_startup_meeting_done"),
]

operations = [
migrations.RemoveField(
model_name='project',
name='is_accepted',
model_name="project",
name="is_accepted",
),
]
6 changes: 3 additions & 3 deletions trs/migrations/0013_remove_person_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class Migration(migrations.Migration):

dependencies = [
('trs', '0012_remove_project_is_accepted'),
("trs", "0012_remove_project_is_accepted"),
]

operations = [
migrations.RemoveField(
model_name='person',
name='mpc',
model_name="person",
name="mpc",
),
]
2 changes: 1 addition & 1 deletion trs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def left_to_dish_out(self):
raw = self.total_income() - self.total_costs()
# Note: a little margin around zero is allowed to account for contract
# amounts not always being rounded.
if (-1 < raw < 1):
if -1 < raw < 1:
return 0
return raw

Expand Down
5 changes: 5 additions & 0 deletions trs/templates/trs/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ <h2>
<a href="{% url 'trs.person.kpi' pk=view.sidebar_person.id %}">
percentages</a>.
</div>
<div>
Afas en TRS qua vrije dagen gelijktrekken?
<a href="{% url 'trs.booking.free-overview' pk=view.sidebar_person.id %}">
Zie het verlofoverzicht</a>.
</div>

{% endif %}
{% endblock %}
Expand Down
58 changes: 58 additions & 0 deletions trs/templates/trs/free_overview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{% extends "trs/base.html" %}
{% load trs_formatting %}

{% block full-width %}
<h1>Overzicht vrije dagen / feestdagen {{ view.person }} {{ view.year }}</h1>

<p>Noot: ik filter op projecten met "feest" en "verlof" in de naam.</p>

<div class="row">
<div class="col-md-10">
<p>
Je kan op het weeknummer klikken om de uren van die week te bewerken.
</p>

<table class="table table-hover table-condensed table-fixed-header">
<thead class="header">
<tr>
<th>Week</th>
<th>Begindag</th>
{% for project in view.free_projects %}
<th class="text-right">{{ project.as_widget }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for line in view.lines %}
<tr>
<td>
<a href="{% url 'trs.booking' pk=view.person.id year=line.year_week.year week=line.year_week.week %}">
Week {{ line.year_week.week }}
</a>
</td>
<td>
<span class="year-date-hint">
{{ line.year_week.formatted_first_day }}
</span>
</td>
{% for hour in line.hours %}
<td class="text-right {% if hour %}success{% endif %}">{{ hour|hours }}</th>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>

</div>
<div class="col-md-2">
<p>Beschikbare jaren:</p>
<ul>
{% for year in view.available_years %}
<li><a href="?year={{ year }}">{{ year }}</a></li>
{% endfor %}
</ul>

</div>
</div>

{% endblock %}
5 changes: 5 additions & 0 deletions trs/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
views.BookingOverview.as_view(),
name="trs.booking.overview",
),
re_path(
r"^persons/(?P<pk>\d+)/freeoverview/$",
views.FreeOverview.as_view(),
name="trs.booking.free-overview",
),
re_path(
r"^overviews/wbso_projects/(?P<pk>\d+)/$",
views.WbsoProjectView.as_view(),
Expand Down
Loading

0 comments on commit 7a6bc9b

Please sign in to comment.