Fixed upload form, made a new form element, added some processing.

This commit is contained in:
James Cole
2015-07-03 11:52:51 +02:00
parent 86011d4ea2
commit 16374bce9b
14 changed files with 2533 additions and 78 deletions

View File

@@ -21,6 +21,13 @@ 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_row' => 'row',
'upload_not_writeable' => 'Cannot write to the path mentioned here. Cannot upload',
// create new stuff:
'create_new_withdrawal' => 'Create new withdrawal',

View File

@@ -45,6 +45,8 @@ return [
'under' => 'Under',
'symbol' => 'Symbol',
'code' => 'Code',
'csv' => 'CSV file',
'has_headers' => 'Headers',
'store_new_withdrawal' => 'Store new withdrawal',
'store_new_deposit' => 'Store new deposit',

View File

@@ -20,7 +20,14 @@ return [
'search_results_for' => 'Zoekresultaten voor ":query"',
// csv import:
'csv_import' => 'Import CSV file',
'csv_import' => 'Importeer CSV-bestand',
'csv' => 'CSV',
'csv_index_text' => 'Hier komt uitleg.',
'csv_upload_form' => 'Upload formulier',
'upload_csv_file' => 'Upload CSV-bestand',
'csv_header_help' => 'Check dit als bla bla',
'csv_row' => 'rij',
'upload_not_writeable' => 'Cannot write to the path mentioned here. Cannot upload',
// create new stuff:
'create_new_withdrawal' => 'Nieuwe uitgave',

View File

@@ -45,6 +45,8 @@ return [
'under' => 'Onder',
'symbol' => 'Symbool',
'code' => 'Code',
'csv' => 'CSV-bestand',
'has_headers' => 'Eerste rij zijn kolomnamen',
'store_new_withdrawal' => 'Nieuwe uitgave opslaan',
'store_new_deposit' => 'Nieuwe inkomsten opslaan',

View File

@@ -7,6 +7,81 @@
{% block content %}
Bla bla.
<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'|_ }}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<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.file('csv') }}
{% if uploadPossible %}
<div class="form-group" id="csv_holder">
<div class="col-sm-4">
&nbsp;
</div>
<div class="col-sm-8">
<button type="submit" class="btn btn-success">
{{ 'upload_csv_file'|_ }}
</button>
</div>
</div>
{% else %}
<div class="form-group" id="csv_holder">
<div class="col-sm-4">
&nbsp;
</div>
<div class="col-sm-8">
<pre>{{ path }}</pre>
<p class="text-danger">
{{ 'upload_not_writeable'|_ }}
</p>
</div>
</div>
{% endif %}
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -7,6 +7,7 @@
{{ Form.checkbox(name, value, options.checked, options) }}
</label>
</div>
{% include 'form/help.twig' %}
{% include 'form/feedback.twig' %}
</div>
</div>

View File

@@ -0,0 +1,9 @@
<div class="{{ classes }}" id="{{ name }}_holder">
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
<div class="col-sm-8">
{{ Form.file(name, options) }}
{% include 'form/help.twig' %}
{% include 'form/feedback.twig' %}
</div>
</div>