diff --git a/lib/Pear/LocalLoop.pm b/lib/Pear/LocalLoop.pm index 9890811..5a2bcfe 100644 --- a/lib/Pear/LocalLoop.pm +++ b/lib/Pear/LocalLoop.pm @@ -191,6 +191,7 @@ sub startup { $admin_routes->get('/feedback')->to('admin-feedback#index'); $admin_routes->get('/feedback/:id')->to('admin-feedback#read'); + $admin_routes->get('/feedback/:id/actioned')->to('admin-feedback#actioned'); $admin_routes->get('/transactions')->to('admin-transactions#index'); $admin_routes->get('/transactions/:id')->to('admin-transactions#read'); diff --git a/lib/Pear/LocalLoop/Controller/Admin.pm b/lib/Pear/LocalLoop/Controller/Admin.pm index 7a9cf8d..1e5a411 100644 --- a/lib/Pear/LocalLoop/Controller/Admin.pm +++ b/lib/Pear/LocalLoop/Controller/Admin.pm @@ -18,6 +18,8 @@ sub home { my $token_rs = $c->schema->resultset('AccountToken'); my $pending_orgs_rs = $c->schema->resultset('Organisation')->search({ pending => 1 }); my $pending_transaction_rs = $pending_orgs_rs->entity->sales; + my $feedback_rs = $c->schema->resultset('Feedback'); + my $pending_feedback_rs = $feedback_rs->search({ actioned => 0 }); $c->stash( user_count => $user_rs->count, tokens => { @@ -26,6 +28,10 @@ sub home { }, pending_orgs => $pending_orgs_rs->count, pending_trans => $pending_transaction_rs->count, + feedback => { + total => $feedback_rs->count, + pending => $pending_feedback_rs->count, + }, ); } diff --git a/lib/Pear/LocalLoop/Controller/Admin/Feedback.pm b/lib/Pear/LocalLoop/Controller/Admin/Feedback.pm index 753539c..a182362 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Feedback.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Feedback.pm @@ -33,4 +33,19 @@ sub read { } } +sub actioned { + my $c = shift; + + my $id = $c->param('id'); + + if ( my $feedback = $c->result_set->find($id) ) { + $feedback->actioned( ! $feedback->actioned ); + $feedback->update; + $c->redirect_to( '/admin/feedback/' . $id ); + } else { + $c->flash( error => 'No Feedback found' ); + $c->redirect_to( '/admin/feedback' ); + } +} + 1; diff --git a/templates/admin/feedback/index.html.ep b/templates/admin/feedback/index.html.ep index 8c41fd4..9c7242a 100644 --- a/templates/admin/feedback/index.html.ep +++ b/templates/admin/feedback/index.html.ep @@ -15,7 +15,7 @@ % for my $feedback ( $feedback_rs->all ) {
-
+
<%= $feedback->id %> %= $feedback->user->email;
diff --git a/templates/admin/feedback/read.html.ep b/templates/admin/feedback/read.html.ep index 05e2d63..e5cfec0 100644 --- a/templates/admin/feedback/read.html.ep +++ b/templates/admin/feedback/read.html.ep @@ -30,6 +30,15 @@ Submitted At: <%= format_human_datetime $feedback->submitted_at %> +
  • + Actioned: + + <%= $feedback->actioned ? 'Done' : 'Needs Action' %> + + Toggle + + +
  • diff --git a/templates/admin/home.html.ep b/templates/admin/home.html.ep index 3f1aa45..ed4ad63 100644 --- a/templates/admin/home.html.ep +++ b/templates/admin/home.html.ep @@ -3,7 +3,7 @@ % content_for javascript => begin % end
    -
    +
    User Count
    @@ -13,7 +13,7 @@
    -
    +
    Unused Tokens
    @@ -23,7 +23,9 @@
    -
    +
    +
    +
    Pending Organisations
    @@ -33,7 +35,7 @@
    -
    +
    Pending Transactions
    @@ -44,3 +46,15 @@
    +
    +
    +
    + Unactioned Feedback +
    +
    +

    + <%= $feedback->{pending} %> / <%= $feedback->{total} %> +

    +
    +
    +