added initial UI for uploading csv

This commit is contained in:
Finn 2019-07-04 14:16:49 +01:00
parent c456428681
commit 4b7550f569
No known key found for this signature in database
GPG key ID: 7455B4B17685B598
4 changed files with 45 additions and 9 deletions

View file

@ -246,6 +246,8 @@ sub startup {
$admin_routes->get('/import/:set_id/import')->to('admin-import#run_import');
$admin_routes->get('/import_from')->to('admin-import_from#index');
$admin_routes->post('/import_from/suppliers')->to('admin-import_from#post_suppliers');
$admin_routes->post('/import_from/transactions')->to('admin-import_from#post_transactions');
# my $user_routes = $r->under('/')->to('root#under');

View file

@ -1,4 +1,26 @@
package Pear::LocalLoop::Controller::Admin::ImportFrom;
use Mojo::Base 'Mojolicious::Controller';
use Devel::Dwarn;
1;
sub index {
my $c = shift;
$c->app->max_request_size(1048576);
}
sub post_suppliers {
my $c = shift;
Dwarn "yahoo!";
return $c->redirect_to( '/admin/import_from' );
}
sub post_transactions {
my $c = shift;
Dwarn "yahoo!";
$c->flash( success => "CSV imported!" );
return $c->redirect_to( '/admin/import_from' );
}
1;

View file

@ -5,6 +5,8 @@ extends qw/Pear::LocalLoop::Import::LCCCsv/;
sub import {
my $self = shift;
$import = Pear::LocalLoop::Import::LCCCsv->new;
}
sub _row_to_result {
@ -13,4 +15,4 @@ sub _row_to_result {
}
1;
1;