// Carrier Wizard with bootstrap WIP

This commit is contained in:
Kevin Granger
2013-09-04 15:38:45 +02:00
parent cf1f9a01db
commit b4ecaf3ddb
6 changed files with 117 additions and 73 deletions

View File

@@ -41,12 +41,21 @@
</div>
{/if}
{if $input.name == 'logo'}
<div class="row">
<input id="carrier_logo_input" type="file" onchange="uploadCarrierLogo();" name="carrier_logo_input" />
<div class="col-lg-9">
<input id="carrier_logo_input" class="hide" type="file" onchange="uploadCarrierLogo();" name="carrier_logo_input" />
<input type="hidden" id="logo" name="logo" value="" />
<p class="preference_description">
{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}<br />
{l s='Current size:'} <span id="carrier_logo_size">{l s='undefined'}</span>.
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="attachement_filename" type="text" class="disabled" name="filename" readonly="">
<span class="input-group-btn">
<button id="attachement_fileselectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
<i class="icon-folder-open"></i> Choose a file
</button>
</span>
</div>
<p class="help-block">
{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}
{l s='Current size:'} <span id="carrier_logo_size">{l s='undefined'}</span>.
</p>
</div>
{/if}

View File

@@ -1,61 +1,102 @@
<script>var zones_nbr = {$zones|count +3} ; /*corresponds to the third input text (max, min and all)*/</script>
<div style="float:left" id="zone_ranges">
<table cellpadding="5" cellspacing="0" id="zones_table">
<tr class="range_inf">
<td class="range_type"></td>
<td class="border_left border_bottom range_sign">>=</td>
{foreach from=$ranges key=r item=range}
<td class="border_bottom center"><input name="range_inf[{$range.id_range|intval}]" type="text" value="{$range.delimiter1|string_format:"%.6f"}" /><sup>*</sup><span class="weight_unit">&nbsp; {$PS_WEIGHT_UNIT}</span><span class="price_unit">&nbsp; {$currency_sign}</span></td>
{foreachelse}
<td class="border_bottom center"><input name="range_inf[{$range.id_range|intval}]" type="text" /><sup>*</sup><span class="weight_unit">&nbsp; {$PS_WEIGHT_UNIT}</span><span class="price_unit">&nbsp; {$currency_sign}</span></td>
{/foreach}
</tr>
<tr class="range_sup">
<td class="center range_type"></td>
<td class="border_left range_sign"><</td>
{foreach from=$ranges key=r item=range}
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" {if isset($form_id) && !$form_id} value="" {else} value="{if isset($change_ranges) && $range.id_range == 0} {else}{$range.delimiter2|string_format:"%.6f"}{/if}" {/if}/><sup>*</sup><span class="weight_unit">&nbsp; {$PS_WEIGHT_UNIT}</span><span class="price_unit">&nbsp; {$currency_sign}</span></td>
{foreachelse}
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" /><sup>*</sup><span class="weight_unit">&nbsp; {$PS_WEIGHT_UNIT}</span><span class="price_unit">&nbsp; {$currency_sign}</span></td>
{/foreach}
</tr>
<tr class="fees_all">
<td class="border_top border_bottom border_bold"><span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span></td>
<td></td>
{foreach from=$ranges key=r item=range}
<td class="center border_top border_bottom {if $range.id_range != 0} validated {/if}" >
<input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == 0} style="display:none"{/if} /><span class="currency_sign" {if $range.id_range == 0} style="display:none" {/if}>&nbsp; {$currency_sign}</span>
<div id="zone_ranges">
<h4>{l s='Tranches'}</h4>
<table id="zones_table" class="table">
<tbody>
<tr class="range_inf">
<td class="range_type"></td>
<td class="border_left border_bottom range_sign">&gt;=</th>
{foreach from=$ranges key=r item=range}
<td class="border_bottom">
<div class="input-group">
<span class="input-group-addon weight_unit">{$PS_WEIGHT_UNIT}</span>
<span class="input-group-addon price_unit">{$currency_sign}</span>
<input class="form-control" name="range_inf[{$range.id_range|intval}]" type="text" value="{$range.delimiter1|string_format:"%.6f"}" />
</div>
</td>
{foreachelse}
<td class="center border_top border_bottom">
<input style="display:none" type="text" /><span class="currency_sign" style="display:none">&nbsp; {$currency_sign}</span>
{foreachelse}
<td class="border_bottom">
<div class="input-group">
<span class="input-group-addon weight_unit">{$PS_WEIGHT_UNIT}</span>
<span class="input-group-addon price_unit">{$currency_sign}</span>
<input name="form-control range_inf[{$range.id_range|intval}]" type="text" />
</div>
</td>
{/foreach}
</tr>
{foreach from=$zones key=i item=zone}
<tr class="fees {if $i is odd}alt_row{/if}" data-zoneid="{$zone.id_zone}">
<td><label for="zone_{$zone.id_zone}">{$zone.name}</label></td>
<td class="zone">
<input class="input_zone" id="zone_{$zone.id_zone}" name="zone_{$zone.id_zone}" value="1" type="checkbox" {if isset($fields_value['zones'][$zone.id_zone]) && $fields_value['zones'][$zone.id_zone]} checked="checked"{/if}/>
</td>
{foreach from=$ranges key=r item=range}
<td class="center">
<input name="fees[{$zone.id_zone|intval}][{$range.id_range|intval}]" type="text"
{if !isset($fields_value['zones'][$zone.id_zone]) || (isset($fields_value['zones'][$zone.id_zone]) && !$fields_value['zones'][$zone.id_zone])} disabled="disabled"{/if} {if isset($price_by_range[$range.id_range][$zone.id_zone]) && $price_by_range[$range.id_range][$zone.id_zone] && isset($fields_value['zones'][$zone.id_zone]) && $fields_value['zones'][$zone.id_zone]} value="{$price_by_range[$range.id_range][$zone.id_zone]|string_format:'%.6f'}" {else} value="" {/if} /> &nbsp; {$currency_sign}
{/foreach}
</tr>
<tr class="range_sup">
<td class="range_type"></td>
<td class="border_left range_sign">&lt;</td>
{foreach from=$ranges key=r item=range}
<td class="range_data">
<div class="input-group">
<span class="input-group-addon weight_unit">{$PS_WEIGHT_UNIT}</span>
<span class="input-group-addon price_unit">{$currency_sign}</span>
<input class="form-control" name="range_sup[{$range.id_range|intval}]" type="text" {if isset($form_id) && !$form_id} value="" {else} value="{if isset($change_ranges) && $range.id_range == 0} {else}{$range.delimiter2|string_format:"%.6f"}{/if}" {/if}/>
</div>
</td>
{foreachelse}
<td class="range_data_new">
<div class="input-group">
<span class="input-group-addon weight_unit">{$PS_WEIGHT_UNIT}</span>
<span class="input-group-addon price_unit">{$currency_sign}</span>
<input class="form-control" name="range_sup[{$range.id_range|intval}]" type="text" />
</div>
</td>
{/foreach}
</tr>
<tr class="fees_all">
<td class="border_top border_bottom border_bold">
<span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span>
</td>
<td></td>
{foreach from=$ranges key=r item=range}
<td class="border_top border_bottom {if $range.id_range != 0} validated {/if}" >
<div class="input-group">
<span class="input-group-addon currency_sign" {if $range.id_range == 0} style="display:none" {/if}>{$currency_sign}</span>
<input class="form-control" type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == 0} style="display:none"{/if} />
</div>
</td>
{foreachelse}
<td class="border_top border_bottom">
<div class="input-group">
<span class="input-group-addon currency_sign" style="display:none">{$currency_sign}</span>
<input class="form-control" style="display:none" type="text" />
</div>
</td>
{/foreach}
</tr>
{foreach from=$zones key=i item=zone}
<tr class="fees" data-zoneid="{$zone.id_zone}">
<td>
<label for="zone_{$zone.id_zone}">{$zone.name}</label>
</td>
<td class="zone">
<input class="form-control input_zone" id="zone_{$zone.id_zone}" name="zone_{$zone.id_zone}" value="1" type="checkbox" {if isset($fields_value['zones'][$zone.id_zone]) && $fields_value['zones'][$zone.id_zone]} checked="checked"{/if}/>
</td>
{foreach from=$ranges key=r item=range}
<td>
<div class="input-group">
<span class="input-group-addon">{$currency_sign}</span>
<input class="form-control" name="fees[{$zone.id_zone|intval}][{$range.id_range|intval}]" type="text" {if !isset($fields_value['zones'][$zone.id_zone]) || (isset($fields_value['zones'][$zone.id_zone]) && !$fields_value['zones'][$zone.id_zone])} disabled="disabled"{/if} {if isset($price_by_range[$range.id_range][$zone.id_zone]) && $price_by_range[$range.id_range][$zone.id_zone] && isset($fields_value['zones'][$zone.id_zone]) && $fields_value['zones'][$zone.id_zone]} value="{$price_by_range[$range.id_range][$zone.id_zone]|string_format:'%.6f'}" {else} value="" {/if} />
</div>
</td>
{/foreach}
</tr>
{/foreach}
</tr>
{/foreach}
<tr class="delete_range">
<td>&nbsp;</td>
<td>&nbsp;</td>
{foreach from=$ranges name=ranges key=r item=range}
{if $smarty.foreach.ranges.first}
<td class="center">&nbsp;</td>
{else}
<td class="center"><button class="btn btn-default">{l s='Delete'}</button</td>
{/if}
{/foreach}
</tr>
<tr class="delete_range">
<td>&nbsp;</td>
<td>&nbsp;</td>
{foreach from=$ranges name=ranges key=r item=range}
{if $smarty.foreach.ranges.first}
<td>&nbsp;</td>
{else}
<td>
<button class="btn btn-default">{l s='Delete'}</button>
</td>
{/if}
{/foreach}
</tr>
</tbody>
</table>
</div>

View File

@@ -302,8 +302,6 @@
<i class="icon-{$t.class_name}"></i>
<span class="title">{if $t.name eq ''}{$t.class_name}{else}{$t.name}{/if}</span>
</a>
<ul class="submenu">
{foreach from=$t.sub_tabs item=t2}
{if $t2.active}

View File

@@ -3103,4 +3103,4 @@ class AdminControllerCore extends Controller
return $return;
}
}
}

View File

@@ -216,7 +216,7 @@ function validateSteps(step_number)
function displayError(errors, step_number)
{
$('.wizard_error').remove();
str_error = '<div class="error wizard_error" style="display:none"><span style="float:right"><a id="hideError" href="#"><img alt="X" src="../img/admin/close.png" /></a></span><ul>';
str_error = '<div class="error wizard_error" style="display:none"><ul>';
for (var error in errors)
{
$('#carrier_wizard').smartWizard('setError',{stepnum:step_number,iserror:true});
@@ -408,7 +408,7 @@ function validateRange(index)
}
else if (is_ok && (isNaN(range_inf) || range_inf.length === 0))
{
$('tr.range_inf td:eq('+index+')').children('input:text').addClass('field_error');
$('tr.range_inf td:eq('+index+')').closest('input:text').addClass('field_error');
is_ok = false;
displayError([invalid_range], $("#carrier_wizard").smartWizard('currentStep'));
}
@@ -492,16 +492,15 @@ function add_new_range()
last_sup_val = $('tr.range_sup td:last input').val();
//add new rand sup input
$('tr.range_sup td:last').after('<td class="center"><input name="range_sup[]" type="text" /><sup>*</sup><span class="weight_unit" style="display: none;">&nbsp; '+PS_WEIGHT_UNIT+'</span><span class="price_unit" style="display: none;">&nbsp; '+currency_sign+'</span></td>');
$('tr.range_sup td:last').after('<td class="range_data"><div class="input-group"><span class="input-group-addon weight_unit" style="display: none;">'+PS_WEIGHT_UNIT+'</span><span class="input-group-addon price_unit" style="display: none;">'+currency_sign+'</span><input class="form-control" name="range_sup[]" type="text" /></div></td>');
//add new rand inf input
$('tr.range_inf td:last').after('<td class="border_bottom center"><input name="range_inf[]" type="text" value="'+last_sup_val+'" /><sup>*</sup><span class="weight_unit" style="display: none;">&nbsp; '+PS_WEIGHT_UNIT+'</span><span class="price_unit" style="display: none;">&nbsp; '+currency_sign+'</span></td>');
$('tr.fees_all td:last').after('<td class="center border_top border_bottom"><input style="display:none" type="text" /><span class="currency_sign" style="display:none" >&nbsp;'+currency_sign+'</span></td>');
$('tr.range_inf td:last').after('<td class="border_bottom"><div class="input-group"><span class="input-group-addon weight_unit" style="display: none;">'+PS_WEIGHT_UNIT+'</span><span class="input-group-addon price_unit" style="display: none;">'+currency_sign+'</span><input class="form-control" name="range_inf[]" type="text" value="'+last_sup_val+'" /></div></td>');
$('tr.fees_all td:last').after('<td class="border_top border_bottom"><div class="input-group"><span class="input-group-addon currency_sign" style="display:none" >'+currency_sign+'</span><input class="form-control" style="display:none" type="text" /></div></td>');
$('tr.fees').each( function () {
$(this).children('td:last').after('<td class="center"><input disabled="disabled" name="fees['+$(this).data('zoneid')+'][]" type="text" /> &nbsp; '+currency_sign+'</td>');
$(this).children('td:last').after('<td><div class="input-group"><span class="input-group-addon currency_sign">'+currency_sign+'</span><input class="form-control" disabled="disabled" name="fees['+$(this).data('zoneid')+'][]" type="text" /></div></td>');
});
$('tr.delete_range td:last').after('<td class="center"><button class="button">'+labelDelete+'</button</td>');
$('tr.delete_range td:last').after('<td><button class="btn btn-default">'+labelDelete+'</button</td>');
validateAndAddRangeButtonDisplay();
bind_inputs();

View File

@@ -84,7 +84,6 @@ function getPush(refresh)
html = "";
nb_notifs = 0;
$.each(json.customer, function(property, value) {
html += "<a href='index.php?tab=AdminCustomers&token=" + token_admin_customers + "&viewcustomer&id_customer=" + parseInt(value.id_customer) + "' class='media list-group-item no_notifs'>";
html += "<span class='pull-left'><i class='icon-time'></i></span>";
html += "<span class='media-body'>";
@@ -93,7 +92,6 @@ function getPush(refresh)
//html += "<p>" + see_customer_msg + "</p>";
html += "<small class='text-muted'>1 minute ago</small>";
html += "</span></a>";
});
if (html != "")
{
@@ -124,7 +122,6 @@ function getPush(refresh)
if (html != "")
{
$("#list_customer_messages_notif").prev("p").hide();
$("#list_customer_messages_notif").empty().append(html);
nb_notifs = $("#list_customer_messages_notif li").length;