Initial commit
This commit is contained in:
commit
24f07b6e56
7 changed files with 908 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*~
|
||||
*.swp
|
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,018 B |
6
inc/lib/moment.min.js
vendored
Normal file
6
inc/lib/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
371
inc/myco.js
Normal file
371
inc/myco.js
Normal file
|
@ -0,0 +1,371 @@
|
|||
refresh_group_list=function() {
|
||||
grouplist=$('#group-choice')[0];
|
||||
$('a.group-choice').each(function(idx,a) {
|
||||
$(a).parent().remove();
|
||||
});
|
||||
|
||||
if (groups.count()==0) {
|
||||
$(grouplist).prepend('<li><a class="group-choice">Aucune groupe</a></li>');
|
||||
|
||||
}
|
||||
else {
|
||||
groups.each(function(idx,group) {
|
||||
$(grouplist).prepend('<li><a class="group-choice">'+group.name+'</a></li>');
|
||||
});
|
||||
|
||||
$('a.group-choice').each(function(idx,a) {
|
||||
$(a).bind('click',on_group_choice_click);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
* Add group
|
||||
****************/
|
||||
on_show_add_group_modal=function(e) {
|
||||
$('#add_group_modal #add_group_name').focus();
|
||||
}
|
||||
|
||||
on_valid_add_group_modal=function () {
|
||||
var name=$('#add_group_name')[0].value;
|
||||
if (name=='') {
|
||||
alert('Vous devez saisir un nom !');
|
||||
return;
|
||||
}
|
||||
if (groups[name]!==undefined) {
|
||||
alert('Ce groupe exite déjà !');
|
||||
return;
|
||||
}
|
||||
groups[name]=new Group(name);
|
||||
refresh_group_list();
|
||||
$('#add_group_modal').modal('hide');
|
||||
groups.save();
|
||||
view_group(groups[name]);
|
||||
}
|
||||
|
||||
on_close_add_group_modal=function () {
|
||||
$('#add_group_name form')[0].reset();
|
||||
}
|
||||
|
||||
/****************
|
||||
* Nav bars
|
||||
****************/
|
||||
on_group_choice_click=function(e) {
|
||||
view_group(groups[$(e.target).html()]);
|
||||
}
|
||||
|
||||
/****************
|
||||
* View group
|
||||
****************/
|
||||
view_group=function(group) {
|
||||
$('#view-group h1').html(group.name);
|
||||
set_contributors(group);
|
||||
on_contributor_change();
|
||||
$('#view-group').css('display','block');
|
||||
}
|
||||
|
||||
set_contributors=function(group) {
|
||||
$('#view-group #contributor option').remove();
|
||||
if(group.contributors.length==0) {
|
||||
$('#view-group #contributor').append('<option>Aucun participant</option>');
|
||||
}
|
||||
else {
|
||||
$(group.contributors).each(function(idx,c) {
|
||||
$('#view-group #contributor').append('<option value="'+c.name+'">'+c.name+'</option>');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
on_contributor_change=function(e) {
|
||||
show_contributions(groups[$('#view-group h1').html()],$('#view-group #contributor')[0].value);
|
||||
}
|
||||
|
||||
show_contributions=function(group,contributor_name) {
|
||||
var tbody=$($('#view-group #contributions tbody')[0]);
|
||||
tbody.html('');
|
||||
total=$($('#view-group #total-value')[0]);
|
||||
contributions=group.contributionsByContributorName(contributor_name);
|
||||
if (contributions.length==0) {
|
||||
tbody.append('<tr><td colspan=3>Aucune contributions</td></tr>');
|
||||
total.html('0,00 €');
|
||||
}
|
||||
else {
|
||||
sum=0;
|
||||
for (idx in contributions) {
|
||||
col_actions='<td><div class="btn-group" data-id="'+contributions[idx].id+'"><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>';
|
||||
tbody.append('<tr><td>'+contributions[idx].getTitle()+'</td><td>'+contributions[idx].cost+' €</td>'+col_actions+'</tr>');
|
||||
sum+=contributions[idx].cost;
|
||||
}
|
||||
total.html(sum+' €');
|
||||
}
|
||||
|
||||
$('.contribution_delete_btn').bind('click',on_contribution_delete_btn_click);
|
||||
$('.contribution_edit_btn').bind('click',on_contribution_edit_btn_click);
|
||||
}
|
||||
|
||||
/*********************
|
||||
* Add contributor
|
||||
*********************/
|
||||
on_click_add_contributor_btn=function() {
|
||||
$('#add_contributor_modal #group_name')[0].value=$($('#view-group h1')[0]).html();
|
||||
$('#add_contributor_modal').modal('show');
|
||||
}
|
||||
|
||||
on_show_add_contributor_modal=function(e) {
|
||||
$('#add_contributor_modal #add_contributor_name').focus();
|
||||
}
|
||||
|
||||
on_valid_add_contributor_modal=function() {
|
||||
var group=groups[$('#add_contributor_modal #group_name')[0].value];
|
||||
var name=$('#add_contributor_name')[0].value;
|
||||
if (name=='') {
|
||||
alert('Vous devez saisir un nom !');
|
||||
return;
|
||||
}
|
||||
if (group.contributorByName(name)!=undefined) {
|
||||
alert('Un contributor porte déjà ce nom !');
|
||||
return;
|
||||
}
|
||||
var email=$('#add_contributor_email')[0].value;
|
||||
if (email=='') {
|
||||
alert('Vous devez saisir un email !');
|
||||
return;
|
||||
}
|
||||
if (group.contributorByEmail(email)!=undefined) {
|
||||
alert('Un contributor utilise déjà cet email !');
|
||||
return;
|
||||
}
|
||||
group.contributors.push(new Contributor(name,email));
|
||||
set_contributors(group);
|
||||
$('#add_contributor_modal').modal('hide');
|
||||
$('#add_contributor_name')[0].value='';
|
||||
$('#add_contributor_email')[0].value='';
|
||||
groups.save();
|
||||
|
||||
}
|
||||
|
||||
on_close_add_contributor_modal=function () {
|
||||
$('#add_contributor_name')[0].value='';
|
||||
$('#add_contributor_email')[0].value='';
|
||||
}
|
||||
|
||||
on_click_del_contributor_btn=function() {
|
||||
contributor=$('#view-group #contributor')[0].value;
|
||||
question='Voulez-vous vraiment supprimer '+contributor+' ?';
|
||||
myconfirm(question,on_confirm_del_contributor,null,contributor);
|
||||
}
|
||||
|
||||
on_confirm_del_contributor=function(contributor) {
|
||||
var group=groups[$($('#view-group h1')[0]).html()];
|
||||
group.removeContributor(contributor);
|
||||
set_contributors(group);
|
||||
groups.save();
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Add/edit/delete contribution
|
||||
********************************/
|
||||
on_show_add_contribution_modal=function(e) {
|
||||
var cs=$($('#add_contribution_modal #add_contribution_contributor_name')[0]);
|
||||
cs.html('');
|
||||
$('#view-group #contributor option').each(function(idx,option) {
|
||||
cs.append($(option).clone());
|
||||
});
|
||||
cs[0].value = $('#view-group #contributor')[0].value;
|
||||
$('#add_contribution_modal #add_contribution_title').focus();
|
||||
}
|
||||
|
||||
on_click_add_contribution_btn=function() {
|
||||
$('#add_contribution_modal #group_name')[0].value=$($('#view-group h1')[0]).html();
|
||||
$('#add_contribution_modal #edit_id')[0].value='-1';
|
||||
$('#add_contribution_modal').modal('show');
|
||||
}
|
||||
|
||||
on_valid_add_contribution_modal=function(e) {
|
||||
e.preventDefault();
|
||||
var group=groups[$('#add_contribution_modal #group_name')[0].value];
|
||||
var contributor_name=$('#add_contribution_contributor_name')[0].value;
|
||||
var contributor=group.contributorByName(contributor_name);
|
||||
if (contributor==undefined) {
|
||||
alert('Participant inconu !');
|
||||
return;
|
||||
}
|
||||
var title=$('#add_contribution_title')[0].value;
|
||||
if (title=='') {
|
||||
$('#add_contribution_title')[0].focus();
|
||||
alert('Vous devez saisir un titre !');
|
||||
return;
|
||||
}
|
||||
var cost=$('#add_contribution_cost')[0].value;
|
||||
if (cost=='') {
|
||||
$('#add_contribution_cost')[0].focus();
|
||||
alert('Vous devez saisir un coût !');
|
||||
return;
|
||||
}
|
||||
else if(!RegExp('^[0-9]*(,[0-9]{1,2})*$').test(cost)) {
|
||||
$('#add_contribution_cost')[0].focus();
|
||||
alert('Coût incorrect !');
|
||||
return;
|
||||
}
|
||||
cost=parseFloat(cost.replace(',','.'));
|
||||
|
||||
var date=$('#add_contribution_date')[0].value;
|
||||
if (date!='') {
|
||||
if(!RegExp('^[0-3][0-9]\/[0-1][0-9]\/[0-2][0-9][0-9][0-9]$').test(date)) {
|
||||
$('#add_contribution_date')[0].focus();
|
||||
alert('Date incorrect !');
|
||||
return;
|
||||
}
|
||||
date=moment(date,'DD-MM-YYYY').toDate();
|
||||
if (jQuery.type(date)!='date') {
|
||||
alert('Date non-reconnu !');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
date=new Date();
|
||||
}
|
||||
|
||||
if($('#add_contribution_modal #edit_id')[0].value=='-1') {
|
||||
group.addContribution(new Contribution(contributor,cost,title,date));
|
||||
}
|
||||
else {
|
||||
contribution_id=$('#add_contribution_modal #edit_id')[0].value;
|
||||
group.replaceContribution(contribution_id,new Contribution(contributor,cost,title,date));
|
||||
}
|
||||
show_contributions(group,contributor_name);
|
||||
$('#add_contribution_modal').modal('hide');
|
||||
$('#add_contribution_modal form')[0].reset();
|
||||
groups.save();
|
||||
}
|
||||
|
||||
on_close_add_contribution_modal=function () {
|
||||
$('#add_contribution_modal form')[0].reset();
|
||||
}
|
||||
|
||||
on_contribution_delete_btn_click=function(e) {
|
||||
var group=groups[$($('#view-group h1')[0]).html()];
|
||||
contribution_id=$($(e.target).parents('div')[0]).data('id');
|
||||
contribution=group.contributions[contribution_id];
|
||||
myconfirm('Etes-vous sûre de vouloir supprimer la participation '+contribution.getTitle()+' de '+contribution.contributor.name+' ?',on_confirm_contribution_delete,null,{'group':group,'contribution_id':contribution_id, 'contribution': contribution} );
|
||||
}
|
||||
|
||||
on_confirm_contribution_delete=function(data) {
|
||||
delete data.group.contributions[data.contribution_id];
|
||||
groups.save();
|
||||
on_contributor_change();
|
||||
}
|
||||
|
||||
on_contribution_edit_btn_click=function(e) {
|
||||
var group=groups[$($('#view-group h1')[0]).html()];
|
||||
$('#add_contribution_modal #group_name')[0].value=$($('#view-group h1')[0]).html();
|
||||
contribution_id=$($(e.target).parents('div')[0]).data('id');
|
||||
contribution=group.contributions[contribution_id];
|
||||
$('#add_contribution_modal #add_contribution_contributor_name')[0].value=contribution.contributor.name;
|
||||
console.log($('#add_contribution_modal #add_contribution_contributor_name')[0]);
|
||||
console.log(contribution.contributor.name);
|
||||
$('#add_contribution_modal #add_contribution_title')[0].value=contribution.getTitle();
|
||||
$('#add_contribution_modal #add_contribution_cost')[0].value=contribution.cost;
|
||||
$('#add_contribution_modal #add_contribution_date')[0].value=moment(contribution.date).format('DD/MM/YYYY');
|
||||
$('#add_contribution_modal #edit_id')[0].value=contribution_id;
|
||||
$('#add_contribution_modal').modal('show');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************
|
||||
* Clear local data
|
||||
********************/
|
||||
clear_local_data=function() {
|
||||
myconfirm('Etes-vous sûre de vouloir supprimer les données locales ?',on_confirm_clear_local_data);
|
||||
}
|
||||
|
||||
on_confirm_clear_local_data=function(data) {
|
||||
localStorage.clear();
|
||||
location.reload();
|
||||
}
|
||||
|
||||
/*********************
|
||||
* View balance
|
||||
*********************/
|
||||
|
||||
on_display_balance_btn_click=function(e) {
|
||||
group=groups[$($('#view-group h1')[0]).html()];
|
||||
display_balance(group);
|
||||
}
|
||||
|
||||
display_balance=function(group) {
|
||||
bal=group.balance();
|
||||
tbody=$($('#display_balance_modal tbody')[0]);
|
||||
tbody.html('');
|
||||
sum=0;
|
||||
for (c in bal) {
|
||||
tbody.append('<tr><td>'+c+'</td><td>'+bal[c]+' €</td></tr>');
|
||||
sum+=bal[c];
|
||||
}
|
||||
$('#display_balance_modal #total-value').html(sum+' €');
|
||||
$('#display_balance_modal').modal('show');
|
||||
}
|
||||
|
||||
/*********************
|
||||
* Remove group
|
||||
*********************/
|
||||
|
||||
on_remove_group_btn_click=function(e) {
|
||||
group=groups[$($('#view-group h1')[0]).html()];
|
||||
myconfirm('Etes-vous sûre de vouloir supprimer le group '+group.name+' ?',on_confirm_remove_group,null,group);
|
||||
|
||||
}
|
||||
|
||||
on_confirm_remove_group=function(group) {
|
||||
if(groups.removeGroup(group.name)) {
|
||||
groups.save();
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
alert('Erreur en supprimant le groupe '+group.name+' :(');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************
|
||||
* Activate
|
||||
*********************/
|
||||
$( document ).ready( function() {
|
||||
if(typeof(Storage)!=="undefined"){
|
||||
groups=new GroupList();
|
||||
groups.loadFromLocalStorage();
|
||||
refresh_group_list();
|
||||
}
|
||||
else {
|
||||
alert('Local storage not supported !');
|
||||
}
|
||||
|
||||
$('#add_group_submit').bind('click',on_valid_add_group_modal);
|
||||
$("#add_group_modal").on('shown.bs.modal',on_show_add_group_modal);
|
||||
$("#add_group_modal").on('hidden.bs.modal',on_close_add_group_modal);
|
||||
$("#add_group_modal form").on('submit',on_valid_add_group_modal);
|
||||
|
||||
$('#clear_local_data').bind('click',clear_local_data);
|
||||
|
||||
$('#view-group #contributor').bind('change',on_contributor_change);
|
||||
|
||||
$('#add_contributor_btn').bind('click',on_click_add_contributor_btn);
|
||||
$('#add_contributor_submit').bind('click',on_valid_add_contributor_modal);
|
||||
$("#add_contributor_modal").on('shown.bs.modal',on_show_add_contributor_modal);
|
||||
$("#add_contributor_modal").on('hidden.bs.modal',on_close_add_contributor_modal);
|
||||
$("#add_contributor_modal form").on('submit',on_valid_add_contributor_modal);
|
||||
|
||||
$('#del_contributor_btn').bind('click',on_click_del_contributor_btn);
|
||||
|
||||
$('#add_contribution_btn').bind('click',on_click_add_contribution_btn);
|
||||
$('#add_contribution_submit').bind('click',on_valid_add_contribution_modal);
|
||||
$("#add_contribution_modal").on('shown.bs.modal',on_show_add_contribution_modal);
|
||||
$("#add_contribution_modal").on('hidden.bs.modal',on_close_add_contribution_modal);
|
||||
$("#add_contribution_modal form").on('submit',on_valid_add_contribution_modal);
|
||||
|
||||
$("#display_balance_btn").bind('click',on_display_balance_btn_click);
|
||||
|
||||
$('#remove_group_btn').bind('click',on_remove_group_btn_click);
|
||||
} );
|
35
inc/myco_confirm.js
Normal file
35
inc/myco_confirm.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
var _myconfirm={
|
||||
'onconfirm': null,
|
||||
'oncancel': null,
|
||||
'data': null
|
||||
};
|
||||
|
||||
myconfirm=function(question,onconfirm,oncancel,data) {
|
||||
$('#confirm_modal #question').html(question);
|
||||
_myconfirm={
|
||||
'onconfirm': onconfirm,
|
||||
'oncancel': oncancel,
|
||||
'data': data
|
||||
};
|
||||
$('#confirm_modal').modal('show');
|
||||
}
|
||||
|
||||
_myconfirm_on_valid_click=function(e) {
|
||||
$('#confirm_modal').modal('hide');
|
||||
console.log(jQuery.type(_myconfirm.onconfirm));
|
||||
if (jQuery.type(_myconfirm.onconfirm) == 'function') {
|
||||
_myconfirm.onconfirm(_myconfirm.data);
|
||||
}
|
||||
}
|
||||
|
||||
_myconfirm_on_cancel_click=function(e) {
|
||||
$('#confirm_modal').modal('hide');
|
||||
if (jQuery.type(_myconfirm.oncancel) == 'function') {
|
||||
_myconfirm.oncancel(_myconfirm.data);
|
||||
}
|
||||
}
|
||||
|
||||
$( document ).ready( function() {
|
||||
$('#confirm_modal_submit').bind('click',_myconfirm_on_valid_click);
|
||||
$('#confirm_modal .cancel').bind('click',_myconfirm_on_cancel_click);
|
||||
});
|
198
inc/myco_objects.js
Normal file
198
inc/myco_objects.js
Normal file
|
@ -0,0 +1,198 @@
|
|||
function GroupList() {
|
||||
|
||||
this.loadFromLocalStorage=function() {
|
||||
if (localStorage.groups!==undefined) {
|
||||
var groups=JSON.parse(localStorage.groups);
|
||||
for (el in groups) {
|
||||
this[el]=new Group(el,groups[el]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.export=function() {
|
||||
ret={};
|
||||
for (el in this) {
|
||||
if (this.isGroup(this[el])) {
|
||||
ret[el]=this[el].export();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
this.save=function() {
|
||||
localStorage.groups=JSON.stringify(this.export());
|
||||
}
|
||||
|
||||
this.each=function(fct) {
|
||||
var idx=0;
|
||||
for (el in this) {
|
||||
if(this.isGroup(this[el])) {
|
||||
fct(idx++,this[el]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.count=function() {
|
||||
len=0;
|
||||
for (el in this) {
|
||||
if (this.isGroup(this[el])) len=len+1;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
this.isGroup=function(el) {
|
||||
return (el.isGroup!==undefined);
|
||||
}
|
||||
|
||||
this.removeGroup=function(name) {
|
||||
if (this.isGroup(this[name])) {
|
||||
delete this[name];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function Group(name,data) {
|
||||
this.name=name;
|
||||
this.contributors=[];
|
||||
this.contributions=[];
|
||||
|
||||
|
||||
this.isGroup=function() {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.export=function() {
|
||||
var contributors=[];
|
||||
for (idx in this.contributors) {
|
||||
contributors.push(this.contributors[idx].export());
|
||||
}
|
||||
var contributions=[];
|
||||
for (idx in this.contributions) {
|
||||
contributions.push(this.contributions[idx].export());
|
||||
}
|
||||
return {
|
||||
'name': this.name,
|
||||
'contributors': contributors,
|
||||
'contributions': contributions
|
||||
};
|
||||
}
|
||||
|
||||
this.removeContributor=function(c) {
|
||||
this.contributors=this.contributors.filter(function(v){
|
||||
return (v.name!=c);
|
||||
});
|
||||
}
|
||||
|
||||
this.contributorByName=function(name) {
|
||||
for (c in this.contributors) {
|
||||
if (this.contributors[c].name == name) return this.contributors[c];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.contributorByEmail=function(email) {
|
||||
for (c in this.contributors) {
|
||||
if (this.contributors[c].email == email) return this.contributors[c];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.contributionsByContributorName=function(name) {
|
||||
var ret=[];
|
||||
for (idx in this.contributions) {
|
||||
if (this.contributions[idx].contributor.name==name) {
|
||||
ret.push(this.contributions[idx]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
this.addContribution=function(c) {
|
||||
c.id=this.contributions.length;
|
||||
this.contributions.push(c);
|
||||
}
|
||||
|
||||
this.replaceContribution=function(idx,c) {
|
||||
c.id=idx;
|
||||
this.contributions[idx]=c;
|
||||
}
|
||||
|
||||
|
||||
this.balance=function() {
|
||||
ret={}
|
||||
for (idx in this.contributors) {
|
||||
sum=0;
|
||||
c=this.contributors[idx].name;
|
||||
cl=this.contributionsByContributorName(c);
|
||||
for (idc in cl) {
|
||||
sum+=cl[idc].cost;
|
||||
}
|
||||
ret[c]=sum;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (jQuery.type(data)=='object') {
|
||||
try {
|
||||
this.name=data.name;
|
||||
if (jQuery.type(data.contributors) == 'array') {
|
||||
for (idx in data.contributors) {
|
||||
this.contributors.push(new Contributor(
|
||||
data.contributors[idx].name,
|
||||
data.contributors[idx].email
|
||||
));
|
||||
}
|
||||
}
|
||||
if (jQuery.type(data.contributions) == 'array') {
|
||||
for (idx in data.contributions) {
|
||||
this.contributions.push(new Contribution(
|
||||
this.contributorByName(data.contributions[idx].contributor),
|
||||
data.contributions[idx].cost,
|
||||
data.contributions[idx].title,
|
||||
data.contributions[idx].date,
|
||||
idx
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
alert('Une erreur est survenue en chargeant le groupe '+this.name+' depuis le cache');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Contributor(name,email) {
|
||||
this.name=name;
|
||||
this.email=email;
|
||||
this.export=function() {
|
||||
return {
|
||||
'name': this.name,
|
||||
'email': this.email
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function Contribution(contributor,cost,title,date,id) {
|
||||
this.contributor=contributor;
|
||||
this.cost=cost;
|
||||
this.title=title;
|
||||
this.date=date;
|
||||
this.id=id;
|
||||
this.export=function() {
|
||||
return {
|
||||
'contributor': this.contributor.name,
|
||||
'cost': this.cost,
|
||||
'title': this.title,
|
||||
'date': this.date,
|
||||
};
|
||||
}
|
||||
|
||||
this.getTitle=function() {
|
||||
if (jQuery.type(this.title)=='string') {
|
||||
return this.title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
296
index.html
Normal file
296
index.html
Normal file
|
@ -0,0 +1,296 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>MyCo</title>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="favicon.png">
|
||||
<!-- Bootstrap -->
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
|
||||
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css">
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<style>
|
||||
body{
|
||||
margin-top: 4em;
|
||||
}
|
||||
|
||||
#total-label {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#total-label, #total-value {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.late {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.hidden-part {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#view-group h1 {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-groupe-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="index.html">MyCo</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="navbar-groupe-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Groupe <b class="caret"></b></a>
|
||||
<ul id="group-choice" class="dropdown-menu">
|
||||
<li><a class='group-choice'>Quotidien</a></li>
|
||||
<li><a class='group-choice'>Noël</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id='add_group' data-toggle="modal" data-target="#add_group_modal">Nouveau</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a id='clear_local_data'>Purger les données locales</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
|
||||
<div id='view-group' class='part hidden-part'>
|
||||
<h1>Noël</h1>
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Participant</span>
|
||||
<select id='contributor' class="form-control">
|
||||
<option value='Benjamin'>Benjamin</option>
|
||||
<option value='Ludovic'>Ludovic</option>
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" id='edit_contributor_btn'><span class='glyphicon glyphicon-edit'></span></button>
|
||||
<button type="button" class="btn btn-primary" id='del_contributor_btn'><span class='glyphicon glyphicon-trash'></span></button>
|
||||
<button type="button" class="btn btn-primary" id='add_contributor_btn'><span class='glyphicon glyphicon-plus'></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="btn-group">
|
||||
<button id='add_contribution_btn' class="btn btn-primary"><span class='glyphicon glyphicon-plus'></span> Ajouter une dépence</span></button>
|
||||
<button id='display_balance_btn' class="btn btn-info"><span class='glyphicon glyphicon-euro'></span> Balance</span></button>
|
||||
<div class="btn-group">
|
||||
<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 id='remove_group_btn'><span class='glyphicon glyphicon-trash'></span> Supprimer le groupe</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<table id='contributions' class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dépence</th>
|
||||
<th>Coût</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Simply</td>
|
||||
<td>124,56€</td>
|
||||
<td>
|
||||
<div class="btn-group" data-id='0'>
|
||||
<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>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td id='total-label'>Total :</td>
|
||||
<td id='total-value' colspan='2'>126,56€</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="add_group_modal" tabindex="-1" role="dialog" aria-labelledby="addGroupModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Ajouter un groupe</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Nom *</span>
|
||||
<input type='text' id='add_group_name' class="form-control" placeholder='Nom'/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" id='add_group_submit'>Ajouter</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="add_contributor_modal" tabindex="-1" role="dialog" aria-labelledby="addContributorModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Ajouter un participant</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<input type='hidden' id='group_name' />
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Nom *</span>
|
||||
<input type='text' id='add_contributor_name' class="form-control" placeholder='Nom'/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Email *</span>
|
||||
<input type='text' id='add_contributor_email' class="form-control" placeholder='Email'/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" id='add_contributor_submit'>Ajouter</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="add_contribution_modal" tabindex="-1" role="dialog" aria-labelledby="addContributorModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Ajouter une contribution</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<input type='hidden' id='group_name' />
|
||||
<input type='hidden' id='edit_id' value='-1' />
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Participant *</span>
|
||||
<select id='add_contribution_contributor_name' class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Titre *</span>
|
||||
<input type='text' id='add_contribution_title' class="form-control" placeholder='Titre'/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Coût *</span>
|
||||
<input type='text' id='add_contribution_cost' class="form-control" placeholder='0,00'/>
|
||||
<span class="input-group-addon">€</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Date</span>
|
||||
<input type='text' id='add_contribution_date' class="form-control" placeholder='JJ/MM/AAAA'/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" id='add_contribution_submit'>Ajouter</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="display_balance_modal" tabindex="-1" role="dialog" aria-labelledby="displayBalanceModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Balance</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr><th>Participant</th><th>Participation</th></tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td id='total-label'>Total :</td>
|
||||
<td id='total-value'></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="confirm_modal" tabindex="-1" role="dialog" aria-labelledby="confirmModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close cancel" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Confirmation</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id='question'></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default cancel">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" id='confirm_modal_submit'>Valider</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||
<script src="https://code.jquery.com/jquery.js"></script>
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
||||
<script src="inc/lib/moment.min.js"></script>
|
||||
<script src="inc/myco_objects.js"></script>
|
||||
<script src="inc/myco_confirm.js"></script>
|
||||
<script src="inc/myco.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue