Project

General

Profile

« Previous | Next » 

Revision 48a85f96

Added by Jérôme Schneider over 11 years ago

actes: suppport act update (fix #2092)

View differences:

calebasse/actes/forms.py
3 3
from django import forms
4 4

  
5 5
from calebasse.actes.models import Act
6
from ajax_select import make_ajax_field
6 7

  
7 8
class ActSearchForm(forms.Form):
8 9
    STATES = (
......
29 30
            widget=forms.CheckboxSelectMultiple)
30 31

  
31 32
class ActUpdate(forms.ModelForm):
33
    doctors = make_ajax_field(Act, 'doctors', 'intervenant', True)
32 34
    class Meta:
33 35
        model = Act
36
        fields = ('act_type', 'doctors', 'is_lost', 'pause', 'switch_billable', 'comment',
37
                'valide')
38
        widgets = {
39
                'comment': forms.Textarea(attrs={'cols': 52, 'rows': 4}),
40
                }
34 41

  
35 42

  
36 43
        
calebasse/actes/models.py
116 116
            choices=VALIDATION_CODE_CHOICES,
117 117
            default='absent',
118 118
            verbose_name=u'Présence')
119
    comment = models.TextField(u'Commentaire')
119
    comment = models.TextField(u'Commentaire', blank=True, null=True)
120 120
    old_id = models.CharField(max_length=256,
121 121
            verbose_name=u'Ancien ID', blank=True, null=True)
122 122

  
calebasse/actes/templates/actes/act_listing.html
10 10
  $(function() {
11 11
    $('table#actes tr').click(function() {
12 12
        generic_ajaxform_dialog($(this).data('id') + '/update', "Modifier l'acte",
13
            '#acte-dlg', '500px', 'Enregistrer', '..');
13
            '#acte-dlg', '700px', 'Enregistrer', '..');
14 14
    });
15 15
    $('.date').datepicker();
16 16
    $('#new-acte').click(function() {
calebasse/actes/templates/actes/act_update.html
1 1
{% load widget_tweaks %}
2 2
<form action="{{ request.get_full_path}}" method="post">
3 3
{% csrf_token %}
4
<p>1234 Bob Leponge (Traitement)</p>
5
<p><select><option>(11) Ortophonie</option></select></p>
6
<p>8 août 2012 - 17:15 - 45 minutes</p>
4
<p>{{ object.patient.id }} {{ object.patient }} ({{ object.get_state }})</p>
5
<p>{{ form.act_type }}</p>
6
<p>{{ object.date }} - {{ object.time }} - {{ object.duration }} minutes
7
{% if object.is_lost %}<button class="flat">Acte perdu</button>{% endif %}</p>
8
{{ form.errors }}
7 9

  
8 10
<table>
9 11
  <tr><td width="50%">
10 12
      <h4>Intervenants</h4>
11 13
      <div id="intervenants">
12
        <ul>
13
          <li><input type="checkbox" value="Bob Léponge" checked="checked">Bob Léponge</input></li>
14
          <li><input type="checkbox" value="Sandy Kilo" checked="checked">Sandy Kilo</input></li>
15
        </ul>
16
        <a href="#">Ajouter</a><br/>
17
        <a href="#">Tout le monde</a>
14
        {{ form.doctors.errors }}
15
        {{ form.doctors }}
18 16
      </div>
19 17
    </td>
20 18

  
21 19
    <td width="50%">
22 20

  
23 21
      <ul>
24
        <li>Rendez-vous pris le 5 juillet 2012 à 10:36</li>
22
        {% for state in object.actvalidationstate_set.all %}
23
        <li>{{ state }} le {{ state.created }}</li>
24
        {% endfor %}
25
        <!-- <li>Rendez-vous pris le 5 juillet 2012 à 10:36</li>
25 26
        <li>Acte validé le 10 août 2012 à 9h10</li>
26
        <li>En cours de facturation (123) <button class="flat">Acte perdu</button></li>
27
        <li>En cours de facturation (123) <button class="flat">Acte perdu</button></li> -->
27 28
      </ul>
28 29
    </td>
29 30
  </tr>
31
  <tr>
32
  </tr>
30 33
</table>
31 34

  
35
{{ form.is_lost }} {{ form.is_lost.label }}<br/>
36
{{ form.pause }} {{ form.pause.label }}<br/>
37
{{ form.switch_billable }} {{ form.switch_billable.label }}</br>
38
{{ form.valide }} {{ form.valide.label }}
32 39
<br/>
33 40
<br/>
34
<textarea cols="50">Bla bla bla</textarea>
41
{{ form.comment }}
35 42
</form>
36 43

  
calebasse/personnes/lookup.py
2 2
from ajax_select import LookupChannel
3 3
from models import Worker
4 4

  
5
class Worker(LookupChannel):
5
class WorkerLookup(LookupChannel):
6 6
    model = Worker
7 7
    search_field = 'display_name'
8 8

  
......
20 20
        text = obj.last_name.upper() + ' ' + obj.first_name
21 21
        return unicode(text)
22 22

  
23
class IntervenantLookup(WorkerLookup):
24
    model = Worker
25
    search_field = 'display_name'
26

  
27
    def get_query(self,q,request):
28
        qs = super(IntervenantLookup, self).get_query(q,request)
29
        return qs.filter(type__intervene=True)
calebasse/settings/common.py
226 226
# AJAX Select
227 227
AJAX_LOOKUP_CHANNELS = {
228 228
    #   pass a dict with the model and the field to search against
229
    'worker' : ('calebasse.personnes.lookup', 'Worker'),
229
    'worker' : ('calebasse.personnes.lookup', 'WorkerLookup'),
230
    'intervenant' : ('calebasse.personnes.lookup', 'IntervenantLookup'),
230 231
    #'patientrecord'  : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
231 232
    #'coordinators'  : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
232 233
    'patientrecord' : ('calebasse.dossiers.lookups', 'PatientRecordLookup'),

Also available in: Unified diff