Improve jQuery usage
This commit is contained in:
parent
78a4e1e3c4
commit
3ef052076d
1 changed files with 59 additions and 59 deletions
118
inc/myco.js
118
inc/myco.js
|
@ -1,15 +1,15 @@
|
||||||
refresh_group_list=function() {
|
refresh_group_list=function() {
|
||||||
grouplist=$('#group-choice')[0];
|
grouplist=$('#group-choice');
|
||||||
$('a.group-choice').each(function(idx,a) {
|
$('a.group-choice').each(function(idx,a) {
|
||||||
$(a).parent().remove();
|
$(a).parent().remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (groups.count()==0) {
|
if (groups.count()==0) {
|
||||||
$(grouplist).prepend('<li><a class="group-choice">Aucune groupe</a></li>');
|
grouplist.prepend('<li><a class="group-choice">Aucune groupe</a></li>');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
groups.each(function(idx,group) {
|
groups.each(function(idx,group) {
|
||||||
$(grouplist).prepend('<li><a class="group-choice" data-uuid="'+group.uuid+'">'+group.name+'</a></li>');
|
grouplist.prepend('<li><a class="group-choice" data-uuid="'+group.uuid+'">'+group.name+'</a></li>');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a.group-choice').each(function(idx,a) {
|
$('a.group-choice').each(function(idx,a) {
|
||||||
|
@ -34,7 +34,7 @@ on_show_add_group_modal=function(e) {
|
||||||
|
|
||||||
on_valid_add_group_modal=function (e) {
|
on_valid_add_group_modal=function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var name=$('#add_group_name')[0].value;
|
var name=$('#add_group_name').val();
|
||||||
if (name=='') {
|
if (name=='') {
|
||||||
alert('Vous devez saisir un nom !');
|
alert('Vous devez saisir un nom !');
|
||||||
return;
|
return;
|
||||||
|
@ -172,14 +172,14 @@ on_contributor_change=function(e) {
|
||||||
$('#group-navbar-collapse-1').collapse('hide');
|
$('#group-navbar-collapse-1').collapse('hide');
|
||||||
}
|
}
|
||||||
$('#view-group #group-username').html($('#view-group #contributor option:selected').text());
|
$('#view-group #group-username').html($('#view-group #contributor option:selected').text());
|
||||||
show_contributions(groups[$('#view-group').data('uuid')],$('#view-group #contributor')[0].value);
|
show_contributions(groups[$('#view-group').data('uuid')],$('#view-group #contributor').val());
|
||||||
$('#nav-search-form input')[0].value='';
|
$('#nav-search-form input').val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
_current_displayed_contributions=[];
|
_current_displayed_contributions=[];
|
||||||
_current_displayed_contributions_group=null;
|
_current_displayed_contributions_group=null;
|
||||||
show_contributions=function(group,contributor_email,contributions) {
|
show_contributions=function(group,contributor_email,contributions) {
|
||||||
var tbody=$($('#view-group #contributions tbody')[0]);
|
var tbody=$('#view-group #contributions tbody').first();
|
||||||
tbody.html('');
|
tbody.html('');
|
||||||
if (!contributions) {
|
if (!contributions) {
|
||||||
contributions=group.contributionsByContributorEmail(contributor_email);
|
contributions=group.contributionsByContributorEmail(contributor_email);
|
||||||
|
@ -192,7 +192,7 @@ show_contributions=function(group,contributor_email,contributions) {
|
||||||
|
|
||||||
show_more_contributions=function(count) {
|
show_more_contributions=function(count) {
|
||||||
if (!_current_displayed_contributions_group) return;
|
if (!_current_displayed_contributions_group) return;
|
||||||
var tbody=$($('#view-group #contributions tbody')[0]);
|
var tbody=$('#view-group #contributions tbody').first();
|
||||||
if (_current_displayed_contributions.length==0) {
|
if (_current_displayed_contributions.length==0) {
|
||||||
tbody.html('');
|
tbody.html('');
|
||||||
tbody.append('<tr><td colspan=3>Aucune contributions</td></tr>');
|
tbody.append('<tr><td colspan=3>Aucune contributions</td></tr>');
|
||||||
|
@ -311,7 +311,7 @@ on_categories_go_back_group_btn_click=function(e) {
|
||||||
|
|
||||||
on_categories_group_add_btn_click=function(e) {
|
on_categories_group_add_btn_click=function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
name=$('#add_category input')[0].value;
|
name=$('#add_category input').val();
|
||||||
|
|
||||||
if (jQuery.type(name)!='string' || name=='') {
|
if (jQuery.type(name)!='string' || name=='') {
|
||||||
return;
|
return;
|
||||||
|
@ -324,7 +324,7 @@ on_categories_group_add_btn_click=function(e) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
group.addCategory(new Category(name));
|
group.addCategory(new Category(name));
|
||||||
$('#add_category input')[0].value='';
|
$('#add_category input').val('');
|
||||||
refresh_group_categories(group);
|
refresh_group_categories(group);
|
||||||
$('#add_category input').focus();
|
$('#add_category input').focus();
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ on_nav_search_form_input=function(e) {
|
||||||
var pattern=ipt.val();
|
var pattern=ipt.val();
|
||||||
|
|
||||||
group=groups[$('#view-group').data('uuid')];
|
group=groups[$('#view-group').data('uuid')];
|
||||||
contributor_email=$('#view-group #contributor')[0].value;
|
contributor_email=$('#view-group #contributor').val();
|
||||||
|
|
||||||
var found=group.searchContributions(pattern,contributor_email);
|
var found=group.searchContributions(pattern,contributor_email);
|
||||||
show_contributions(group,null,found);
|
show_contributions(group,null,found);
|
||||||
|
@ -362,7 +362,7 @@ on_nav_search_form_input=function(e) {
|
||||||
|
|
||||||
on_trash_group_btn_click=function(e) {
|
on_trash_group_btn_click=function(e) {
|
||||||
group=groups[$('#view-group').data('uuid')];
|
group=groups[$('#view-group').data('uuid')];
|
||||||
contributor_email=$('#view-group #contributor')[0].value;
|
contributor_email=$('#view-group #contributor').val();
|
||||||
bottom_navbar_collapse_hide();
|
bottom_navbar_collapse_hide();
|
||||||
view_group_trash(group,contributor_email);
|
view_group_trash(group,contributor_email);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ view_group_trash=function(group,contributor_email) {
|
||||||
|
|
||||||
on_contribution_restore_btn_click=function(e) {
|
on_contribution_restore_btn_click=function(e) {
|
||||||
var group=groups[$('#view-group-trash').data('uuid')];
|
var group=groups[$('#view-group-trash').data('uuid')];
|
||||||
contribution_uuid=$($(e.target).parents('tr')[0]).data('uuid');
|
contribution_uuid=$(e.target).parents('tr').first().data('uuid');
|
||||||
contribution=group.importContribution(group.deletedContributions[contribution_uuid]);
|
contribution=group.importContribution(group.deletedContributions[contribution_uuid]);
|
||||||
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} );
|
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} );
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ view_group_trash_contributors=function(group) {
|
||||||
|
|
||||||
on_contributor_restore_btn_click=function(e) {
|
on_contributor_restore_btn_click=function(e) {
|
||||||
var group=groups[$('#view-group-trash-contributors').data('uuid')];
|
var group=groups[$('#view-group-trash-contributors').data('uuid')];
|
||||||
contributor_email=$($(e.target).parents('tr')[0]).data('email');
|
contributor_email=$(e.target).parents('tr').first().data('email');
|
||||||
contributor=group.importContributor(group.deletedContributors[contributor_email]);
|
contributor=group.importContributor(group.deletedContributors[contributor_email]);
|
||||||
myconfirm('Etes-vous sûre de vouloir restaurer '+contributor.name+' ?',on_confirm_contributor_restore,null,{'group':group,'contributor_email':contributor_email, 'contributor': contributor} );
|
myconfirm('Etes-vous sûre de vouloir restaurer '+contributor.name+' ?',on_confirm_contributor_restore,null,{'group':group,'contributor_email':contributor_email, 'contributor': contributor} );
|
||||||
}
|
}
|
||||||
|
@ -454,8 +454,8 @@ on_confirm_contributor_restore=function(data) {
|
||||||
******************************/
|
******************************/
|
||||||
on_click_add_contributor_btn=function() {
|
on_click_add_contributor_btn=function() {
|
||||||
$('#add_contributor_modal').data('group-uuid',$('#view-group').data('uuid'))
|
$('#add_contributor_modal').data('group-uuid',$('#view-group').data('uuid'))
|
||||||
$($('#add_contributor_modal h4')[0]).html('Ajouter un participant');
|
$('#add_contributor_modal h4').first().html('Ajouter un participant');
|
||||||
$($('#add_contributor_modal #add_contributor_submit')[0]).html('Ajouter');
|
$('#add_contributor_modal #add_contributor_submit').first().html('Ajouter');
|
||||||
$('#add_contributor_modal').data('edit-id','-1');
|
$('#add_contributor_modal').data('edit-id','-1');
|
||||||
$('#add_contributor_modal #add_contributor_email').attr('disabled',false);
|
$('#add_contributor_modal #add_contributor_email').attr('disabled',false);
|
||||||
$('#add_contributor_modal').modal('show');
|
$('#add_contributor_modal').modal('show');
|
||||||
|
@ -473,13 +473,13 @@ validateEmail=function(email) {
|
||||||
on_valid_add_contributor_modal=function(e) {
|
on_valid_add_contributor_modal=function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var group=groups[$('#add_contributor_modal').data('group-uuid')];
|
var group=groups[$('#add_contributor_modal').data('group-uuid')];
|
||||||
var name=$('#add_contributor_name')[0].value;
|
var name=$('#add_contributor_name').val();
|
||||||
var edit_id=$('#add_contributor_modal').data('edit-id');
|
var edit_id=$('#add_contributor_modal').data('edit-id');
|
||||||
if (name=='') {
|
if (name=='') {
|
||||||
alert('Vous devez saisir un nom !');
|
alert('Vous devez saisir un nom !');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var email=$('#add_contributor_email')[0].value;
|
var email=$('#add_contributor_email').val();
|
||||||
if (email=='') {
|
if (email=='') {
|
||||||
alert('Vous devez saisir un email !');
|
alert('Vous devez saisir un email !');
|
||||||
return;
|
return;
|
||||||
|
@ -506,27 +506,27 @@ on_valid_add_contributor_modal=function(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
on_close_add_contributor_modal=function () {
|
on_close_add_contributor_modal=function () {
|
||||||
$('#add_contributor_name')[0].value='';
|
$('#add_contributor_name').val('');
|
||||||
$('#add_contributor_email')[0].value='';
|
$('#add_contributor_email').val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
on_edit_contributor_btn_click=function(e) {
|
on_edit_contributor_btn_click=function(e) {
|
||||||
var group=groups[$('#view-group').data('uuid')];
|
var group=groups[$('#view-group').data('uuid')];
|
||||||
$('#add_contributor_modal').data('group-uuid',group.uuid);
|
$('#add_contributor_modal').data('group-uuid',group.uuid);
|
||||||
contributor_email=$('#view-group #contributor')[0].value;
|
contributor_email=$('#view-group #contributor').val();
|
||||||
contributor=group.contributorByEmail(contributor_email);
|
contributor=group.contributorByEmail(contributor_email);
|
||||||
$('#add_contributor_modal').data('edit-id',contributor_email);
|
$('#add_contributor_modal').data('edit-id',contributor_email);
|
||||||
$('#add_contributor_modal #add_contributor_name')[0].value=contributor.name;
|
$('#add_contributor_modal #add_contributor_name').val(contributor.name);
|
||||||
$('#add_contributor_modal #add_contributor_email')[0].value=contributor.email;
|
$('#add_contributor_modal #add_contributor_email').val(contributor.email);
|
||||||
$('#add_contributor_modal #add_contributor_email').attr('disabled',true);
|
$('#add_contributor_modal #add_contributor_email').attr('disabled',true);
|
||||||
$($('#add_contributor_modal h4')[0]).html('Editer un participant');
|
$('#add_contributor_modal h4').html('Editer un participant');
|
||||||
$($('#add_contributor_modal #add_contributor_submit')[0]).html('Valider');
|
$('#add_contributor_modal #add_contributor_submit').html('Valider');
|
||||||
$('#add_contributor_modal').modal('show');
|
$('#add_contributor_modal').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
on_click_del_contributor_btn=function() {
|
on_click_del_contributor_btn=function() {
|
||||||
var group=groups[$('#view-group').data('uuid')];
|
var group=groups[$('#view-group').data('uuid')];
|
||||||
contributor=group.contributorByEmail($('#view-group #contributor')[0].value);
|
contributor=group.contributorByEmail($('#view-group #contributor').val());
|
||||||
question='Voulez-vous vraiment supprimer '+contributor.name+' ?';
|
question='Voulez-vous vraiment supprimer '+contributor.name+' ?';
|
||||||
myconfirm(question,on_confirm_del_contributor,null,contributor);
|
myconfirm(question,on_confirm_del_contributor,null,contributor);
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ on_confirm_del_contributor=function(contributor) {
|
||||||
last_selected_date=moment().format('DD/MM/YYYY');
|
last_selected_date=moment().format('DD/MM/YYYY');
|
||||||
on_show_add_contribution_modal=function(e) {
|
on_show_add_contribution_modal=function(e) {
|
||||||
$('#add_contribution_modal #add_contribution_contributor_email').html($('#view-group #contributor').html());
|
$('#add_contribution_modal #add_contribution_contributor_email').html($('#view-group #contributor').html());
|
||||||
$('#add_contribution_modal #add_contribution_contributor_email')[0].value=$('#view-group #contributor')[0].value;
|
$('#add_contribution_modal #add_contribution_contributor_email').val($('#view-group #contributor').val());
|
||||||
gid=$('#add_contribution_modal').data('group-uuid');
|
gid=$('#add_contribution_modal').data('group-uuid');
|
||||||
group=groups[gid];
|
group=groups[gid];
|
||||||
populate_add_contribution_categories(group);
|
populate_add_contribution_categories(group);
|
||||||
|
@ -566,7 +566,7 @@ populate_add_contribution_categories=function(group,select) {
|
||||||
gid=$('#add_contribution_modal').data('group-uuid');
|
gid=$('#add_contribution_modal').data('group-uuid');
|
||||||
group=groups[gid];
|
group=groups[gid];
|
||||||
}
|
}
|
||||||
current_cat=$('#add_contribution_modal #add_contribution_category')[0].value;
|
current_cat=$('#add_contribution_modal #add_contribution_category').val();
|
||||||
cats="<option value=''>Non définie</option>";
|
cats="<option value=''>Non définie</option>";
|
||||||
for (u in group.getSortedCategories()) {
|
for (u in group.getSortedCategories()) {
|
||||||
cats+="<option value='"+u+"'>"+group.categories[u]['name']+"</option>";
|
cats+="<option value='"+u+"'>"+group.categories[u]['name']+"</option>";
|
||||||
|
@ -588,11 +588,11 @@ on_select_contribution_suggestion=function(event,choice,name) {
|
||||||
|
|
||||||
on_click_add_contribution_btn=function() {
|
on_click_add_contribution_btn=function() {
|
||||||
$('#add_contribution_modal').data('group-uuid',$('#view-group').data('uuid'));
|
$('#add_contribution_modal').data('group-uuid',$('#view-group').data('uuid'));
|
||||||
$('#add_contribution_modal #edit_uuid')[0].value='-1';
|
$('#add_contribution_modal #edit_uuid').val('-1');
|
||||||
$('#add_contribution_date').val(last_selected_date);
|
$('#add_contribution_date').val(last_selected_date);
|
||||||
$('#add_contribution_date').data('value',last_selected_date);
|
$('#add_contribution_date').data('value',last_selected_date);
|
||||||
$($('#add_contribution_modal h4')[0]).html('Ajouter une contribution');
|
$('#add_contribution_modal h4').html('Ajouter une contribution');
|
||||||
$($('#add_contribution_modal #add_contribution_submit')[0]).html('Ajouter');
|
$('#add_contribution_modal #add_contribution_submit').html('Ajouter');
|
||||||
$('#add_contribution_modal').modal('show');
|
$('#add_contribution_modal').modal('show');
|
||||||
$('#add_contribution_title').val('').focus();
|
$('#add_contribution_title').val('').focus();
|
||||||
}
|
}
|
||||||
|
@ -600,19 +600,19 @@ on_click_add_contribution_btn=function() {
|
||||||
on_valid_add_contribution_modal=function(e) {
|
on_valid_add_contribution_modal=function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var group=groups[$('#add_contribution_modal').data('group-uuid')];
|
var group=groups[$('#add_contribution_modal').data('group-uuid')];
|
||||||
var contributor_email=$('#add_contribution_contributor_email')[0].value;
|
var contributor_email=$('#add_contribution_contributor_email').val();
|
||||||
var contributor=group.contributorByEmail(contributor_email);
|
var contributor=group.contributorByEmail(contributor_email);
|
||||||
if (contributor==undefined) {
|
if (contributor==undefined) {
|
||||||
alert('Participant inconu !');
|
alert('Participant inconu !');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var title=$('#add_contribution_title')[0].value;
|
var title=$('#add_contribution_title').val();
|
||||||
if (title=='') {
|
if (title=='') {
|
||||||
$('#add_contribution_title').focus();
|
$('#add_contribution_title').focus();
|
||||||
alert('Vous devez saisir un titre !');
|
alert('Vous devez saisir un titre !');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var cost=$('#add_contribution_cost')[0].value;
|
var cost=$('#add_contribution_cost').val();
|
||||||
if (cost=='') {
|
if (cost=='') {
|
||||||
$('#add_contribution_cost').focus();
|
$('#add_contribution_cost').focus();
|
||||||
alert('Vous devez saisir un coût !');
|
alert('Vous devez saisir un coût !');
|
||||||
|
@ -625,7 +625,7 @@ on_valid_add_contribution_modal=function(e) {
|
||||||
}
|
}
|
||||||
cost=parseFloat(cost.replace(',','.'));
|
cost=parseFloat(cost.replace(',','.'));
|
||||||
|
|
||||||
var date=$('#add_contribution_date')[0].value;
|
var date=$('#add_contribution_date').val();
|
||||||
date.replace(/ /g,'');
|
date.replace(/ /g,'');
|
||||||
if (date!='') {
|
if (date!='') {
|
||||||
if(!RegExp('^[0-3][0-9]\/[0-1][0-9]\/[0-2][0-9][0-9][0-9]$').test(date)) {
|
if(!RegExp('^[0-3][0-9]\/[0-1][0-9]\/[0-2][0-9][0-9][0-9]$').test(date)) {
|
||||||
|
@ -644,20 +644,20 @@ on_valid_add_contribution_modal=function(e) {
|
||||||
}
|
}
|
||||||
last_selected_date=moment(date).format('DD/MM/YYYY');
|
last_selected_date=moment(date).format('DD/MM/YYYY');
|
||||||
|
|
||||||
var cat=$('#add_contribution_category')[0].value;
|
var cat=$('#add_contribution_category').val();
|
||||||
if (cat != '' && !jQuery.type(group.categories[cat])) {
|
if (cat != '' && !jQuery.type(group.categories[cat])) {
|
||||||
alert('Category incorrect');
|
alert('Category incorrect');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('#add_contribution_modal #edit_uuid')[0].value=='-1') {
|
if($('#add_contribution_modal #edit_uuid').val()=='-1') {
|
||||||
group.addContribution(new Contribution(contributor,cost,title,date,cat));
|
group.addContribution(new Contribution(contributor,cost,title,date,cat));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
contribution_uuid=$('#add_contribution_modal #edit_uuid')[0].value;
|
contribution_uuid=$('#add_contribution_modal #edit_uuid').val();
|
||||||
group.updateContribution(contribution_uuid,new Contribution(contributor,cost,title,date,cat));
|
group.updateContribution(contribution_uuid,new Contribution(contributor,cost,title,date,cat));
|
||||||
}
|
}
|
||||||
show_contributions(group,$('#view-group #contributor')[0].value);
|
show_contributions(group,$('#view-group #contributor').val());
|
||||||
$('#add_contribution_modal').modal('hide');
|
$('#add_contribution_modal').modal('hide');
|
||||||
$('#add_contribution_modal form')[0].reset();
|
$('#add_contribution_modal form')[0].reset();
|
||||||
groups.save();
|
groups.save();
|
||||||
|
@ -669,7 +669,7 @@ on_close_add_contribution_modal=function () {
|
||||||
|
|
||||||
on_contribution_delete_btn_click=function(e) {
|
on_contribution_delete_btn_click=function(e) {
|
||||||
var group=groups[$('#view-group').data('uuid')];
|
var group=groups[$('#view-group').data('uuid')];
|
||||||
contribution_uuid=$($(e.target).parents('div')[0]).data('uuid');
|
contribution_uuid=$(e.target).parents('div').first().data('uuid');
|
||||||
contribution=group.contributions[contribution_uuid];
|
contribution=group.contributions[contribution_uuid];
|
||||||
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} );
|
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} );
|
||||||
}
|
}
|
||||||
|
@ -683,19 +683,19 @@ on_confirm_contribution_delete=function(data) {
|
||||||
on_contribution_edit_btn_click=function(e) {
|
on_contribution_edit_btn_click=function(e) {
|
||||||
var group=groups[$('#view-group').data('uuid')];
|
var group=groups[$('#view-group').data('uuid')];
|
||||||
$('#add_contribution_modal').data('group-uuid',$('#view-group').data('uuid'));
|
$('#add_contribution_modal').data('group-uuid',$('#view-group').data('uuid'));
|
||||||
$($('#add_contribution_modal h4')[0]).html('Editer une contribution');
|
$('#add_contribution_modal h4').first().html('Editer une contribution');
|
||||||
$($('#add_contribution_modal #add_contribution_submit')[0]).html('Valider');
|
$('#add_contribution_modal #add_contribution_submit').html('Valider');
|
||||||
contribution_uuid=$($(e.target).parents('div')[0]).data('uuid');
|
contribution_uuid=$(e.target).parents('div').first().data('uuid');
|
||||||
contribution=group.contributions[contribution_uuid];
|
contribution=group.contributions[contribution_uuid];
|
||||||
$('#add_contribution_modal #add_contribution_contributor_email')[0].value=contribution.contributor.email;
|
$('#add_contribution_modal #add_contribution_contributor_email').val(contribution.contributor.email);
|
||||||
$('#add_contribution_modal #add_contribution_title')[0].value=contribution.getTitle();
|
$('#add_contribution_modal #add_contribution_title').val(contribution.getTitle());
|
||||||
$('#add_contribution_modal #add_contribution_cost')[0].value=contribution.cost;
|
$('#add_contribution_modal #add_contribution_cost').val(contribution.cost);
|
||||||
$('#add_contribution_modal #add_contribution_date')[0].value=moment(contribution.date).format('DD/MM/YYYY');
|
$('#add_contribution_modal #add_contribution_date').val(moment(contribution.date).format('DD/MM/YYYY'));
|
||||||
$('#add_contribution_modal #add_contribution_date').data('value',moment(contribution.date).format('DD/MM/YYYY'));
|
$('#add_contribution_modal #add_contribution_date').data('value',moment(contribution.date).format('DD/MM/YYYY'));
|
||||||
if (contribution.category) {
|
if (contribution.category) {
|
||||||
populate_add_contribution_categories(group,contribution.category);
|
populate_add_contribution_categories(group,contribution.category);
|
||||||
}
|
}
|
||||||
$('#add_contribution_modal #edit_uuid')[0].value=contribution_uuid;
|
$('#add_contribution_modal #edit_uuid').val(contribution_uuid);
|
||||||
$('#add_contribution_modal').modal('show');
|
$('#add_contribution_modal').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ on_display_balance_btn_click=function(e) {
|
||||||
|
|
||||||
display_balance=function(group) {
|
display_balance=function(group) {
|
||||||
bal=group.balance();
|
bal=group.balance();
|
||||||
tbody=$($('#display_balance_modal tbody')[0]);
|
tbody=$('#display_balance_modal tbody').first();
|
||||||
tbody.html('');
|
tbody.html('');
|
||||||
for (c in bal['balance']) {
|
for (c in bal['balance']) {
|
||||||
if(bal['balance'][c]['diff']<0) {
|
if(bal['balance'][c]['diff']<0) {
|
||||||
|
@ -770,9 +770,9 @@ on_close_login_modal=function(e) {
|
||||||
sync_server=false;
|
sync_server=false;
|
||||||
on_valid_login_modal=function(e) {
|
on_valid_login_modal=function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
email=$('#login_modal #login_email')[0].value;
|
email=$('#login_modal #login_email').val();
|
||||||
pass=$('#login_modal #login_pass')[0].value;
|
pass=$('#login_modal #login_pass').val();
|
||||||
server=$('#login_modal #login_server')[0].value;
|
server=$('#login_modal #login_server').val();
|
||||||
$('#login_modal').modal('hide');
|
$('#login_modal').modal('hide');
|
||||||
pleaseWaitShow();
|
pleaseWaitShow();
|
||||||
sync_server.login(server,email,pass,
|
sync_server.login(server,email,pass,
|
||||||
|
@ -815,10 +815,10 @@ on_close_subscribe_modal=function(e) {
|
||||||
sync_server=false;
|
sync_server=false;
|
||||||
on_valid_subscribe_modal=function(e) {
|
on_valid_subscribe_modal=function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
email=$('#subscribe_modal #subscribe_email')[0].value;
|
email=$('#subscribe_modal #subscribe_email').val();
|
||||||
name=$('#subscribe_modal #subscribe_name')[0].value;
|
name=$('#subscribe_modal #subscribe_name').val();
|
||||||
pass=$('#subscribe_modal #subscribe_pass')[0].value;
|
pass=$('#subscribe_modal #subscribe_pass').val();
|
||||||
server=$('#subscribe_modal #subscribe_server')[0].value;
|
server=$('#subscribe_modal #subscribe_server').val();
|
||||||
$('#subscribe_modal').modal('hide');
|
$('#subscribe_modal').modal('hide');
|
||||||
pleaseWaitShow();
|
pleaseWaitShow();
|
||||||
sync_server.subscribe(server,email,name,pass,
|
sync_server.subscribe(server,email,name,pass,
|
||||||
|
@ -902,7 +902,7 @@ on_export_all_btn_click=function(e) {
|
||||||
a.attr('href',window.URL.createObjectURL(blob));
|
a.attr('href',window.URL.createObjectURL(blob));
|
||||||
a.css('display','none');
|
a.css('display','none');
|
||||||
$('body').append(a);
|
$('body').append(a);
|
||||||
a[0].click();
|
a.click();
|
||||||
a.remove();
|
a.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@ on_import_all_btn_click=function(e) {
|
||||||
var input=$('<input type="file"/>');
|
var input=$('<input type="file"/>');
|
||||||
input.css('display','none');
|
input.css('display','none');
|
||||||
$('body').append(input);
|
$('body').append(input);
|
||||||
input[0].click();
|
input.click();
|
||||||
input.bind('change',{'input': input},function(e) {
|
input.bind('change',{'input': input},function(e) {
|
||||||
pleaseWaitShow();
|
pleaseWaitShow();
|
||||||
var file=input.prop('files')[0];
|
var file=input.prop('files')[0];
|
||||||
|
@ -983,7 +983,7 @@ logged_out_menu=function() {
|
||||||
|
|
||||||
on_click_myaccount_btn=function() {
|
on_click_myaccount_btn=function() {
|
||||||
$('#myaccount_modal #myaccount_email').html(user.email);
|
$('#myaccount_modal #myaccount_email').html(user.email);
|
||||||
$('#myaccount_modal #myaccount_name')[0].value=user.name;
|
$('#myaccount_modal #myaccount_name').val(user.name);
|
||||||
$('#myaccount_modal #myaccount_server').html(user.server);
|
$('#myaccount_modal #myaccount_server').html(user.server);
|
||||||
if (user.lastsync) {
|
if (user.lastsync) {
|
||||||
$('#myaccount_modal #myaccount_lastsync').html(moment(user.lastsync).format('DD/MM/YYYY HH:mm:ss'));
|
$('#myaccount_modal #myaccount_lastsync').html(moment(user.lastsync).format('DD/MM/YYYY HH:mm:ss'));
|
||||||
|
|
Loading…
Reference in a new issue