1
|
# -*- coding: utf-8 -*-
|
2
|
|
3
|
from django import forms
|
4
|
|
5
|
from calebasse.actes.models import Act
|
6
|
from calebasse.ressources.models import ActType
|
7
|
from ajax_select import make_ajax_field
|
8
|
|
9
|
class ActSearchForm(forms.Form):
|
10
|
STATES = (
|
11
|
('pointe', u'Pointés'),
|
12
|
('non-pointe', u'Non pointés'),
|
13
|
('valide', u'Présents'),
|
14
|
('absent-or-canceled', u'Absents ou annulés'),
|
15
|
('is-billable', u'Facturables'),
|
16
|
('non-invoicable', u'Non facturables'),
|
17
|
('switch-billable', u'Avec facturabilité inversée'),
|
18
|
('lost', u'Perdus'),
|
19
|
('pause-invoicing', u'En pause facturation'),
|
20
|
('invoiced', u'Facturés'),
|
21
|
('group', u'De groupe'),
|
22
|
# ('current-invoicing', u'Facturation en cours')
|
23
|
)
|
24
|
|
25
|
INITIAL = [x[0] for x in STATES]
|
26
|
|
27
|
last_name = forms.CharField(required=False)
|
28
|
patient_record_id = forms.IntegerField(required=False)
|
29
|
social_security_number = forms.CharField(required=False)
|
30
|
|
31
|
doctor_name = forms.CharField(required=False)
|
32
|
filters = forms.MultipleChoiceField(choices=STATES,
|
33
|
widget=forms.CheckboxSelectMultiple)
|
34
|
|
35
|
class ActUpdate(forms.ModelForm):
|
36
|
doctors = make_ajax_field(Act, 'doctors', 'intervenant', True)
|
37
|
class Meta:
|
38
|
model = Act
|
39
|
fields = ('act_type', 'doctors', 'is_lost', 'pause',
|
40
|
'switch_billable', )
|
41
|
|
42
|
def __init__(self, instance, service=None, **kwargs):
|
43
|
super(ActUpdate, self).__init__(instance=instance, **kwargs)
|
44
|
if instance.patient.service:
|
45
|
self.fields['act_type'].queryset = \
|
46
|
ActType.objects.for_service(instance.patient.service) \
|
47
|
.order_by('name')
|