Added fairly trading org field and change org transactions to show
purchases not sales
This commit is contained in:
parent
d4ff855251
commit
8be16867bb
4 changed files with 39 additions and 1 deletions
|
@ -41,6 +41,7 @@ sub add_org_submit {
|
||||||
$validation->optional('postcode')->postcode;
|
$validation->optional('postcode')->postcode;
|
||||||
$validation->optional('pending');
|
$validation->optional('pending');
|
||||||
$validation->optional('is_local');
|
$validation->optional('is_local');
|
||||||
|
$validation->optional('is_fair');
|
||||||
|
|
||||||
if ( $validation->has_error ) {
|
if ( $validation->has_error ) {
|
||||||
$c->flash( error => 'The validation has failed' );
|
$c->flash( error => 'The validation has failed' );
|
||||||
|
@ -60,6 +61,7 @@ sub add_org_submit {
|
||||||
submitted_by_id => $c->current_user->id,
|
submitted_by_id => $c->current_user->id,
|
||||||
pending => defined $validation->param('pending') ? 0 : 1,
|
pending => defined $validation->param('pending') ? 0 : 1,
|
||||||
is_local => $validation->param('is_local'),
|
is_local => $validation->param('is_local'),
|
||||||
|
is_fair => $validation->param('is_fair'),
|
||||||
},
|
},
|
||||||
type => 'organisation',
|
type => 'organisation',
|
||||||
});
|
});
|
||||||
|
@ -78,7 +80,7 @@ sub add_org_submit {
|
||||||
sub valid_read {
|
sub valid_read {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
my $valid_org = $c->schema->resultset('Organisation')->find( $c->param('id') );
|
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, {
|
undef, {
|
||||||
page => $c->param('page') || 1,
|
page => $c->param('page') || 1,
|
||||||
rows => 10,
|
rows => 10,
|
||||||
|
@ -109,6 +111,7 @@ sub valid_edit {
|
||||||
$validation->required('postcode')->postcode;
|
$validation->required('postcode')->postcode;
|
||||||
$validation->optional('pending');
|
$validation->optional('pending');
|
||||||
$validation->optional('is_local');
|
$validation->optional('is_local');
|
||||||
|
$validation->optional('is_fair');
|
||||||
$validation->optional('is_lis');
|
$validation->optional('is_lis');
|
||||||
$validation->optional('is_esta');
|
$validation->optional('is_esta');
|
||||||
|
|
||||||
|
@ -129,6 +132,7 @@ sub valid_edit {
|
||||||
postcode => $validation->param('postcode'),
|
postcode => $validation->param('postcode'),
|
||||||
pending => defined $validation->param('pending') ? 0 : 1,
|
pending => defined $validation->param('pending') ? 0 : 1,
|
||||||
is_local => $validation->param('is_local'),
|
is_local => $validation->param('is_local'),
|
||||||
|
is_fair => $validation->param('is_fair'),
|
||||||
});
|
});
|
||||||
$valid_org->entity->update_or_create_related( 'associations', {
|
$valid_org->entity->update_or_create_related( 'associations', {
|
||||||
lis => $validation->param('is_lis'),
|
lis => $validation->param('is_lis'),
|
||||||
|
|
|
@ -55,6 +55,24 @@
|
||||||
<input id="pending" type="checkbox" name="pending" value="0">
|
<input id="pending" type="checkbox" name="pending" value="0">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="local" class="col-md-4 col-form-label">Is Local</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select id="local" class="form-control" name="is_local">
|
||||||
|
<option value="0"<%= !$valid_org->is_local ? '' : ' selected' %>>Non Local</option>
|
||||||
|
<option value="1"<%= $valid_org->is_local ? ' selected' : '' %>>Local</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="local" class="col-md-4 col-form-label">Is Fairly Traded</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select id="local" class="form-control" name="is_fair">
|
||||||
|
<option value="0"<%= !$valid_org->is_fair ? '' : ' selected' %>>Non Fairly Traded</option>
|
||||||
|
<option value="1"<%= $valid_org->is_fair ? ' selected' : '' %>>Fairly Traded</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="ml-auto col-sm-10">
|
<div class="ml-auto col-sm-10">
|
||||||
<button class="btn btn-success" type="submit">Save Changes To Organisation</button>
|
<button class="btn btn-success" type="submit">Save Changes To Organisation</button>
|
||||||
|
|
|
@ -38,6 +38,13 @@
|
||||||
% } else {
|
% } else {
|
||||||
<span class="badge badge-secondary">Non Local Org</span>
|
<span class="badge badge-secondary">Non Local Org</span>
|
||||||
% }
|
% }
|
||||||
|
% if ( !defined $org_result->is_fair ) {
|
||||||
|
<span class="badge badge-danger">Fair Trading Status Not Set</span>
|
||||||
|
% } elsif ( $org_result->is_fair ) {
|
||||||
|
<span class="badge badge-success">Fairly Trading Org</span>
|
||||||
|
% } else {
|
||||||
|
<span class="badge badge-secondary">Non Fairly Trading Org</span>
|
||||||
|
% }
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
% }
|
% }
|
||||||
|
|
|
@ -126,6 +126,15 @@ function initMap() {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="local" class="col-md-4 col-form-label">Is Fairly Traded</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select id="local" class="form-control" name="is_fair">
|
||||||
|
<option value="0"<%= !$valid_org->is_fair ? '' : ' selected' %>>Non Fairly Traded</option>
|
||||||
|
<option value="1"<%= $valid_org->is_fair ? ' selected' : '' %>>Fairly Traded</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="ml-auto col-md-8">
|
<div class="ml-auto col-md-8">
|
||||||
<button class="btn btn-success btn-block" type="submit">Save Changes To Organisation</button>
|
<button class="btn btn-success btn-block" type="submit">Save Changes To Organisation</button>
|
||||||
|
|
Reference in a new issue