flash fixes on import

This commit is contained in:
Finn 2019-09-11 15:02:08 +01:00
parent fdbe86a464
commit ff04f44232
3 changed files with 10 additions and 14 deletions

View file

@ -37,7 +37,9 @@ sub post_suppliers {
my $job_id = $c->minion->enqueue('csv_supplier_import' => [ $filename ]); my $job_id = $c->minion->enqueue('csv_supplier_import' => [ $filename ]);
$c->flash(success => "CSV import started, see status of minion job at: " . $c->link_to( 'Minion Job', "/admin/minion/jobs?id=$job_id")); my $job_url = $c->url_for("/admin/minion/jobs?id=$job_id")->to_abs;
$c->flash(success => "CSV import started, see status of minion job at: $job_url");
return $c->redirect_to('/admin/import_from'); return $c->redirect_to('/admin/import_from');
} }
@ -63,7 +65,9 @@ sub post_postcodes {
my $job_id = $c->minion->enqueue('csv_postcode_import' => [ $filename ]); my $job_id = $c->minion->enqueue('csv_postcode_import' => [ $filename ]);
$c->flash(success => "CSV import started, see status of minion job at: " . $c->link_to( 'Minion Job', "/admin/minion/jobs?id=$job_id")); my $job_url = $c->url_for("/admin/minion/jobs?id=$job_id")->to_abs;
$c->flash(success => "CSV import started, see status of minion job at: $job_url");
return $c->redirect_to('/admin/import_from'); return $c->redirect_to('/admin/import_from');
} }
@ -94,7 +98,9 @@ sub post_transactions {
my $job_id = $c->minion->enqueue('csv_transaction_import' => [ $filename, $c->param('entity_id') ]); my $job_id = $c->minion->enqueue('csv_transaction_import' => [ $filename, $c->param('entity_id') ]);
$c->flash(success => "CSV import started, see status of minion job at: " . $c->link_to( 'Minion Job', "/admin/minion/jobs?id=$job_id")); my $job_url = $c->url_for("/admin/minion/jobs?id=$job_id")->to_abs;
$c->flash(success => "CSV import started, see status of minion job at: $job_url");
return $c->redirect_to('/admin/import_from'); return $c->redirect_to('/admin/import_from');
} }

View file

@ -87,7 +87,7 @@ sub _row_to_result {
pattern => '%m/%d/%Y', pattern => '%m/%d/%Y',
time_zone => 'Europe/London' time_zone => 'Europe/London'
); );
my $paid_date = ( $row->{paid_date} ? my $paid_date = ( $row->{paid_date} ?
$date_formatter->parse_datetime($row->{paid_date}) : $date_formatter->parse_datetime($row->{paid_date}) :
$date_formatter->parse_datetime($row->{invoice_date}) ); $date_formatter->parse_datetime($row->{invoice_date}) );

View file

@ -16,16 +16,6 @@ $(function() {
}) })
</script> </script>
% end % 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>
% }
<div class="row"> <div class="row">
<div class="col-12 mb-3"> <div class="col-12 mb-3">
<h3 class="float-left">Import From</h3> <h3 class="float-left">Import From</h3>