diff --git a/TODO b/TODO index 96fce1f..05b2803 100755 --- a/TODO +++ b/TODO @@ -1,6 +1,9 @@ Issues : ======== -* Check CSRF everywhere ? +* Check CSRF everywhere +* Close a global payback +* View see_paybacks in english +* Sort global paybacks DESC by DATE or id Improvements : ============== diff --git a/index.php b/index.php index 2d66b9c..390d17d 100644 --- a/index.php +++ b/index.php @@ -676,6 +676,28 @@ } break; + case "see_paybacks": + $global_paybacks = new GlobalPayback(); + + if(empty($_GET['id'])) { + $global_paybacks = $global_paybacks->load(); + } + else { + $global_paybacks = $global_paybacks->load(array('id'=>(int) $_GET['id']), true); + $tpl->assign('id', (int) $_GET['id']); + + $users_list = new User(); + $users_list = $users_list->load(); + + $tpl->assign('users', $users_list); + } + + $tpl->assign('list', true); + $tpl->assign('global_paybacks', $global_paybacks); + + $tpl->draw('see_paybacks'); + break; + case "manage_paybacks": if(empty($_GET['new'])) { $global_paybacks = new GlobalPayback(); @@ -766,8 +788,6 @@ } } - var_dump($users_in); - $global_payback->setUsersIn($users_in); $global_payback->setDate(date('i'), date('G'), date('j'), date('n'), date('Y')); $global_payback->save(); diff --git a/tpl/default_en/css/style.css b/tpl/default_en/css/style.css index 1b4c4b8..1329c95 100644 --- a/tpl/default_en/css/style.css +++ b/tpl/default_en/css/style.css @@ -10,6 +10,11 @@ body { margin: 0; } +body>p, body>ul, body>dl { + margin-left: 1em; + margin-right: 1em; +} + fieldset { border: 1px solid #999; margin-bottom: 1em; @@ -55,18 +60,24 @@ h2 { border-left: none; } +hr { + width: 33%; + margin-top: 2em; + margin-bottom: 2em; +} + input[type="checkbox"] { margin-left: 2em; } -.center { - text-align: center; -} - .red { color: red; } +.center { + text-align: center; +} + .label-block { display: inline-block; text-align: right; @@ -124,12 +135,16 @@ input[type=submit] { text-align: center } -#edit_password_form, #edit_user_form, #invoice_form, #notice_form { +#edit_password_form, #edit_user_form, #invoice_form, #notice_form, #global_payback_form { width: 67%; margin: auto; } -#edit_password_form p, #edit_user_form p, #notice_form p { +#global_payback_form fieldset { + margin-top: 2em; +} + +#edit_password_form p, #edit_user_form p, #notice_form p, #global_payback_form p { text-align: center; } @@ -145,7 +160,7 @@ textarea#what { width: 75%; } -#list_expenses tr:hover, #balance_table tr:not(:first-child):hover *, .highlight_td { +#list_expenses tr:hover, #balance_table tr:not(:first-child):hover *, #global_paybacks_table tr:not(:first-child):hover *, .highlight_td { background-color: green; } diff --git a/tpl/default_en/header.html b/tpl/default_en/header.html index b916cff..341bcd3 100755 --- a/tpl/default_en/header.html +++ b/tpl/default_en/header.html @@ -18,7 +18,7 @@ {if condition="$current_user->getAdmin() == 1"} diff --git a/tpl/default_en/js/main.js b/tpl/default_en/js/main.js index 054505b..1bf7acb 100644 --- a/tpl/default_en/js/main.js +++ b/tpl/default_en/js/main.js @@ -40,7 +40,7 @@ function toggle_password(id) { } $(document).ready(function() { - $('#balance_table td').hover(function() { + $('#balance_table td, #global_paybacks_table td').hover(function() { $(this).closest('tr').find('td,th').addClass('highlight_td'); var col = $(this).index()+1; $(this).closest('table').find('tr :nth-child('+col+')').addClass('highlight_td'); @@ -50,7 +50,7 @@ $(document).ready(function() { $(this).closest('table').find('tr :nth-child('+col+')').removeClass('highlight_td'); }); - $('#balance_table tr:first-child th:not(:first-child)').hover(function() { + $('#balance_table tr:first-child th:not(:first-child), #global_paybacks_table tr:first-child th:not(:first-child)').hover(function() { var col = $(this).index()+1; $(this).closest('table').find('tr :nth-child('+col+')').addClass('highlight_td'); }, function() { diff --git a/tpl/default_en/see_paybacks.html b/tpl/default_en/see_paybacks.html new file mode 100644 index 0000000..b95e2f2 --- /dev/null +++ b/tpl/default_en/see_paybacks.html @@ -0,0 +1,48 @@ +{include="header"} + +{if condition="empty($id)"} +

Global paybacks list

+ {if condition="$global_paybacks !== FALSE"} +
+ {loop="$global_paybacks"} +
{$value->getDate()}
+
Payback n°{$value->getId()}
+ {/loop} +
+ {else} +

No global paybacks available.

+ {/if} +{else} +

Payback n°{$global_paybacks->getId()}

+ + {$table=$global_paybacks->getUsersIn()->get()} + + + + {loop="$global_paybacks->getUsersIn()->get()"} + + {/loop} + + {loop="$global_paybacks->getUsersIn()->get()"} + + + {loop="$global_paybacks->getUsersIn()->get()"} + {if condition="$key1 == $key2"} + + {else} + + {/if} + {/loop} + + {/loop} +
Owes / To{$users[$key1]->getDisplayName()}
{$users[$key1]->getDisplayName()} + {if condition="$table[$key1][$key2] != 0"} + {$table[$key1][$key2]} + {else} + - + {/if} +
+ +

Go back to global paybacks list

+{/if} +{include="footer"} diff --git a/tpl/default_fr/css/style.css b/tpl/default_fr/css/style.css index 45d6680..1329c95 100644 --- a/tpl/default_fr/css/style.css +++ b/tpl/default_fr/css/style.css @@ -160,7 +160,7 @@ textarea#what { width: 75%; } -#list_expenses tr:hover, #balance_table tr:not(:first-child):hover *, .highlight_td { +#list_expenses tr:hover, #balance_table tr:not(:first-child):hover *, #global_paybacks_table tr:not(:first-child):hover *, .highlight_td { background-color: green; } diff --git a/tpl/default_fr/header.html b/tpl/default_fr/header.html index a1462bb..ee50208 100755 --- a/tpl/default_fr/header.html +++ b/tpl/default_fr/header.html @@ -18,7 +18,7 @@ {if condition="$current_user->getAdmin() == 1"} diff --git a/tpl/default_fr/js/main.js b/tpl/default_fr/js/main.js index c06ae29..593d0d8 100644 --- a/tpl/default_fr/js/main.js +++ b/tpl/default_fr/js/main.js @@ -40,7 +40,7 @@ function toggle_password(id) { } $(document).ready(function() { - $('#balance_table td').hover(function() { + $('#balance_table td, #global_paybacks_table td').hover(function() { $(this).closest('tr').find('td,th').addClass('highlight_td'); var col = $(this).index()+1; $(this).closest('table').find('tr :nth-child('+col+')').addClass('highlight_td'); @@ -50,7 +50,7 @@ $(document).ready(function() { $(this).closest('table').find('tr :nth-child('+col+')').removeClass('highlight_td'); }); - $('#balance_table tr:first-child th:not(:first-child)').hover(function() { + $('#balance_table tr:first-child th:not(:first-child), #global_paybacks_table tr:first-child th:not(:first-child)').hover(function() { var col = $(this).index()+1; $(this).closest('table').find('tr :nth-child('+col+')').addClass('highlight_td'); }, function() { diff --git a/tpl/default_fr/see_paybacks.html b/tpl/default_fr/see_paybacks.html new file mode 100644 index 0000000..c021e29 --- /dev/null +++ b/tpl/default_fr/see_paybacks.html @@ -0,0 +1,48 @@ +{include="header"} + +{if condition="empty($id)"} +

Liste des remboursements globaux

+ {if condition="$global_paybacks !== FALSE"} +
+ {loop="$global_paybacks"} +
{$value->getDate()}
+
Remboursement n°{$value->getId()}
+ {/loop} +
+ {else} +

Aucun remboursement global disponible pour l'instant.

+ {/if} +{else} +

Remboursement n°{$global_paybacks->getId()}

+ + {$table=$global_paybacks->getUsersIn()->get()} + + + + {loop="$global_paybacks->getUsersIn()->get()"} + + {/loop} + + {loop="$global_paybacks->getUsersIn()->get()"} + + + {loop="$global_paybacks->getUsersIn()->get()"} + {if condition="$key1 == $key2"} + + {else} + + {/if} + {/loop} + + {/loop} +
Doit / À{$users[$key1]->getDisplayName()}
{$users[$key1]->getDisplayName()} + {if condition="$table[$key1][$key2] != 0"} + {$table[$key1][$key2]} + {else} + - + {/if} +
+ +

Retour à la liste des remboursements

+{/if} +{include="footer"}