X-Git-Url: https://jasonwoof.com/gitweb/?p=contractor-progress.git;a=blobdiff_plain;f=index.php;h=4258b8a192dbed82839e43e71e0a9414906bc119;hp=91c24eea99d8e83bf9f6d6e83fd4f6ffe858bf6a;hb=ee6685eef368fdd21c4916b32a0ad26880146cce;hpb=cd31f0e08af5e737de8d25a1c27f62d811345bc2 diff --git a/index.php b/index.php index 91c24ee..4258b8a 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,20 @@ . + require_once('code/tasks.php'); function index_main() { @@ -29,7 +44,7 @@ function task_summary($tem_prefix, $where_clause/*, ... */) { tem_set('task_price', $price); tem_set('task_state', task_state_pretty($state)); if(logged_in_as_contractor()) { - tem_set('client', db_get_value('people', 'name', 'where id=%i', $client_id)); + tem_set('client', db_get_value('people', 'username', 'where id=%i', $client_id)); } tem_show($tem_prefix . '_row'); $total += $price; @@ -51,23 +66,29 @@ function _index_main() { } if(logged_in_as_contractor()) { + tem_show('su_link'); tem_show('needs_attention_header'); - task_summary('needs_approval', 'where state=%i order by id desc', TASK_WORKING); - task_summary('needs_fixing', 'where (state=%i || state=%i) || (client_id=1 && state<%i) order by id desc', TASK_NEEDS_QUOTE, TASK_BUG, TASK_QUEUED); - task_summary('finished_unpaid', 'where state=%i && paid = 0 order by id desc', TASK_FINISHED); - task_summary('finished_paid', 'where state=%i && paid = 1 order by id desc', TASK_FINISHED); - task_summary('queue', 'where state=%i order by client_id, ord', TASK_QUEUED); + + # things with a view link: + task_summary('needs_approval', 'where state=%i || (client_id=%i && (state=%i || state=%i || state=%i)) order by id desc', TASK_WORKING, $client_id, TASK_NEEDS_TESTING, TASK_NEEDS_GO_AHEAD, TASK_BUG); + + # things with an edit link: + task_summary('needs_fixing', 'where (state=%i || state=%i) || (client_id=%i && (state<%i || state=%i)) order by id desc', TASK_NEEDS_QUOTE, TASK_BUG, $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION); + task_summary('finished_unpaid', 'where state=%i && paid=0 order by finished_at desc', TASK_FINISHED); + task_summary('finished_untested', 'where state=%i order by client_id, finished_at desc', TASK_NEEDS_TESTING); + task_summary('finished_paid', 'where state=%i && paid = 1 order by finished_at desc limit 20', TASK_FINISHED); + task_summary('queue', 'where state=%i order by client_id, ord desc', TASK_QUEUED); } else { if(db_count('tasks', 'where client_id=%i && (state=%i || state=%i || state=%i || state=%i)', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING)) { tem_show('needs_attention_header'); task_summary('needs_approval', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING); task_summary('needs_fixing', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION); } - task_summary('queue', 'where client_id=%i && state=%i order by ord', $client_id, TASK_QUEUED); + task_summary('queue', 'where client_id=%i && state=%i order by ord desc', $client_id, TASK_QUEUED); task_summary('jason', 'where client_id=%i && (state=%i || state=%i) order by id desc', $client_id, TASK_NEEDS_QUOTE, TASK_BUG); task_summary('jason_working', 'where client_id=%i && state=%i order by id desc', $client_id, TASK_WORKING); - task_summary('finished_unpaid', 'where client_id=%i && state=%i && paid=0 order by id desc', $client_id, TASK_FINISHED); - task_summary('finished_paid', 'where client_id=%i && state=%i && paid=1 order by id desc', $client_id, TASK_FINISHED); + task_summary('finished_unpaid', 'where client_id=%i && state=%i && paid=0 order by finished_at desc', $client_id, TASK_FINISHED); + task_summary('finished_paid', 'where client_id=%i && state=%i && paid=1 order by finished_at desc', $client_id, TASK_FINISHED); } return; }