11{#
22Template for the modal popup used to change the user register for a shift bucket in /booking/admin
3+ Also on the /schedule page to display more shift infos (without any action buttons)
34It use the materialize modal class https://materializeweb.com/modals.html
45id = "modal-bucket"
56#}
7+ {% if (display_names ?? true ) %}
8+ {% set display_names = display_name_shifters %}
9+ {% endif %}
610{% set nbBookableShifts = shifts | filter ( shift => not shift .shifter ) | length %}
711{% set nbShifts = (shifts | length ) %}
812{% set nbBookedShifts = nbShifts - nbBookableShifts %}
@@ -33,7 +37,9 @@ id = "modal-bucket"
3337 {% if use_card_reader_to_validate_shifts and shift .isPastOrCurrent %}
3438 <span class =" {% if shift .wasCarriedOut %}green-text{% else %}red-text{% endif %}" >◉ </span >
3539 {% endif %}
36- {{ shift .shifter .displayNameWithMemberNumber }}
40+ {% if display_names %}
41+ {{ shift .shifter .displayNameWithMemberNumber }}
42+ {% endif %}
3743 {% if shift .formation %} ({{ shift .formation .name }}){% endif %}
3844 {% if not shift .formation and shift .shifter .formations | length > 0 %}
3945 <strong class =" orange-text" >({{ shift .shifter .formations | join(' , ' ) }})</strong >
@@ -54,7 +60,7 @@ id = "modal-bucket"
5460 <strong >{% if shift .fixe %}fixe{% else %}volant{% endif %}</strong >
5561 {% endif %}
5662 réservé
57- {% if shift .shifter != shift .booker .beneficiary %}
63+ {% if shift .shifter != shift .booker .beneficiary and display_names %}
5864 pour <a href =" {{ path(" member_show" , { ' member_number' : shift .shifter .membership .memberNumber }) }}" target =" _blank" >{{ shift .shifter }}</a >
5965 {% endif %}
6066 le <i >{{ shift .bookedTime | date_fr_full_with_time }}</i >
@@ -75,18 +81,20 @@ id = "modal-bucket"
7581 {% endif %}
7682 {{ form_end(shift_validate_invalidate_forms [shift .id ]) }}
7783 {% endif %}
78- {{ form_start(shift_free_forms [shift .id ], {' attr' : { ' style' : ' display:inline;' }}) }}
79- {% do shift_free_forms [shift .id ].reason.setRendered () %} <!-- hidden -->
80- {% if shift .isPast %}
81- <button type =" submit" class =" btn red" title =" Supprimer la participation" >
82- <i class =" material-icons left" >delete</i >Supprimer la participation
83- </button >
84- {% else %}
85- <button type =" submit" class =" btn orange" title =" Libérer" >
86- <i class =" material-icons left" >lock_open</i >Libérer
87- </button >
88- {% endif %}
89- {{ form_end(shift_free_forms [shift .id ]) }}
84+ {% if shift_free_forms is defined %}
85+ {{ form_start(shift_free_forms [shift .id ], {' attr' : { ' style' : ' display:inline;' }}) }}
86+ {% do shift_free_forms [shift .id ].reason.setRendered () %} <!-- hidden -->
87+ {% if shift .isPast %}
88+ <button type =" submit" class =" btn red" title =" Supprimer la participation" >
89+ <i class =" material-icons left" >delete</i >Supprimer la participation
90+ </button >
91+ {% else %}
92+ <button type =" submit" class =" btn orange" title =" Libérer" >
93+ <i class =" material-icons left" >lock_open</i >Libérer
94+ </button >
95+ {% endif %}
96+ {{ form_end(shift_free_forms [shift .id ]) }}
97+ {% endif %}
9098 {% endif %}
9199 <!-- shift.createdBy -->
92100 {% if shift .createdBy %}
@@ -104,8 +112,13 @@ id = "modal-bucket"
104112 <div class =" col s12" >
105113 <b >
106114 <span style =" font-style: italic" >
107- {% if shift .lastShifter %}réservé à {{ shift .lastShifter .displayNameWithMemberNumber }}
108- {% else %}libre
115+ {% if shift .lastShifter %}
116+ réservé
117+ {% if display_names %}
118+ à {{ shift .lastShifter .displayNameWithMemberNumber }}
119+ {% endif %}
120+ {% else %}
121+ libre
109122 {% endif %}
110123 </span >
111124 </b >
@@ -119,29 +132,32 @@ id = "modal-bucket"
119132 </div >
120133 <div class =" collapsible-body" >
121134 <!-- shift book form -->
122- {{ form_start(shift_book_forms [shift .id ], {' attr' : { ' style' : ' display:inline;' }}) }}
123- <div class =" row" >
124- <div class =" col {% if use_fly_and_fixed %}s7{% else %}s9{% endif %} input-field" >
125- {{ form_label(shift_book_forms [shift .id ].shifter) }}
126- {{ form_widget(shift_book_forms [shift .id ].shifter) }}
127- </div >
128- {% if use_fly_and_fixed %}
129- <div class =" col s2 input-field" >
130- {{ form_widget(shift_book_forms [shift .id ].fixe) }}
135+ {% if shift_book_forms is defined %}
136+ {{ form_start(shift_book_forms [shift .id ], {' attr' : { ' style' : ' display:inline;' }}) }}
137+ <div class =" row" >
138+ <div class =" col {% if use_fly_and_fixed %}s7{% else %}s9{% endif %} input-field" >
139+ {{ form_label(shift_book_forms [shift .id ].shifter) }}
140+ {{ form_widget(shift_book_forms [shift .id ].shifter) }}
131141 </div >
132- {% endif %}
133- <div class =" col s3 input-field" >
134- {% if not use_fly_and_fixed % }
135- {{ form_widget( shift_book_forms [ shift . id ].fixe) }}
142+ {% if use_fly_and_fixed %}
143+ <div class =" col s2 input-field" >
144+ {{ form_widget( shift_book_forms [ shift . id ].fixe) } }
145+ </ div >
136146 {% endif %}
137- <button type =" submit" class =" btn" >
138- <i class =" material-icons left" >add</i >Ajouter
139- </button >
147+ <div class =" col s3 input-field" >
148+ {% if not use_fly_and_fixed %}
149+ {{ form_widget(shift_book_forms [shift .id ].fixe) }}
150+ {% endif %}
151+ <button type =" submit" class =" btn" >
152+ <i class =" material-icons left" >add</i >Ajouter
153+ </button >
154+ </div >
140155 </div >
141- </div >
142- {{ form_end(shift_book_forms [shift .id ]) }}
156+ {{ form_end(shift_book_forms [shift .id ]) }}
157+ {% endif %}
158+
143159 <!-- shift delete form -->
144- {% if is_granted(" ROLE_ADMIN" ) %}
160+ {% if is_granted(" ROLE_ADMIN" ) and shift_delete_forms is defined %}
145161 {% if not shift .lastShifter %}
146162 {{ form_start(shift_delete_forms [shift .id ]) }}
147163 <button type =" submit" title =" Supprimer le poste" class =" btn red" >
@@ -164,49 +180,60 @@ id = "modal-bucket"
164180</ul >
165181
166182{# add shift form #}
167- {{ form_start(bucket_shift_add_form , {' attr' : { ' style' : ' display:inline;' }}) }}
168- <input type =" hidden" id =" {{ bucket_shift_add_form .start .date .vars .id }}" name =" {{ bucket_shift_add_form .start .date .vars .full_name }}" value =" {{ bucket_shift_add_form .start .date .vars .value }}" >
169- <input type =" hidden" id =" {{ bucket_shift_add_form .start .time .vars .id }}" name =" {{ bucket_shift_add_form .start .time .vars .full_name }}" value =" {{ bucket_shift_add_form .start .time .vars .value }}" >
170- <input type =" hidden" id =" {{ bucket_shift_add_form .end .date .vars .id }}" name =" {{ bucket_shift_add_form .end .date .vars .full_name }}" value =" {{ bucket_shift_add_form .end .date .vars .value }}" >
171- <input type =" hidden" id =" {{ bucket_shift_add_form .end .time .vars .id }}" name =" {{ bucket_shift_add_form .end .time .vars .full_name }}" value =" {{ bucket_shift_add_form .end .time .vars .value }}" >
172- {{ form_widget(bucket_shift_add_form .job ) }}
173- <div class =" row valign-wrapper" >
174- <div class =" col s3" >
175- {{ form_label(bucket_shift_add_form .number ) }}
176- {{ form_widget(bucket_shift_add_form .number ) }}
183+ {% if bucket_shift_add_form is defined %}
184+ {{ form_start(bucket_shift_add_form , {' attr' : { ' style' : ' display:inline;' }}) }}
185+ <input type =" hidden" id =" {{ bucket_shift_add_form .start .date .vars .id }}" name =" {{ bucket_shift_add_form .start .date .vars .full_name }}" value =" {{ bucket_shift_add_form .start .date .vars .value }}" >
186+ <input type =" hidden" id =" {{ bucket_shift_add_form .start .time .vars .id }}" name =" {{ bucket_shift_add_form .start .time .vars .full_name }}" value =" {{ bucket_shift_add_form .start .time .vars .value }}" >
187+ <input type =" hidden" id =" {{ bucket_shift_add_form .end .date .vars .id }}" name =" {{ bucket_shift_add_form .end .date .vars .full_name }}" value =" {{ bucket_shift_add_form .end .date .vars .value }}" >
188+ <input type =" hidden" id =" {{ bucket_shift_add_form .end .time .vars .id }}" name =" {{ bucket_shift_add_form .end .time .vars .full_name }}" value =" {{ bucket_shift_add_form .end .time .vars .value }}" >
189+ {{ form_widget(bucket_shift_add_form .job ) }}
190+ <div class =" row valign-wrapper" >
191+ <div class =" col s3" >
192+ {{ form_label(bucket_shift_add_form .number ) }}
193+ {{ form_widget(bucket_shift_add_form .number ) }}
194+ </div >
195+ <div class =" col s6" >
196+ {{ form_label(bucket_shift_add_form .formation ) }}
197+ {{ form_widget(bucket_shift_add_form .formation ) }}
198+ </div >
199+ <div class =" col s3" >
200+ <button type =" submit" class =" btn waves-effect waves-light teal" >
201+ <i class =" material-icons left" >add</i >Ajouter
202+ </button >
203+ </div >
177204 </div >
178- <div class =" col s6" >
179- {{ form_label(bucket_shift_add_form .formation ) }}
180- {{ form_widget(bucket_shift_add_form .formation ) }}
181- </div >
182- <div class =" col s3" >
183- <button type =" submit" class =" btn waves-effect waves-light teal" >
184- <i class =" material-icons left" >add</i >Ajouter
185- </button >
186- </div >
187- </div >
188- {{ form_row(bucket_shift_add_form ._token ) }}
189- {{ form_end(bucket_shift_add_form , {' render_rest' : false }) }}
205+ {{ form_row(bucket_shift_add_form ._token ) }}
206+ {{ form_end(bucket_shift_add_form , {' render_rest' : false }) }}
207+ {% endif %}
190208
191209{# bucket actions #}
192- <a href =" {{ path(' mail_bucketshift' , { ' id' : bucket .id }) }}" class =" btn" >
193- <i class =" material-icons left" >mail</i >Envoyer un email
194- </a >
195- {{ form_start(bucket_lock_unlock_form , {' attr' : { ' style' : ' display:inline;' }}) }}
196- {% if bucket .locked %}
197- <button type =" submit" class =" btn orange" >
198- <i class =" material-icons left" >lock_open</i >Déverrouiller
199- </button >
200- {% else %}
201- <button type =" submit" class =" btn orange" >
202- <i class =" material-icons left" >lock</i >Verrouiller
203- </button >
210+ {% if display_send_email_button ?? false and is_granted(" ROLE_ADMIN_PANEL" ) %}
211+ <a href =" {{ path(' mail_bucketshift' , { ' id' : bucket .id }) }}" class =" btn" >
212+ <i class =" material-icons left" >mail</i >Envoyer un email
213+ </a >
204214{% endif %}
205- {{ form_end(bucket_lock_unlock_form ) }}
206- <a href =" {{ path(' bucket_edit' , { ' id' : bucket .id }) }}" class =" btn deep-purple" >
207- <i class =" material-icons left" >edit</i >Editer
208- </a >
209- {% if is_granted(" ROLE_ADMIN" ) %}
215+
216+ {% if bucket_lock_unlock_form is defined %}
217+ {{ form_start(bucket_lock_unlock_form , {' attr' : { ' style' : ' display:inline;' }}) }}
218+ {% if bucket .locked %}
219+ <button type =" submit" class =" btn orange" >
220+ <i class =" material-icons left" >lock_open</i >Déverrouiller
221+ </button >
222+ {% else %}
223+ <button type =" submit" class =" btn orange" >
224+ <i class =" material-icons left" >lock</i >Verrouiller
225+ </button >
226+ {% endif %}
227+ {{ form_end(bucket_lock_unlock_form ) }}
228+ {% endif %}
229+
230+ {% if display_edit_button ?? false and is_granted(" ROLE_SHIFT_MANAGER" ) %}
231+ <a href =" {{ path(' bucket_edit' , { ' id' : bucket .id }) }}" class =" btn deep-purple" >
232+ <i class =" material-icons left" >edit</i >Editer
233+ </a >
234+ {% endif %}
235+
236+ {% if is_granted(" ROLE_ADMIN" ) and bucket_delete_form is defined %}
210237 <!-- bucket delete is allowed only if all shifts are free -->
211238 {{ form_start(bucket_delete_form , {' attr' : { ' style' : ' display:inline;' }}) }}
212239 <button id =" bucket_delete" class =" btn red" title =" Supprimer tous les créneaux à cette heure et ce poste" {% if not use_time_log_saving and (nbBookedShifts > 0 ) %}disabled {% endif %}>
0 commit comments