added initial UI for uploading csv
This commit is contained in:
parent
c456428681
commit
4b7550f569
4 changed files with 45 additions and 9 deletions
|
@ -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');
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in a new issue