Changeset 1465 for trunk/gestorpsi
- Timestamp:
- 15/12/2009 11:43:07 (2 years ago)
- Location:
- trunk/gestorpsi
- Files:
-
- 2 modified
-
media/js/gestorpsi.json.js (modified) (2 diffs)
-
service/views.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gestorpsi/media/js/gestorpsi.json.js
r1450 r1465 22 22 $.getJSON(url, function(json) { 23 23 var tableTR = ''; 24 25 /**26 * build html27 */28 29 24 tableTR = ''; 30 25 31 jQuery.each(json, function(){ 32 jQuery.each(this.client, function(){ 33 str_client = this.name; 34 str_client_id = this.id; 35 }); 36 37 str_professional = ''; 38 str_professional_id = ''; 39 str_occurence = ''; 40 41 if (this.professional){ 42 jQuery.each(this.professional, function(){ 43 str_professional += ' ('+ this.name + ')'; 44 str_professional_id = this.id; 45 }); 46 } 47 48 if (this.occurence){ 49 jQuery.each(this.occurence, function(){ 50 str_occurence += ' ('+ this.p + ')'; 51 }); 52 } 26 /** 27 * build html 28 */ 29 30 jQuery.each(json, function(){ 31 jQuery.each(this.client, function(){ 32 str_client = this.name; 33 str_client_id = this.id; 34 }); 35 36 str_professional = ''; 37 str_professional_id = ''; 38 //str_occurence = ''; 39 40 if (this.professional){ 41 jQuery.each(this.professional, function(){ 42 str_professional += ' '+ this.name + ''; 43 str_professional_id = this.id; 44 }); 45 } 46 47 //if (this.occurence){ 48 // jQuery.each(this.occurence, function(){ 49 // str_occurence += ' ('+ this.p + ')'; 50 // }); 51 //} 53 52 54 tableTR += '<tr>';55 tableTR += '<td class="title">'+ str_client +' '+ str_professional +'<br /> Date ' + this.dt+ '<br />Occurences: '+ str_occurence;56 tableTR += '</td>';57 tableTR += '<td>';58 tableTR += '</td>';59 tableTR += '</tr>';60 }); 61 53 tableTR += '<tr>'; 54 tableTR += '<td class="title">'+ str_client + '<br />' + str_professional +'<br /> Inscrito em: ' + this.dt; //+ '<br />Occurences: '+ str_occurence; 55 tableTR += '</td>'; 56 tableTR += '<td>'; 57 tableTR += '</td>'; 58 tableTR += '</tr>'; 59 }); 60 62 61 buildTableList(tableTR, 'div#list'); 63 62 buildPaginator(app, json['paginator'], json['util'], 'div#list'); … … 68 67 }); 69 68 }); 70 71 69 return false; 72 70 } -
trunk/gestorpsi/service/views.py
r1459 r1465 300 300 301 301 @permission_required_with_403('service.service_list') 302 def client_list(request, page = 1, object_id = None, no_paging = None, initial = None, filter =None):302 def client_list(request, page=1, object_id=None, no_paging=None, initial=None, filter=None): 303 303 array = {} # json 304 304 i = 0 305 306 305 referral = Referral.objects.charged().filter(service = object_id).order_by('-date') 307 308 306 if initial: 309 307 referral = referral.filter(client__person__name__istartswith = initial) 310 311 308 if filter: 312 309 referral = referral.filter(client__person__name__icontains = filter) 313 314 array['util'] = { 315 'has_perm_read': request.user.has_perm('place.place_read'), 316 } 317 310 #array['util'] = { 311 # 'has_perm_read': request.user.has_perm('place.place_read'), 312 #} 318 313 for r in referral: 319 314 array[i] = { 320 'dt': r.date.strftime("%d -%m-%Y %H:%M ")315 'dt': r.date.strftime("%d/%m/%Y %H:%M ") 321 316 } 322 323 317 list = r.upcoming_occurrences() 324 318 sub = 0 … … 327 321 array[i]['occurence'][sub] = ({'p': ('%s' % p.start_time.strftime(" %d-%m-%Y %H:%M ")) }) 328 322 sub = sub + 1 329 330 323 sub = 0 331 324 array[i]['professional'] = {} … … 333 326 array[i]['professional'][sub] = ({'id':p.id, 'name':p.person.name}) 334 327 sub = sub + 1 335 336 328 sub = 0 337 329 array[i]['client'] = {} … … 339 331 array[i]['client'][sub] = ({'id':p.id, 'name':p.person.name}) 340 332 sub = sub + 1 341 342 333 i = i + 1 343 334 344 335 return HttpResponse(simplejson.dumps(array, sort_keys=True), mimetype='application/json') 345 346 336 347 337 # list referral groups
