824225b5d63cebfdb81c781d45ea97a083246a5f
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)   ul=$('#grp_cat_modal ul');
137)   html="";
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

138)   for(cid in grp.categories) {
139)     html+="<li><span class='cat-color' style='background-color: "+grp.categories[cid]['color']+"'></span> "+grp.categories[cid]['name']+"</li>";
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

140)   }
141)   ul.html(html);
142)   $('#grp_cat_modal').modal('show');
143) }
144) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

145) /****************
146)  * View group
147)  ****************/
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

154) }
155) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

163)       if (email == contributor_email) {
164)         sel=' selected';
165)       }
166)       else {
167)         sel='';
168)       }
169)       $('#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

170)     }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

176) }
177) 
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

191)       var cat='';
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

192)       if (contributions[idx].category && jQuery.type(group.categories[contributions[idx].category])) {
193) 		cat='<br/><span class="category"><span class="cat-color" style="background-color: '+group.categories[contributions[idx].category]['color']+'"></span> '+group.categories[contributions[idx].category]['name']+"</span>";
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

195)       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

196)       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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

200)   }
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

201)   
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

202)   $('.contribution_delete_btn').bind('click',on_contribution_delete_btn_click);
203)   $('.contribution_edit_btn').bind('click',on_contribution_edit_btn_click);
204) }
205) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

206) /*****************************
207)  * Trash
208)  *****************************/
209) 
210) on_trash_group_btn_click=function(e) {
211)   group=groups[$('#view-group').data('uuid')];
212)   contributor_email=$('#view-group #contributor')[0].value;
213)   view_group_trash(group,contributor_email);
214) }
215) 
216) on_go_back_group_btn_click=function(e) {
217)   group=groups[$('#view-group-trash').data('uuid')];
218)   contributor_email=$('#view-group-trash').data('contributor-email');
219)   view_group(group,contributor_email);
220) }
221) 
222) view_group_trash=function(group,contributor_email) {
223)   $('#view-group-trash').data('uuid',group.uuid);
224)   $('#view-group-trash').data('contributor-email',contributor_email);
225)   var tbody=$('#view-group-trash #trash tbody');
226)   tbody.html('');
227)   contributions=group.deletedContributionsByContributorEmail(contributor_email);
228)   contributions.reverse();
229)   if (contributions.length==0) {
230)     tbody.append('<tr><td colspan=3>Aucune contributions</td></tr>');
231)   }
232)   else {
233)     for (idx in contributions) {
234)       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>');
235)     }
236)   }
237)   
238)   $('#view-group-trash .contribution_restore_btn').bind('click',on_contribution_restore_btn_click);
239)  
240)   view_part('#view-group-trash');
241) }
242) 
243) on_contribution_restore_btn_click=function(e) {
244)   var group=groups[$('#view-group-trash').data('uuid')];
245)   contribution_uuid=$($(e.target).parents('tr')[0]).data('uuid');
246)   contribution=group.importContribution(group.deletedContributions[contribution_uuid]);
247)   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} );
248) }
249) 
250) on_confirm_contribution_restore=function(data) {
251)   data.group.restoreContribution(data.contribution_uuid);
252)   groups.save();
253)   view_group(data.group,data.contribution.contributor.email);
254) }
255) 
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

298) /******************************
299)  * Add/Edit/remove contributor
300)  ******************************/
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

314) validateEmail=function(email) {
315)     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,}))$/;
316)     return re.test(email);
317) }
318) 
Benjamin Renard Manage submit event in moda...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

335)     alert('Un contributor utilise déjà cet email !');
336)     return;
337)   }
Benjamin Renard Add contributor's email val...

Benjamin Renard authored 10 years ago

338)   if (!validateEmail(email)) {
339)     alert('Email invalide !');
340)     return;
341)   }
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

347)   }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

348)   set_contributors(group);
349)   $('#add_contributor_modal').modal('hide');
350)   groups.save();
Benjamin Renard Display contribution of con...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

377)   myconfirm(question,on_confirm_del_contributor,null,contributor);
378) }
379) 
380) on_confirm_del_contributor=function(contributor) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

383)   view_group(group);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

391)   $('#add_contribution_modal #add_contribution_contributor_email').html($('#view-group #contributor').html());
392)   $('#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

393)   gid=$('#add_contribution_modal').data('group-uuid');
394)   group=groups[gid];
395)   cats="<option value=''>Non définie</option>";
396)   for (u in group.categories) {
397) 	cats+="<option value='"+u+"'>"+group.categories[u]['name']+"</option>";
398)   }
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

399)   $('#add_contribution_modal #add_contribution_category').html(cats);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

439)   
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

457)   
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

458)   var cat=$('#add_contribution_category')[0].value;
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

459)   if (cat != '' && !jQuery.type(group.categories[cat])) {
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

460) 	alert('Category incorrect');
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

461) 	return;
462)   }
463)   
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

466)   }
467)   else {
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

483)   contribution_uuid=$($(e.target).parents('div')[0]).data('uuid');
484)   contribution=group.contributions[contribution_uuid];
485)   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

486) }
487) 
488) on_confirm_contribution_delete=function(data) {
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

490)   groups.save();
491)   on_contributor_change();
492) }
493) 
494) on_contribution_edit_btn_click=function(e) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

502)   $('#add_contribution_modal #add_contribution_title')[0].value=contribution.getTitle();
503)   $('#add_contribution_modal #add_contribution_cost')[0].value=contribution.cost;
504)   $('#add_contribution_modal #add_contribution_date')[0].value=moment(contribution.date).format('DD/MM/YYYY');
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

505)   if (contribution.category) {
506) 	$('#add_contribution_modal #add_contribution_category')[0].value=contribution.category;
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

507)   }
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

518)   navbar_collapse_hide();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

523)   delete localStorage.groups;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

547)     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

548)   }
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

597)       logged_menu();
598)     },
599)     function(data) {
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

623) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

657) 
658) /********************
659)  * Sync
660)  ********************/
661) on_click_sync_btn=function(e) {
Benjamin Renard Hide navbar after sync btn...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

665)     onsuccess=function(data) {
666)       console.log(data);
667)       if (data.groups) {
668)         groups.import(data.groups);
669)         groups.save();
bn8 Add lastsync information to...

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

690)       else {
691)         alert('Erreur durant la synchronisation :(');
692)       }
693)     }
694)     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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

722)   $('#user-name').html('Connexion');
723)   $('#user-menu li').remove();
724)   menu=$('#user-menu');
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

748) on_click_subscribe_btn=function() {
749)   $('#subscribe_modal').modal('show');
750) }
751) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

752) on_click_logoff_btn=function() {
753)   delete localStorage.user;
754)   logged_out_menu();
755) }
756) 
Benjamin Renard Add pleaseWaitDialog and fu...

Benjamin Renard authored 10 years ago

757) /*******************
758)  * pleaseWaitDialog
759)  *******************/
760) 
761) pleaseWaitShow=function() {
Benjamin Renard Fix please wait modal

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

763) }
764) 
765) pleaseWaitHide=function() {
Benjamin Renard Fix please wait modal

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

767) }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

768) 
769) /*********************
770)  * Activate
771)  *********************/
772) $( document ).ready( function() {
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

773)   pleaseWaitShow();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

784)   }
785)   else {
786)     alert('Local storage not supported !');
Benjamin Renard Use pleaseWaitDialog in som...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

788)     return;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

789)   }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

791) 
Benjamin Renard Add link on App Name in Navbar

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

795)   $('#add_group_submit').bind('click',on_valid_add_group_modal);
796)   $("#add_group_modal").on('shown.bs.modal',on_show_add_group_modal);
797)   $("#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

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

Benjamin Renard authored 10 years ago

799) 
800)   $('#clear_local_data').bind('click',clear_local_data);
801) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

804)   $('#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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

811)   $('#view-group #contributor').bind('change',on_contributor_change);
812) 
813)   $('#add_contributor_btn').bind('click',on_click_add_contributor_btn);
814)   $('#add_contributor_submit').bind('click',on_valid_add_contributor_modal);
815)   $("#add_contributor_modal").on('shown.bs.modal',on_show_add_contributor_modal);
816)   $("#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

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

819) 
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

832)   $("#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

833)   $("#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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

838)   pleaseWaitHide();