amended user info view to accordion

This commit is contained in:
Finn 2018-03-15 13:28:31 +00:00
parent 9229f6ec92
commit a446e62939
2 changed files with 138 additions and 105 deletions

View file

@ -2,6 +2,11 @@
# Next Release # Next Release
# v0.10.5
* **Admin Feature** Removed generic Transaction List
* **Admin Feature** Amended user view to have accordion
# v0.10.4 # v0.10.4
* Added API for category budget * Added API for category budget

View file

@ -11,113 +11,141 @@
<strong>Success!</strong> <%= $success %> <strong>Success!</strong> <%= $success %>
</div> </div>
% } % }
<form action="<%= url_for %>" method="post" autocomplete="off"> <div id="accordion">
<div class="card mb-3"> <div class="card">
<h3 class="card-header"> <div class="card-header" id="headingOne">
User Details <h5 class="mb-0">
</h3> <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
<div class="card-body"> Edit User Details
<div class="form-group"> </button>
<label for="email">Email Address</label> </h5>
<input id="email" type="text" autocomplete="off" class="form-control" placeholder="Email" name="email" value="<%= $user->email %>">
</div>
<div class="form-group">
<label for="joindate">Join Date</label>
<input id="joindate" type="datetime" class="form-control" placeholder="Date" name="joindate" value="<%= $user->join_date %>" disabled>
</div>
<div class="form-group">
<label for="type">Account Type</label>
<input id="type" type="text" class="form-control" value="<%= $user->type eq 'customer' ? 'Customer' : 'Organisation' %>" disabled>
</div>
<div class="form-group">
<label for="new_password">New Password</label>
<input id="new_password" type="password" autocomplete="off" class="form-control" placeholder="New Password" name="new_password">
<p class="help-block">Leave blank unless you want to change their password</p>
</div>
</div> </div>
</div> <div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card mb-3"> <div class="card-body">
% if ( my $customer_rs = $user->entity->customer ) { <form action="<%= url_for %>" method="post" autocomplete="off">
<h3 class="card-header"> <div class="card mb-3">
Customer Details <h3 class="card-header">
</h3> User Details
<div class="card-body"> </h3>
<div class="form-group"> <div class="card-body">
<label for="postcode">Customer Postcode</label> <div class="form-group">
<input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode" value="<%= $customer_rs->postcode %>"> <label for="email">Email Address</label>
</div> <input id="email" type="text" autocomplete="off" class="form-control" placeholder="Email" name="email" value="<%= $user->email %>">
<div class="form-group"> </div>
<label for="full_name">Full Name</label> <div class="form-group">
<input id="full_name" type="text" class="form-control" placeholder="Full Name" name="full_name" value="<%= $customer_rs->full_name %>"> <label for="joindate">Join Date</label>
</div> <input id="joindate" type="datetime" class="form-control" placeholder="Date" name="joindate" value="<%= $user->join_date %>" disabled>
<div class="form-group"> </div>
<label for="display_name">Display Name</label> <div class="form-group">
<input id="display_name" type="text" class="form-control" placeholder="Display Name" name="display_name" value="<%= $customer_rs->display_name %>"> <label for="type">Account Type</label>
</div> <input id="type" type="text" class="form-control" value="<%= $user->type eq 'customer' ? 'Customer' : 'Organisation' %>" disabled>
<div class="form-group"> </div>
<label for="year_of_birth">Year of Birth</label> <div class="form-group">
<input id="year_of_birth" type="number" class="form-control" placeholder="Year of Birth" name="year_of_birth" value="<%= $customer_rs->year_of_birth %>" disabled> <label for="new_password">New Password</label>
</div> <input id="new_password" type="password" autocomplete="off" class="form-control" placeholder="New Password" name="new_password">
</div> <p class="help-block">Leave blank unless you want to change their password</p>
% } elsif ( my $org_rs = $user->entity->organisation ) { </div>
<h3 class="card-header"> </div>
Organisation Details
</h3>
<div class="card-body">
<div class="form-group">
<label for="postcode">Organisation Postcode</label>
<input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode" value="<%= $org_rs->postcode %>">
</div>
<div class="form-group">
<label for="name">Organisation Name</label>
<input id="name" type="text" class="form-control" placeholder="Organisation Name" name="name" value="<%= $org_rs->name %>">
</div>
<div class="form-group">
<label for="street_name">Street Name</label>
<input id="street_name" type="text" class="form-control" placeholder="Street Name" name="street_name" value="<%= $org_rs->street_name %>">
</div>
<div class="form-group">
<label for="town">Town</label>
<input id="town" type="text" class="form-control" placeholder="Town" name="town" value="<%= $org_rs->town %>">
</div>
<div class="form-group">
<label for="town">Sector</label>
<select id="sector" type="sector" class="form-control" placeholder="Sector Area Code" name="sector">
%= include 'partials/sector_options', selected_sector => $org_rs->sector || '';
</select>
</div>
</div>
% } else {
<h3 class="card-header text-white bg-danger">
Warning!
</h3>
<div class="card-body">
User is not a customer or an organisation
</div>
% }
</div>
<div class="form-group">
<button class="btn btn-primary form-control" type="submit">Edit Account</button>
</div>
</form>
<div class="card mb-3">
<h3 class="card-header">
Transactions
</h3>
<div class="list-group list-group-flush">
% for my $transaction ( $transactions->all ) {
<a href="<%= url_for '/admin/transactions/' . $transaction->id %>" class="list-group-item list-group-item-action">
<div class="row text-center">
<div class="col">From: <%= $transaction->buyer->name %></div>
<div class="col">To: <%= $transaction->seller->name %></div>
<div class="col">Value: <%= $transaction->value %></div>
<div class="col">Submitted At: <%= $transaction->submitted_at %></div>
<div class="col">Purchase Time: <%= $transaction->purchase_time %></div>
</div> </div>
</a> <div class="card mb-3">
% } % if ( my $customer_rs = $user->entity->customer ) {
<div class="list-group-item"> <h3 class="card-header">
%= bootstrap_pagination( $c->param('page') || 1, $transactions->pager->last_page, { class => 'justify-content-center' } ); Customer Details
</h3>
<div class="card-body">
<div class="form-group">
<label for="postcode">Customer Postcode</label>
<input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode" value="<%= $customer_rs->postcode %>">
</div>
<div class="form-group">
<label for="full_name">Full Name</label>
<input id="full_name" type="text" class="form-control" placeholder="Full Name" name="full_name" value="<%= $customer_rs->full_name %>">
</div>
<div class="form-group">
<label for="display_name">Display Name</label>
<input id="display_name" type="text" class="form-control" placeholder="Display Name" name="display_name" value="<%= $customer_rs->display_name %>">
</div>
<div class="form-group">
<label for="year_of_birth">Year of Birth</label>
<input id="year_of_birth" type="number" class="form-control" placeholder="Year of Birth" name="year_of_birth" value="<%= $customer_rs->year_of_birth %>" disabled>
</div>
</div>
% } elsif ( my $org_rs = $user->entity->organisation ) {
<h3 class="card-header">
Organisation Details
</h3>
<div class="card-body">
<div class="form-group">
<label for="postcode">Organisation Postcode</label>
<input id="postcode" type="text" class="form-control" placeholder="Postcode" name="postcode" value="<%= $org_rs->postcode %>">
</div>
<div class="form-group">
<label for="name">Organisation Name</label>
<input id="name" type="text" class="form-control" placeholder="Organisation Name" name="name" value="<%= $org_rs->name %>">
</div>
<div class="form-group">
<label for="street_name">Street Name</label>
<input id="street_name" type="text" class="form-control" placeholder="Street Name" name="street_name" value="<%= $org_rs->street_name %>">
</div>
<div class="form-group">
<label for="town">Town</label>
<input id="town" type="text" class="form-control" placeholder="Town" name="town" value="<%= $org_rs->town %>">
</div>
<div class="form-group">
<label for="town">Sector</label>
<select id="sector" type="sector" class="form-control" placeholder="Sector Area Code" name="sector">
%= include 'partials/sector_options', selected_sector => $org_rs->sector || '';
</select>
</div>
</div>
% } else {
<h3 class="card-header text-white bg-danger">
Warning!
</h3>
<div class="card-body">
User is not a customer or an organisation
</div>
% }
</div>
<div class="form-group">
<button class="btn btn-primary form-control" type="submit">Edit Account</button>
</div>
</form>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
View User Transaction List
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<div class="card mb-3">
<h3 class="card-header">
Transactions
</h3>
<div class="list-group list-group-flush">
% for my $transaction ( $transactions->all ) {
<a href="<%= url_for '/admin/transactions/' . $transaction->id %>" class="list-group-item list-group-item-action">
<div class="row text-center">
<div class="col">From: <%= $transaction->buyer->name %></div>
<div class="col">To: <%= $transaction->seller->name %></div>
<div class="col">Value: <%= $transaction->value %></div>
<div class="col">Submitted At: <%= $transaction->submitted_at %></div>
<div class="col">Purchase Time: <%= $transaction->purchase_time %></div>
</div>
</a>
% }
<div class="list-group-item">
%= bootstrap_pagination( $c->param('page') || 1, $transactions->pager->last_page, { class => 'justify-content-center' } );
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>