Commit du module Colissimo
@@ -0,0 +1,209 @@
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/libs/underscore-min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var config = {
|
||||
'urlAdd': '{url path="/admin/module/socolissimo/slice/save"}',
|
||||
'urlDelete': '{url path="/admin/module/socolissimo/slice/delete"}',
|
||||
'urlSave': '{url path="/admin/module/socolissimo/slice/save"}'
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var checkboxes = [];
|
||||
|
||||
{loop name="js.get.orders.socolissimo.export" type="order.notsent.socolissimo"}
|
||||
checkboxes.push("export_{$ID}");
|
||||
{/loop}
|
||||
//Buttons
|
||||
$("#check-all-but").click( function() {
|
||||
checkboxes.forEach(function(entry) {
|
||||
$("#"+entry).prop('checked', true);
|
||||
});
|
||||
});
|
||||
$("#uncheck-all-but").click( function() {
|
||||
checkboxes.forEach(function(entry) {
|
||||
$("#"+entry).prop('checked', false);
|
||||
});
|
||||
});
|
||||
$("#reverse-all-but").click( function() {
|
||||
checkboxes.forEach(function(entry) {
|
||||
var box=$("#"+entry);
|
||||
box.prop('checked', !box.is(":checked"));
|
||||
});
|
||||
});
|
||||
// Export form button
|
||||
$("button[name=export_socolissimo_form]").click(function() {
|
||||
var value = $("input[name='exportsocolissimoorder[new_status_id]']:checked").val();
|
||||
if(value == "sent") {
|
||||
checkboxes.forEach(function(entry) {
|
||||
var box=$("#"+entry);
|
||||
if(box.is(":checked")) {
|
||||
var row= box.parents("tr"); // get first tr parent
|
||||
row.hide('slow', function() {
|
||||
row.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// Free shipping switch
|
||||
$(".freeshipping-activation-SoColissimo").bootstrapSwitch();
|
||||
|
||||
$(".freeshipping-activation-SoColissimo").on("switch-change", function(e, data){
|
||||
var is_checked = data.value;
|
||||
var mode = $(this).data("id");
|
||||
var form = $("#freeshippingform-"+mode);
|
||||
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||
$.ajax({
|
||||
url: form.attr('action'),
|
||||
type: form.attr('method'),
|
||||
data: form.serialize()
|
||||
}).done(function(){
|
||||
$("#loading-event").remove();
|
||||
})
|
||||
.success(function() {
|
||||
if (is_checked) {
|
||||
$('#config-btn-0').removeClass('disabled');
|
||||
$('#table-prices-socolissimo-'+mode).hide('slow');
|
||||
$('#freeshipping-from-'+mode).hide('slow');
|
||||
} else {
|
||||
$('#config-btn-0').addClass('disabled');
|
||||
$('#table-prices-socolissimo-'+mode).show('slow');
|
||||
$('#freeshipping-from-'+mode).show('slow');
|
||||
}
|
||||
})
|
||||
.fail(function(jqXHR, textStatus, errorThrown){
|
||||
$('#freeshipping-failed-body').html(jqXHR.responseJSON.error);
|
||||
$("#freeshipping-failed").modal("show");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Price slice
|
||||
|
||||
var tpl = _.template($("#tpl-slice").html());
|
||||
|
||||
var showMessage = function showMessage(message) {
|
||||
$('#socolissimo_dialog')
|
||||
.find('.modal-body')
|
||||
.html(message)
|
||||
.end()
|
||||
.modal("show");
|
||||
};
|
||||
|
||||
var getSliceData = function getSliceData($slice) {
|
||||
var data = {
|
||||
id: $slice.data("id"),
|
||||
area: $slice.data("area"),
|
||||
deliveryModeId: $slice.data("delivmode"),
|
||||
price: $slice.find(".js-slice-price").first().val(),
|
||||
priceMax: $slice.find(".js-slice-price-max").first().val(),
|
||||
weightMax: $slice.find(".js-slice-weight-max").first().val()
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// add new slice
|
||||
$('.js-slice-add').on('click', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
// reset form
|
||||
$slice.find('input').val('');
|
||||
// add slice
|
||||
sliceHtml = tpl(data.slice);
|
||||
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
} else {
|
||||
showMessage(data.message.join('<br>'));
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// save new slice
|
||||
$('.slices').on('click', '.js-slice-save', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
if (!data.success) {
|
||||
showMessage(data.message.join('<br>'));
|
||||
} else {
|
||||
var sliceHtml = tpl(data.slice);
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
$slice.remove();
|
||||
// $slice.find('.js-slice-save').removeClass('btn-success');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
$('.slices').on('change', '.js-slice input', function() {
|
||||
$(this).parents('tr').first().find('.js-slice-save').addClass('btn-success');
|
||||
});
|
||||
|
||||
// delete new slice
|
||||
$('.slices').on('click', '.js-slice-delete', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlDelete
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
$slice.remove();
|
||||
} else {
|
||||
showMessage(data.message);
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// add new slice
|
||||
$('.js-slice input').on('change', function(){
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,498 @@
|
||||
<div class="row">
|
||||
<!-- Errors -->
|
||||
{loop name="checkrights.socolissimo" type="socolissimo.check.rights"}
|
||||
<div class="alert alert-danger">
|
||||
<p>{$ERRMES} {$ERRFILE} | {intl l="Please change the access rights" d='socolissimo.bo.default'}.</p>
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
{elseloop rel="checkrights.socolissimo"}
|
||||
|
||||
<div class="modal fade" id="freeshipping-failed" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="An error occured"}</h3>
|
||||
</div>
|
||||
<div class="modal-body" id="freeshipping-failed-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{assign var="tab" value="export"}
|
||||
{if isset($smarty.get.current_tab)}
|
||||
{assign var="tab" value=$smarty.get.current_tab}
|
||||
{/if}
|
||||
|
||||
{* default currency *}
|
||||
{loop type="currency" name="default_currency" default_only="1"}
|
||||
{$currencySymbol=$SYMBOL}
|
||||
{/loop}
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<ul id="tabbed-menu" class="nav nav-tabs">
|
||||
<li class="{if $tab eq "export"}active{/if}"><a data-toggle="tab" href="#export">{intl l="Export Coliship file" d='socolissimo.bo.default'}</a> </li>
|
||||
<li class="{if $tab eq "import"}active{/if}"><a data-toggle="tab" href="#import">{intl l="Import Coliship file" d='socolissimo.bo.default'}</a> </li>
|
||||
{loop type="socolissimo.delivery.mode" name="devlivery_mode"}
|
||||
<li class="{if $tab eq "prices_slices_tab_{$ID}"}active{/if}"><a data-toggle="tab" href="#prices_slices_tab_{$ID}">{intl l="Price slices for \"%mode\"" d='socolissimo.bo.default' mode={$TITLE}}</a></li>
|
||||
{/loop}
|
||||
<li class="{if $tab eq "configure"}active{/if}"><a data-toggle="tab" href="#configure">{intl l="Advanced configuration" d='socolissimo.bo.default'}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="export" class="tab-pane {if $tab eq "export"}active{/if} form-container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl l="operations" d='socolissimo.bo.default'}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<button id="check-all-but" title="{intl l="Check all" d='socolissimo.bo.default'}" class="form-submit-button btn btn-sm btn-default">{intl l="Check all" d='socolissimo.bo.default'}</button>
|
||||
<button id="uncheck-all-but" title="{intl l="Uncheck all" d='socolissimo.bo.default'}" class="form-submit-button btn btn-sm btn-default">{intl l="Uncheck all" d='socolissimo.bo.default'}</button>
|
||||
<button id="reverse-all-but" title="{intl l="Reverse selection" d='socolissimo.bo.default'}" class="form-submit-button btn btn-sm btn-default">{intl l="Reverse selection" d='socolissimo.bo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
{form name="socolissimo.export"}
|
||||
<form action="{url path='/admin/module/socolissimo/export'}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl l="Change orders status after export" d='socolissimo.bo.default'}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{form_field form=$form field="new_status_id"}
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nochange">{intl l="Do not change" d='socolissimo.bo.default'}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" id="nochange" name="{$name}" value="nochange" {if $data eq "nochange"}checked{/if} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="processing">{intl l="Processing" d='socolissimo.bo.default'}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" id="processing" name="{$name}" value="processing" {if $data eq "processing"}checked{/if} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="sent">{intl l="Sent" d='socolissimo.bo.default'}*</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" id="sent" name="{$name}" value="sent" {if $data eq "sent"}checked{/if} />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/form_field}
|
||||
<span class="p">{intl l="*If you choose this option, the exported orders would not be available on this page anymore" d='socolissimo.bo.default'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<th class="object-title">
|
||||
{intl l="REF" d='socolissimo.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Customer"}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Date" d='socolissimo.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Total taxed amount" d='socolissimo.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Package weight" d='socolissimo.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Export" d='socolissimo.bo.default'}
|
||||
</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="order.notsent.socolissimo" type="order.notsent.socolissimo"}
|
||||
<tr>
|
||||
<td>
|
||||
<label for="{$label_attr.for}">
|
||||
{form_field form=$form field="order_"|cat:$ID}
|
||||
<a href="{url path='/admin/order/update/%order_id' order_id={$ID}}">{$label}</a>
|
||||
{/form_field}
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
{loop name='order-customer' type='customer' id={$CUSTOMER} current=false}
|
||||
<a href="{url path='/admin/customer/update?customer_id=%customer_id' customer_id={$ID}}">{$FIRSTNAME} {$LASTNAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel='order-customer'}
|
||||
<a href="{url path='/admin/customer/update?customer_id=%customer_id' customer_id={$CUSTOMER}}">{intl l='Unknown customer' d='socolissimo.bo.default'}</a>
|
||||
{/elseloop}
|
||||
</td>
|
||||
<td>
|
||||
{format_date date=$CREATE_DATE output="datetime"}
|
||||
</td>
|
||||
<td>
|
||||
{$TOTAL_TAXED_AMOUNT} {loop name="list.socolissimo.getcurrency" type="currency" id=$CURRENCY}{$SYMBOL}{/loop}
|
||||
</td>
|
||||
<td>
|
||||
{form_field form=$form field="order_weight_"|cat:$ID}
|
||||
<input class="form-control text-center" type="text" name="{$name}" value="0" required />
|
||||
{/form_field}
|
||||
</td>
|
||||
<td>
|
||||
{form_field form=$form field="order_"|cat:$ID}
|
||||
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="true" class="form-control"/>
|
||||
{/form_field}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="submit" name="export_socolissimo_form" value="stay" class="form-submit-button btn btn-sm btn-default" title="{intl l='Export' d='socolissimo.bo.default'}">{intl l='Export' d='socolissimo.bo.default'}</button>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<!-- Import form -->
|
||||
<div id="import" class="tab-pane {if $tab eq "import"}active{/if} form-container">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl l="The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference." d='socolissimo.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
{flash type='import-result'}
|
||||
<div class="alert alert-success">
|
||||
{$MESSAGE}
|
||||
</div>
|
||||
{/flash}
|
||||
|
||||
{form name='socolissimo.import'}
|
||||
<form action="{url path='/admin/module/socolissimo/import'}" method="post" {form_enctype form=$form}>
|
||||
{form_hidden_fields form=$form}
|
||||
{render_form_field form=$form field="success_url" value={url path="/admin/module/SoColissimo"} current_tab="import"}
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
{form_field form=$form field="import_file"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{$label} :
|
||||
</label>
|
||||
|
||||
<input type="file" id="{$label_attr.for}" name="{$name}" value="{$value}" required/>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<button type="submit" class="btn btn-primary">{intl d='socolissimo.bo.default' l='Upload'}</button>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="configure" class="tab-pane {if $tab eq "configure"}active{/if} form-container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{intl l="Advanced configuration" d='socolissimo.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{form name="socolissimo.configure"}
|
||||
{if $form_error && $form_error_message}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
<form action="{url path='/admin/module/socolissimo/configure'}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
{form_field form=$form field='url_prod'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='url_test'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='test_mode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
<option value="0" {if $value == 0}selected{/if}>{intl l="PRODUCTION" d='socolissimo.bo.default'}</option>
|
||||
<option value="1" {if $value == 1}selected{/if}>{intl l="TEST" d='socolissimo.bo.default'}</option>
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='accountnumber'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" >
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='password'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='google_map_key'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
<br/>
|
||||
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl l='Save changes' d='socolissimo.bo.default'}">{intl l='Save changes' d='socolissimo.bo.default'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{loop type="socolissimo.delivery.mode" name="devlivery_mode"}
|
||||
{$deliveryModeId=$ID}
|
||||
<div id="prices_slices_tab_{$deliveryModeId}" class="tab-pane {if $tab eq "prices_slices_tab_$deliveryModeId" }active{/if} form-container">
|
||||
{if null !== $smarty.get.price_error && {$deliveryModeId} == $smarty.get.price_error_id}
|
||||
<div class="alert alert-danger" role="alert">{$smarty.get.price_error}</div>
|
||||
{/if}
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- checkbox free shipping -->
|
||||
{assign var="isSoColissimoFreeShipping" value=0}
|
||||
{form name="socolissimo.freeshipping.form"}
|
||||
<form action="{url path="/admin/module/socolissimo/freeshipping"}" method="post" id="freeshippingform-{$deliveryModeId}">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field="delivery_mode"}
|
||||
<input type="hidden" name="{$name}" value="{$deliveryModeId}">
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="freeshipping"}
|
||||
<label>
|
||||
{intl l="Activate total free shipping " d="socolissimo.bo.default"}
|
||||
</label>
|
||||
|
||||
<div class="switch-small freeshipping-activation-SoColissimo" data-id="{$deliveryModeId}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>">
|
||||
<input type="checkbox" name="{$name}" value="true" {if $FREESHIPPING_ACTIVE}checked{assign var="isSoColissimoFreeShipping" value=1}{/if} />
|
||||
</div>
|
||||
{/form_field}
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6" id="freeshipping-from-{$deliveryModeId}" {if $isSoColissimoFreeShipping eq 1} style="display:none;" {/if}>
|
||||
<form action="{url path="/admin/module/socolissimo/freeshipping_from"}" method="post">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon {if $FREESHIPPING_FROM}alert-success{/if}">{intl l="Or activate free shipping from (€) :" d="socolissimo.bo.default"}</span>
|
||||
<input type="hidden" name="delivery-mode" value="{$deliveryModeId}">
|
||||
<input type="number" name="price" class="form-control" value="{$FREESHIPPING_FROM}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{intl l="Save"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l="You can create price slices by specifying a maximum cart weight and/or a maximum cart price." d='socolissimo.bo.default'}
|
||||
{intl l="The slices are ordered by maximum cart weight then by maximum cart price." d='socolissimo.bo.default'}
|
||||
{intl l="If a cart matches multiple slices, it will take the last slice following that order." d='socolissimo.bo.default'}
|
||||
{intl l="If you don't specify a cart weight in a slice, it will have priority over the slices with weight." d='socolissimo.bo.default'}
|
||||
{intl l="If you don't specify a cart price in a slice, it will have priority over the other slices with the same weight." d='socolissimo.bo.default'}
|
||||
{intl l="If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice." d='socolissimo.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="slices" class="form-container">
|
||||
|
||||
{loop type="area" name="area_loop" module_id=$module_id backend_context=true}
|
||||
{$area_id=$ID}
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="clearfix">
|
||||
<small>{intl d='socolissimo.bo.default' l="Area : "}</small> {$NAME}
|
||||
</label>
|
||||
</th>
|
||||
<th width="40%">
|
||||
<div id="area-freeshipping-{$area_id}" {if $isSoColissimoFreeShipping eq 1} style="display:none;" {/if}>
|
||||
<form action="{url path="/admin/module/socolissimo/area_freeshipping"}" method="post">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon {if $area_id }alert-success{/if}">{intl l="Activate free shipping from (€) :" d="socolissimo.bo.default"}</span>
|
||||
<input type="hidden" name="area-id" value="{$area_id}">
|
||||
<input type="hidden" name="delivery-mode" value="{$deliveryModeId}">
|
||||
|
||||
{if $deliveryModeId eq 1}
|
||||
{ifloop rel="area_freeshipping_dom"}
|
||||
{loop type="socolissimo.area.freeshipping.dom" name="area_freeshipping_dom" area_id=$area_id}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="{$CART_AMOUNT}">
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="area_freeshipping_dom"}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="">
|
||||
{/elseloop}
|
||||
{/if}
|
||||
|
||||
{if $deliveryModeId eq 2}
|
||||
{ifloop rel="area_freeshipping_pr"}
|
||||
{loop type="socolissimo.area.freeshipping.pr" name="area_freeshipping_pr" area_id=$area_id}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="{$CART_AMOUNT}">
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="area_freeshipping_pr"}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="">
|
||||
{/elseloop}
|
||||
{/if}
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{intl l="Save"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{intl l="Weight up to ... kg" d='socolissimo.bo.default'}</th>
|
||||
<th class="col-md-3">{intl l="Untaxed Price up to ... %symbol" symbol=$currencySymbol d='socolissimo.bo.default'}</th>
|
||||
<th class="col-md-5">{intl l="Price (%symbol)" symbol=$currencySymbol d='socolissimo.bo.default'}</th>
|
||||
<th class="col-md-1">{intl l="Actions" d='socolissimo.bo.default'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="socolissimo" name="socolissimo_area_$ID" area_id={$area_id} delivery_mode_id={$deliveryModeId} }
|
||||
<tr class="js-slice" data-area="{$area_id}" data-id="{$SLICE_ID}" data-delivmode="{$deliveryModeId}">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="{$MAX_WEIGHT}" data-old="{$MAX_WEIGHT}" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="{$MAX_PRICE}" data-old="{$MAX_PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="{$PRICE}" data-old="{$PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='socolissimo.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='socolissimo.bo.default' l='Delete this price slice'}" data-id="{$ID}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{* New slice *}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="socolissimo" access="CREATE"}
|
||||
<tr class="js-slice-new" data-area="{$area_id}" data-id="0" data-delivmode="{$deliveryModeId}">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<a class="btn btn-default btn-xs js-slice-add" title="{intl d='socolissimo.bo.default' l='Add this price slice'}" >
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
{elseloop rel="area_loop"}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-warning">
|
||||
{intl d='socolissimo.bo.default' l="You should first attribute shipping zones to the modules: "}
|
||||
<a href="{url path="/admin/configuration/shipping_zones/update/$module_id"}">
|
||||
{intl d='socolissimo.bo.default' l="manage shipping zones"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{include
|
||||
file = "includes/generic-warning-dialog.html"
|
||||
|
||||
dialog_id = "socolissimo_dialog"
|
||||
dialog_title = {intl d='socolissimo.bo.default' l="Message"}
|
||||
dialog_body = ""
|
||||
}
|
||||
|
||||
{* JS Templates *}
|
||||
<script id="tpl-slice" type="text/html">
|
||||
<tr class="js-slice" data-area="<%=areaId %>" data-id="<%=id %>" data-delivmode="<%=deliveryModeId %>">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="<%=weightMax %>" data-old="<%=weightMax %>" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="<%=priceMax %>" data-old="<%=priceMax %>" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="<%=price %>" data-old="<%=price %>" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="socolissimo" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='socolissimo.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="socolissimo" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='socolissimo.bo.default' l='Delete this price slice'}" data-id="<%=id %>">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
{/elseloop}
|
||||
@@ -0,0 +1,7 @@
|
||||
#socolissimomap .table tbody > tr > th, #socolissimomap .table tbody > tr > td {
|
||||
padding: 10px 10px 0;
|
||||
}
|
||||
|
||||
.title-socolissimo-pickup-type{
|
||||
color: #E47A10;
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,29 @@
|
||||
{assign var="addresslooptype" value="address"}
|
||||
|
||||
{loop type="socolissimoid" name="socolissimoid.invoice"}
|
||||
{if $module == {order attr="delivery_module"}}
|
||||
{assign var="addresslooptype" value="address.socolissimo"}
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
{loop type=$addresslooptype name="delivery-address" id={order attr="delivery_address"}}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">{intl l="Delivery address"}</div>
|
||||
<div class="panel-body">
|
||||
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
|
||||
<span class="org">{$COMPANY}</span>
|
||||
<address class="adr">
|
||||
<span class="street-address">{$ADDRESS1}</span><br>
|
||||
{if $ADDRESS2 != ""}
|
||||
<span class="street-address">{$ADDRESS2}</span><br>
|
||||
{/if}
|
||||
{if $ADDRESS3 != ""}
|
||||
<span class="street-address">{$ADDRESS3}</span><br>
|
||||
{/if}
|
||||
<span class="postal-code">{$ZIPCODE}</span>
|
||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span><br>
|
||||
<span class="cellphone">{$CELLPHONE}</span>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||
@@ -0,0 +1,509 @@
|
||||
|
||||
{loop type="delivery" name="socolissimo" id=$module force_return="true" country=$country}
|
||||
<tr style="display: none;">
|
||||
<td colspan="3">
|
||||
<div id="point-socolissimo">
|
||||
<div id="google-map-socolissimo">
|
||||
{* Domicile *}
|
||||
{socolissimoDeliveryPrice delivery-mode="dom" country=$country}
|
||||
{if $isValidMode !== false}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="home delivery" d='socolissimo.fo.default'}</strong> / {$deliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div style="padding-top: 15px;">
|
||||
{images file="assets/img/socolissimo/dom-small.png" source="SoColissimo"}
|
||||
<img src="{$asset_url}" alt="{intl l="My home" d='socolissimo.fo.default'}">
|
||||
{/images}
|
||||
<br>
|
||||
{intl l="Delivery to you or a personal address of your choice." d='socolissimo.fo.default'}
|
||||
|
||||
<div class="clearfix">
|
||||
<button type="submit" name="socolissimo-home" value="DOM" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="socolissimo.fo.default"}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* Point relais *}
|
||||
{* Check if soColissimo webservice is up *}
|
||||
{assign var="isSocolissimoUp" value=0}
|
||||
{socolissimoDeliveryPrice delivery-mode="pr" country=$country}<h1>{$isValidMode}</h1>
|
||||
{if $isValidMode !== false}
|
||||
{loop name="is.socolissimo.up" type="socolissimo.around"}{/loop}
|
||||
{ifloop rel="is.socolissimo.up"}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Near you" d='socolissimo.fo.default'}</strong> / {$deliveryModePrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<script>
|
||||
var mapSOC = {
|
||||
"map": null,
|
||||
"infowindow": null,
|
||||
"geocoder": null,
|
||||
"listMarker": [],
|
||||
"position": null,
|
||||
"images": {
|
||||
'BPR': '{image file="assets/img/socolissimo/BPR.png" source="SoColissimo"}',
|
||||
'ACP': '{image file="assets/img/socolissimo/BPR.png" source="SoColissimo"}',
|
||||
'CDI': '{image file="assets/img/socolissimo/BPR.png" source="SoColissimo"}',
|
||||
'BDP': '{image file="assets/img/socolissimo/BPR.png" source="SoColissimo"}',
|
||||
'A2P': '{image file="assets/img/socolissimo/A2P.png" source="SoColissimo"}',
|
||||
'CMT': '{image file="assets/img/socolissimo/A2P.png" source="SoColissimo"}',
|
||||
'PCS': '{image file="assets/img/socolissimo/CIT.png" source="SoColissimo"}',
|
||||
'HANDICAPE': '{image file="assets/img/socolissimo/mobilite-reduite.gif" source="SoColissimo"}'
|
||||
},
|
||||
"address": "",
|
||||
"locations": []
|
||||
};
|
||||
|
||||
function updatemap_socolissimo(adr_geoloc, locations) {
|
||||
|
||||
var buf = "",
|
||||
marker,
|
||||
loc,
|
||||
i;
|
||||
|
||||
// save current search
|
||||
if (adr_geoloc !== undefined && locations !== undefined) {
|
||||
mapSOC.address = adr_geoloc;
|
||||
mapSOC.locations = locations;
|
||||
}
|
||||
|
||||
if (mapSOC.map === null) {
|
||||
// Define MAP
|
||||
var mapOptions = {
|
||||
zoom: 13,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
}
|
||||
// On va créer la map dans la div qui a l'id relaymap
|
||||
mapSOC.map = new google.maps.Map(document.getElementById('socolissimomap'), mapOptions);
|
||||
mapSOC.infowindow = new google.maps.InfoWindow({
|
||||
size: new google.maps.Size(50,50)
|
||||
});
|
||||
mapSOC.geocoder = new google.maps.Geocoder();
|
||||
}
|
||||
|
||||
// We get latitude and longitude for the customer's adress
|
||||
var b = [];
|
||||
b['address'] = mapSOC.address;
|
||||
mapSOC.geocoder.geocode(b, function (results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
// Et on centre la map sur cette position
|
||||
mapSOC.map.setCenter(results[0].geometry.location);
|
||||
marker = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()),
|
||||
map: mapSOC.map,
|
||||
icon: "{image file='assets/img/socolissimo/maison.png' source='SoColissimo'}"
|
||||
});
|
||||
if (mapSOC.position != null){
|
||||
mapSOC.position.setMap(null);
|
||||
}
|
||||
mapSOC.position = marker;
|
||||
} else {
|
||||
// Sinon on met le centre de la map sur Clermont-Ferrand ;)
|
||||
alert("{intl l="Actual address can't be geolocated"}");
|
||||
var myLatLng = new google.maps.LatLng(45.7789, 3.0782);
|
||||
mapSOC.map.setCenter(myLatLng);
|
||||
mapSOC.map.setZoom(3);
|
||||
}
|
||||
});
|
||||
|
||||
// clean current map
|
||||
$("#table-socolissimo").html("");
|
||||
for (i = 0; i < mapSOC.listMarker.length; i++) {
|
||||
//google.maps.event.removeListener(listMarker[i]);
|
||||
mapSOC.listMarker[i].setMap(null);
|
||||
}
|
||||
mapSOC.listMarker = [];
|
||||
|
||||
var servicesCode = {
|
||||
'POSTE' : ['BPR', 'ACP', 'CDI', 'BDP'],
|
||||
'RELAIS' : ['A2P', 'CMT'],
|
||||
'CONSIGNE' : ['PCS']
|
||||
};
|
||||
|
||||
// Get services (or relay point type) that user wants to include in his search
|
||||
var services = {};
|
||||
$("input.toggle-type-socolissimo:checked").each(function(){
|
||||
if(servicesCode.hasOwnProperty(this.value)){
|
||||
var codeArray = servicesCode[this.value];
|
||||
codeArray.forEach(function (code) {
|
||||
services[code] = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Pour chaque point relais dans locations on crée un nouveau marker
|
||||
// And Complete table-relais
|
||||
for (i = 0; i < mapSOC.locations.length; i++) {
|
||||
loc = mapSOC.locations[i];
|
||||
|
||||
if (! services[loc.type]){
|
||||
continue;
|
||||
}
|
||||
|
||||
buf += '<tr>' +
|
||||
'<td>' +
|
||||
'<img src="' + mapSOC.images[loc.type] + '">' +
|
||||
'<strong>' + loc.name + '</strong> ' +
|
||||
'<br>' +
|
||||
loc.address +
|
||||
'<br>' +
|
||||
loc.zipcode + ' ' + loc.city +
|
||||
' - ' + loc.distance;
|
||||
|
||||
if (loc.disabledPerson == "1"){
|
||||
buf += ' <img src="' + mapSOC.images["HANDICAPE"] + '">';
|
||||
}
|
||||
|
||||
buf += '</td>' +
|
||||
'<td>' +
|
||||
'<div class="radio">' +
|
||||
'<input type="radio" name="socolissimo_code" data-marker=' + i + ' class="socolissimo_pr" id="pr-socolissimo' + loc.id + '" value="' + loc.id + ':'+ loc.type + ':'+ loc.countrycode + '">' +
|
||||
'</div>' +
|
||||
'</td>' +
|
||||
'</tr>';
|
||||
|
||||
marker = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(loc.lat, loc.lng),
|
||||
map: mapSOC.map,
|
||||
icon: mapSOC.images[loc.type]
|
||||
});
|
||||
|
||||
mapSOC.listMarker.push(marker);
|
||||
attachMarker(marker, loc);
|
||||
}
|
||||
document.getElementById("table-socolissimo").innerHTML = buf;
|
||||
}
|
||||
|
||||
function attachMarker(marker, data) {
|
||||
google.maps.event.addListener(marker, 'click', function() {
|
||||
$("#pr-socolissimo" + data.id).prop('checked', true);
|
||||
//verifyRadio();
|
||||
mapSOC.infowindow.setContent(
|
||||
'<img src="' + mapSOC.images[data.type] + '">' +
|
||||
'<strong>' + data.name + '</strong>' +
|
||||
'<address style="margin: 0">' +
|
||||
data.address +
|
||||
'<br>' +
|
||||
data.zipcode +
|
||||
' ' +
|
||||
data.city +
|
||||
'</address>' +
|
||||
'<p>' + data.distance +
|
||||
' ' +
|
||||
((data.disabledPerson) ? '<img src="' + mapSOC.images["HANDICAPE"] + '">' : "") +
|
||||
'</p>' +
|
||||
'<table class="table table-condensed table-striped table-bordered" style="width: 100%;">' +
|
||||
getHoraireRow('{intl l="Monday" d='socolissimo.fo.default'}', data.monday) +
|
||||
getHoraireRow('{intl l="Tuesday" d='socolissimo.fo.default'}', data.tuesday) +
|
||||
getHoraireRow('{intl l="Wednesday" d='socolissimo.fo.default'}', data.wednesday) +
|
||||
getHoraireRow('{intl l="Friday" d='socolissimo.fo.default'}', data.friday) +
|
||||
getHoraireRow('{intl l="Thursday" d='socolissimo.fo.default'}', data.thursday) +
|
||||
getHoraireRow('{intl l="Saturday" d='socolissimo.fo.default'}', data.saturday) +
|
||||
getHoraireRow('{intl l="Sunday" d='socolissimo.fo.default'}', data.sunday) +
|
||||
'</table>');
|
||||
mapSOC.infowindow.open(mapSOC.map, marker);
|
||||
});
|
||||
}
|
||||
|
||||
function getHoraireRow(lib, data){
|
||||
var newData = data.replace("00:00-00:00", "", "g").replace(" ", "", "g");
|
||||
var ret = "";
|
||||
if (newData != ""){
|
||||
ret = '<tr><th>' + lib + ' </th><td> ' + newData + '</td></tr>';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function initialize_so() {
|
||||
// Get the selected customer address
|
||||
var $selectedAddressInput = $('#form-cart-delivery')
|
||||
.find('[name="thelia_order_delivery[delivery-address]"]')
|
||||
.filter(':checked');
|
||||
|
||||
var selectedAddressId = $selectedAddressInput.val();
|
||||
|
||||
var locationsSearchUrl = "{url path='/module/socolissimo/points'}";
|
||||
|
||||
var addresses_geoloc = [];
|
||||
{loop type="address" name="delivery-selection-socolissimo" customer="current"}
|
||||
addresses_geoloc[{$ID}] = "{$ADDRESS1}, {$ZIPCODE} {$CITY}";
|
||||
{/loop}
|
||||
|
||||
var adr_geoloc = addresses_geoloc[selectedAddressId];
|
||||
|
||||
// Get every relay around customer's address
|
||||
var locations = [];
|
||||
$.get(
|
||||
locationsSearchUrl + "?address=" + selectedAddressId,
|
||||
function(data) {
|
||||
locations = data.locations;
|
||||
updatemap_socolissimo(adr_geoloc, locations);
|
||||
}
|
||||
);
|
||||
}
|
||||
var normalize = (function () {
|
||||
var a = ['À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'];
|
||||
var b = ['A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'];
|
||||
|
||||
return function (str) {
|
||||
var i = a.length;
|
||||
while (i--) str = str.replace(a[i], b[i]);
|
||||
return str;
|
||||
};
|
||||
}());
|
||||
|
||||
function search_city_socolissimo() {
|
||||
var address = document.getElementById("search-address-socolissimo").value;
|
||||
var zipcode = document.getElementById("search-zipcode-socolissimo").value;
|
||||
var city = document.getElementById("search-city-socolissimo").value;
|
||||
var countryid = $("#search-countryid-socolissimo").val();
|
||||
if (zipcode == "" || city == "") {
|
||||
alert("{intl l="Please enter a city and a zipcode" d='socolissimo.fo.default'}");
|
||||
} else {
|
||||
// Get site base url
|
||||
var url_site = '{url path="/"}module/socolissimo/'
|
||||
+ encodeURIComponent(countryid) + '/'
|
||||
+ encodeURIComponent(zipcode) + '/'
|
||||
+ encodeURIComponent(normalize(city));
|
||||
if (address != ""){
|
||||
url_site += '/' + encodeURIComponent(normalize(address));
|
||||
}
|
||||
// Get search address
|
||||
var adr_geoloc = address + " " + zipcode + " " + city;
|
||||
// Get every relay around customer's address
|
||||
var locations = [];
|
||||
$.getJSON(url_site)
|
||||
.done(function(data) {
|
||||
if (!$.isEmptyObject(data)) {
|
||||
locations = data.locations;
|
||||
updatemap_socolissimo(adr_geoloc, locations);
|
||||
} else {
|
||||
alert("{intl l='Colissimo is unavailable. Please choose another delivery method' d='socolissimo.fo.default'}");
|
||||
}
|
||||
})
|
||||
.fail(function( jqxhr, textStatus, error ) {
|
||||
var err = textStatus + ", " + error;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<!-- Bureau de poste -->
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||
{images file="assets/img/socolissimo/BPR.png" source="SoColissimo"}
|
||||
<img src="{$asset_url}" class="pull-left">
|
||||
{/images}
|
||||
<h5 class="title-socolissimo-pickup-type">{intl l="Post office" d='socolissimo.fo.default'}</h5>
|
||||
<p>{intl l="Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe." d='socolissimo.fo.default'}</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="toggle-type-socolissimo-4">
|
||||
<input type="checkbox" name="toggle-type-socolissimo" id="toggle-type-socolissimo-4" class="toggle-type-socolissimo" value="POSTE" checked>
|
||||
{intl l="include in results" d='socolissimo.fo.default'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- // Bureau de poste -->
|
||||
|
||||
<!-- Relais Pickup -->
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||
{images file="assets/img/socolissimo/A2P.png" source="SoColissimo"}
|
||||
<img src="{$asset_url}" class="pull-left">
|
||||
{/images}
|
||||
<h5 class="title-socolissimo-pickup-type">{intl l="Pickup shop" d='socolissimo.fo.default'}</h5>
|
||||
<p>{intl l="Delivery in one of the 7,500 shops in the PICKUP network." d='socolissimo.fo.default'}</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="toggle-type-socolissimo-5">
|
||||
<input type="checkbox" name="toggle-type-socolissimo" id="toggle-type-socolissimo-5" class="toggle-type-socolissimo" value="RELAIS" checked>
|
||||
{intl l="include in results" d='socolissimo.fo.default'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- // Relais Pickup -->
|
||||
|
||||
<!-- Consigne Pickup Station -->
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||
{images file="assets/img/socolissimo/CIT.png" source="SoColissimo"}
|
||||
<img src="{$asset_url}" class="pull-left">
|
||||
{/images}
|
||||
<h5 class="title-socolissimo-pickup-type">{intl l="Automatic pickup point" d='socolissimo.fo.default'}</h5>
|
||||
<p>{intl l="Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24." d='socolissimo.fo.default'}</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="toggle-type-socolissimo-6">
|
||||
<input type="checkbox" name="toggle-type-socolissimo" id="toggle-type-socolissimo-6" class="toggle-type-socolissimo" value="CONSIGNE" checked>
|
||||
{intl l="include in results" d='socolissimo.fo.default'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- // Consigne Pickup Station -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="container-fluid">
|
||||
<!-- Map -->
|
||||
<div class="col-md-7" style="padding-right: 0;">
|
||||
<div id="socolissimomap" style="width: 100%; height: 450px;"></div>
|
||||
</div><!-- // Map -->
|
||||
|
||||
<!-- Liste -->
|
||||
<div class="col-md-5" style="padding-left: 0">
|
||||
<div style="height: 450px; overflow-y: scroll;">
|
||||
<table class="table table-bordered table-striped" id="table-socolissimo"></table>
|
||||
</div>
|
||||
</div><!-- // Liste -->
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-12">
|
||||
<h4>{intl l="Search Colissimo relay in a city" d='socolissimo.fo.default'}</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<label for="search-address-socolissimo" class="control-label sr-only">
|
||||
{intl l="address" d='socolissimo.fo.default'}
|
||||
</label>
|
||||
<input type="text" id="search-address-socolissimo" placeholder="{intl l='address' d='socolissimo.fo.default'}" class="form-control" style="" onPaste=""
|
||||
{literal}onkeydown="if (event.keyCode == 13) {return false;}"{/literal}/>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="search-zipcode-socolissimo" class="control-label sr-only">
|
||||
{intl l="zipcode" d='socolissimo.fo.default'}
|
||||
</label>
|
||||
<input type="text" id="search-zipcode-socolissimo" placeholder="{intl l='zipcode' d='socolissimo.fo.default'}" class="form-control" style="" onPaste=""
|
||||
{literal}onkeydown="if (event.keyCode == 13) {search_city_socolissimo();return false;}"{/literal}/>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label for="search-city-socolissimo" class="control-label sr-only">
|
||||
{intl l="city" d='socolissimo.fo.default'}
|
||||
</label>
|
||||
<input type="text" id="search-city-socolissimo" placeholder="{intl l='city' d='socolissimo.fo.default'}" class="form-control" style="" onPaste=""
|
||||
{literal}onkeydown="if (event.keyCode == 13) {search_city_socolissimo();return false;}"{/literal}/>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select id="search-countryid-socolissimo" class="form-control">
|
||||
{loop type="country" name="country.list"}
|
||||
<option value="{$ID}"
|
||||
{if $value != ""}
|
||||
{if $value == $ID}selected{/if}
|
||||
{else}
|
||||
{if $IS_DEFAULT}selected{/if}
|
||||
{/if}
|
||||
>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" id="search-city-submit-socolissimo" class="form-submit-button btn btn-block btn-default" title="{intl l='Search' d='socolissimo.fo.default'}">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
{intl l='Search' d='socolissimo.fo.default'}
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearfix col-md-12" style="margin-top: 15px;margin-bottom: 15px;">
|
||||
<button type="submit" name="socolissimo-pr" value="PR" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="socolissimo.fo.default"}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- // Search city -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/ifloop}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
function loadScript() {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = 'https://maps.googleapis.com/maps/api/js'
|
||||
+ '?callback=SoColissimoInitialize'
|
||||
+ '&key={config key="socolissimo_google_map_key"}';
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
if (typeof(google) == 'undefined') {
|
||||
loadScript();
|
||||
} else {
|
||||
SoColissimoInitialize();
|
||||
}
|
||||
|
||||
function SoColissimoInitialize() {
|
||||
if (typeof initialize_so == 'function') {
|
||||
initialize_so();
|
||||
// Search city pseudo-form
|
||||
document.getElementById("search-city-submit-socolissimo").onclick = search_city_socolissimo;
|
||||
}
|
||||
}
|
||||
|
||||
function displayContent () {
|
||||
$("#google-map-socolissimo").closest('tr').show(function () {
|
||||
$('.btn-checkout-next').hide();
|
||||
if (typeof initialize_so == 'function') {
|
||||
google.maps.event.trigger(mapSOC.map, 'resize');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
if ($("#delivery-method_{$module}").is(':checked')) {
|
||||
displayContent();
|
||||
}
|
||||
|
||||
$('[name="socolissimo-pr"]').on('click', function(){
|
||||
var radioChecked = $('input[type="radio"]:checked', '#table-socolissimo').length;
|
||||
if (radioChecked === 0) {
|
||||
alert("{intl l='No relay points were selected' d='socolissimo.fo.default'}");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('[name="thelia_order_delivery[delivery-module]"]', '.table-delivery').on('change', function(){
|
||||
if($(this).attr('id') != 'delivery-method_{$module}') {
|
||||
$("#google-map-socolissimo").closest('tr').hide();
|
||||
$('.btn-checkout-next').show();
|
||||
} else {
|
||||
displayContent();
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof initialize_so == 'function') {
|
||||
$(".toggle-type-socolissimo").on('change', function () {
|
||||
updatemap_socolissimo();
|
||||
});
|
||||
|
||||
$("#delivery-method").on('click', '.socolissimo_pr', function () {
|
||||
markerId = $(this).data('marker');
|
||||
google.maps.event.trigger(mapSOC.listMarker[markerId], 'click');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{/loop}
|
||||
@@ -0,0 +1,36 @@
|
||||
{literal}
|
||||
{
|
||||
{/literal}
|
||||
"locations":
|
||||
[
|
||||
{loop type="socolissimo.around" name="delivery-selection-socolissimo" countryid=$_countryid_ zipcode=$_zipcode_ city=$_city_ address=$_address_}
|
||||
{literal}
|
||||
{
|
||||
{/literal}
|
||||
"name": "{$nom}",
|
||||
"lat": {$coordGeolocalisationLatitude},
|
||||
"lng": {$coordGeolocalisationLongitude},
|
||||
"id": "{$identifiant}",
|
||||
"address": "{$adresse1}",
|
||||
"zipcode": "{$codePostal}",
|
||||
"city": "{$localite}",
|
||||
"countrycode" : "{$codePays}",
|
||||
"distance": "{$distance}",
|
||||
"type": "{$typeDePoint}",
|
||||
"monday": "{$horairesOuvertureLundi}",
|
||||
"tuesday": "{$horairesOuvertureMardi}",
|
||||
"wednesday": "{$horairesOuvertureMercredi}",
|
||||
"thursday": "{$horairesOuvertureJeudi}",
|
||||
"friday": "{$horairesOuvertureVendredi}",
|
||||
"saturday": "{$horairesOuvertureSamedi}",
|
||||
"sunday": "{$horairesOuvertureDimanche}",
|
||||
"disabledPerson": "{$accesPersonneMobiliteReduite}"
|
||||
{literal}
|
||||
}
|
||||
{/literal}
|
||||
{if $LOOP_COUNT < $LOOP_TOTAL},{/if}
|
||||
{/loop}
|
||||
]
|
||||
{literal}
|
||||
}
|
||||
{/literal}
|
||||
@@ -0,0 +1,18 @@
|
||||
{loop type='socolissimo.order_address' name='socolissimo.order_address' id=$delivery_address_id}
|
||||
{if {$CODE} == 0}
|
||||
<p>{intl l='Delivered at home.' d='socolissimo.pdf.default'}</p>
|
||||
{else}
|
||||
<p>
|
||||
{intl l='Delivered at a relay.' d='socolissimo.pdf.default'}<br/><br/>
|
||||
<b>{intl l='Relay address:' d='socolissimo.pdf.default'}</b>
|
||||
{loop name='order_address' type='order_address' id=$delivery_address_id}
|
||||
<blockquote>{$COMPANY}<br/>
|
||||
{$ADDRESS1} {$ADDRESS2} {$ADDRESS3}<br/>
|
||||
{$ZIPCODE} {$CITY}<br/>
|
||||
{loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
|
||||
</blockquote>
|
||||
{/loop}
|
||||
{elseloop rel='order_address'} {intl l='no address' d='socolissimo.pdf.default'}{/elseloop}
|
||||
</p>
|
||||
{/if}
|
||||
{/loop}
|
||||