Le module MondialRelay n'était pas commité

This commit is contained in:
2020-12-05 09:32:52 +01:00
parent 9572b71f14
commit ef16a65ce8
143 changed files with 16232 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{form name="mondialrelay.settings_form"}
<form action="{url path="/admin/module/MondialRelay/settings/save"}" {form_enctype form=$form} method="post" data-ajax-target="#general-form-container">
{include file = "includes/inner-form-toolbar.html"
hide_flags = true
page_url = "{url path='/admin/module/MondialRelay'}"
close_url = "{url path='/admin/modules'}"
hide_save_and_close_button = true
}
{form_hidden_fields form=$form}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<div class="row">
<div class="col-md-6">
{render_form_field field="code_enseigne" value={module_config module="MondialRelay" key='code_enseigne' locale="en_US"}}
{render_form_field field="private_key" value={module_config module="MondialRelay" key='private_key' locale="en_US"}}
{render_form_field field="webservice_url" value={module_config module="MondialRelay" key='webservice_url' locale="en_US"}}
{render_form_field field="google_maps_api_key" value={module_config module="MondialRelay" key='google_maps_api_key' locale="en_US"}}
</div>
<div class="col-md-6">
{render_form_field field="allow_relay_delivery" value={module_config module="MondialRelay" key='allow_relay_delivery' locale="en_US"}}
{render_form_field field="allow_home_delivery" value={module_config module="MondialRelay" key='allow_home_delivery' locale="en_US"}}
{*
{render_form_field field="allow_insurance" value={module_config module="MondialRelay" key='allow_insurance' locale="en_US"}}
*}
<div class="text-center" style="margin-top: 40px; padding: 0 20%;">
<p><a href="https://www.younivers.fr"><img src="{image file="mondialrelay/assets/img/younivers.png" source="MondialRelay"}"></a></p>
<p>{intl l='Development of this module is sponsored by <a href="https://www.younivers.fr">you\'Nivers</a> web and communication agency in Roanne.' d="mondialrelay.bo.default"}</p>
</div>
</div>
</div>
</form>
{/form}
{include file="mondialrelay/includes/error-dialog.html"}

View File

@@ -0,0 +1,98 @@
{form name="mondialrelay.insurances_update_form"}
<form action="{url path="/admin/module/MondialRelay/insurances/save"}" {form_enctype form=$form} method="post" data-ajax-target="#insurances-form-container">
{form_hidden_fields form=$form}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>{intl l='Cart value' d='mondialrelay.bo.default'}</th>
<th>{intl l='Insurance price with tax' d='mondialrelay.bo.default'}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{loop type="mondialrelay.insurances" name="insurances"}
<tr>
<td>
{form_field field="max_value"}
<div class="input-group">
<input type="text" {form_field_attributes field="max_value" value_key=$ID value=$MAX_VALUE|string_format:"%.2f"}>
<span class="input-group-addon">{currency attr="symbol"}</span>
</div>
{/form_field}
</td>
<td>
{form_field field="price_with_tax"}
<div class="input-group">
<input type="text" {form_field_attributes field="price_with_tax" value_key=$ID value=$PRICE|string_format:"%.2f"}>
<span class="input-group-addon">{currency attr="symbol"}</span>
</div>
{/form_field}
</td>
<td>
<a href="{url path="/admin/module/MondialRelay/insurances/delete/$ID"}" data-ajax-target="#insurances-form-container" class="btn btn-danger" title="{intl l='Delete this insurance' d='mondialrelay.bo.default'}">
<i class="glyphicon glyphicon-remove"></i>
</a>
</td>
</tr>
{/loop}
</tbody>
<tfoot>
<tr>
<td colspan="99" class="text-right">
<button class="btn btn-primary" type="submit">
<i class="glyphicon glyphicon-ok"></i>
{intl l='Save changes' d='mondialrelay.bo.default'}
</button>
</td>
</tr>
</tfoot>
</table>
</form>
{/form}
{form name="mondialrelay.insurance_create_form"}
<form action="{url path="/admin/module/MondialRelay/insurances/create"}" {form_enctype form=$form} method="post" data-ajax-target="#insurances-form-container">
{form_hidden_fields form=$form}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<table class="table table-condensed table-striped">
<tbody>
<tr>
<th colspan="99">{intl l='Add a new insurance' d='mondialrelay.bo.default'}</th>
</tr>
<tr>
<td>
{form_field field="max_value"}
<div class="input-group">
<input type="text" {form_field_attributes field="max_value"}>
<span class="input-group-addon">{currency attr="symbol"}</span>
</div>
{/form_field}
</td>
<td>
{form_field field="price_with_tax"}
<div class="input-group">
<input type="text" {form_field_attributes field="price_with_tax"}>
<span class="input-group-addon">{currency attr="symbol"}</span>
</div>
{/form_field}
</td>
<td>
<button type="submit" class="btn btn-primary" title="{intl l='Add new insurance' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-plus"></i></button>
</td>
</tr>
</tbody>
</table>
</form>
{/form}
{include file="mondialrelay/includes/error-dialog.html"}

View File

@@ -0,0 +1,158 @@
{$module_id = {$smarty.request.module_id|default:$module_id|default:0}}
{ifloop rel="module-areas"}
<p>&nbsp;</p>
{loop type="area" name="module-areas" module_id=$module_id order='id'}
<div class="panel panel-info">
<div class="panel-heading text-uppercase">
{intl l="Shipping zone \"%name\"" name=$NAME d='mondialrelay.bo.default'}
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-8">
<div class="panel panel-default">
<div class="panel-heading">
{intl l='Delivery prices' d='mondialrelay.bo.default'}
</div>
<div class="panel-body">
{form name="mondialrelay.prices_update_form"}
<form action="{url path="/admin/module/MondialRelay/prices/save/$ID/$module_id"}" data-ajax-target="#prices-form-container" {form_enctype form=$form} method="post">
{form_hidden_fields form=$form}
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>{intl l='Cart weight up to...' d='mondialrelay.bo.default'}</th>
<th>{intl l='Price with tax' d='mondialrelay.bo.default'}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{loop type="mondialrelay.prices" name="prices" area_id=$ID}
<tr>
<td>
{form_field field="max_weight" value_key=$ID}
<div class="input-group">
<input type="text" {form_field_attributes field="max_weight" value_key=$ID value=$MAX_WEIGHT|string_format:"%.2f"}>
<span class="input-group-addon">{intl l='kg' d='mondialrelay.bo.default'}</span>
</div>
{/form_field}
</td>
<td>
{form_field field="price" value_key=$ID}
<div class="input-group">
<input type="text" {form_field_attributes field="price" value_key=$ID value=$PRICE|string_format:"%.2f"}>
<span class="input-group-addon">{currency attr="symbol"}</span>
</div>
{/form_field}
</td>
<td class="text-nowrap">
<a href="{url path="/admin/module/MondialRelay/prices/delete/$ID/$module_id"}" data-ajax-target="#prices-form-container" class="btn btn-danger" title="{intl l='Delete this price' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-remove"></i></a>
</td>
</tr>
{/loop}
</tbody>
<tfoot>
<tr>
<td colspan="99" class="text-right">
<button class="btn btn-primary" type="submit">
<i class="glyphicon glyphicon-ok"></i>
{intl l='Save changes' d='mondialrelay.bo.default'}
</button>
</td>
</tr>
</tfoot>
</table>
</form>
{/form}
{form name="mondialrelay.price_form"}
<form action="{url path="/admin/module/MondialRelay/prices/create/$ID/$module_id"}" data-ajax-target="#prices-form-container" {form_enctype form=$form} method="post">
{form_hidden_fields form=$form}
<table class="table table-condensed table-striped">
<tbody>
<tr>
<th colspan="99">{intl l='Add a new price' d='mondialrelay.bo.default'}</th>
</tr>
<tr>
<td>
{form_field field="max_weight"}
<div class="input-group">
<input type="text" {form_field_attributes field="max_weight"}>
<span class="input-group-addon">{intl l='kg' d='mondialrelay.bo.default'}</span>
</div>
{/form_field}
</td>
<td>
{form_field field="price"}
<div class="input-group">
<input type="text" {form_field_attributes field="price"}>
<span class="input-group-addon">{currency attr="symbol"}</span>
</div>
{/form_field}
</td>
<td>
<button class="btn btn-primary" title="{intl l='Add this price' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-plus"></i></button>
</td>
</tr>
</tbody>
</table>
</form>
{/form}
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
{intl l='Area properties' d='mondialrelay.bo.default'}
</div>
<div class="panel-body">
{form name="mondialrelay.area_attributes_update_form"}
<form action="{url path="/admin/module/MondialRelay/area-attributes/save/$ID/$module_id"}" data-ajax-target="#prices-form-container" {form_enctype form=$form} method="post">
{form_hidden_fields form=$form}
{loop type="mondialrelay.area-attributes" name="area-attributes" area_id=$ID}
{custom_render_form_field field="delivery_time"}
<div class="input-group">
<input type="text" {form_field_attributes field="delivery_time" value=$DELIVERY_TIME}>
<span class="input-group-addon">{intl l='days' d='mondialrelay.bo.default'}</span>
</div>
{/custom_render_form_field}
{render_form_field field="delivery_type" value=$DELIVERY_TYPE}
<button type="submit" class="btn btn-primary" title="{intl l='Save changes' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-ok"></i> {intl l="Save" d='mondialrelay.bo.default'}</button>
{/loop}
</form>
{/form}
</div>
</div>
</div>
</div>
</div>
</div>
{/loop}
{/ifloop}
{elseloop rel="module-areas"}
<div class="alert alert-warning">
{intl l='There\'s no shipping zone defined for Mondial Relay. Please <a href="%url">click here</a> to configure module\'s shipping zones.' url={url path='/admin/configuration/shipping_zones'} d='mondialrelay.bo.default'}
</div>
{/elseloop}
{include file="mondialrelay/includes/error-dialog.html"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
<script>
$(function() {
function ajaxSubmit($zis) {
var data, url;
var notif = $.notify({
message: '<i class="glyphicon glyphicon-time"></i> {intl l="Saving data, please wait..." d="mondialrelay.bo.default"}'
}, {
type: 'info',
allow_dismiss: true
});
if ($zis.attr('action')) {
data = $zis.serialize();
url = $zis.attr('action');
} else {
url = $zis.attr('href');
}
$.ajax({
url: url,
method: 'post',
data: data,
success: function (result) {
$($zis.data('ajax-target')).html(result);
notif.close();
$.notify({
message: '<i class="glyphicon glyphicon-ok"></i> {intl l="Update finished." d="mondialrelay.bo.default"}'
}, {
type: 'success',
allow_dismiss: true,
delay: 2000
});
},
error: function () {
notif.close();
alert("{intl l='Sorry, something goes wrong. Please try again.' d='mondialrelay.bo.default'}");
}
});
}
$(document).on('submit', 'form[data-ajax-target]', function (ev) {
ajaxSubmit($(this));
ev.preventDefault();
});
$(document).on('click', 'a[data-ajax-target]', function (ev) {
ajaxSubmit($(this));
ev.preventDefault();
});
});
</script>

View File

@@ -0,0 +1,27 @@
{if $error_message}
<div class="modal fade" id="error-dialog" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>An error occured</h3>
</div>
<div class="modal-body">
{$error_message}
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary"><span class="glyphicon glyphicon-check"></span> Continue</button>
</div>
</div>
</div>
</div>
<script>
$(function() {
$('#error-dialog').modal('show');
});
</script>
{/if}

View File

@@ -0,0 +1,38 @@
{$current_tab = {$smarty.get.tab|default:'general'}}
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title">
{intl l="Mondial Relay delivery configuration" d='mondialrelay.bo.default'}
</div>
</div>
<ul class="nav nav-tabs clearfix">
<li {if $current_tab == 'general'}class="active"{/if}><a href="#general" data-tab-name="general" data-toggle="tab">{intl l="Configuration" d='mondialrelay.bo.default'}</a></li>
<li {if $current_tab == 'prices'}class="active"{/if}><a href="#prices" data-tab-name="prices" data-toggle="tab">{intl l="Prices" d='mondialrelay.bo.default'}</a></li>
{*
<li {if $current_tab == 'insurances'}class="active"{/if}><a href="#insurances" data-tab-name="insurances" data-toggle="tab">{intl l="Insurances" d='mondialrelay.bo.default'}</a></li>
*}
</ul>
<div class="tab-content">
<div class="tab-pane fade {if $current_tab == 'general'}active in{/if}" id="general">
<div class="form-container" id="general-form-container">
{include file="mondialrelay/ajax/general.html"}
</div>
</div>
<div class="tab-pane fade {if $current_tab == 'prices'}active in{/if}" id="prices">
<div class="form-container" id="prices-form-container">
{include file="mondialrelay/ajax/prices.html" module_id=$module_id}
</div>
</div>
{*
<div class="tab-pane fade {if $current_tab == 'insurances'}active in{/if}" id="insurances">
<div class="form-container" id="insurances-form-container">
{include file="mondialrelay/ajax/insurances.html"}
</div>
</div>
*}
</div>
</div>

View File

@@ -0,0 +1,28 @@
{extends file="email-layout.tpl"}
{default_translation_domain domain='mondialrelay.email.default'}
{* Do not provide a "Open in browser" link *}
{block name="browser"}{/block}
{* No pre-header *}
{block name="pre-header"}{/block}
{* Subject *}
{block name="email-subject"}{intl l="Your %ref order has been shipped" ref=$REF}{/block}
{* Title *}
{block name="email-title"}{intl l="Your %ref order has been shipped" ref=$REF}{/block}
{* Content *}
{block name="email-content"}
{loop type="order" name="order" id=$order_id}
{loop type="customer" name="customer.order" current=false id=$CUSTOMER backend_context="1"}
<p>{intl l="Dear %first %last" last=$LASTNAME first=$FIRSTNAME},</p>
{/loop}
<p>{intl l="Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please <a href=\"https://www.mondialrelay.fr/suivi-de-colis\">click here</a> to track the delivery." order_ref=$REF tracking_ref=$DELIVERY_REF}</p>
<p>{intl l="Details about this order are available <a href=\"%account_url\">in your customer account</a>." account_url={url path="/account"}}</p>
<p>{intl l="See you soon at <a href=\"%url\">%store</a>" url={navigate to='index'} store={config key="store_name"}}</p>
<p>{intl l="The %store team." store={config key="store_name"}}</p>
{/loop}
{/block}

View File

@@ -0,0 +1,11 @@
{default_translation_domain domain='mondialrelay.email.default'}
{default_locale locale={$locale}}
{loop type="order" name="order" id=$order_id}
{loop type="customer" name="customer.order" current=false id=$CUSTOMER backend_context="1"}
{intl l="Dear %first %last" last=$LASTNAME first=$FIRSTNAME},<br>
{/loop}
{intl l="Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis" order_ref=$REF tracking_ref=$DELIVERY_REF}<br>
{intl l="Details about this order are available in your customer account: %account_url." account_url={url path="/account"}}<br>
{intl l="See you soon at %store at the following address: %url" url={navigate to='index'} store={config key="store_name"}}<br>
{intl l="The %store team." store={config key="store_name"}}
{/loop}

View File

@@ -0,0 +1,26 @@
{strip}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
{if count($OPENINGS) > 0}
<div class="opening hours">
<p>{intl l="Pickup relay opening hours:" d="mondialrelay.email.default"}</p>
<table>
{foreach $OPENINGS as $opening}
<tr>
<td><b>{$opening.day}</b></td>
{if $opening.opening_time_1}
<td>{$opening.opening_time_1} - {$opening.closing_time_1}</td>
{else}
<td>&nbsp;</td>
{/if}
{if $opening.opening_time_2}
<td>{$opening.opening_time_2} - {$opening.closing_time_2}</td>
{else}
<td>&nbsp;</td>
{/if}
</tr>
{/foreach}
</table>
</div>
{/if}
{/loop}
{/strip}

View File

@@ -0,0 +1,8 @@
{strip}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
{if count($OPENINGS) > 0}{foreach $OPENINGS as $opening}
{intl l="Pickup relay opening hours:" d="mondialrelay.email.default"}
{$opening.day}: {if $opening.opening_time_1}{$opening.opening_time_1} - {$opening.closing_time_1}{/if} {if $opening.opening_time_2}{$opening.opening_time_2} - {$opening.closing_time_2}{/if}
{/foreach}{/if}
{/loop}
{/strip}

View File

@@ -0,0 +1,13 @@
{strip}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
{intl l="Mondial Relay pickup location #%num" num=$ID d="mondialrelay.email.default"}<br>
{format_address
country_code=$COUNTRY
locality=$CITY
postal_code=$ZIPCODE
address_line1=$ADDRESS
organization=$NAME
html=$html_mode
}
{/loop}
{/strip}

View File

@@ -0,0 +1,66 @@
.location-form {
margin-bottom: 20px;
}
.location-form button {
padding: 6px 12px !important;
}
#relay_info {
height: 450px;
overflow-y: scroll;
border: 1px solid #ccc;
}
#relay_info table {
margin: 0;
width: 100%;
}
#relay_info table.pickup-points > tbody > tr > td {
border-bottom: 1px solid #ccc;
margin: 0;
padding: 10px;
cursor: pointer;
}
#relay_info table.pickup-points > tbody > tr:hover {
background-color: #f5f5f5;
}
#relay_info table.pickup-points > tbody > tr > td .name {
font-weight: bold;
}
#relay_info table.pickup-points > tbody > tr > td .name .numero {
display: inline-block;
border-radius: 2px;
background-color:#e64b62;
color: #fff;
padding: 0 5px;
margin-right: 5px;
}
#relay_info table.opening-hours {
width: 100%;
}
#relay_info table.opening-hours tr td {
font-size: 90%;
padding: 3px;
}
#relay_info table.opening-hours tr:nth-child(even) {
background-color:#f5f5f5;
}
#mondial-relay-pickup {
display: none;
}
.pickup-home-separator {
margin-top: 20px;
border-top: 1px solid #eee;
padding-top: 30px;
margin-left: -30px;
margin-right: -30px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,18 @@
{strip}
{loop type="module" name="is_mondial_relay" id={order attr="delivery_module"} code="MondialRelay"}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup"}
<div class="panel panel-default col-sm-6">
<div class="panel-heading">{intl l="Pickup location address" d="mondialrelay.fo.default"}</div>
<div class="panel-body">
<span class="fn">{intl l="Pickup location #%number" number=$ID d="mondialrelay.fo.default"}</span>
<span class="org">{$NAME}</span>
<address class="adr">
<span class="street-address">{$ADDRESS}</span><br>
<span class="postal-code">{$ZIPCODE} </span>
<span class="locality">{$CITY} - {$COUNTRY}</span>
</address>
</div>
</div>
{/loop}
{/loop}
{/strip}

View File

@@ -0,0 +1,26 @@
{strip}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
{intl l="Mondial Relay pickup location #%num" num=$ID d="mondialrelay.fo.default"}<br>
{format_address
country_code=$COUNTRY
locality=$CITY
postal_code=$ZIPCODE
address_line1=$ADDRESS
organization=$NAME
}
{if count($OPENINGS) > 0}
<div class="opening hours">
<h4>{intl l="Pickup location opening hours" d='mondialrelay.fo.default'}</h4>
<table class="table table-condensed table-stripped">
{foreach $OPENINGS as $opening}
<tr>
<td>{$opening.day}</td>
<td>{if $opening.opening_time_1}{$opening.opening_time_1} - {$opening.closing_time_1}{else}&nbsp;{/if}</td>
<td>{if $opening.opening_time_2}{$opening.opening_time_2} - {$opening.closing_time_2}{else}&nbsp;{/if}</td>
</tr>
{/foreach}
</table>
</div>
{/if}
{/loop}
{/strip}

View File

@@ -0,0 +1,347 @@
<script type="text/html" id="mondialrelay_ui">
<td colspan="3">
<input type="hidden" name="mondial-relay-selected-delivery-mode" value="none">
{$withHome = false}
{loop type="mondialrelay.delivery-price" name="home-prices" mode="home" country_id=$country state_id=$state}
{$withHome = true}
<div class="row">
<div class="col-sm-4">
<label for="mondialrelay_home">
{form name="thelia.order.delivery"}
{form_field field='delivery-module'}
<label for="delivery-method_{$module_id}_home">
<input type="radio" data-mondial-relay-delivery-mode="home" name="{$name}" id="delivery-method_{$module_id}_home" value="{$module_id}">
<strong>{intl d="mondialrelay.fo.default" l="Mondial Relay home delivery"}</strong>
<br>
<span class="help-block">
{intl l="Expected delivery date: %delivery_date" delivery_date={format_date date=$DELIVERY_DATE output="date"} d="mondialrelay.fo.default" }
</span>
</label>
{/form_field}
{/form}
</label>
</div>
<div class="col-sm-4 hidden-xs text-center">
{loop type="image" name="deliveryspicture" source="module" source_id=$module_id force_return="true" width="100" height="72"}
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
{/loop}
</div>
<div class="col-sm-4">
<div class="price text-right">
{format_money number=$PRICE symbol={currency attr='symbol'}}
</div>
</div>
</div>
{/loop}
{$withRelay = false}
{loop type="mondialrelay.delivery-price" name="relay-prices" mode="relay" country_id=$country state_id=$state}
<div {if $withHome}class="pickup-home-separator"{/if}></div>
{$withRelay = true}
<div class="row">
<div class="col-sm-4">
<label for="mondialrelay_pickup">
{form name="thelia.order.delivery"}
{form_field field='delivery-module'}
<label for="delivery-method_{$module_id}_pickup">
<input type="radio" data-mondial-relay-delivery-mode="pickup" name="{$name}" id="delivery-method_{$module_id}_pickup" value="{$module_id}">
<strong>{intl d="mondialrelay.fo.default" l="Mondial Relay pickup location"}</strong>
<br>
<span class="help-block">
{intl l="Expected delivery date: %delivery_date" delivery_date={format_date date=$DELIVERY_DATE output="date"} d="mondialrelay.fo.default" }
</span>
</label>
{/form_field}
{/form}
</label>
</div>
<div class="col-sm-4 hidden-xs text-center">
{loop type="image" name="deliveryspicture" source="module" source_id=$module_id force_return="true" width="100" height="72"}
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
{/loop}
</div>
<div class="col-sm-4">
<div class="price text-right">
{format_money number=$PRICE symbol={currency attr='symbol'}}
</div>
</div>
</div>
<div id="mondial-relay-pickup">
<div class="row">
<div class="location-form clearfix">
<div class="col-md-12">
<h4>{intl d="mondialrelay.fo.default" l="Find a pickup location around you"}</h4>
</div>
{loop type="address" name="adr" id=$address_id}
<div class="col-sm-2">
<input type="text" required class="form-control" id="mondial_relay_zipcode" name="mondial_relay_zipcode" placeholder="{intl l="Zip code" d="mondialrelay.fo.default"}" value="{$ZIPCODE}">
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="mondial_relay_city" name="mondial_relay_city" placeholder="{intl l="City" d="mondialrelay.fo.default"}" value="{$CITY}">
</div>
<div class="col-sm-3">
<select class="form-control" id="mondial_relay_country_id" name="mondial_relay_country_id">
{loop type="country" name="cntry"}
<option value="{$ID}"{if $COUNTRY == $ID} selected{/if}>{$TITLE}</option>
{/loop}
</select>
</div>
<div class="col-sm-2">
<div class="input-group">
<input type="text" class="form-control" id="mondial_relay_radius" name="mondial_relay_radius" placeholder="{intl l="Search radius" d="mondialrelay.fo.default"}" value="10">
<span class="input-group-addon">{intl d="mondialrelay.fo.default" l="km"}</span>
</div>
</div>
<div class="col-sm-1">
<button id="search-mr-relay" class="form-submit-button btn btn-block btn-default" type="button">{intl d="mondialrelay.fo.default" l="Find"}</button>
</div>
{/loop}
</div>
</div>
<div class="row">
<div class="col-md-5">
<div id="relay_info">
<p>{intl d="mondialrelay.fo.default" l="Loading..."}</p>
</div>
</div>
<div class="col-md-7">
<div id="mondialrelay_map" style="width: 100%; height: 450px;">
</div>
</div>
</div>
</div>
{/loop}
</td>
</script>
<script>
$("#delivery-module-{$module_id}").html($('#mondialrelay_ui').html());
jQuery.fn.scrollTo = function(elem, speed) {
$(this).animate({
scrollTop: $(this).scrollTop() - $(this).offset().top + $(elem).offset().top
}, speed === undefined ? 1000 : speed);
return this;
};
{if $withRelay}
var MRData = {
markers: [],
map: null,
geocoder: null,
bounds: null,
pinImages: [
{for $idx = 1 to 30}
"{image file="mondialrelay/assets/img/pins/pointsrelais_pin_{$idx}.png" source="MondialRelay"}"{if $idx < 30},{/if}
{/for}
]
};
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js'
+ '?callback=mondialRelaySetup'
+ '&key={module_config module="MondialRelay" key="google_maps_api_key" locale="en_US"}';
document.body.appendChild(script);
}
function loadRelayMap() {
var $relayInfo = $('#relay_info');
MRData.bounds = new google.maps.LatLngBounds();
for(var idx = 0; idx < MRData.markers.length; idx++) {
MRData.markers[idx].setMap(null);
}
MRData.markers.length = 0;
$relayInfo.html('');
$.ajax({
url: "{url path="MondialRelay/relay-map"}",
data : {
country_id: $('#mondial_relay_country_id').val(),
city: $('#mondial_relay_city').val(),
zipcode: $('#mondial_relay_zipcode').val(),
radius: $('#mondial_relay_radius').val()
},
success: function(data) {
var html, item, opening, marker;
if (data.error !== '') {
var errMsg = "{intl d="mondialrelay.fo.default" l="Sorry, we failed to get pickup locations. Error is : __ERR__." js=1}";
alert(errMsg.replace('__ERR__', data.error));
} else if (data.points.length === 0) {
html = '<div class="alert alert-danger">{intl d="mondialrelay.fo.default" l="No pickup locations were found for this address." js=1}</div>';
} else {
html = '<table class="pickup-points">';
// Build point data and map points from json data
for (var idx = 0; idx < data.points.length; idx++) {
item = data.points[idx];
marker = new google.maps.Marker({
map: MRData.map,
position: new google.maps.LatLng(item.latitude, item.longitude),
title: (idx + 1) + ' : ' + item.name,
icon: MRData.pinImages[idx],
relay_id: item.id
});
google.maps.event.addListener(marker, 'click', function () {
$relayInfo.scrollTo("#pickup-point-" + this.relay_id);
});
MRData.bounds.extend(marker.getPosition());
MRData.markers.push(marker);
html +=
'<tr class="pickup-point" data-pickup-id="' + item.id + '" id="pickup-point-' + item.id + '">'
+ '<td>'
+ ' <label for="" class="name">'
+ ' <span class="numero">' + (idx + 1) + '</span> ' + item.name + ' (' + item.distance_km + ' km)'
+ ' </label>'
+ ' <div class="address">' + item.address + '</div>'
+ ' <div class="zipcode">' + item.zipcode + ' ' + item.city + '</div>'
;
if (item.openings.length > 0) {
html += '<table class="opening-hours">';
for (var jdx = 0; jdx < item.openings.length; jdx++) {
opening = item.openings[jdx];
html += '<tr>';
html += '<td class="day">' + opening.day + '</td> ';
if (opening.opening_time_1 !== undefined) {
html += '<td>' + opening.opening_time_1 + ' - ' + opening.closing_time_1 + '</td>';
}
if (opening.opening_time_2 !== undefined) {
html += '<td>' + opening.opening_time_2 + ' - ' + opening.closing_time_2 + '</td>';
}
html += '</tr>';
}
html += '</table>';
}
html += '</td>';
html += '<td><input type="radio" name="mondialrelay_relay" value="' + item.id + '"></td>';
html += '</tr>';
}
html += '</table>';
}
$relayInfo.html(html);
// View all markers
MRData.map.fitBounds(MRData.bounds);
},
error: function() {
alert("{intl d="mondialrelay.fo.default" l="Oops, something goes wrong, please try again." js=1}")
}
});
}
if (typeof(google) === 'undefined') {
loadScript();
} else {
mondialRelaySetup();
}
function mondialRelaySetup() {
// Google Map
var MRData_mapOptions = {
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
MRData.map = new google.maps.Map(document.getElementById('mondialrelay_map'), MRData_mapOptions);
MRData.geocoder = new google.maps.Geocoder();
// Center map on the current customer address
{loop type="address" name="adr" id=$address_id}
var MRDataAddress = [];
MRDataAddress['address'] = "{$ADDRESS1|replace:'"':'\\"'}, {$ZIPCODE} {$CITY|replace:'"':'\\"'}";
MRData.geocoder.geocode(MRDataAddress, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
MRData.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: MRData.map,
icon: "{image file='mondialrelay/assets/img/maison.png' source='MondialRelay'}"
});
} else {
// Sinon on met le centre de la map sur Clermont-Ferrand ;)
alert("{intl d="mondialrelay.fo.default" l="Current address can't be geolocated" js=1}");
var myLatLng = new google.maps.LatLng(45.7789, 3.0782);
MRData.map.setCenter(myLatLng);
MRData.map.setZoom(3);
}
});
{/loop}
loadRelayMap();
$(document).on('click', '.pickup-point', function(ev) {
var pointId = $(this).data('pickup-id');
$('input[value='+pointId+']').prop("checked", true)
});
$('#search-mr-relay').off().click(function(ev) {
loadRelayMap();
});
$("#form-cart-delivery").off('submit').submit(function(ev) {
if ($('[data-mondial-relay-delivery-mode=pickup]').is(':checked')
&&
$('input[name=mondialrelay_relay]:checked').length === 0) {
alert("{intl d="mondialrelay.fo.default" l="Please select a pickup location." js=1}");
ev.preventDefault();
}
});
}
{/if}
$('[data-mondial-relay-delivery-mode]').change(function() {
$('input[name=mondial-relay-selected-delivery-mode]').val($(this).data('mondial-relay-delivery-mode'));
});
// Hide / Show pickeup selection UI
$('input[type=radio]').click(function() {
if ($('[data-mondial-relay-delivery-mode=pickup]').is(':checked')) {
$('#mondial-relay-pickup').slideDown('fast');
// Show a descent map
MRData.map.fitBounds(MRData.bounds);
} else {
$('#mondial-relay-pickup').slideUp('fast');
}
});
</script>

View File

@@ -0,0 +1,30 @@
{strip}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
{if count($OPENINGS) > 0}
<div class="opening hours">
<p>{intl l="Pickup relay opening hours:" d="mondialrelay.pdf.default"}</p>
<table>
<col style="padding: 1mm; border-bottom: 1px solid #ccc;" />
<col style="padding: 1mm; border-bottom: 1px solid #ccc;" />
<col style="padding: 1mm; border-bottom: 1px solid #ccc;" />
{foreach $OPENINGS as $opening}
<tr>
<td><b>{$opening.day}</b></td>
{if $opening.opening_time_1}
<td>{$opening.opening_time_1} - {$opening.closing_time_1}</td>
{else}
<td>&nbsp;</td>
{/if}
{if $opening.opening_time_2}
<td>{$opening.opening_time_2} - {$opening.closing_time_2}</td>
{else}
<td>&nbsp;</td>
{/if}
</tr>
{/foreach}
</table>
</div>
{/if}
{/loop}
{/strip}

View File

@@ -0,0 +1,12 @@
{strip}
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
{intl l="Mondial Relay pickup location #%num" num=$ID d="mondialrelay.pdf.default"}<br>
{format_address
country_code=$COUNTRY
locality=$CITY
postal_code=$ZIPCODE
address_line1=$ADDRESS
organization=$NAME
}
{/loop}
{/strip}