fixes added and working admin interface

This commit is contained in:
Finn 2017-11-23 16:25:14 +00:00
parent 0072a97a3a
commit 8ada3f86b6
3 changed files with 21 additions and 9 deletions

View file

@ -86,10 +86,14 @@ sub valid_read {
},
);
my $associations = $valid_org->entity->associations;
my $assoc = {
lis => defined $associations ? $associations->lis : 0,
};
$c->stash(
valid_org => $valid_org,
transactions => $transactions,
associations => $associations,
associations => $assoc,
);
}
@ -104,6 +108,7 @@ sub valid_edit {
$validation->required('postcode')->postcode;
$validation->optional('pending');
$validation->optional('is_local');
$validation->optional('is_lis');
if ( $validation->has_error ) {
$c->flash( error => 'The validation has failed' );
@ -123,9 +128,12 @@ sub valid_edit {
pending => defined $validation->param('pending') ? 0 : 1,
is_local => $validation->param('is_local'),
});
$valid_org->entity->update_or_create_related( 'associations', {
lis => $validation->param('is_lis'),
});
} );
} finally {
if ( @_ ) {
if ( @_ ) {use Devel::Dwarn; Dwarn \@_;
$c->flash( error => 'Something went wrong Updating the Organisation' );
} else {
$c->flash( success => 'Updated Organisation' );