2017-06-27 17:52:40 +02:00

35 lines
1.6 KiB
JavaScript

$(function(){
$('.configurator-opt-change').on('change', function(e) {
$.post($(this).data('url'), $('form#buy_block').serialize(), function (data) {
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
}, 'json').fail(function(){});
});
$('.configurator-opt-click').on('click', function(e){
$.post($(this).data('url'), $('form#buy_block').serialize(), function (data) {
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
}, 'json').fail(function(){});
})
$.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );
$('.configurator-opt-datepicker').datepicker({dateFormat: "dd MM yy"});
$('.configurator-opt-file').fileupload({
dataType: 'json',
change: function (e, data) {
$.each(data.files, function (index, file) {
});
},
done: function (e, data) {
$.each(data.result.files, function (index, file) {
// Set hidden field
$('input[name='+$(e.target).data('field')+']').val(file.name);
// Set Response
$('span#response-'+$(e.target).data('field')).text(file.name);
$(e.target).parent().find('span.filename').text('');
});
},
progressall: function (e, data) {
$('span#response-'+$(e.target).data('field')).text("Envoi en cours...");
var progress = parseInt(data.loaded / data.total * 100, 10);
}
}).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
});