bebeboutik/modules/soflexibilite/js/fcts.js
Marion Muszynski ffbb3232b9 modif soflex
2016-05-09 17:43:57 +02:00

103 lines
4.0 KiB
JavaScript

/**
* NOTICE OF LICENSE
*
* This source file is subject to a commercial license from Common-Services Co., Ltd.
* Use, copy, modification or distribution of this source file without written
* license agreement from the SARL SMC is strictly forbidden.
* In order to obtain a license, please contact us: contact@common-services.com
* ...........................................................................
* INFORMATION SUR LA LICENCE D'UTILISATION
*
* L'utilisation de ce fichier source est soumise a une licence commerciale
* concedee par la societe Common-Services Co., Ltd.
* Toute utilisation, reproduction, modification ou distribution du present
* fichier source sans contrat de licence ecrit de la part de la Common-Services Co. Ltd. est
* expressement interdite.
* Pour obtenir une licence, veuillez contacter Common-Services Co., Ltd. a l'adresse: contact@common-services.com
* ...........................................................................
*
* @package So Colissimo Flexibilite
* @author Alexandre D.
* @copyright Copyright (c) 2011-2015 Common Services Co Ltd - 90/25 Sukhumvit 81 - 10260 Bangkok - Thailand
* @license Commercial license
* Support by mail : support.soflexibilite@common-services.com
*/
SoFlexibilite = {
selectRightCarrier: function(relay_class) {
var bpr_id = $('input#soflexibilite_bpr_id').val() + ',';
var a2p_id = $('input#soflexibilite_a2p_id').val() + ',';
var cit_id = $('input#soflexibilite_cit_id').val() + ',';
$('#picFinalColissimo').show();
if (relay_class === 'BPR' || relay_class === 'BDP' || relay_class === 'CDI')
{
$('.delivery_option_radio').each(function() {
if ($(this).val() === bpr_id)
{
$('.delivery_option_radio').attr('checked', false).parent().removeClass('checked');
$(this).attr('checked', true).parent().addClass('checked');
}
});
}
else if (relay_class === 'A2P' || relay_class === 'CMT')
{
$('.delivery_option_radio').each(function() {
if ($(this).val() === a2p_id)
{
$('.delivery_option_radio').attr('checked', false).parent().removeClass('checked');
$(this).attr('checked', true).parent().addClass('checked');
}
});
}
else if (relay_class === 'CIT')
{
$('.delivery_option_radio').each(function() {
if ($(this).val() === cit_id)
{
$('.delivery_option_radio').attr('checked', false).parent().removeClass('checked');
$(this).attr('checked', true).parent().addClass('checked');
}
});
}
if (typeof(updateCarrierSelectionAndGift) === 'function')
updateCarrierSelectionAndGift();
},
hideAllForOverlay: function() {
$('#picStreetView').hide();
$('#infofofo').hide();
$('.onlyForDom').hide();
$('#picFinalBpr').hide();
$('#picFinalA2p').hide();
$('#picFinalDom').hide();
$('#picFinalRdv').hide();
$('#picFinalCit').hide();
$('#so-h3-recap-horsdom').hide();
$('#so-h3-recap-dom').hide();
},
buildFinalAddress: function(address_chunk) {
var final_address = '<div class="so-prez-libelle">';
if (address_chunk.libelle)
final_address += address_chunk.libelle + '<br>';
if (address_chunk.company)
final_address += address_chunk.company + '<br>';
final_address += address_chunk.firstname + ' ' + address_chunk.lastname + '</div>';
final_address += address_chunk.address1 + '<br>';
if (address_chunk.address2)
final_address += address_chunk.address2 + '<br>';
final_address += address_chunk.postcode + ' ' + address_chunk.city + '<br>' + address_chunk.country;
return (final_address);
},
updateCarrierSelectionAndGift: function() {
if (typeof(updateCarrierSelectionAndGift) === 'function')
updateCarrierSelectionAndGift();
}
};