Skip to content

Firefly III: a personal finances manager

CSV importer now indicates the problems it has.

James Cole540dde135e0e
diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.php
index 94e6b75e5a..3f7be24554 100644
--- a/app/Helpers/Csv/Importer.php
+++ b/app/Helpers/Csv/Importer.php
@@ -37,18 +37,6 @@ class Importer
/** @var array */
protected $roles;
- /**
- * @param $value
- */
- public function parseRaboDebetCredit($value)
- {
- if ($value == 'D') {
- return -1;
- }
-
- return 1;
- }
-
/**
*
*/
@@ -58,10 +46,11 @@ class Importer
$this->roles = $this->data->getRoles();
$this->mapped = $this->data->getMapped();
foreach ($this->data->getReader() as $index => $row) {
+ Log::debug('Now at row ' . $index);
$result = $this->importRow($row);
if (!($result === true)) {
+ Log::error('Caught error at row #' . $index . ': ' . $result);
$this->errors[$index] = $result;
- Log::error('ImportRow: ' . $result);
}
}
@@ -96,16 +85,10 @@ class Importer
$converter->setData($data); // the complete array so far.
$converter->setField($field);
$converter->setIndex($index);
+ $converter->setMapped($this->mapped);
$converter->setValue($value);
$converter->setRole($role);
- // if (is_array($field)) {
- // $convertResult = $converter->convert();
- // foreach ($field as $fieldName) {
- // $data[$fieldName] = $convertResult[$fieldName];
- // }
- // } else {
$data[$field] = $converter->convert();
- // }
}
$data = $this->postProcess($data, $row);
@@ -164,6 +147,10 @@ class Importer
$accountType = AccountType::where('type', 'Revenue account')->first();
}
+ if(strlen($data['description']) == 0) {
+ $data['description'] = trans('firefly.csv_empty_description');
+ }
+
// do bank specific fixes:
$specifix = new Specifix();
diff --git a/app/Helpers/Csv/DataGrabber.php b/app/Helpers/Csv/Mapper/AssetAccount.php
similarity index 51%
rename from app/Helpers/Csv/DataGrabber.php
rename to app/Helpers/Csv/Mapper/AssetAccount.php
index 93260b82c4..d8fe71cc2d 100644
--- a/app/Helpers/Csv/DataGrabber.php
+++ b/app/Helpers/Csv/Mapper/AssetAccount.php
@@ -1,26 +1,29 @@
<?php
+/**
+ * Created by PhpStorm.
+ * User: sander
+ * Date: 05/07/15
+ * Time: 08:35
+ */
-namespace FireflyIII\Helpers\Csv;
+namespace FireflyIII\Helpers\Csv\Mapper;
use Auth;
use FireflyIII\Models\Account;
-use FireflyIII\Models\TransactionCurrency;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
- * Class DataGrabber
+ * Class AssetAccount
*
- * Class dedicated to retreiving all sorts of data related to the CSV import.
- *
- * @package FireflyIII\Helpers\Csv
+ * @package FireflyIII\Helpers\Csv\Mapper
*/
-class DataGrabber
+class AssetAccount implements MapperInterface
{
/**
* @return array
*/
- public function getAssetAccounts()
+ public function getMap()
{
$result = Auth::user()->accounts()->with(
['accountmeta' => function (HasMany $query) {
@@ -36,19 +39,4 @@ class DataGrabber
return $list;
}
-
- /**
- * @return array
- */
- public function getCurrencies()
- {
- $currencies = TransactionCurrency::get();
- $list = [];
- foreach ($currencies as $currency) {
- $list[$currency->id] = $currency->name . ' (' . $currency->code . ')';
- }
-
- return $list;
- }
-
}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/MapperInterface.php b/app/Helpers/Csv/Mapper/MapperInterface.php
new file mode 100644
index 0000000000..a01785f9a4
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/MapperInterface.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace FireflyIII\Helpers\Csv\Mapper;
+
+/**
+ * Interface MapperInterface
+ *
+ * @package FireflyIII\Helpers\Csv\Mapper
+ */
+interface MapperInterface
+{
+ /**
+ * @return array
+ */
+ public function getMap();
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Mapper/TransactionCurrency.php b/app/Helpers/Csv/Mapper/TransactionCurrency.php
new file mode 100644
index 0000000000..0945bea416
--- /dev/null
+++ b/app/Helpers/Csv/Mapper/TransactionCurrency.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace FireflyIII\Helpers\Csv\Mapper;
+
+use FireflyIII\Models\TransactionCurrency as TC;
+
+/**
+ * Class TransactionCurrency
+ *
+ * @package FireflyIII\Helpers\Csv\Mapper
+ */
+class TransactionCurrency implements MapperInterface
+{
+
+ /**
+ * @return array
+ */
+ public function getMap()
+ {
+ $currencies = TC::get();
+ $list = [];
+ foreach ($currencies as $currency) {
+ $list[$currency->id] = $currency->name . ' (' . $currency->code . ')';
+ }
+
+ return $list;
+ }
+}
\ No newline at end of file
diff --git a/app/Helpers/Csv/Wizard.php b/app/Helpers/Csv/Wizard.php
index b08e10bc55..92291e7f45 100644
--- a/app/Helpers/Csv/Wizard.php
+++ b/app/Helpers/Csv/Wizard.php
@@ -1,11 +1,14 @@
<?php
namespace FireflyIII\Helpers\Csv;
+use App;
use Auth;
use Config;
use Crypt;
use FireflyIII\Exceptions\FireflyException;
+use FireflyIII\Helpers\Csv\Mapper\MapperInterface;
use League\Csv\Reader;
+use ReflectionException;
use Session;
/**
@@ -126,34 +129,24 @@ class Wizard implements WizardInterface
*/
public function showOptions(array $map)
{
- $dataGrabber = new DataGrabber;
$options = [];
foreach ($map as $index => $columnRole) {
- /*
- * Depending on the column role, get the relevant data from the database.
- * This needs some work to be optimal.
- */
- switch ($columnRole) {
- default:
- throw new FireflyException('Cannot map field of type "' . $columnRole . '".');
- break;
- case 'account-iban':
- $set = $dataGrabber->getAssetAccounts();
- break;
- case 'currency-code':
- $set = $dataGrabber->getCurrencies();
- break;
+ $mapper = Config::get('csv.roles.' . $columnRole . '.mapper');
+ if (is_null($mapper)) {
+ throw new FireflyException('Cannot map field of type "' . $columnRole . '".');
}
-
- /*
- * Make select list kind of thing:
- */
-
+ $class = 'FireflyIII\Helpers\Csv\Mapper\\' . $mapper;
+ try {
+ /** @var MapperInterface $mapObject */
+ $mapObject = App::make($class);
+ } catch (ReflectionException $e) {
+ throw new FireflyException('Column "' . $columnRole . '" cannot be mapped because class ' . $mapper . ' does not exist.');
+ }
+ $set = $mapObject->getMap();
$options[$index] = $set;
}
-
return $options;
}
diff --git a/app/Http/Controllers/CsvController.php b/app/Http/Controllers/CsvController.php
index a8636dde63..03cfd5e63f 100644
--- a/app/Http/Controllers/CsvController.php
+++ b/app/Http/Controllers/CsvController.php
@@ -9,18 +9,14 @@
namespace FireflyIII\Http\Controllers;
use App;
-use Carbon\Carbon;
use Config;
-use Crypt;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Csv\Data;
use FireflyIII\Helpers\Csv\Importer;
use FireflyIII\Helpers\Csv\WizardInterface;
-use FireflyIII\Models\Account;
-use FireflyIII\Models\TransactionCurrency;
use Illuminate\Http\Request;
use Input;
-use League\Csv\Reader;
+use Log;
use Redirect;
use Session;
use View;
@@ -80,7 +76,7 @@ class CsvController extends Controller
$map = $this->data->getMap();
for ($i = 1; $i <= $count; $i++) {
- $headers[] = trans('firefly.csv_row') . ' #' . $i;
+ $headers[] = trans('firefly.csv_column') . ' #' . $i;
}
if ($this->data->getHasHeaders()) {
$headers = $firstRow;
@@ -157,12 +153,24 @@ class CsvController extends Controller
Session::forget('csv-roles');
Session::forget('csv-mapped');
+ // get values which are yet unsaveable or unmappable:
+ $unsupported = [];
+ foreach (Config::get('csv.roles') as $role) {
+ if (!isset($role['converter'])) {
+ $unsupported[] = trans('firefly.csv_unsupported_value', ['columnRole' => $role['name']]);
+ }
+ if ($role['mappable'] === true && !isset($role['mapper'])) {
+ $unsupported[] = trans('firefly.csv_unsupported_map', ['columnRole' => $role['name']]);
+ }
+ }
+ sort($unsupported);
+
// can actually upload?
$uploadPossible = is_writable(storage_path('upload'));
$path = storage_path('upload');
- return view('csv.index', compact('subTitle', 'uploadPossible', 'path'));
+ return view('csv.index', compact('subTitle', 'uploadPossible', 'path','unsupported'));
}
/**
@@ -209,7 +217,8 @@ class CsvController extends Controller
* Or simply start processing.
*/
- return Redirect::route('csv.process');
+ // proceed to download config
+ return Redirect::route('csv.download-config-page');
}
@@ -284,104 +293,21 @@ class CsvController extends Controller
return Redirect::route('csv.index');
}
- //
+ Log::debug('Created importer');
$importer = new Importer;
$importer->setData($this->data);
try {
$importer->run();
} catch (FireflyException $e) {
+ Log::error('Catch error: ' . $e->getMessage());
+
return view('error', ['message' => $e->getMessage()]);
}
+ Log::debug('Done importing!');
-
+ echo 'display result';
exit;
- // loop the original file again:
- $content = file_get_contents(Session::get('csv-file'));
- $hasHeaders = Session::get('csv-has-headers');
- $reader = Reader::createFromString(Crypt::decrypt($content));
-
- // dump stuff
- $dateFormat = Session::get('csv-date-format');
- $roles = Session::get('csv-roles');
- $mapped = Session::get('csv-mapped');
-
- /*
- * Loop over the CSV and collect mappable data:
- */
- foreach ($reader as $index => $row) {
- if (($hasHeaders && $index > 1) || !$hasHeaders) {
- // this is the data we need to store the new transaction:
- $amount = 0;
- $amountModifier = 1;
- $description = '';
- $assetAccount = null;
- $opposingAccount = null;
- $currency = null;
- $date = null;
-
- foreach ($row as $index => $value) {
- if (isset($roles[$index])) {
- switch ($roles[$index]) {
- default:
- throw new FireflyException('Cannot process role "' . $roles[$index] . '"');
- break;
- case 'account-iban':
- // find ID in "mapped" (if present).
- if (isset($mapped[$index])) {
- $searchID = $mapped[$index][$value];
- $assetAccount = Account::find($searchID);
- } else {
- // create account
- }
- break;
- case 'opposing-name':
- // don't know yet if its going to be a
- // revenue or expense account.
- $opposingAccount = $value;
- break;
- case 'currency-code':
- // find ID in "mapped" (if present).
- if (isset($mapped[$index])) {
- $searchValue = $mapped[$index][$value];
- $currency = TransactionCurrency::whereCode($searchValue);
- } else {
- // create account
- }
- break;
- case 'date-transaction':
- // unmappable:
- $date = Carbon::createFromFormat($dateFormat, $value);
-
- break;
- case 'rabo-debet-credet':
- if ($value == 'D') {
- $amountModifier = -1;
- }
- break;
- case 'amount':
- $amount = $value;
- break;
- case 'description':
- $description .= ' ' . $value;
- break;
- case 'sepa-ct-id':
- $description .= ' ' . $value;
- break;
-
- }
- }
- }
- // do something with all this data:
-
-
- // do something.
- var_dump($row);
-
- }
- }
-
-
}
/**
diff --git a/config/csv.php b/config/csv.php
index 78b4121dcb..e141c2f438 100644
--- a/config/csv.php
+++ b/config/csv.php
@@ -27,7 +27,8 @@ return [
'name' => 'Currency code (ISO 4217)',
'mappable' => true,
'converter' => 'CurrencyCode',
- 'field' => 'currency'
+ 'field' => 'currency',
+ 'mapper' => 'TransactionCurrency'
],
'currency-symbol' => [
'name' => 'Currency symbol (matching Firefly)',
@@ -93,7 +94,8 @@ return [
'name' => 'Asset account IBAN',
'mappable' => true,
'converter' => 'AccountIban',
- 'field' => 'asset-account'
+ 'field' => 'asset-account',
+ 'mapper' => 'AssetAccount'
],
'opposing-id' => [
'name' => 'Expense or revenue account ID (matching Firefly)',
diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php
index 071f352e50..1374379ef4 100644
--- a/resources/lang/en/firefly.php
+++ b/resources/lang/en/firefly.php
@@ -22,15 +22,53 @@ return [
// csv import:
'csv_import' => 'Import CSV file',
'csv' => 'CSV',
- 'csv_index_text' => 'Here be explanation.',
- 'csv_upload_form' => 'Upload form',
- 'upload_csv_file' => 'Upload CSV file',
- 'csv_header_help' => 'Check this when bla bla',
+ 'csv_index_title' => 'Upload and import a CSV file',
+ 'csv_index_text' =>
+ 'This form allows you to import a CSV file with transactions into Firefly. It is based on the excellent CSV importer made by' .
+ ' the folks at <a href="https://www.atlassian.com/">Atlassian</a>. Simply upload your CSV file and follow the instructions.',
+ 'csv_index_beta_warning' => 'This tool is very much in beta. Please proceed with caution',
+ 'csv_header_help' => 'Check this box when your CSV file\'s first row consists of column names, not actual data',
'csv_date_help' => 'Date time format in your CSV. Follow the format like <a href="https://secure.' .
'php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters">this' .
- ' page</a> indicates.',
- 'csv_row' => 'row',
- 'upload_not_writeable' => 'Cannot write to the path mentioned here. Cannot upload',
+ ' page</a> indicates. The default value will parse dates that look like this: ' . date('Ymd'),
+ 'csv_csv_file_help' => 'Select the CSV file here. You can only upload one file at a time',
+ 'csv_csv_config_file_help' => 'Select your CSV import configuration here. If you do not know what this is, ignore it. It will be explained later.',
+ 'csv_upload_button' => 'Start importing CSV',
+ 'csv_column_roles_title' => 'Define column roles',
+ 'csv_column_roles_text' => 'Firefly does not know what each column means. You need to indicate what every column is. Please check out the example '
+ . 'data if you\'re not sure yourself. Click on the question mark (top right of the page) to learn what'
+ . ' each column means. If you want to map imported data onto existing data in Firefly, use the checkbox. '
+ . 'The next step will show you what this button does.',
+ 'csv_column_roles_table' => 'Column roles',
+ 'csv_column' => 'CSV column',
+ 'cvs_column_name' => 'CSV column name',
+ 'cvs_column_example' => 'Column example data',
+ 'cvs_column_role' => 'Column contains?',
+ 'csv_do_map_value' => 'Map value?',
+ 'csv_continue' => 'Continue to the next step',
+ 'csv_go_back' => 'Go back to the previous step',
+ 'csv_map_title' => 'Map found values to existing values',
+ 'csv_map_text' =>
+ 'This page allows you to map the values from the CSV file to existing entries in your database. This ensures that accounts and other'
+ . ' things won\'t be created twice.',
+ 'cvs_field_value' => 'Field value from CSV',
+ 'csv_field_mapped_to' => 'Must be mapped to...',
+ 'csv_download_config_title' => 'Download CSV configuration',
+ 'csv_download_config_text' => 'Everything you\'ve just set up can be downloaded as a configuration file. Click the button to do so.',
+ 'csv_more_information_text' => 'If the import fails, you can use this configuration file so you don\'t have to start all over again.',
+ 'csv_do_download_config' => 'Download configuration file.',
+ 'csv_empty_description' => '(empty description)',
+ 'csv_upload_form' => 'CSV upload form',
+ 'csv_index_unsupported_warning' => 'The CSV importer is yet incapable of doing the following:',
+ 'csv_unsupported_map' => 'The importer cannot map the column ":columnRole" to existing values in the database.',
+ 'csv_unsupported_value' => 'The importer does not know how to handle values in columns marked as ":columnRole".',
+ // 'csv_index_text' => 'Here be explanation.',
+ // 'csv_upload_form' => 'Upload form',
+ // 'upload_csv_file' => 'Upload CSV file',
+ // 'csv_header_help' => 'Check this when bla bla',
+ // 'csv_date_help' =>
+ // 'csv_row' => 'row',
+ 'csv_upload_not_writeable' => 'Cannot write to the path mentioned here. Cannot upload',
// create new stuff:
'create_new_withdrawal' => 'Create new withdrawal',
diff --git a/resources/lang/en/form.php b/resources/lang/en/form.php
index ef9596096f..67e7337be6 100644
--- a/resources/lang/en/form.php
+++ b/resources/lang/en/form.php
@@ -48,6 +48,7 @@ return [
'csv' => 'CSV file',
'has_headers' => 'Headers',
'date_format' => 'Date format',
+ 'csv_config' => 'CSV import configuration',
'store_new_withdrawal' => 'Store new withdrawal',
'store_new_deposit' => 'Store new deposit',
diff --git a/resources/twig/csv/column-roles.twig b/resources/twig/csv/column-roles.twig
index e3e0248288..3480bdbd0f 100644
--- a/resources/twig/csv/column-roles.twig
+++ b/resources/twig/csv/column-roles.twig
@@ -7,32 +7,11 @@
{% block content %}
-<div class="row">
- <div class="col-lg-12">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'csv_process'|_ }}</h3>
-
- <!-- ACTIONS MENU -->
- <div class="box-tools pull-right">
- <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
- </div>
-
- </div>
- <div class="box-body">
- <p>{{ 'csv_process_text'|_ }}</p>
- <h4>{{ 'csv_more_information' }}</h4>
- <p>{{ 'csv_more_information_text'|_ }}</p>
- </div>
- </div>
-
- </div>
-</div>
<div class="row">
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
- <h3 class="box-title">{{ 'csv_process_form'|_ }}</h3>
+ <h3 class="box-title">{{ 'csv_column_roles_title'|_ }}</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
@@ -41,40 +20,68 @@
</div>
<div class="box-body">
- <form action="{{ route('csv.initial_parse') }}" method="post">
- <input type="hidden" name="_token" value="{{ csrf_token() }}" />
- <table class="table">
- <thead>
+ <p>{{ 'csv_column_roles_text'|_ }}</p>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ <form action="{{ route('csv.initial_parse') }}" method="post">
+ <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
+
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'csv_column_roles_table'|_ }}</h3>
+
+ <!-- ACTIONS MENU -->
+ <div class="box-tools pull-right">
+ <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
+ </div>
+
+ </div>
+ <div class="box-body">
+
+ <table class="table">
+ <thead>
<th>{{ 'cvs_column_name'|_ }}</th>
<th>{{ 'cvs_column_example'|_ }}</th>
<th>{{ 'cvs_column_role'|_ }}</th>
- <th>{{ 'do_map_value'|_ }}</th>
- </thead>
- {% for index,header in headers %}
- <tr>
- <td>{{ header }}</td>
- <td>{{ example[index] }}</td>
- <td>
- {{ Form.select(('role['~index~']'), availableRoles,roles[index]) }}
- </td>
- <td>
- {{ Form.checkbox(('map['~index~']'),1,map[index]) }}
- </td>
+ <th>{{ 'csv_do_map_value'|_ }}</th>
+ </thead>
+ {% for index,header in headers %}
+ <tr>
+ <td>{{ header }}</td>
+ <td>{{ example[index] }}</td>
+ <td>
+ {{ Form.select(('role['~index~']'), availableRoles,roles[index]) }}
+ </td>
+ <td>
+ {{ Form.checkbox(('map['~index~']'),1,map[index]) }}
+ </td>
+
+ </tr>
+ {% endfor %}
+ </table>
- </tr>
- {% endfor %}
- </table>
- <p>
- <a href="{{ route('csv.index') }}" class="btn btn-danger pull-right">{{ 'go_back'|_ }}</a>
- <button type="submit" class="btn btn-success">
- {{ 'process_csv_file'|_ }}
- </button>
- </p>
- </form>
+ </div>
</div>
</div>
</div>
- </div>
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-body">
+ <a href="{{ route('csv.index') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
+ <button type="submit" class="btn btn-success pull-right">
+ {{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </form>
{% endblock %}
diff --git a/resources/twig/csv/download-config.twig b/resources/twig/csv/download-config.twig
index e566d293ec..302670614d 100644
--- a/resources/twig/csv/download-config.twig
+++ b/resources/twig/csv/download-config.twig
@@ -7,34 +7,44 @@
{% block content %}
-<div class="row">
- <div class="col-lg-12">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'csv_download_config'|_ }}</h3>
-
- <!-- ACTIONS MENU -->
- <div class="box-tools pull-right">
- <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'csv_download_config_title'|_ }}</h3>
+
+ <!-- ACTIONS MENU -->
+ <div class="box-tools pull-right">
+ <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
+ </div>
+
</div>
+ <div class="box-body">
+ <p>
+ {{ 'csv_download_config_text'|_ }}
+ </p>
- </div>
- <div class="box-body">
- <p>
- {{ 'csv_some_text'|_ }}
- </p>
- <p>
- <a href="{{ route('csv.download-config') }}" class="btn btn-info"><i class="fa fa-download"></i> {{ 'csv_do_download_config'|_ }}</a>
- </p>
- <p>
- {{ 'csv_more_information_text'|_ }}
- </p>
- <p>
- <a href="{{ route('csv.process') }}" class="btn btn-lg btn-success"><i class="fa fa-gears"></i> {{ 'csv_do_process'|_ }}</a>
- </p>
+ <p>
+ <a href="{{ route('csv.download-config') }}" class="btn btn-info"><i class="fa fa-download"></i> {{ 'csv_do_download_config'|_ }}</a>
+ </p>
+
+ <p>
+ {{ 'csv_more_information_text'|_ }}
+ </p>
+ </div>
</div>
</div>
+ </div>
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-body">
+ <a href="{{ route('csv.index') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
+ <a href="{{ route('csv.process') }}" class="btn btn-success pull-right">{{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i></a>
+ </div>
+ </div>
+ </div>
</div>
-</div>
+
{% endblock %}
diff --git a/resources/twig/csv/index.twig b/resources/twig/csv/index.twig
index 58b4c3f2b3..10f00c9cf2 100644
--- a/resources/twig/csv/index.twig
+++ b/resources/twig/csv/index.twig
@@ -7,32 +7,11 @@
{% block content %}
-<div class="row">
- <div class="col-lg-12">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'csv'|_ }}</h3>
-
- <!-- ACTIONS MENU -->
- <div class="box-tools pull-right">
- <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
- </div>
-
- </div>
- <div class="box-body">
- {{ 'csv_index_text'|_ }}
- <h4>{{ 'csv_more_information' }}</h4>
- {{ 'csv_more_information_text'|_ }}
- </div>
- </div>
-
- </div>
-</div>
<div class="row">
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
- <h3 class="box-title">{{ 'csv_upload_form'|_ }}</h3>
+ <h3 class="box-title">{{ 'csv_index_title'|_ }}</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
@@ -41,31 +20,48 @@
</div>
<div class="box-body">
+ {{ 'csv_index_text'|_ }}
+ <p class="text-info">{{ 'csv_index_beta_warning'|_ }}</p>
+ {% if unsupported|length > 0 %}
+ <p class="text-danger">{{ 'csv_index_unsupported_warning'|_ }}</p>
+ <ul>
+ {% for message in unsupported %}
+ <li>{{ message }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ </div>
+ </div>
+
+ </div>
+ </div>
+
+ <form class="form-horizontal" action="{{ route('csv.upload') }}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
+
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'csv_upload_form'|_ }}</h3>
+
+ <!-- ACTIONS MENU -->
+ <div class="box-tools pull-right">
+ <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
+ </div>
+
+ </div>
+ <div class="box-body">
- <form class="form-horizontal" action="{{ route('csv.upload') }}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="_token" value="{{ csrf_token() }}" />
{{ ExpandedForm.checkbox('has_headers',false,null,{helpText: 'csv_header_help'|_}) }}
{{ ExpandedForm.text('date_format','Ymd',{helpText: 'csv_date_help'|_}) }}
- {{ ExpandedForm.file('csv') }}
-
- {{ ExpandedForm.file('csv_config') }}
+ {{ ExpandedForm.file('csv',{helpText: 'csv_csv_file_help'|_}) }}
- {% if uploadPossible %}
- <div class="form-group" id="csv_holder">
- <div class="col-sm-4">
- &nbsp;
- </div>
+ {{ ExpandedForm.file('csv_config',{helpText: 'csv_csv_config_file_help'|_}) }}
- <div class="col-sm-8">
-
- <button type="submit" class="btn btn-success">
- {{ 'upload_csv_file'|_ }}
- </button>
- </div>
- </div>
- {% else %}
+ {% if not uploadPossible %}
<div class="form-group" id="csv_holder">
<div class="col-sm-4">
&nbsp;
@@ -74,20 +70,31 @@
<div class="col-sm-8">
<pre>{{ path }}</pre>
<p class="text-danger">
- {{ 'upload_not_writeable'|_ }}
+ {{ 'csv_upload_not_writeable'|_ }}
</p>
</div>
</div>
{% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
-
- </form>
-
-
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-body">
+ <button type="submit" class="pull-right btn btn-success">
+ {{ 'csv_upload_button'|_ }}
+ </button>
+ </div>
</div>
</div>
</div>
- </div>
+ </form>
+
+
+
{% endblock %}
diff --git a/resources/twig/csv/map.twig b/resources/twig/csv/map.twig
index 255abac3b0..97ce18b582 100644
--- a/resources/twig/csv/map.twig
+++ b/resources/twig/csv/map.twig
@@ -11,7 +11,7 @@
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
- <h3 class="box-title">{{ 'csv_map'|_ }}</h3>
+ <h3 class="box-title">{{ 'csv_map_title'|_ }}</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
@@ -20,7 +20,9 @@
</div>
<div class="box-body">
- <a href="{{ route('csv.download-config') }}">Download config for use again</a>
+ <p>
+ {{ 'csv_map_text'|_ }}
+ </p>
</div>
</div>
@@ -35,7 +37,7 @@
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
- <h3 class="box-title">{{ columnName }}</h3>
+ <h3 class="box-title">{{ Config.get('csv.roles.'~columnName~'.name') }}</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
@@ -69,11 +71,21 @@
</div>
</div>
{% endfor %}
- <p>
- <button type="submit" class="btn btn-success">
- {{ 'save_mapping'|_ }}
- </button>
- </p>
+
+
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="box">
+ <div class="box-body">
+ <a href="{{ route('csv.column-roles') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
+ <button type="submit" class="btn btn-success pull-right">
+ {{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+
</form>