Added endpoints for organisation sector
This commit is contained in:
parent
06e89c9199
commit
ff263374ec
8 changed files with 20 additions and 0 deletions
|
@ -28,6 +28,7 @@ sub add_org_submit {
|
||||||
$validation->required('name');
|
$validation->required('name');
|
||||||
$validation->optional('street_name');
|
$validation->optional('street_name');
|
||||||
$validation->required('town');
|
$validation->required('town');
|
||||||
|
$validation->optional('sector');
|
||||||
$validation->optional('postcode')->postcode;
|
$validation->optional('postcode')->postcode;
|
||||||
|
|
||||||
if ( $validation->has_error ) {
|
if ( $validation->has_error ) {
|
||||||
|
@ -43,6 +44,7 @@ sub add_org_submit {
|
||||||
name => $validation->param('name'),
|
name => $validation->param('name'),
|
||||||
street_name => $validation->param('street_name'),
|
street_name => $validation->param('street_name'),
|
||||||
town => $validation->param('town'),
|
town => $validation->param('town'),
|
||||||
|
sector => $validation->param('sector'),
|
||||||
postcode => $validation->param('postcode'),
|
postcode => $validation->param('postcode'),
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -78,6 +80,7 @@ sub valid_edit {
|
||||||
$validation->required('name');
|
$validation->required('name');
|
||||||
$validation->required('street_name');
|
$validation->required('street_name');
|
||||||
$validation->required('town');
|
$validation->required('town');
|
||||||
|
$validation->optional('sector');
|
||||||
$validation->required('postcode')->postcode;
|
$validation->required('postcode')->postcode;
|
||||||
|
|
||||||
if ( $validation->has_error ) {
|
if ( $validation->has_error ) {
|
||||||
|
@ -94,6 +97,7 @@ sub valid_edit {
|
||||||
name => $validation->param('name'),
|
name => $validation->param('name'),
|
||||||
street_name => $validation->param('street_name'),
|
street_name => $validation->param('street_name'),
|
||||||
town => $validation->param('town'),
|
town => $validation->param('town'),
|
||||||
|
sector => $validation->param('sector'),
|
||||||
postcode => $validation->param('postcode'),
|
postcode => $validation->param('postcode'),
|
||||||
});
|
});
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -68,6 +68,7 @@ sub edit {
|
||||||
$validation->required('name');
|
$validation->required('name');
|
||||||
$validation->required('street_name');
|
$validation->required('street_name');
|
||||||
$validation->required('town');
|
$validation->required('town');
|
||||||
|
$validation->optional('sector');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $validation->has_error ) {
|
if ( $validation->has_error ) {
|
||||||
|
@ -107,6 +108,7 @@ sub edit {
|
||||||
name => $validation->param('name'),
|
name => $validation->param('name'),
|
||||||
street_name => $validation->param('street_name'),
|
street_name => $validation->param('street_name'),
|
||||||
town => $validation->param('town'),
|
town => $validation->param('town'),
|
||||||
|
sector => $validation->param('sector'),
|
||||||
postcode => $validation->param('postcode'),
|
postcode => $validation->param('postcode'),
|
||||||
});
|
});
|
||||||
$user->update({
|
$user->update({
|
||||||
|
|
|
@ -75,6 +75,7 @@ sub post_register{
|
||||||
$validation->required('name');
|
$validation->required('name');
|
||||||
$validation->required('street_name');
|
$validation->required('street_name');
|
||||||
$validation->required('town');
|
$validation->required('town');
|
||||||
|
$validation->required('sector');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $c->api_validation_error if $validation->has_error;
|
return $c->api_validation_error if $validation->has_error;
|
||||||
|
@ -112,6 +113,7 @@ sub post_register{
|
||||||
name => $validation->param('name'),
|
name => $validation->param('name'),
|
||||||
street_name => $validation->param('street_name'),
|
street_name => $validation->param('street_name'),
|
||||||
town => $validation->param('town'),
|
town => $validation->param('town'),
|
||||||
|
sector => $validation->param('sector'),
|
||||||
postcode => $validation->param('postcode'),
|
postcode => $validation->param('postcode'),
|
||||||
});
|
});
|
||||||
$c->schema->resultset('User')->create({
|
$c->schema->resultset('User')->create({
|
||||||
|
|
|
@ -128,6 +128,7 @@ sub post_account_update {
|
||||||
$validation->required('name');
|
$validation->required('name');
|
||||||
$validation->required('street_name');
|
$validation->required('street_name');
|
||||||
$validation->required('town');
|
$validation->required('town');
|
||||||
|
$validation->required('sector');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $c->api_validation_error if $validation->has_error;
|
return $c->api_validation_error if $validation->has_error;
|
||||||
|
@ -154,6 +155,7 @@ sub post_account_update {
|
||||||
name => $validation->param('name'),
|
name => $validation->param('name'),
|
||||||
street_name => $validation->param('street_name'),
|
street_name => $validation->param('street_name'),
|
||||||
town => $validation->param('town'),
|
town => $validation->param('town'),
|
||||||
|
sector => $validation->param('sector'),
|
||||||
postcode => $validation->param('postcode'),
|
postcode => $validation->param('postcode'),
|
||||||
});
|
});
|
||||||
$user->update({
|
$user->update({
|
||||||
|
|
|
@ -34,6 +34,10 @@ __PACKAGE__->add_columns(
|
||||||
size => 16,
|
size => 16,
|
||||||
is_nullable => 1,
|
is_nullable => 1,
|
||||||
},
|
},
|
||||||
|
sector => {
|
||||||
|
data_type => "varchar",
|
||||||
|
size => 1,
|
||||||
|
is_nullable => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
__PACKAGE__->set_primary_key('id');
|
__PACKAGE__->set_primary_key('id');
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<li class="list-group-item"><input id="name" type="text" class="form-control" placeholder="Organisation Name" name="name"></li>
|
<li class="list-group-item"><input id="name" type="text" class="form-control" placeholder="Organisation Name" name="name"></li>
|
||||||
<li class="list-group-item"><input id="street_name" type="text" class="form-control" placeholder="Street Name" name="street_name"></li>
|
<li class="list-group-item"><input id="street_name" type="text" class="form-control" placeholder="Street Name" name="street_name"></li>
|
||||||
<li class="list-group-item"><input id="town" type="text" class="form-control" placeholder="Town" name="town"></li>
|
<li class="list-group-item"><input id="town" type="text" class="form-control" placeholder="Town" name="town"></li>
|
||||||
|
<li class="list-group-item"><input id="sector" type="text" class="form-control" placeholder="Sector Area Code" name="sector"></li>
|
||||||
<li class="list-group-item"><input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode"></li>
|
<li class="list-group-item"><input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode"></li>
|
||||||
<li class="list-group-item"><button class="btn btn-success" type="submit">Add Organisation</button></li>
|
<li class="list-group-item"><button class="btn btn-success" type="submit">Add Organisation</button></li>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<li class="list-group-item"><input id="name" type="text" class="form-control" placeholder="Organisation Name" name="name" value="<%= $valid_org->name %>"></li>
|
<li class="list-group-item"><input id="name" type="text" class="form-control" placeholder="Organisation Name" name="name" value="<%= $valid_org->name %>"></li>
|
||||||
<li class="list-group-item"><input id="street_name" type="text" class="form-control" placeholder="Street Name" name="street_name" value="<%= $valid_org->street_name %>"></li>
|
<li class="list-group-item"><input id="street_name" type="text" class="form-control" placeholder="Street Name" name="street_name" value="<%= $valid_org->street_name %>"></li>
|
||||||
<li class="list-group-item"><input id="town" type="text" class="form-control" placeholder="Town" name="town" value="<%= $valid_org->town %>"></li>
|
<li class="list-group-item"><input id="town" type="text" class="form-control" placeholder="Town" name="town" value="<%= $valid_org->town %>"></li>
|
||||||
|
<li class="list-group-item"><input id="sector" type="text" class="form-control" placeholder="Sector Letter Code" name="sector" value="<%= $valid_org->sector %>"></li>
|
||||||
<li class="list-group-item"><input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode" value="<%= $valid_org->postcode %>"></li>
|
<li class="list-group-item"><input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode" value="<%= $valid_org->postcode %>"></li>
|
||||||
<li class="list-group-item"><button class="btn btn-success" type="submit">Edit Organisation</button></li>
|
<li class="list-group-item"><button class="btn btn-success" type="submit">Edit Organisation</button></li>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -72,6 +72,10 @@
|
||||||
<label for="town">Town</label>
|
<label for="town">Town</label>
|
||||||
<input id="town" type="text" class="form-control" placeholder="Town" name="town" value="<%= $org_rs->town %>">
|
<input id="town" type="text" class="form-control" placeholder="Town" name="town" value="<%= $org_rs->town %>">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="town">Town</label>
|
||||||
|
<input id="town" type="sector" class="form-control" placeholder="Sector Area Code" name="sector" value="<%= $org_rs->sector %>">
|
||||||
|
</div>
|
||||||
% } else {
|
% } else {
|
||||||
<h3 class="card-header">
|
<h3 class="card-header">
|
||||||
User is not a customer or an organisation
|
User is not a customer or an organisation
|
||||||
|
|
Reference in a new issue