// Import WIP (still broken for first upload)

This commit is contained in:
Kevin Granger
2013-11-27 19:33:36 +01:00
parent 65106c6a24
commit cc3a1379d1
8 changed files with 75 additions and 34 deletions
+9 -9
View File
@@ -476,7 +476,7 @@ a .icon-rotate-90:before, a .icon-rotate-180:before, a .icon-rotate-270:before,
.icon-circle-arrow-left:before, .bootstrap .process-icon-back:before { content: "\f0a8"; }
.icon-circle-arrow-right:before { content: "\f0a9"; }
.icon-circle-arrow-right:before, .bootstrap .process-icon-next:before { content: "\f0a9"; }
.icon-circle-arrow-up:before { content: "\f0aa"; }
@@ -1966,10 +1966,10 @@ table { border-collapse: collapse; border-spacing: 0; }
.bootstrap .table-bordered > thead > tr > th, .bootstrap .table-bordered > thead > tr > td, .bootstrap .table-bordered > tbody > tr > th, .bootstrap .table-bordered > tbody > tr > td, .bootstrap .table-bordered > tfoot > tr > th, .bootstrap .table-bordered > tfoot > tr > td { border: 1px solid #dddddd; }
.bootstrap .table-bordered > thead > tr > th, .bootstrap .table-bordered > thead > tr > td { border-bottom-width: 2px; }
.bootstrap .table-striped > tbody > tr:nth-child(odd) > td, .bootstrap .table-striped > tbody > tr:nth-child(odd) > th { background-color: #f9f9f9; }
.bootstrap .table-hover > tbody > tr:hover > td, .bootstrap .table-hover > tbody > tr:hover > th { background-color: #e6e8e3; }
.bootstrap .table-hover > tbody > tr:hover > td, .bootstrap .table-hover > tbody > tr:hover > th { background-color: #edf7fb; }
.bootstrap table col[class*="col-"] { float: none; display: table-column; }
.bootstrap table td[class*="col-"], .bootstrap table th[class*="col-"] { float: none; display: table-cell; }
.bootstrap .table > thead > tr > td.active, .bootstrap .table > thead > tr > th.active, .bootstrap .table > thead > tr.active > td, .bootstrap .table > thead > tr.active > th, .bootstrap .table > tbody > tr > td.active, .bootstrap .table > tbody > tr > th.active, .bootstrap .table > tbody > tr.active > td, .bootstrap .table > tbody > tr.active > th, .bootstrap .table > tfoot > tr > td.active, .bootstrap .table > tfoot > tr > th.active, .bootstrap .table > tfoot > tr.active > td, .bootstrap .table > tfoot > tr.active > th { background-color: #e6e8e3; }
.bootstrap .table > thead > tr > td.active, .bootstrap .table > thead > tr > th.active, .bootstrap .table > thead > tr.active > td, .bootstrap .table > thead > tr.active > th, .bootstrap .table > tbody > tr > td.active, .bootstrap .table > tbody > tr > th.active, .bootstrap .table > tbody > tr.active > td, .bootstrap .table > tbody > tr.active > th, .bootstrap .table > tfoot > tr > td.active, .bootstrap .table > tfoot > tr > th.active, .bootstrap .table > tfoot > tr.active > td, .bootstrap .table > tfoot > tr.active > th { background-color: #edf7fb; }
.bootstrap .table > thead > tr > td.success, .bootstrap .table > thead > tr > th.success, .bootstrap .table > thead > tr.success > td, .bootstrap .table > thead > tr.success > th, .bootstrap .table > tbody > tr > td.success, .bootstrap .table > tbody > tr > th.success, .bootstrap .table > tbody > tr.success > td, .bootstrap .table > tbody > tr.success > th, .bootstrap .table > tfoot > tr > td.success, .bootstrap .table > tfoot > tr > th.success, .bootstrap .table > tfoot > tr.success > td, .bootstrap .table > tfoot > tr.success > th { background-color: #dff0d8; }
.bootstrap .table-hover > tbody > tr > td.success:hover, .bootstrap .table-hover > tbody > tr > th.success:hover, .bootstrap .table-hover > tbody > tr.success:hover > td, .bootstrap .table-hover > tbody > tr.success:hover > th { background-color: #d0e9c6; }
.bootstrap .table > thead > tr > td.danger, .bootstrap .table > thead > tr > th.danger, .bootstrap .table > thead > tr.danger > td, .bootstrap .table > thead > tr.danger > th, .bootstrap .table > tbody > tr > td.danger, .bootstrap .table > tbody > tr > th.danger, .bootstrap .table > tbody > tr.danger > td, .bootstrap .table > tbody > tr.danger > th, .bootstrap .table > tfoot > tr > td.danger, .bootstrap .table > tfoot > tr > th.danger, .bootstrap .table > tfoot > tr.danger > td, .bootstrap .table > tfoot > tr.danger > th { background-color: #f2dede; }
@@ -2560,7 +2560,7 @@ table { border-collapse: collapse; border-spacing: 0; }
.bootstrap .label-warning[href]:hover, .bootstrap .label-warning[href]:focus { background-color: #ec971f; }
.bootstrap .label-danger { background-color: #d9534f; }
.bootstrap .label-danger[href]:hover, .bootstrap .label-danger[href]:focus { background-color: #c9302c; }
.bootstrap .badge, .bootstrap #header_notifs_icon_wrapper .notifs_badge, #header_notifs_icon_wrapper .bootstrap .notifs_badge, .bootstrap .badge.badge-success, .bootstrap .badge.badge-error { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 11px; font-weight: bold; color: white; line-height: 1; vertical-align: baseline; white-space: nowrap; text-align: center; background-color: #999999; border-radius: 10px; }
.bootstrap .badge, .bootstrap #header_notifs_icon_wrapper .notifs_badge, #header_notifs_icon_wrapper .bootstrap .notifs_badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 11px; font-weight: bold; color: white; line-height: 1; vertical-align: baseline; white-space: nowrap; text-align: center; background-color: #999999; border-radius: 10px; }
.bootstrap .badge:empty, .bootstrap #header_notifs_icon_wrapper .notifs_badge:empty, #header_notifs_icon_wrapper .bootstrap .notifs_badge:empty { display: none; }
.bootstrap a.badge:hover, .bootstrap #header_notifs_icon_wrapper a.notifs_badge:hover, #header_notifs_icon_wrapper .bootstrap a.notifs_badge:hover, .bootstrap a.badge:focus, .bootstrap #header_notifs_icon_wrapper a.notifs_badge:focus, #header_notifs_icon_wrapper .bootstrap a.notifs_badge:focus { color: white; text-decoration: none; cursor: pointer; }
.bootstrap .btn .badge, .bootstrap .btn #header_notifs_icon_wrapper .notifs_badge, #header_notifs_icon_wrapper .bootstrap .btn .notifs_badge { position: relative; top: -1px; }
@@ -3153,9 +3153,9 @@ a.link-social:hover { text-decoration: none; }
.bootstrap .row-padding-top { padding-top: 15px; }
.bootstrap .thumbnail, .bootstrap .img-thumbnail, .bootstrap .thumbnail { background-color: white; border-color: #cccccc !important; }
.bootstrap .highlight { background-color: yellow; }
.bootstrap .badge, .bootstrap #header_notifs_icon_wrapper .notifs_badge, #header_notifs_icon_wrapper .bootstrap .notifs_badge, .bootstrap .badge.badge-success, .bootstrap .badge.badge-error { background-color: #8fc04d; }
.bootstrap #header_notifs_icon_wrapper .badge-success.notifs_badge, #header_notifs_icon_wrapper .bootstrap .badge-success.notifs_badge, .bootstrap .badge-success.badge { background-color: #5cb85c; }
.bootstrap #header_notifs_icon_wrapper .badge-error.notifs_badge, #header_notifs_icon_wrapper .bootstrap .badge-error.notifs_badge, .bootstrap .badge-error.badge { background-color: #d9534f; }
.bootstrap .badge, .bootstrap #header_notifs_icon_wrapper .notifs_badge, #header_notifs_icon_wrapper .bootstrap .notifs_badge { font-weight: normal; font-size: 1.1em; letter-spacing: 0.0625em; background-color: #1ba6e5; }
.bootstrap .badge.badge-success, .bootstrap #header_notifs_icon_wrapper .badge-success.notifs_badge, #header_notifs_icon_wrapper .bootstrap .badge-success.notifs_badge { background-color: #5cb85c; }
.bootstrap .badge.badge-error, .bootstrap #header_notifs_icon_wrapper .badge-error.notifs_badge, #header_notifs_icon_wrapper .bootstrap .badge-error.notifs_badge { background-color: #d9534f; }
.bootstrap .nav-tabs { border-bottom: none; }
.bootstrap .nav-tabs li a { font-size: 1.1em; font-family: "Ubuntu", sans-serif; text-transform: uppercase; font-weight: 300; }
.bootstrap .nav-tabs li.active a, .bootstrap .nav-tabs li.active a:hover, .bootstrap .nav-tabs li.active a:focus { background-color: white; }
@@ -3177,7 +3177,7 @@ a.link-social:hover { text-decoration: none; }
.bootstrap .table input, .bootstrap .table select { margin: 0; }
.bootstrap .table tbody > tr > td { border-top: none; background-color: white; padding: 3px 7px; vertical-align: middle; word-wrap: nowrap; font-size: 12px; border-bottom: solid 1px #eeeeee; }
.bootstrap .table tbody > tr.odd > td { background-color: #f9f9f9; }
.bootstrap .table tbody > tr:hover > td { background-color: #e6e8e3; }
.bootstrap .table tbody > tr:hover > td { background-color: #edf7fb; }
.bootstrap .table td.center, .bootstrap .table th.center { text-align: center; }
.bootstrap .table td.pointer { cursor: pointer; }
.bootstrap tr.highlighted td { background-color: #1ba6e5 !important; color: white; }
@@ -3372,7 +3372,7 @@ a.link-social:hover { text-decoration: none; }
.bootstrap .ladda-button .ladda-label { position: relative; z-index: 3; }
.bootstrap .ladda-button .ladda-progress { position: absolute; width: 0; height: 100%; left: 0; top: 0; background: rgba(0, 0, 0, 0.2); visibility: hidden; opacity: 0; -webkit-transition: 0.1s linear all !important; -moz-transition: 0.1s linear all !important; -ms-transition: 0.1s linear all !important; -o-transition: 0.1s linear all !important; transition: 0.1s linear all !important; }
.bootstrap .ladda-button .ladda-progress[data-loading] .ladda-progress { opacity: 1; visibility: visible; }
.bootstrap .ladda-button, .bootstrap .ladda-button .ladda-spinner, .bootstrap .ladda-button .ladda-label { -webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; -moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; -ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; -o-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; }
.bootstrap .ladda-button, .bootstrap .ladda-button .ladda-spinner, .bootstrap .ladda-button .ladda-label { -webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) background-color !important; -moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) background-color !important; -ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) background-color !important; -o-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) background-color !important; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) background-color !important; }
.bootstrap .ladda-button[data-style=zoom-in], .bootstrap .ladda-button[data-style=zoom-in] .ladda-spinner, .bootstrap .ladda-button[data-style=zoom-in] .ladda-label, .bootstrap .ladda-button[data-style=zoom-out], .bootstrap .ladda-button[data-style=zoom-out] .ladda-spinner, .bootstrap .ladda-button[data-style=zoom-out] .ladda-label { -webkit-transition: 0.3s ease all !important; -moz-transition: 0.3s ease all !important; -ms-transition: 0.3s ease all !important; -o-transition: 0.3s ease all !important; transition: 0.3s ease all !important; }
.bootstrap .ladda-button[data-style=expand-right] .ladda-spinner { right: 14px; }
.bootstrap .ladda-button[data-style=expand-right][data-size="s"] .ladda-spinner, .bootstrap .ladda-button[data-style=expand-right][data-size="xs"] .ladda-spinner { right: 4px; }
@@ -24,12 +24,13 @@
background-color: #FFFF00
.badge
background-color: $secondary-color
font-weight: normal
font-size: 1.1em
letter-spacing: 0.0625em
background-color: $brand-primary
&.badge-success
@extend .badge
background-color: $brand-success
&.badge-error
@extend .badge
background-color: $brand-danger
//tabs
@@ -74,6 +74,8 @@
@extend .icon-remove
.process-icon-back
@extend .icon-circle-arrow-left
.process-icon-next
@extend .icon-circle-arrow-right
.process-icon-help
@extend .icon-question-sign
.process-icon-export
@@ -74,7 +74,7 @@ $border-radius-base: 3px ;
// $table-bg: transparent ; overall background-color
$table-bg-accent: #f9f9f9 ; //for striping
$table-bg-hover: $bg-panel-heading-color ;
$table-bg-hover: #EDF7FB;
// $table-border-color: #ddd ; table and cell border
@@ -71,7 +71,7 @@ $spinnerSize: 32px
// EASING
.ladda-button, .ladda-button .ladda-spinner, .ladda-button .ladda-label
@include transition( 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) all )
@include transition( 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) background-color )
.ladda-button[data-style=zoom-in],
.ladda-button[data-style=zoom-in] .ladda-spinner,
.ladda-button[data-style=zoom-in] .ladda-label,
@@ -114,9 +114,13 @@
<button class="ladda-button btn btn-default" data-style="expand-right" data-size="s" type="button" id="file-add-button">
<i class="icon-plus-sign"></i> {l s='Add file'}
</button>
or
<button class="btn btn-default" href="#" onclick="$('#csv_files_history').slideToggle();$('#csv_file_uploader').slideToggle(); return false;">
<i class="icon-folder-close"></i> {l s="Choose from history / FTP"}
</button>
<p class="help-block">
{l s="You can also use a file that you already have uploaded."}
<a href="#" onclick="$('#csv_files_history').slideToggle();$('#csv_file_uploader').slideToggle(); return false;">{l s="Show history / FTP"}</a>.
{l s='Only UTF-8 and ISO-8859-1 encoding are allowed'}.<br/>
{l s='You can also upload your file via FTP to the following directory:'} {$path_import}.
</p>
</div>
</div>
@@ -127,23 +131,30 @@
<div class="alert alert-danger" id="file-errors"></div>
</div>
<script type="text/javascript">
function humanizeSize(bytes)
{
function humanizeSize(bytes) {
if (typeof bytes !== 'number')
return '';
if (bytes >= 1000000000)
return (bytes / 1000000000).toFixed(2) + ' GB';
if (bytes >= 1000000)
return (bytes / 1000000).toFixed(2) + ' MB';
return (bytes / 1000).toFixed(2) + ' KB';
}
$( document ).ready(
function()
{
function csv_select(filename) {
$('#csv_selected_value').val(filename);
$('#csv_selected_filename').html(filename);
$('#csv_file_selected').show();
}
$(document).ready(function() {
$('#csv_uploaded_history').on('click', 'button', function(e){
e.preventDefault();
var filename = $(this).data('filename');
csv_select(filename);
});
var file_add_button = Ladda.create( document.querySelector('#file-add-button' ));
var file_total_files = 0;
@@ -152,7 +163,7 @@
autoUpload: true,
acceptFileTypes: /(\.|\/)(csv)$/i,
singleFileUploads: true,
maxFileSize: {$post_max_size},
{if isset ($post_max_size)}maxFileSize: {$post_max_size},{/if}
start: function (e)
{
file_add_button.start();
@@ -174,8 +185,11 @@
$('#file-success').parent().show();
}
}
$(data.context).find('button').remove();
$(data.context).find('button').remove();
$('#csv_uploaded_history').append($('#csv_uploaded_history tr:first').clone());
$('#csv_uploaded_history tr:last td:first').html(data.result.file.filename);
$('#csv_uploaded_history tr:last button').data('filename', data.result.file.filename);
csv_select(data.result.file.filename);
}
},
}).on('fileuploadalways', function (e, data)
@@ -228,7 +242,7 @@
<i class="icon-remove"></i>
</button>
</div>
<table class="table">
<table id="csv_uploaded_history" class="table">
{foreach $files_to_import AS $filename}
<tr >
<td>
@@ -236,7 +250,7 @@
</td>
<td>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default">
<button type="button" data-filename="{$filename|escape:'html':'UTF-8'}" class="btn btn-default">
<i class="icon-ok"></i>
{l s='Use'}
</button>
@@ -265,6 +279,23 @@
</table>
</div>
</div>
<div class="form-group" id="csv_file_selected"{if empty($csv_selected)} style="display :none;"{/if}>
<div class="alert alert-success clearfix">
<input type="hidden" value="{$filename}" name="csv" id="csv_selected_value">
<div class="col-lg-8">
<span id="csv_selected_filename">{$csv_selected|escape:'html':'UTF-8'}</span>
</div>
<div class="col-lg-4">
<div class="btn-group pull-right">
<button type="button" class="btn btn-default">
<i class="icon-refresh"></i>
{l s='Change'}
</button>
</div>
</div>
</div>
</div>
<hr>
<div class="form-group">
<label class="control-label col-lg-4">
@@ -350,7 +381,7 @@
<div class="form-group">
<label for="forceIDs" class="control-label col-lg-4">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='If you don\'t use this option, all ID\'s will be auto-incremented.'}">
{l s='Force all ID\'s during import?'}
{l s='Force all ID'}
</span>
</label>
<div class="col-lg-8">
@@ -364,7 +395,7 @@
</label>
</div>
</div>
<hr>
<!-- <hr>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<button type="submit" name="submitImportFile" id="submitImportFile" class="btn btn-default pull-right" {if empty($files_to_import)}disabled{/if}>
@@ -372,7 +403,7 @@
<i class="icon-circle-arrow-right"></i>
</button>
</div>
</div>
</div> -->
<!-- {if empty($files_to_import)}
<div class="alert alert-info">{l s='You must upload a file in order to proceed to the next step'}</div>
@@ -381,6 +412,11 @@
<!--{if !count($files_to_import)}
<p>{l s='There is no CSV file available. Please upload one using the \'Upload\' button above.'}</p>
{/if}-->
<div class="panel-footer">
<button type="submit" name="submitImportFile" id="submitImportFile" class="btn btn-default pull-right">
<i class="process-icon-next"></i> <span>{l s='Next step'}</span>
</button>
</div>
</form>
</div>
</div>
@@ -99,6 +99,8 @@ class AdminCustomersControllerCore extends AdminController
'total_spent' => array(
'title' => $this->l('Sales'),
'type' => 'price',
'prefix' => '<span class="badge badge-success">',
'suffix' => '</span>',
'search' => false,
'havingFilter' => true,
'align' => 'right'
+2 -2
View File
@@ -88,8 +88,8 @@ class AdminOrdersControllerCore extends AdminController
'total_paid_tax_incl' => array(
'title' => $this->l('Total'),
'align' => 'right',
'prefix' => '<b>',
'suffix' => '</b>',
'prefix' => '<span class="badge">',
'suffix' => '</span>',
'type' => 'price',
'currency' => true
),