Revision 9d75fa2a
Added by Benjamin Dauvergne over 12 years ago
calebasse/agenda/views.py | ||
---|---|---|
194 | 194 |
return get_acts_of_the_day(self.date) |
195 | 195 |
|
196 | 196 |
def post(self, request, *args, **kwargs): |
197 |
if 'validate-all' in request.POST: |
|
198 |
#TODO: check that the user is authorized |
|
199 |
(nb_acts_total, nb_acts_validated, nb_acts_double, |
|
200 |
nb_acts_abs_non_exc, nb_acts_abs_exc, nb_acts_annul_nous, |
|
201 |
nb_acts_annul_famille, nb_acts_abs_ess_pps, |
|
202 |
nb_acts_enf_hosp) = \ |
|
203 |
automated_validation(self.date, self.service, |
|
204 |
request.user, commit = False) |
|
205 |
#TODO: call confirmation pop-up |
|
206 |
elif 'unlock-all' in request.POST: |
|
197 |
if 'unlock-all' in request.POST: |
|
207 | 198 |
#TODO: check that the user is authorized |
208 | 199 |
unlock_all_acts_of_the_day(self.date) |
209 | 200 |
else: |
... | ... | |
242 | 233 |
return context |
243 | 234 |
|
244 | 235 |
|
245 |
class AutomatedValidationView(CreateView): |
|
246 |
pass |
|
236 |
class AutomatedValidationView(TemplateView): |
|
237 |
template_name = 'agenda/automated-validation.html' |
|
238 |
|
|
239 |
def post(self, request, *args, **kwargs): |
|
240 |
automated_validation(self.date, self.service, |
|
241 |
request.user) |
|
242 |
return HttpResponseRedirect('..') |
|
243 |
|
|
244 |
def get_context_data(self, **kwargs): |
|
245 |
context = super(AutomatedValidationView, self).get_context_data(**kwargs) |
|
246 |
request = self.request |
|
247 |
(nb_acts_total, nb_acts_validated, nb_acts_double, |
|
248 |
nb_acts_abs_non_exc, nb_acts_abs_exc, nb_acts_annul_nous, |
|
249 |
nb_acts_annul_famille, nb_acts_abs_ess_pps, |
|
250 |
nb_acts_enf_hosp) = \ |
|
251 |
automated_validation(self.date, self.service, |
|
252 |
request.user, commit = False) |
|
253 |
|
|
254 |
context.update({ |
|
255 |
'nb_acts_total': nb_acts_total, |
|
256 |
'nb_acts_validated': nb_acts_validated, |
|
257 |
'nb_acts_double': nb_acts_double, |
|
258 |
'nb_acts_abs_non_exc': nb_acts_abs_non_exc, |
|
259 |
'nb_acts_abs_exc': nb_acts_abs_exc, |
|
260 |
'nb_acts_annul_nous': nb_acts_annul_nous, |
|
261 |
'nb_acts_annul_famille': nb_acts_annul_famille, |
|
262 |
'nb_acts_abs_ess_pps': nb_acts_abs_ess_pps, |
|
263 |
'nb_acts_enf_hosp': nb_acts_enf_hosp}) |
|
264 |
return context |
|
247 | 265 |
|
248 | 266 |
class UnlockAllView(CreateView): |
249 | 267 |
pass |
Also available in: Unified diff
add detailed modal confirmation dialog when automatic validation button is clicked, fixes #1887