30 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-06-27 11:47:36 +02:00
$(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(){});
})
2017-06-27 17:52:40 +02:00
$('.configurator-opt-datepicker').datepicker({dateFormat: "dd MM yy"});
$('.configurator-opt-file').fileupload({
2017-06-27 11:47:36 +02:00
dataType: 'json',
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
2017-07-17 14:54:03 +02:00
$('span#response-'+$(e.target).data('field')).text(file.name).trigger('change');
2017-06-27 11:47:36 +02:00
$(e.target).parent().find('span.filename').text('');
2017-07-17 14:54:03 +02:00
});
},
2017-06-27 11:47:36 +02:00
progressall: function (e, data) {
2017-06-27 17:52:40 +02:00
$('span#response-'+$(e.target).data('field')).text("Envoi en cours...");
2017-06-27 11:47:36 +02:00
var progress = parseInt(data.loaded / data.total * 100, 10);
}
2017-06-30 15:08:11 +02:00
}).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
2017-06-27 11:47:36 +02:00
});