This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/templates/admin/users/read.html.ep

124 lines
5.3 KiB
Text
Raw Permalink Normal View History

2017-04-18 18:03:03 +00:00
% layout 'admin';
% title 'Users';
% content_for javascript => begin
% end
% if ( my $error = flash 'error' ) {
<div class="alert alert-danger" role="alert">
<strong>Error!</strong> <%= $error %>
</div>
% } elsif ( my $success = flash 'success' ) {
<div class="alert alert-success" role="alert">
<strong>Success!</strong> <%= $success %>
</div>
% }
2017-09-04 13:10:38 +00:00
<form action="<%= url_for %>" method="post" autocomplete="off">
<div class="card mb-3">
<h3 class="card-header">
User Details
</h3>
<div class="card-body">
<div class="form-group">
<label for="email">Email Address</label>
<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 class="card mb-3">
2017-08-31 15:38:03 +00:00
% if ( my $customer_rs = $user->entity->customer ) {
<h3 class="card-header">
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>
2017-08-31 15:38:03 +00:00
% } 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">
2017-12-13 15:29:35 +00:00
<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>
2017-04-18 18:03:03 +00:00
</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>
</a>
% }
<div class="list-group-item">
%= bootstrap_pagination( $c->param('page') || 1, $transactions->pager->last_page, { class => 'justify-content-center' } );
</div>
</div>
</div>