e358209d678cd11c6b11a19abc025699a71310a7
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

1) refresh_group_list=function() {
2)   grouplist=$('#group-choice')[0];
3)   $('a.group-choice').each(function(idx,a) {
4)     $(a).parent().remove();
5)   });
6) 
7)   if (groups.count()==0) {
8)     $(grouplist).prepend('<li><a class="group-choice">Aucune groupe</a></li>');
9)   }
10)   else { 
11)     groups.each(function(idx,group) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

12)       $(grouplist).prepend('<li><a class="group-choice" data-uuid="'+group.uuid+'">'+group.name+'</a></li>');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

13)     });
14) 
15)     $('a.group-choice').each(function(idx,a) {
16)       $(a).bind('click',on_group_choice_click);
17)     });
18)   }
19) }
20) 
21) 
22) /****************
23)  * Add group
24)  ****************/
Benjamin Renard Hide navbar-groupe-collapse...

Benjamin Renard authored 10 years ago

25) 
26) on_click_add_group_btn=function(e) {
Benjamin Renard Add function navbar_collaps...

Benjamin Renard authored 10 years ago

27)   navbar_collapse_hide();
Benjamin Renard Hide navbar-groupe-collapse...

Benjamin Renard authored 10 years ago

28)   $('#add_group_modal').modal('show');
29) }
30) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

31) on_show_add_group_modal=function(e) {
32)   $('#add_group_modal #add_group_name').focus();
33) }
34) 
Benjamin Renard Manage submit event in moda...

Benjamin Renard authored 10 years ago

35) on_valid_add_group_modal=function (e) {
36)   e.preventDefault();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

37)   var name=$('#add_group_name')[0].value;
38)   if (name=='') {
39)     alert('Vous devez saisir un nom !');
40)     return;
41)   }
42)   if (groups[name]!==undefined) {
43)     alert('Ce groupe exite déjà !');
44)     return;
45)   }
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

46)   var uuid=groups.newGroup(name);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

47)   refresh_group_list();
48)   $('#add_group_modal').modal('hide');
49)   groups.save();
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

50)   view_group(groups[uuid]);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

51) }
52) 
53) on_close_add_group_modal=function () {
Benjamin Renard Fix error on add_group_moda...

Benjamin Renard authored 10 years ago

54)   $('#add_group_modal form')[0].reset();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

55) }
56) 
57) /****************
58)  * Nav bars
59)  ****************/
60) on_group_choice_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

61)   view_group(groups[$(e.target).data('uuid')]);
Benjamin Renard Add function navbar_collaps...

Benjamin Renard authored 10 years ago

62)   navbar_collapse_hide();
63) }
64) 
65) navbar_collapse_hide=function() {
66)   if ($('#navbar-groupe-collapse').hasClass('in')) {
67)     $('#navbar-groupe-collapse').collapse('hide');
68)   }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

69) }
70) 
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

71) /****************
72)  * Parts
73)  ****************/
74) 
75) view_part=function(part) {
76)   $('.part').each(function(idx,div) {
77)     $(div).css('display','none');
78)   });
79)   $(part).css('display','block');
80) }
81) 
82) view_home=function() {
Benjamin Renard Hide navbar on view_home

Benjamin Renard authored 10 years ago

83)   navbar_collapse_hide();
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

84)   if (user) {
85)     $('#view-home #title').html('Bonjour '+user.name);
86)   }
87)   else {
88)     $('#view-home #title').html('Bonjour');
89)   }
90)   if (groups.count()>0) {
91)     tbody=$('#view-home #mybalances tbody');
92)     tbody.html('');
93)     balances=groups.balances();
94)     var sum=0;
95)     for (g in balances) {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

96)       if (jQuery.type(balances[g]['balance'][user.email])!='undefined') {
97)         if (balances[g]['balance'][user.email]['diff']<0) {
98)           sum+=balances[g]['balance'][user.email]['diff'];
99)           diff='<td class="negative">'+balances[g]['balance'][user.email]['diff'].toFixed(2)+'</td>';
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

100)         }
101)         else {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

102)           value=balances[g]['balance'][user.email]['total']-balances[g]['min'];
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

103)           sum+=value;
104)           diff='<td class="positive">+'+value.toFixed(2)+' €</td>';
105)         }
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

106)         menu='<div class="btn-group" data-grp="'+g+'"><button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span></button><ul class="dropdown-menu"><li><a class="home_grp_cat_btn"><span class="glyphicon glyphicon-th-list"></span> Catégories</a></li></ul></div>';
107)         tbody.html(tbody.html()+'<tr><td><a class="group-link" data-uuid="'+g+'">'+balances[g].name+'</a></td>'+diff+'<td>'+menu+'</td></tr>');
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

108)       }
109)     }
Benjamin Renard Make group name as link in...

Benjamin Renard authored 10 years ago

110)     $('#view-home #mybalances a.group-link').bind('click',function(e) {
Benjamin Renard Fixed link to group in Home...

Benjamin Renard authored 10 years ago

111)       g=$(e.target).data('uuid');
Benjamin Renard Make group name as link in...

Benjamin Renard authored 10 years ago

112)       if (jQuery.type(groups[g])!='undefined') {
113)         view_group(groups[g]);
114)       }
115)     });
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

116)     $('a.home_grp_cat_btn').each(function(idx,a) {
117)       $(a).bind('click',on_home_grp_cat_btn_click);
118)     });
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

119)     if (sum<0) {
120)       $('#view-home #mybalances #total-value').html('<span class="negative">'+sum.toFixed(2)+' €</span>');
121)     }
122)     else {
123)       $('#view-home #mybalances #total-value').html('<span class="positive">'+(sum==0?'':'+')+sum.toFixed(2)+' €</span>');
124)     }
Benjamin Renard Fixed table display on home...

Benjamin Renard authored 10 years ago

125)     $('#view-home #mybalances').css('display','table');
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

126)   }
127)   else {
128)     $('#view-home #mybalances').css('display','none');
129)   }
130)   view_part('#view-home');
131) }
132) 
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

133) on_home_grp_cat_btn_click=function(e) {
134)   grp_id=$(e.target).parents('div.btn-group').data('grp');
135)   grp=groups[grp_id];
136)   console.log(grp.getCategories());
137)   ul=$('#grp_cat_modal ul');
138)   html="";
139)   cats=grp.getCategories();
140)   for(cid in cats) {
141)     html+="<li><span class='cat-color' style='background-color: "+cats[cid]['color']+"'></span> "+cats[cid]['name']+"</li>";
142)   }
143)   ul.html(html);
144)   $('#grp_cat_modal').modal('show');
145) }
146) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

147) /****************
148)  * View group
149)  ****************/
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

150) view_group=function(group,contributor_email) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

151)   $('#view-group').data('uuid',group.uuid);
Benjamin Renard Replace usage of view-group...

Benjamin Renard authored 10 years ago

152)   $('#view-group h1 span:first').html(group.name);
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

153)   set_contributors(group,contributor_email);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

154)   on_contributor_change();
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

155)   view_part('#view-group');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

156) }
157) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

158) set_contributors=function(group,contributor_email) {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

159)   $('#view-group #contributor option').remove();
160)   if(group.contributors.length==0) {
161)     $('#view-group #contributor').append('<option>Aucun participant</option>');
162)   }
163)   else {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

164)     for (email in group.contributors) {
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

165)       if (email == contributor_email) {
166)         sel=' selected';
167)       }
168)       else {
169)         sel='';
170)       }
171)       $('#view-group #contributor').append('<option value="'+email+'"'+sel+'>'+group.contributors[email].name+'</option>');
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

172)     }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

173)   }
174) }
175) 
176) on_contributor_change=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

177)   show_contributions(groups[$('#view-group').data('uuid')],$('#view-group #contributor')[0].value);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

178) }
179) 
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

180) show_contributions=function(group,contributor_email) {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

181)   var tbody=$($('#view-group #contributions tbody')[0]);
182)   tbody.html('');
183)   total=$($('#view-group #total-value')[0]);
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

184)   contributions=group.contributionsByContributorEmail(contributor_email);
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

185)   contributions.reverse();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

186)   if (contributions.length==0) {
187)     tbody.append('<tr><td colspan=3>Aucune contributions</td></tr>');
188)     total.html('0,00 €');
189)   }
190)   else {
191)     sum=0;
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

192)     for (idx in contributions) {
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

193)       var cat='';
194)       console.log(contributions[idx].categorie);
195)       if (contributions[idx].categorie && jQuery.type(group.categories[contributions[idx].categorie])) {
196) 		cat='<br/><span class="categorie"><span class="cat-color" style="background-color: '+group.categories[contributions[idx].categorie]['color']+'"></span> '+group.categories[contributions[idx].categorie]['name']+"</span>";
197) 	  }
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

198)       col_actions='<td><div class="btn-group" data-uuid="'+contributions[idx].uuid+'"><button type="button" class="btn btn-default contribution_edit_btn"><span class="glyphicon glyphicon-edit"></span></button><button type="button" class="btn btn-default contribution_delete_btn"><span class="glyphicon glyphicon-trash"></span></button></div></td>';
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

199)       tbody.append('<tr><td>'+contributions[idx].getTitle()+cat+'</td><td>'+contributions[idx].cost.toFixed(2)+' €<br/><span class="date">'+moment(contributions[idx].date).format('DD/MM/YYYY')+'</span></td>'+col_actions+'</tr>');
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

200)       sum+=contributions[idx].cost;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

201)     }
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

202)     total.html(sum.toFixed(2)+' €');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

203)   }
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

204)   
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

205)   $('.contribution_delete_btn').bind('click',on_contribution_delete_btn_click);
206)   $('.contribution_edit_btn').bind('click',on_contribution_edit_btn_click);
207) }
208) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

209) /*****************************
210)  * Trash
211)  *****************************/
212) 
213) on_trash_group_btn_click=function(e) {
214)   group=groups[$('#view-group').data('uuid')];
215)   contributor_email=$('#view-group #contributor')[0].value;
216)   view_group_trash(group,contributor_email);
217) }
218) 
219) on_go_back_group_btn_click=function(e) {
220)   group=groups[$('#view-group-trash').data('uuid')];
221)   contributor_email=$('#view-group-trash').data('contributor-email');
222)   view_group(group,contributor_email);
223) }
224) 
225) view_group_trash=function(group,contributor_email) {
226)   $('#view-group-trash').data('uuid',group.uuid);
227)   $('#view-group-trash').data('contributor-email',contributor_email);
228)   var tbody=$('#view-group-trash #trash tbody');
229)   tbody.html('');
230)   contributions=group.deletedContributionsByContributorEmail(contributor_email);
231)   contributions.reverse();
232)   if (contributions.length==0) {
233)     tbody.append('<tr><td colspan=3>Aucune contributions</td></tr>');
234)   }
235)   else {
236)     for (idx in contributions) {
237)       tbody.append('<tr data-uuid="'+contributions[idx].uuid+'"><td>'+contributions[idx].getTitle()+'</td><td>'+contributions[idx].cost.toFixed(2)+' €<br/><span class="date">'+moment(contributions[idx].date).format('DD/MM/YYYY')+'</span></td><td><button type="button" class="btn btn-default contribution_restore_btn"><span class="glyphicon glyphicon-share"></span></button></td></tr>');
238)     }
239)   }
240)   
241)   $('#view-group-trash .contribution_restore_btn').bind('click',on_contribution_restore_btn_click);
242)  
243)   view_part('#view-group-trash');
244) }
245) 
246) on_contribution_restore_btn_click=function(e) {
247)   var group=groups[$('#view-group-trash').data('uuid')];
248)   contribution_uuid=$($(e.target).parents('tr')[0]).data('uuid');
249)   contribution=group.importContribution(group.deletedContributions[contribution_uuid]);
250)   myconfirm('Etes-vous sûre de vouloir restaurer la participation '+contribution.getTitle()+' de '+contribution.contributor.name+' ?',on_confirm_contribution_restore,null,{'group':group,'contribution_uuid':contribution_uuid, 'contribution': contribution} );
251) }
252) 
253) on_confirm_contribution_restore=function(data) {
254)   data.group.restoreContribution(data.contribution_uuid);
255)   groups.save();
256)   view_group(data.group,data.contribution.contributor.email);
257) }
258) 
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

259) on_trash_group_contributors_btn_click=function(e) {
260)   group=groups[$('#view-group').data('uuid')];
261)   view_group_trash_contributors(group);
262) }
263) 
264) on_go_back_group_trash_contributors_btn_click=function(e) {
265)   group=groups[$('#view-group-trash-contributors').data('uuid')];
266)   view_group(group);
267) }
268) 
269) view_group_trash_contributors=function(group) {
270)   $('#view-group-trash-contributors').data('uuid',group.uuid);
271)   var tbody=$('#view-group-trash-contributors #trash tbody');
272)   tbody.html('');
273)   contributors=group.getDeletedContributors();
274)   if (contributors.length==0) {
275)     tbody.append('<tr><td colspan=3>Aucun participant</td></tr>');
276)   }
277)   else {
278)     for (idx in contributors) {
279)       tbody.append('<tr data-email="'+contributors[idx].email+'"><td>'+contributors[idx].name+'</td><td><button type="button" class="btn btn-default contributor_restore_btn"><span class="glyphicon glyphicon-share"></span></button></td></tr>');
280)     }
281)   }
282) 
283)   $('#view-group-trash-contributors .contributor_restore_btn').bind('click',on_contributor_restore_btn_click);
284) 
285)   view_part('#view-group-trash-contributors');
286) }
287) 
288) on_contributor_restore_btn_click=function(e) {
289)   var group=groups[$('#view-group-trash-contributors').data('uuid')];
290)   contributor_email=$($(e.target).parents('tr')[0]).data('email');
291)   contributor=group.importContributor(group.deletedContributors[contributor_email]);
292)   myconfirm('Etes-vous sûre de vouloir restaurer '+contributor.name+' ?',on_confirm_contributor_restore,null,{'group':group,'contributor_email':contributor_email, 'contributor': contributor} );
293) }
294) 
295) on_confirm_contributor_restore=function(data) {
296)   data.group.restoreContributor(data.contributor_email);
297)   groups.save();
298)   view_group(data.group,data.contributor_email);
299) }
300) 
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

301) /******************************
302)  * Add/Edit/remove contributor
303)  ******************************/
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

304) on_click_add_contributor_btn=function() {
Benjamin Renard Fixed add contributor

Benjamin Renard authored 10 years ago

305)   $('#add_contributor_modal').data('group-uuid',$('#view-group').data('uuid'))
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

306)   $($('#add_contributor_modal h4')[0]).html('Ajouter un participant');
307)   $($('#add_contributor_modal #add_contributor_submit')[0]).html('Ajouter');
308)   $('#view-group #edit_id')[0].value='-1';
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

309)   $('#add_contributor_modal #add_contributor_email').attr('disabled',false);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

310)   $('#add_contributor_modal').modal('show');
311) }
312) 
313) on_show_add_contributor_modal=function(e) {
314)   $('#add_contributor_modal #add_contributor_name').focus();
315) }
316) 
Benjamin Renard Add contributor's email val...

Benjamin Renard authored 10 years ago

317) validateEmail=function(email) {
318)     var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
319)     return re.test(email);
320) }
321) 
Benjamin Renard Manage submit event in moda...

Benjamin Renard authored 10 years ago

322) on_valid_add_contributor_modal=function(e) {
323)   e.preventDefault();
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

324)   var group=groups[$('#add_contributor_modal').data('group-uuid')];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

325)   var name=$('#add_contributor_name')[0].value;
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

326)   edit_id=$('#view-group #edit_id')[0].value;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

327)   if (name=='') {
328)     alert('Vous devez saisir un nom !');
329)     return;
330)   }
331)   var email=$('#add_contributor_email')[0].value;
332)   if (email=='') {
333)     alert('Vous devez saisir un email !');
334)     return;
335)   }
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

336)   duplicate=group.contributorByEmail(email)
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

337)   if (duplicate!=undefined && edit=='-1') {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

338)     alert('Un contributor utilise déjà cet email !');
339)     return;
340)   }
Benjamin Renard Add contributor's email val...

Benjamin Renard authored 10 years ago

341)   if (!validateEmail(email)) {
342)     alert('Email invalide !');
343)     return;
344)   }
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

345)   if(edit_id=='-1') {
346)     group.addContributor(new Contributor(name,email));
347)   }
348)   else {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

349)     group.replaceContributor(email,new Contributor(name,email));
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

350)   }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

351)   set_contributors(group);
352)   $('#add_contributor_modal').modal('hide');
353)   groups.save();
Benjamin Renard Display contribution of con...

Benjamin Renard authored 10 years ago

354)   view_group(group,email);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

355) }
356) 
357) on_close_add_contributor_modal=function () {
358)   $('#add_contributor_name')[0].value='';
359)   $('#add_contributor_email')[0].value='';
360) }
361) 
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

362) on_edit_contributor_btn_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

363)   var group=groups[$('#view-group').data('uuid')];
364)   $('#add_contributor_modal').data('group-uuid',group.uuid);
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

365)   contributor_email=$('#view-group #contributor')[0].value;
366)   contributor=group.contributorByEmail(contributor_email);
367)   $('#view-group #edit_id')[0].value=contributor_email;
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

368)   $('#add_contributor_modal #add_contributor_name')[0].value=contributor.name;
369)   $('#add_contributor_modal #add_contributor_email')[0].value=contributor.email;
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

370)   $('#add_contributor_modal #add_contributor_email').attr('disabled',true);
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

371)   $($('#add_contributor_modal h4')[0]).html('Editer un participant');
372)   $($('#add_contributor_modal #add_contributor_submit')[0]).html('Valider');
373)   $('#add_contributor_modal').modal('show');
374) }
375) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

376) on_click_del_contributor_btn=function() {
Benjamin Renard Fix contributor deletion

Benjamin Renard authored 10 years ago

377)   var group=groups[$('#view-group').data('uuid')];
378)   contributor=group.contributorByEmail($('#view-group #contributor')[0].value);
379)   question='Voulez-vous vraiment supprimer '+contributor.name+' ?';
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

380)   myconfirm(question,on_confirm_del_contributor,null,contributor);
381) }
382) 
383) on_confirm_del_contributor=function(contributor) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

384)   var group=groups[$('#view-group').data('uuid')];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

385)   group.removeContributor(contributor);
Benjamin Renard Display group home after de...

Benjamin Renard authored 10 years ago

386)   view_group(group);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

387)   groups.save();
388) }
389) 
390) /********************************
391)  * Add/edit/delete contribution
392)  ********************************/
393) on_show_add_contribution_modal=function(e) {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

394)   $('#add_contribution_modal #add_contribution_contributor_email').html($('#view-group #contributor').html());
395)   $('#add_contribution_modal #add_contribution_contributor_email')[0].value=$('#view-group #contributor')[0].value;
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

396)   gid=$('#add_contribution_modal').data('group-uuid');
397)   group=groups[gid];
398)   cats="<option value=''>Non définie</option>";
399)   for (u in group.categories) {
400) 	cats+="<option value='"+u+"'>"+group.categories[u]['name']+"</option>";
401)   }
402)   $('#add_contribution_modal #add_contribution_categorie').html(cats);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

403)   $('#add_contribution_modal #add_contribution_title').focus();
404) }
405) 
406) on_click_add_contribution_btn=function() {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

407)   $('#add_contribution_modal').data('group-uuid',$('#view-group').data('uuid'));
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

408)   $('#add_contribution_modal #edit_uuid')[0].value='-1';
bn8 Add pickadate date picker

bn8 authored 10 years ago

409)   $('#add_contribution_date')[0].value=moment().format('DD/MM/YYYY');
Benjamin Renard Customize add_contribution_...

Benjamin Renard authored 10 years ago

410)   $($('#add_contribution_modal h4')[0]).html('Ajouter une contribution');
411)   $($('#add_contribution_modal #add_contribution_submit')[0]).html('Ajouter');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

412)   $('#add_contribution_modal').modal('show');
413) }
414) 
415) on_valid_add_contribution_modal=function(e) {
416)   e.preventDefault();
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

417)   var group=groups[$('#add_contribution_modal').data('group-uuid')];
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

418)   var contributor_email=$('#add_contribution_contributor_email')[0].value;
419)   var contributor=group.contributorByEmail(contributor_email);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

420)   if (contributor==undefined) {
421)     alert('Participant inconu !');
422)     return;
423)   }
424)   var title=$('#add_contribution_title')[0].value;
425)   if (title=='') {
426)     $('#add_contribution_title')[0].focus();
427)     alert('Vous devez saisir un titre !');
428)     return;
429)   }
430)   var cost=$('#add_contribution_cost')[0].value;
431)   if (cost=='') {
432)     $('#add_contribution_cost')[0].focus();
433)     alert('Vous devez saisir un coût !');
434)     return;
435)   }
Benjamin Renard Add support of dot and comm...

Benjamin Renard authored 10 years ago

436)   else if(!RegExp('^[0-9]*((,|\.)[0-9]{1,2})*$').test(cost)) {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

437)     $('#add_contribution_cost')[0].focus();
438)     alert('Coût incorrect !');
439)     return;
440)   }
441)   cost=parseFloat(cost.replace(',','.'));
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

442)   
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

443)   var date=$('#add_contribution_date')[0].value;
bn8 Add pickadate date picker

bn8 authored 10 years ago

444)   date.replace(/ /g,'');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

445)   if (date!='') {
446)     if(!RegExp('^[0-3][0-9]\/[0-1][0-9]\/[0-2][0-9][0-9][0-9]$').test(date)) {
447)       $('#add_contribution_date')[0].focus();
448)       alert('Date incorrect !');
449)       return;
450)     }
451)     date=moment(date,'DD-MM-YYYY').toDate();
452)     if (jQuery.type(date)!='date') {
453)       alert('Date non-reconnu !');
454)       return;
455)     }
456)   }
457)   else {
458)     date=new Date();
459)   }
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

460)   
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

461)   var cat=$('#add_contribution_categorie')[0].value;
462)   if (cat != '' && !jQuery.type(group.categories[cat])) {
463) 	alert('Categorie incorrect');
464) 	return;
465)   }
466)   
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

467)   if($('#add_contribution_modal #edit_uuid')[0].value=='-1') {
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

468)     group.addContribution(new Contribution(contributor,cost,title,date,cat));
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

469)   }
470)   else {
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

471)     contribution_uuid=$('#add_contribution_modal #edit_uuid')[0].value;
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

472)     group.updateContribution(contribution_uuid,new Contribution(contributor,cost,title,date,cat));
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

473)   }
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

474)   show_contributions(group,contributor_email);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

475)   $('#add_contribution_modal').modal('hide');
476)   $('#add_contribution_modal form')[0].reset();
477)   groups.save();
478) }
479) 
480) on_close_add_contribution_modal=function () {
481)   $('#add_contribution_modal form')[0].reset();
482) }
483) 
484) on_contribution_delete_btn_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

485)   var group=groups[$('#view-group').data('uuid')];
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

486)   contribution_uuid=$($(e.target).parents('div')[0]).data('uuid');
487)   contribution=group.contributions[contribution_uuid];
488)   myconfirm('Etes-vous sûre de vouloir supprimer la participation '+contribution.getTitle()+' de '+contribution.contributor.name+' ?',on_confirm_contribution_delete,null,{'group':group,'contribution_uuid':contribution_uuid, 'contribution': contribution} );
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

489) }
490) 
491) on_confirm_contribution_delete=function(data) {
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

492)   data.group.deleteContribution(data.contribution_uuid);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

493)   groups.save();
494)   on_contributor_change();
495) }
496) 
497) on_contribution_edit_btn_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

498)   var group=groups[$('#view-group').data('uuid')];
499)   $('#add_contribution_modal').data('group-uuid',$('#view-group').data('uuid'));
Benjamin Renard Customize add_contribution_...

Benjamin Renard authored 10 years ago

500)   $($('#add_contribution_modal h4')[0]).html('Editer une contribution');
501)   $($('#add_contribution_modal #add_contribution_submit')[0]).html('Valider');
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

502)   contribution_uuid=$($(e.target).parents('div')[0]).data('uuid');
503)   contribution=group.contributions[contribution_uuid];
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

504)   $('#add_contribution_modal #add_contribution_contributor_email')[0].value=contribution.contributor.email;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

505)   $('#add_contribution_modal #add_contribution_title')[0].value=contribution.getTitle();
506)   $('#add_contribution_modal #add_contribution_cost')[0].value=contribution.cost;
507)   $('#add_contribution_modal #add_contribution_date')[0].value=moment(contribution.date).format('DD/MM/YYYY');
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

508)   if (contribution.categorie) {
509) 	$('#add_contribution_modal #add_contribution_categorie')[0].value=contribution.categorie;
510)   }
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

511)   $('#add_contribution_modal #edit_uuid')[0].value=contribution_uuid;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

512)   $('#add_contribution_modal').modal('show');
513) }
514) 
515) 
516) 
517) /********************
518)  * Clear local data
519)  ********************/
520) clear_local_data=function() {
Benjamin Renard Add function navbar_collaps...

Benjamin Renard authored 10 years ago

521)   navbar_collapse_hide();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

522)   myconfirm('Etes-vous sûre de vouloir supprimer les données locales ?',on_confirm_clear_local_data);
523) }
524) 
525) on_confirm_clear_local_data=function(data) {
Benjamin Renard Just remove groups from loc...

Benjamin Renard authored 10 years ago

526)   delete localStorage.groups;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

527)   location.reload();
528) }
529) 
530) /*********************
531)  * View balance
532)  *********************/
533) 
534) on_display_balance_btn_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

535)   group=groups[$('#view-group').data('uuid')];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

536)   display_balance(group);
537) }
538) 
539) display_balance=function(group) {
540)   bal=group.balance();
541)   tbody=$($('#display_balance_modal tbody')[0]);
542)   tbody.html('');
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

543)   for (c in bal['balance']) {
544)     if(bal['balance'][c]['diff']<0) {
545)       diff='<td class="negative">'+bal['balance'][c]['diff'].toFixed(2)+' €</td>';
546)     }
547)     else {
548)       diff='<td><span class="glyphicon glyphicon-thumbs-up"></span></td>';
549)     }
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

550)     tbody.append('<tr><td>'+bal['balance'][c]['name']+'</td><td>'+bal['balance'][c]['total'].toFixed(2)+' €</td>'+diff+'</tr>');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

551)   }
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

552)   $('#display_balance_modal #total-value').html(bal.sum.toFixed(2)+' €');
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

553)   $('#display_balance_modal').modal('show');
554) }
555) 
556) /*********************
557)  * Remove group
558)  *********************/
559) 
560) on_remove_group_btn_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

561)   group=groups[$('#view-group').data('uuid')];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

562)   myconfirm('Etes-vous sûre de vouloir supprimer le group '+group.name+' ?',on_confirm_remove_group,null,group);
563) }
564) 
565) on_confirm_remove_group=function(group) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

566)   if(groups.removeGroup(group.uuid)) {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

567)     groups.save();
568)     location.reload();
569)   }
570)   else {
571)     alert('Erreur en supprimant le groupe '+group.name+' :(');
572)   }
573) }
574) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

575) /********************
576)  * Login
577)  ********************/
578) on_close_login_modal=function(e) {
579)   $('#login_modal form')[0].reset();
580) }
581) 
582) sync_server=false;
583) on_valid_login_modal=function(e) {
Benjamin Renard Manage submit event in moda...

Benjamin Renard authored 10 years ago

584)   e.preventDefault();
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

585)   email=$('#login_modal #login_email')[0].value;
586)   pass=$('#login_modal #login_pass')[0].value;
587)   server=$('#login_modal #login_server')[0].value;
588)   $('#login_modal').modal('hide');
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

589)   pleaseWaitShow();
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

590)   sync_server.login(server,email,pass,
591)     function(data) {
592)       localStorage.user=JSON.stringify({
593)         'name': data.name,
594)         'email': email,
595)         'password': pass,
596)         'server': server,
bn8 Add lastsync information to...

bn8 authored 10 years ago

597)         'lastsync': null
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

598)       });
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

599)       pleaseWaitHide();
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

600)       logged_menu();
601)     },
602)     function(data) {
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

603)       pleaseWaitHide();
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

604)       if (jQuery.type(data) != 'object' && data.loginerror) {
605)         alert(data.loginerror);
606)       }
607)       else {
608)         console.log(data);
609)         alert('Erreur durant la connexion au serveur');
610)       }
611)     }
612)   );
613) }
614) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

615) on_click_go_to_subscribe_btn=function() {
616)   $('#login_modal').modal('hide');
617)   $('#subscribe_modal').modal('show');
618) }
619) 
620) /********************
621)  * Subscribe
622)  ********************/
623) on_close_subscribe_modal=function(e) {
624)   $('#subscribe_modal form')[0].reset();
625) }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

626) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

627) sync_server=false;
628) on_valid_subscribe_modal=function(e) {
629)   e.preventDefault();
630)   email=$('#subscribe_modal #subscribe_email')[0].value;
631)   name=$('#subscribe_modal #subscribe_name')[0].value;
632)   pass=$('#subscribe_modal #subscribe_pass')[0].value;
633)   server=$('#subscribe_modal #subscribe_server')[0].value;
634)   $('#subscribe_modal').modal('hide');
635)   pleaseWaitShow();
636)   sync_server.subscribe(server,email,name,pass,
637)     function(data) {
638)       localStorage.user=JSON.stringify({
639)         'name': data.name,
640)         'email': data.email,
641)         'password': data.password,
642)         'server': server,
643)       });
644)       pleaseWaitHide();
645)       logged_menu();
646)       alert('Bienvenu '+data.name+' !');
647)     },
648)     function(data) {
649)       pleaseWaitHide();
650)       if (jQuery.type(data) == 'object' && jQuery.type(data.subscribeerror)!='undefined') {
651)         alert(data.subscribeerror);
652)       }
653)       else {
654)         console.log(data);
655)         alert('Erreur durant la connexion au serveur');
656)       }
657)     }
658)   );
659) }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

660) 
661) /********************
662)  * Sync
663)  ********************/
664) on_click_sync_btn=function(e) {
Benjamin Renard Hide navbar after sync btn...

Benjamin Renard authored 10 years ago

665)   navbar_collapse_hide();
Benjamin Renard Manage user global variable

Benjamin Renard authored 10 years ago

666)   if (user) {
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

667)     pleaseWaitShow();
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

668)     onsuccess=function(data) {
669)       console.log(data);
670)       if (data.groups) {
671)         groups.import(data.groups);
672)         groups.save();
bn8 Add lastsync information to...

bn8 authored 10 years ago

673)         user.lastsync=new Date().getTime();
674)         localStorage.user=JSON.stringify(user);
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

675)         refresh_group_list();
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

676)         pleaseWaitHide();
Benjamin Renard Display home after successf...

Benjamin Renard authored 10 years ago

677)         view_home();
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

678)         alert('Groupes synchronisés');
679)       }
680)       else {
681)         onerror(data);
682)       }
683)     }
684)     onerror=function(data) {
685)       pleaseWaitHide();
686)       console.log(data);
687)       if (jQuery.type(data['loginerror'])!='undefined') {
688)         alert(data['loginerror']);
689)       }
690)       else if (jQuery.type(data['syncerror'])!='undefined') {
691)         alert(data['syncerror']);
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

692)       }
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

693)       else {
694)         alert('Erreur durant la synchronisation :(');
695)       }
696)     }
697)     sync_server.sync(user.server, user.email, user.password, groups.export(),onsuccess,onerror);
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

698)   }
699)   else {
700)     alert("Vous devez vous connecter pour commencer");
701)     $('#login_modal').modal('show');
702)   }
703) }
704) 
705) /*
706)  * User menu
707)  */
708) user=false;
709) logged_menu=function() {
710)   user=JSON.parse(localStorage.user);
711)   $('#user-name').html(user.name);
712)   $('#user-menu li').remove();
713)   menu=$('#user-menu');
714)   menu.html("<li><a id='myaccount_btn'>Mon compte</a></li>"+
715)   "<li><a id='sync_btn'>Synchroniser</a></li>" +
716)   "<li class='divider'></li>" +
717)   "<li><a id='logoff_btn'>Déconnexion</a></li>");
718)   $('#myaccount_btn').bind('click',on_click_myaccount_btn);
719)   $('#sync_btn').bind('click',on_click_sync_btn);
720)   $('#logoff_btn').bind('click',on_click_logoff_btn);
721) }
722) 
723) logged_out_menu=function() {
Benjamin Renard Manage user global variable

Benjamin Renard authored 10 years ago

724)   user=false;
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

725)   $('#user-name').html('Connexion');
726)   $('#user-menu li').remove();
727)   menu=$('#user-menu');
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

728)   menu.html("<li><a id='login_btn'>Connexion</a></li>"+
729) 	"<li><a id='subscribe_btn'>Inscription</a></li>");
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

730)   $('#login_btn').bind('click',on_click_login_btn);
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

731)   $('#subscribe_btn').bind('click',on_click_subscribe_btn);
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

732) }
733) 
734) on_click_myaccount_btn=function() {
735)   $('#myaccount_modal #myaccount_email').html(user.email);
736)   $('#myaccount_modal #myaccount_name')[0].value=user.name;
Benjamin Renard Display server in myaccount...

Benjamin Renard authored 10 years ago

737)   $('#myaccount_modal #myaccount_server').html(user.server);
bn8 Add lastsync information to...

bn8 authored 10 years ago

738)   if (user.lastsync) {
739)     $('#myaccount_modal #myaccount_lastsync').html(moment(user.lastsync).format('DD/MM/YYYY HH:mm:ss'));
740)   }
741)   else {
742)     $('#myaccount_modal #myaccount_lastsync').html('Jamais synchronis&eacute;');
743)   }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

744)   $('#myaccount_modal').modal('show');
745) }
746) 
747) on_click_login_btn=function() {
748)   $('#login_modal').modal('show');
749) }
750) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

751) on_click_subscribe_btn=function() {
752)   $('#subscribe_modal').modal('show');
753) }
754) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

755) on_click_logoff_btn=function() {
756)   delete localStorage.user;
757)   logged_out_menu();
758) }
759) 
Benjamin Renard Add pleaseWaitDialog and fu...

Benjamin Renard authored 10 years ago

760) /*******************
761)  * pleaseWaitDialog
762)  *******************/
763) 
764) pleaseWaitShow=function() {
Benjamin Renard Fix please wait modal

Benjamin Renard authored 10 years ago

765)   $('#please_wait_modal').modal('show');
Benjamin Renard Add pleaseWaitDialog and fu...

Benjamin Renard authored 10 years ago

766) }
767) 
768) pleaseWaitHide=function() {
Benjamin Renard Fix please wait modal

Benjamin Renard authored 10 years ago

769)   $('#please_wait_modal').modal('hide');
Benjamin Renard Add pleaseWaitDialog and fu...

Benjamin Renard authored 10 years ago

770) }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

771) 
772) /*********************
773)  * Activate
774)  *********************/
775) $( document ).ready( function() {
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

776)   pleaseWaitShow();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

777)   if(typeof(Storage)!=="undefined"){
778)     groups=new GroupList();
779)     groups.loadFromLocalStorage();
780)     refresh_group_list();
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

781)     if (jQuery.type(localStorage.user)!='undefined') {
782)       logged_menu();
783)     }
784)     else {
785)       logged_out_menu();
786)     }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

787)   }
788)   else {
789)     alert('Local storage not supported !');
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

790)     pleaseWaitHide();
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

791)     return;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

792)   }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

793)   sync_server=new SyncServer();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

794) 
Benjamin Renard Add link on App Name in Navbar

Benjamin Renard authored 10 years ago

795)   $('#app-name').bind('click',view_home);
796) 
Benjamin Renard Hide navbar-groupe-collapse...

Benjamin Renard authored 10 years ago

797)   $('#add_group_btn').bind('click',on_click_add_group_btn);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

798)   $('#add_group_submit').bind('click',on_valid_add_group_modal);
799)   $("#add_group_modal").on('shown.bs.modal',on_show_add_group_modal);
800)   $("#add_group_modal").on('hidden.bs.modal',on_close_add_group_modal);
Benjamin Renard Manage submit event in moda...

Benjamin Renard authored 10 years ago

801)   $("#add_group_modal form").bind('submit',on_valid_add_group_modal);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

802) 
803)   $('#clear_local_data').bind('click',clear_local_data);
804) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

805)   $('#login_modal').on('hidden.bs.modal',on_close_login_modal);
806)   $('#login_modal #login_submit').bind('click',on_valid_login_modal);
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

807)   $('#login_modal #go_to_subscribe_btn').bind('click',on_click_go_to_subscribe_btn);
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

808)   $('#login_modal form').bind('submit',on_valid_login_modal);
809) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

810)   $('#subscribe_modal').on('hidden.bs.modal',on_close_subscribe_modal);
811)   $('#subscribe_modal #subscribe_submit').bind('click',on_valid_subscribe_modal);
812)   $('#subscribe_modal form').bind('submit',on_valid_subscribe_modal);
813) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

814)   $('#view-group #contributor').bind('change',on_contributor_change);
815) 
816)   $('#add_contributor_btn').bind('click',on_click_add_contributor_btn);
817)   $('#add_contributor_submit').bind('click',on_valid_add_contributor_modal);
818)   $("#add_contributor_modal").on('shown.bs.modal',on_show_add_contributor_modal);
819)   $("#add_contributor_modal").on('hidden.bs.modal',on_close_add_contributor_modal);
Benjamin Renard Manage submit event in moda...

Benjamin Renard authored 10 years ago

820)   $("#add_contributor_modal form").bind('submit',on_valid_add_contributor_modal);
bn8 Add pickadate date picker

bn8 authored 10 years ago

821)   $("#add_contribution_date").pickadate({'format': 'dd/mm/yyyy','firstDay': 1});
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

822) 
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

823)   $('#edit_contributor_btn').bind('click',on_edit_contributor_btn_click);
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

824)   $('#trash_contributor_btn').bind('click',on_trash_group_contributors_btn_click);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

825)   $('#del_contributor_btn').bind('click',on_click_del_contributor_btn);
826) 
827)   $('#add_contribution_btn').bind('click',on_click_add_contribution_btn);
828)   $('#add_contribution_submit').bind('click',on_valid_add_contribution_modal);
829)   $("#add_contribution_modal").on('shown.bs.modal',on_show_add_contribution_modal);
830)   $("#add_contribution_modal").on('hidden.bs.modal',on_close_add_contribution_modal);
831)   $("#add_contribution_modal form").on('submit',on_valid_add_contribution_modal);
832) 
833)   $("#display_balance_btn").bind('click',on_display_balance_btn_click);
834) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

835)   $("#view-group-trash #go-back-group").bind('click',on_go_back_group_btn_click);
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

836)   $("#view-group-trash-contributors #go-back-group").bind('click',on_go_back_group_trash_contributors_btn_click);
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

837) 
838)   $('#trash_group_btn').bind('click',on_trash_group_btn_click);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

839)   $('#remove_group_btn').bind('click',on_remove_group_btn_click);
Benjamin Renard Manage multiple screen part...

Benjamin Renard authored 10 years ago

840)   view_home();
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

841)   pleaseWaitHide();