From 725bebb00ba5945c5b35f928e0b525b460b85874 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 2 Jan 2018 19:57:12 +0000 Subject: [PATCH] Added fairly trading org field and change org transactions to show purchases not sales --- .../Controller/Admin/Organisations.pm | 6 +++++- templates/admin/organisations/add_org.html.ep | 18 ++++++++++++++++++ templates/admin/organisations/list.html.ep | 7 +++++++ .../admin/organisations/valid_read.html.ep | 9 +++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm index 7a42d10..69ce211 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm @@ -41,6 +41,7 @@ sub add_org_submit { $validation->optional('postcode')->postcode; $validation->optional('pending'); $validation->optional('is_local'); + $validation->optional('is_fair'); if ( $validation->has_error ) { $c->flash( error => 'The validation has failed' ); @@ -60,6 +61,7 @@ sub add_org_submit { submitted_by_id => $c->current_user->id, pending => defined $validation->param('pending') ? 0 : 1, is_local => $validation->param('is_local'), + is_fair => $validation->param('is_fair'), }, type => 'organisation', }); @@ -78,7 +80,7 @@ sub add_org_submit { sub valid_read { my $c = shift; my $valid_org = $c->schema->resultset('Organisation')->find( $c->param('id') ); - my $transactions = $valid_org->entity->sales->search( + my $transactions = $valid_org->entity->purchases->search( undef, { page => $c->param('page') || 1, rows => 10, @@ -109,6 +111,7 @@ sub valid_edit { $validation->required('postcode')->postcode; $validation->optional('pending'); $validation->optional('is_local'); + $validation->optional('is_fair'); $validation->optional('is_lis'); $validation->optional('is_esta'); @@ -129,6 +132,7 @@ sub valid_edit { postcode => $validation->param('postcode'), pending => defined $validation->param('pending') ? 0 : 1, is_local => $validation->param('is_local'), + is_fair => $validation->param('is_fair'), }); $valid_org->entity->update_or_create_related( 'associations', { lis => $validation->param('is_lis'), diff --git a/templates/admin/organisations/add_org.html.ep b/templates/admin/organisations/add_org.html.ep index be22d3c..7a964a8 100644 --- a/templates/admin/organisations/add_org.html.ep +++ b/templates/admin/organisations/add_org.html.ep @@ -55,6 +55,24 @@ +
+ +
+ +
+
+
+ +
+ +
+
diff --git a/templates/admin/organisations/list.html.ep b/templates/admin/organisations/list.html.ep index eca8aed..bde7d05 100644 --- a/templates/admin/organisations/list.html.ep +++ b/templates/admin/organisations/list.html.ep @@ -38,6 +38,13 @@ % } else { Non Local Org % } + % if ( !defined $org_result->is_fair ) { + Fair Trading Status Not Set + % } elsif ( $org_result->is_fair ) { + Fairly Trading Org + % } else { + Non Fairly Trading Org + % }
% } diff --git a/templates/admin/organisations/valid_read.html.ep b/templates/admin/organisations/valid_read.html.ep index 5341659..8bf73ad 100644 --- a/templates/admin/organisations/valid_read.html.ep +++ b/templates/admin/organisations/valid_read.html.ep @@ -126,6 +126,15 @@ function initMap() {
+
+ +
+ +
+