Basic for for #262

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole 2016-05-22 21:11:30 +02:00
parent 288e713f94
commit a447c886c4
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
4 changed files with 100 additions and 1 deletions

View File

@ -0,0 +1,41 @@
<?php
namespace FireflyIII\Http\Controllers;
use FireflyIII\Http\Requests;
use View;
/**
* Class ImportController
*
* @package FireflyIII\Http\Controllers
*/
class ImportController extends Controller
{
/**
*
*/
public function __construct()
{
parent::__construct();
View::share('mainTitleIcon', 'fa-archive');
View::share('title', trans('firefly.import_data'));
}
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
$subTitle = trans('firefly.import_data_index');
$subTitleIcon = 'fa-home';
$importFileTypes = [];
$defaultImportType = config('firefly.default_import_format');
foreach (array_keys(config('firefly.import_formats')) as $type) {
$importFileTypes[$type] = trans('firefly.import_file_type_' . $type);
}
return view('import.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
}
}

View File

@ -220,6 +220,11 @@ Route::group(
Route::get('/chart/report/in-out-sum/{reportType}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\ReportController@yearInOutSummarized']);
Route::get('/chart/report/net-worth/{reportType}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\ReportController@netWorth']);
/**
* IMPORT CONTROLLER
*/
Route::get('/import', ['uses' => 'ImportController@index','as' => 'import.index']);
Route::post('/import/upload', ['uses' => 'ImportController@upload','as' => 'import.upload']);
/**
* Help Controller

View File

@ -87,7 +87,8 @@ class General extends Twig_Extension
'activeRoutePartial', function () : string {
$args = func_get_args();
$route = $args[0]; // name of the route.
if (!(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
$name = Route::getCurrentRoute()->getName() ?? '';
if (!(strpos($name, $route) === false)) {
return 'active';
}

View File

@ -0,0 +1,52 @@
{% extends "./layout/default.twig" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists }}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<!-- ACCOUNTS -->
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">{{ 'import'|_ }}</h3>
</div>
<div class="box-body">
<p>
{{ 'import_intro_text'|_ }}
</p>
<p>
&nbsp;
</p>
<div class="row">
<form method="POST" action="{{ route('import.upload') }}" accept-charset="UTF-8" class="form-horizontal" id="update"
enctype="multipart/form-data">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="col-lg-6 col-md-8 col-sm-12 col-xs-12">
{{ ExpandedForm.file('import_file',{helpText: 'import_file_help'|_}) }}
{{ ExpandedForm.select('import_file_type', importFileTypes, defaultImportType, {'helpText' : 'import_file_type_help'|_}) }}
<div class="form-group" id="import_file_holder">
<label for="ffInput_submit" class="col-sm-4 control-label">&nbsp;</label>
<div class="col-sm-8">
<button type="submit" class="btn pull-right btn-success">
{{ ('import_start')|_ }}
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
{% endblock %}
{% block styles %}
{% endblock %}