Skip to content

Commit 3072f11

Browse files
authored
Différencier les bucket vérrouillés de complets (#720)
* Booking: show check on bucket if full * Planning: display if bucket is locked
1 parent 5f8293a commit 3072f11

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

app/Resources/views/booking/_partial/disabled_shift.html.twig

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
{% set nbShifts = bucket.shifts | length %}
22
{% set nbBookableShifts = shift_service.getBookableShifts(bucket) | length %}
3-
{% set nbBookedShifts = nbShifts - nbBookableShifts %}
3+
44
<div class="tooltipped" data-tooltip="{{ bucket.sortedShifts.first.job.name }} - {% if nbBookableShifts == 0 %}complet{% else %}inaccessible pour {{ beneficiary.firstname }}{% endif %}"
55
data-offset="{{ (((bucket.start|date('G')-start)*60 + bucket.start|date('i'))/60) }}"
66
data-length="{{ (100/(end-start+1)) }}"
7-
style="padding: 0 1px;width:{{ (bucket.duration / 60) * (100/(end-start+1)) }}%;position: absolute;
8-
left:{{ (((bucket.start|date('G')-start)*60 + bucket.start|date('i'))/60)*(100/(end-start+1)) }}%;
9-
top: {{ line*10 }}px;">
7+
style="padding: 0 1px;width:{{ (bucket.duration / 60) * (100/(end-start+1)) }}%;position: absolute;left:{{ (((bucket.start|date('G')-start)*60 + bucket.start|date('i'))/60)*(100/(end-start+1)) }}%;top: {{ line*10 }}px;">
108
<div class="z-depth-1 grey lighten-3" style="height:40px;position: relative; cursor: not-allowed">
11-
129
<div class="shift-block grey-text text-lighten-1">
13-
<i class="material-icons tiny">lock</i><span class="small hide-on-med-and-up" style="font-size: 10px">
14-
{% if bucket.start|date('i') == '00' %}{{ bucket.start|date('G\\h') }}{% else %}{{ bucket.start|date('G\\hi') }}{% endif %}
10+
{% if bucket.first.locked %}
11+
<i class="material-icons tiny">lock</i>
12+
{% elseif nbBookableShifts == 0 %}
13+
<i class="material-icons tiny">check</i>
14+
{% endif %}
15+
<span class="small hide-on-med-and-up" style="font-size: 10px">
16+
{% if bucket.start|date('i') == '00' %}{{ bucket.start|date('G\\h') }}{% else %}{{ bucket.start|date('G\\hi') }}{% endif %}
1517
{% if bucket.end|date('i') == '00' %}{{ bucket.end|date('G\\h') }}{% else %}{{ bucket.end|date('G\\hi') }}{% endif %}
16-
</span>
17-
<span class="hide-on-small-and-down">{{ bucket.start|date('G\\hi') }} - {{ bucket.end|date('G\\hi') }}</span>
18+
</span>
19+
<span class="hide-on-small-and-down">
20+
{{ bucket.start|date('G\\hi') }} - {{ bucket.end|date('G\\hi') }}
21+
</span>
1822
</div>
1923
<div class="shift-block">
2024
<div class="hide-on-med-and-down">

app/Resources/views/booking/_partial/list.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{% if shift_service.isBucketBookable(bucket, beneficiary) or not beneficiary %}
5555
{% include "booking/_partial/shift.html.twig" with { beneficiary: beneficiary, user: app.user, bucket: bucket, start: hours|first, end: hours|last, line:l, cycle: current_cycle, display_names: display_names } %}
5656
{% else %}
57-
{% include "booking/_partial/disabled_shift.html.twig" with { bucket: bucket,start: hours|first, end: hours|last, line:l, display_names: display_names } %}
57+
{% include "booking/_partial/disabled_shift.html.twig" with { bucket: bucket,start: hours|first, end: hours|last, line:l, display_names: display_names } %}
5858
{% endif %}
5959
{% endfor %}
6060
</div>

app/Resources/views/booking/_partial/shift.html.twig

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{% set nbBookableShifts = shift_service.getBookableShiftsCount(bucket) %}
44
{% set nbBookedShifts = nbShifts - nbBookableShifts %}
55
{% set firstBookableShift = shift_service.firstBookable(bucket, beneficiary) %}
6+
67
<div class="shift-bucket"
78
data-offset="{{ (((bucket.start|date('G')-start)*60 + bucket.start|date('i'))/60) }}" data-length="{{ (100/(end-start+1)) }}"
89
style="width:{{ (bucket.duration / 60) * (100/(end-start+1)) }}%;left:{{ (((bucket.start|date('G')-start)*60 + bucket.start|date('i'))/60)*(100/(end-start+1)) }}%;top: {{ line*10 }}px;">
@@ -22,13 +23,15 @@
2223
{% if bucket.start|date('i') == '00' %}{{ bucket.start|date('G\\h') }}{% else %}{{ bucket.start|date('G\\hi') }}{% endif %}
2324
{% if bucket.end|date('i') == '00' %}{{ bucket.end|date('G\\h') }}{% else %}{{ bucket.end|date('G\\hi') }}{% endif %}
2425
</span>
25-
<span class="hide-on-small-and-down">{{ bucket.start|date('G\\hi') }} - {{ bucket.end|date('G\\hi') }}</span><br>
26-
{% if (nbShifter == 0) %}
26+
<span class="hide-on-small-and-down">{{ bucket.start|date('G\\hi') }} - {{ bucket.end|date('G\\hi') }}</span>
27+
<br>
28+
{% if bucket.first.locked %}
29+
<i class="material-icons tiny">lock</i><span class="hide-on-small-and-down">&nbsp;vérouillé</span>
30+
{% elseif (nbShifter == 0) %}
2731
<span class="red-text"><i class="material-icons tiny">warning</i><span class="hide-on-small-and-down">&nbsp;sous-effectif</span></span>
2832
{% elseif (nbShifter < nbShifts/2) %}
2933
<span class="orange-text"><i class="material-icons tiny">warning</i><span class="hide-on-small-and-down">&nbsp;sous-effectif</span></span>
30-
{% endif %}
31-
{% if nbBookableShifts == 0 %}
34+
{% elseif nbBookableShifts == 0 %}
3235
<span class="green-text"><i class="material-icons tiny">check</i>&nbsp;complet</span>
3336
{% endif %}
3437
</div>

0 commit comments

Comments
 (0)