Project

General

Profile

« Previous | Next » 

Revision 9123ecac

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

agenda / api: act validation manage billable and lost

View differences:

calebasse/agenda/templates/agenda/act-validation.html
60 60
           </select>
61 61
           <button {% if last_status %}disabled{% endif %}>Modifier</button>
62 62
           </form>
63
           <label> Facturable : </label>
64
           <input class="input_is_billable" data-id="{{acte.id}}" type="checkbox" {% if acte.is_billable %}checked{% endif %}></input>
65
           <label> Acte perdu : </label>
66
           <input class="input_is_lost" data-id="{{acte.id}}" type="checkbox" {% if acte.is_lost %}checked{% endif %}></input>
63 67
         {% endif %}
64 68
      </div>
65 69
    </div>
calebasse/api.py
1 1

  
2 2
from tastypie.authorization import DjangoAuthorization
3 3
from tastypie.resources import ModelResource
4
from calebasse.actes.models import Act
4 5
from calebasse.agenda.models import Event
5 6
from calebasse.dossiers.models import PatientRecord, PatientAddress
6 7

  
......
23 24
        resource_name = 'patientaddress'
24 25
        authorization = DjangoAuthorization()
25 26

  
27
class ActRessource(ModelResource):
28
    class Meta:
29
        queryset = Act.objects.all()
30
        resource_name = 'act'
31
        authorization = DjangoAuthorization()
32

  
26 33
patientaddress_ressource = PatientAddressRessource()
27 34
event_resource = EventResource()
28 35
patientrecord_resource = PatientRecordRessource()
36
act_ressource = ActRessource()
29 37

  
calebasse/settings/common.py
238 238
LOGIN_REDIRECT_URL = '/'
239 239

  
240 240
# Base directory for generated patient files
241
PATIENT_FILES_BASE_DIRECTORY = None
241
PATIENT_FILES_BASE_DIRECTORY = '/home/jschneider/temp/target/'
242 242

  
243 243
# Client side base directory for generated patient files
244
CLIENT_SIDE_PATIENT_FILES_BASE_DIRECTORY = None
244
CLIENT_SIDE_PATIENT_FILES_BASE_DIRECTORY =  None
245 245

  
246 246
# Patient subdirectories
247 247
PATIENT_SUBDIRECTORIES = (
......
265 265
)
266 266

  
267 267
# RTF templates directory
268
RTF_TEMPLATES_DIRECTORY = None
268
RTF_TEMPLATES_DIRECTORY = '/home/jschneider/temp/templates/'
calebasse/static/js/calebasse.agenda.js
7 7
          var span = textarea.prev()
8 8
          var btn = $(this)
9 9
          $.ajax({
10
              url: '/api/event/' + $(this).data("event-id") + '/?format=json',
10
              url: '/api/v1/event/' + $(this).data("event-id") + '/?format=json',
11 11
              type: 'PATCH',
12 12
              contentType: 'application/json',
13 13
              data: '{"description": "' + textarea.val() + '"}',
......
17 17
              }
18 18
          });
19 19
      });
20
      /* TODO: put this in a generic function */
21
      $('.input_is_billable').click(function() {
22
          if ((this.checked) == false) {
23
              var value = "true";
24
          } else {
25
              var value = "false";
26
          }
27
          $.ajax({
28
              url: '/api/v1/act/' + $(this).data("id") + '/?format=json',
29
              type: 'PATCH',
30
              contentType: 'application/json',
31
              data: '{"switch_billable": ' + value + '}',
32
              success: function(data) {
33
                  console.log('success');
34
              }
35
          });
36
      });
37
      $('.input_is_lost').click(function() {
38
          if ((this.checked) == true) {
39
              var value = "true";
40
          } else {
41
              var value = "false";
42
          }
43
          $.ajax({
44
              url: '/api/v1/act/' + $(this).data("id") + '/?format=json',
45
              type: 'PATCH',
46
              contentType: 'application/json',
47
              data: '{"is_lost": ' + value + '}',
48
              success: function(data) {
49
                  console.log('success');
50
              }
51
          });
52
      });
53

  
20 54
      $(base).find('.appointment').on('click', function() {
21 55
          $('.textedit span', this).html('');
22 56
      });
calebasse/static/js/calebasse.dossiers.js
285 285
              var value = "false";
286 286
          }
287 287
          $.ajax({
288
              url: '/api/patientaddress/' + $(this).data("id") + '/?format=json',
288
              url: '/api/v1/patientaddress/' + $(this).data("id") + '/?format=json',
289 289
              type: 'PATCH',
290 290
              contentType: 'application/json',
291 291
              data: '{"place_of_life": ' + value + '}',
calebasse/urls.py
5 5

  
6 6
from urls_utils import decorated_includes
7 7

  
8
from calebasse.api import (event_resource,
8
from calebasse.api import (act_ressource, event_resource,
9 9
        patientrecord_resource, patientaddress_ressource)
10
from tastypie.api import Api
10 11

  
11 12
admin.autodiscover()
12 13

  
14
v1_api = Api(api_name="v1")
15
v1_api.register(act_ressource)
16
v1_api.register(event_resource)
17
v1_api.register(patientaddress_ressource)
18
v1_api.register(patientrecord_resource)
13 19

  
14 20
service_patterns = patterns('',
15 21
    url(r'^$', 'calebasse.views.homepage', name='homepage'),
......
33 39
    url(r'^accounts/logout/', 'django.contrib.auth.views.logout_then_login'),
34 40
    url(r'^accounts/', include('django.contrib.auth.urls')),
35 41
    url(r'^api/',
36
        decorated_includes(login_required, include(event_resource.urls))),
37
    url(r'^api/',
38
        decorated_includes(login_required, include(patientrecord_resource.urls)),
39
        ),
40
    url(r'^api/',
41
        decorated_includes(login_required, include(patientaddress_ressource.urls)),
42
        ),
42
        decorated_includes(login_required, include(v1_api.urls))),
43 43
    url(r'^(?P<service>[a-z-]+)/', decorated_includes(login_required,
44 44
        include(service_patterns))),
45 45
    url(r'^lookups/', include('ajax_select.urls')),

Also available in: Unified diff