Changeset 1465 for trunk/gestorpsi

Show
Ignore:
Timestamp:
15/12/2009 11:43:07 (2 years ago)
Author:
sergio
Message:

fixed client list in service sidebar

Location:
trunk/gestorpsi
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/gestorpsi/media/js/gestorpsi.json.js

    r1450 r1465  
    2222    $.getJSON(url, function(json) { 
    2323        var tableTR = ''; 
    24  
    25         /** 
    26         * build html 
    27         */ 
    28  
    2924        tableTR = ''; 
    3025 
    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            //} 
    5352  
    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         
    6261        buildTableList(tableTR, 'div#list'); 
    6362        buildPaginator(app, json['paginator'], json['util'], 'div#list'); 
     
    6867        }); 
    6968    }); 
    70  
    7169    return false; 
    7270} 
  • trunk/gestorpsi/service/views.py

    r1459 r1465  
    300300 
    301301@permission_required_with_403('service.service_list') 
    302 def client_list(request, page = 1, object_id = None, no_paging = None, initial = None, filter = None): 
     302def client_list(request, page=1, object_id=None, no_paging=None, initial=None, filter=None): 
    303303    array = {} # json 
    304304    i = 0 
    305      
    306305    referral = Referral.objects.charged().filter(service = object_id).order_by('-date') 
    307  
    308306    if initial: 
    309307        referral = referral.filter(client__person__name__istartswith = initial) 
    310  
    311308    if filter: 
    312309        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    #} 
    318313    for r in referral: 
    319314        array[i] = { 
    320             'dt': r.date.strftime("%d-%m-%Y  %H:%M ") 
     315            'dt': r.date.strftime("%d/%m/%Y  %H:%M ") 
    321316        } 
    322  
    323317        list = r.upcoming_occurrences() 
    324318        sub = 0 
     
    327321            array[i]['occurence'][sub] = ({'p': ('%s' % p.start_time.strftime(" %d-%m-%Y  %H:%M ")) }) 
    328322            sub = sub + 1 
    329  
    330323        sub = 0 
    331324        array[i]['professional'] = {} 
     
    333326            array[i]['professional'][sub] = ({'id':p.id, 'name':p.person.name}) 
    334327            sub = sub + 1 
    335  
    336328        sub = 0 
    337329        array[i]['client'] = {} 
     
    339331            array[i]['client'][sub] =  ({'id':p.id, 'name':p.person.name}) 
    340332            sub = sub + 1 
    341  
    342333        i = i + 1 
    343334 
    344335    return HttpResponse(simplejson.dumps(array, sort_keys=True), mimetype='application/json') 
    345  
    346336 
    347337# list referral groups