manager: display a title for event timesheet (#67078)
This commit is contained in:
parent
ff2706b4f1
commit
19dbca495f
|
@ -32,12 +32,6 @@
|
|||
</form>
|
||||
|
||||
{% if request.GET and form.is_valid %}
|
||||
{% if event %}
|
||||
<h4>{% blocktrans %}Timesheet{% endblocktrans %}</h4>
|
||||
{% else %}
|
||||
<h4>{% blocktrans with start=form.cleaned_data.date_start end=form.cleaned_data.date_end %}Timesheet from {{ start }} to {{ end }}{% endblocktrans %}</h4>
|
||||
{% endif %}
|
||||
|
||||
{% include 'chrono/manager_events_timesheet_fragment.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% if event %}
|
||||
<h4>{% blocktrans with event_date=event.start_datetime %}Timesheet - {{ event }} - {{ event_date }}{% endblocktrans %}</h4>
|
||||
{% else %}
|
||||
<h4>{% blocktrans with start=form.cleaned_data.date_start end=form.cleaned_data.date_end %}Timesheet from {{ start }} to {{ end }}{% endblocktrans %}</h4>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% with slots=form.get_slots %}
|
||||
{% with events_num=slots.events|length %}
|
||||
{% for dates in slots.dates %}
|
||||
|
|
|
@ -512,6 +512,8 @@ def test_events_timesheet_booked(app, admin_user):
|
|||
},
|
||||
]
|
||||
|
||||
assert resp.pyquery.find('h4')[0].text == 'Timesheet from Feb. 1, 2022 to Feb. 28, 2022'
|
||||
|
||||
# activity_display: row
|
||||
assert len(resp.pyquery.find('th.activity')) == 1
|
||||
assert resp.pyquery.find('th.activity')[0].text == 'Activity'
|
||||
|
@ -996,7 +998,10 @@ def test_event_timesheet_form(app, admin_user):
|
|||
def test_event_timesheet_slots(app, admin_user):
|
||||
agenda = Agenda.objects.create(label='Events', kind='events')
|
||||
event = Event.objects.create(
|
||||
start_datetime=make_aware(datetime.datetime(2022, 2, 15, 17, 0)), places=10, agenda=agenda
|
||||
label='My event',
|
||||
start_datetime=make_aware(datetime.datetime(2022, 2, 15, 17, 0)),
|
||||
places=10,
|
||||
agenda=agenda,
|
||||
)
|
||||
Subscription.objects.create(
|
||||
agenda=agenda,
|
||||
|
@ -1013,6 +1018,8 @@ def test_event_timesheet_slots(app, admin_user):
|
|||
resp = resp.form.submit()
|
||||
assert len(ctx.captured_queries) == 7
|
||||
|
||||
assert resp.pyquery.find('h4')[0].text == 'Timesheet - My event - Feb. 15, 2022, 5 p.m.'
|
||||
|
||||
slots = resp.context['form'].get_slots()
|
||||
assert len(slots['dates']) == 1
|
||||
assert [d[0] for d in slots['dates'][0]] == [
|
||||
|
|
Loading…
Reference in New Issue