Finishing off CSV import functionality
This commit is contained in:
parent
423c68aca2
commit
91677034ca
6 changed files with 149 additions and 31 deletions
|
@ -12,22 +12,31 @@
|
|||
</div>
|
||||
% }
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<h3 class="card-header">
|
||||
CSV Import
|
||||
<a href="<%= url_for . '/add' %>" class="btn btn-success" style="float: right">Import Data</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<h3 class="float-left">CSV Import</h3>
|
||||
<a href="<%= url_for . '/add' %>" class="btn btn-success float-right">Import Data</a>
|
||||
</div>
|
||||
% for my $import ( $import_rs->all ) {
|
||||
% my $total = $import_rs->get_values( $import->id, 1, 1 )->count;
|
||||
% my $unimported = $import_rs->get_values( $import->id, undef, undef )->count;
|
||||
% my $with_ignored = $import_rs->get_values( $import->id, 1, undef )->count;
|
||||
% my $with_imported = $import_rs->get_values( $import->id, undef, 1 )->count;
|
||||
% my $ignored_total = $with_ignored - $unimported;
|
||||
% my $imported_total = $with_imported - $unimported;
|
||||
<div class="col col-md-4 mb-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="font-bold"><%= $import->id %></span>
|
||||
%= format_human_datetime $import->date;
|
||||
<div class="card-header text-white <%= $unimported ? 'bg-danger' : 'bg-success' %>">
|
||||
<span><%= format_human_datetime $import->date %></span>
|
||||
<span class=" float-right font-bold"><%= $import->id %></span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span>Unimported: <%= $unimported %></span>
|
||||
<br>
|
||||
<span>Ignored: <%= $ignored_total %></span>
|
||||
<br>
|
||||
<span>Imported: <%= $imported_total %></span>
|
||||
<br>
|
||||
<span>Total: <%= $total %></span>
|
||||
</div>
|
||||
<div class="card-footer text-right">
|
||||
<a href="<%= url_for . '/' . $import->id %>" class="card-link">
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
%= $user->user_name
|
||||
</div>
|
||||
<div class="col-4">
|
||||
% if ( my $lookup = $import_lookup_rs->find({ name => $user->user_name }) ) {
|
||||
<span class="text-muted"><%= $lookup->entity->name %></span>
|
||||
% if ( defined $import_lookup_rs->{ $user->user_name } ) {
|
||||
<span class="text-muted"><%= $import_lookup_rs->{ $user->user_name }->{name} %></span>
|
||||
% } else {
|
||||
<span class="text-muted font-italic">Unassigned</span>
|
||||
% }
|
||||
|
@ -59,8 +59,8 @@
|
|||
%= $org->org_name
|
||||
</div>
|
||||
<div class="col-4">
|
||||
% if ( my $lookup = $import_lookup_rs->find({ name => $org->org_name }) ) {
|
||||
<span class="text-muted"><%= $lookup->entity->name %></span>
|
||||
% if ( defined $import_lookup_rs->{ $org->org_name } ) {
|
||||
<span class="text-muted"><%= $import_lookup_rs->{ $org->org_name }->{name} %></span>
|
||||
% } else {
|
||||
<span class="text-muted font-italic">Unassigned</span>
|
||||
% }
|
||||
|
@ -74,39 +74,64 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="col-12 mb-3">
|
||||
<div class="card">
|
||||
<h3 class="card-header">
|
||||
%= format_human_datetime $import_set->date;
|
||||
<a href="<%= url_for->query({ignored => $c->param('ignored') ? 0 : 1 }) %>"
|
||||
class="btn btn-primary float-right">
|
||||
Toggle show Ignored
|
||||
<%= $c->param('ignored') ? 'Hide' : 'Show' %> Ignored
|
||||
</a>
|
||||
<a href="<%= url_for->query({imported => $c->param('imported') ? 0 : 1 }) %>"
|
||||
class="btn btn-secondary float-right">
|
||||
<%= $c->param('imported') ? 'Hide' : 'Show' %> Imported
|
||||
</a>
|
||||
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
Content listed in original order of import
|
||||
</div>
|
||||
<div class="list-group list-group-flush">
|
||||
% for my $import_value ( $import_value_rs->all ) {
|
||||
% my $user_lookup = $import_lookup_rs->{ $import_value->user_name };
|
||||
% my $purchase_lookup = parse_currency $import_value->purchase_value;
|
||||
% my $org_lookup = $import_lookup_rs->{ $import_value->org_name };
|
||||
<div class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<%= $import_value->user_name %>
|
||||
% if ( defined $user_lookup ) {
|
||||
<br>
|
||||
<span class="text-muted"><%= $user_lookup->{name} %></span>
|
||||
% }
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<%= format_human_datetime $import_value->purchase_date %>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<%= $import_value->purchase_value %>
|
||||
<br>
|
||||
<span class="text-muted"><%= $purchase_lookup %></span>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<%= $import_value->org_name %>
|
||||
% if ( defined $org_lookup ) {
|
||||
<br>
|
||||
<span class="text-muted"><%= $org_lookup->{name} %></span>
|
||||
% }
|
||||
</div>
|
||||
<div class="col-2">
|
||||
% if ( $import_value->ignore_value ) {
|
||||
<a href="<%= url_for . '/ignore/' . $import_value->id %>" class="btn btn-success">Un Ignore</a>
|
||||
% if ( defined $import_value->transaction_id ) {
|
||||
<button class="btn btn-primary">Imported</button>
|
||||
% } else {
|
||||
<a href="<%= url_for . '/ignore/' . $import_value->id %>" class="btn btn-danger">Ignore</a>
|
||||
% if ( defined $user_lookup && defined $org_lookup && $purchase_lookup ) {
|
||||
<button class="btn btn-success">Ready</button>
|
||||
% }
|
||||
% if ( $import_value->ignore_value ) {
|
||||
<a href="<%= url_for . '/ignore/' . $import_value->id %>" class="btn btn-success">Un Ignore</a>
|
||||
% } else {
|
||||
<a href="<%= url_for . '/ignore/' . $import_value->id %>" class="btn btn-danger">Ignore</a>
|
||||
% }
|
||||
% }
|
||||
</div>
|
||||
</div>
|
||||
|
@ -115,4 +140,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a href="<%= url_for . '/import' %>" class="btn btn-info float-right">Import Ready Items</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue