996c19ba8fa23ac0ade6efd5ae3276caa4fbf0a6
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 Improve category selection

Benjamin Renard authored 10 years ago

138)   for(cid in grp.getSortedCategories()) {
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

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];
Benjamin Renard Improve category selection

Benjamin Renard authored 10 years ago

395)   current_cat=$('#add_contribution_modal #add_contribution_category')[0].value;
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

396)   cats="<option value=''>Non définie</option>";
Benjamin Renard Improve category selection

Benjamin Renard authored 10 years ago

397)   for (u in group.getSortedCategories()) {
Benjamin Renard Add Categories management

Benjamin Renard authored 10 years ago

398) 	cats+="<option value='"+u+"'>"+group.categories[u]['name']+"</option>";
399)   }
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

400)   $('#add_contribution_modal #add_contribution_category').html(cats);
Benjamin Renard Improve category selection

Benjamin Renard authored 10 years ago

401)   $('#add_contribution_modal #add_contribution_category')[0].value=current_cat;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

441)   
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

459)   
Benjamin Renard Fix category management

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

463) 	return;
464)   }
465)   
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

504)   $('#add_contribution_modal #add_contribution_title')[0].value=contribution.getTitle();
505)   $('#add_contribution_modal #add_contribution_cost')[0].value=contribution.cost;
506)   $('#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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

520)   navbar_collapse_hide();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

525)   delete localStorage.groups;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

550)   }
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

625) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

769) }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

775)   pleaseWaitShow();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

790)     return;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

791)   }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

793) 
Benjamin Renard Add link on App Name in Navbar

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

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

bn8 authored 10 years ago

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

Benjamin Renard authored 10 years ago

821) 
Benjamin Renard Add edit contributor feature

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

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

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

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

Benjamin Renard authored 10 years ago

840)   pleaseWaitHide();