#10 Promotion Modul, Kommentar 2
This commit is contained in:
parent
f0da981737
commit
c9e1545693
128 changed files with 8194 additions and 637 deletions
|
|
@ -2,7 +2,23 @@ $(function () {
|
|||
// $('.selectpicker').selectpicker();
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$('.bootstrap-maxlength').each(function() {
|
||||
$(this).maxlength({
|
||||
warningClass: 'badge badge-success',
|
||||
limitReachedClass: 'badge badge-danger',
|
||||
separator: ' / ',
|
||||
preText: ' ',
|
||||
postText: ' Zeichen',
|
||||
validate: true,
|
||||
placement: 'top',
|
||||
threshold: +this.getAttribute('maxlength')
|
||||
});
|
||||
});
|
||||
});
|
||||
$(function() {
|
||||
autosize($('.text-autosize'));
|
||||
});
|
||||
|
||||
function update_modal_data_load(e, $ele) {
|
||||
var ele = $ele,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@ var IqPromotionCart = {
|
|||
$(_self.table).find(_self.check_event).off('change').on('change', function(){
|
||||
_self.update_input_table($(this));
|
||||
});
|
||||
},
|
||||
_self.update_poduct_price();
|
||||
|
||||
},
|
||||
add_product: function (_obj){
|
||||
var _self = this;
|
||||
var input = $(_self.table).find('input#product_qty_'+_obj.data('product-id'));
|
||||
|
|
@ -74,15 +75,28 @@ var IqPromotionCart = {
|
|||
//push, is checked
|
||||
if($(_self.table).find('#product_check_'+$(this).data('product-id')).is(':checked')){
|
||||
tempData.push({product_id: $(this).data('product-id'), qty: $(this).val()});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
data.action = $(_self.table).data('action');
|
||||
data.user_promotion_id = $(_self.table).data('user_promotion_id');
|
||||
data.products = tempData;
|
||||
_self.performRequest(data)
|
||||
.done(_self.refreshItemsAndView);
|
||||
_self.update_poduct_price();
|
||||
|
||||
},
|
||||
update_poduct_price: function(){
|
||||
console.log("s");
|
||||
var _self = this;
|
||||
|
||||
$('.calculate_product_qty_price').each(function(){
|
||||
var qty = _self.checkNumber($(_self.table).find('#'+$(this).data('qty-id')).val());;
|
||||
var price = $(this).data('price');
|
||||
var total = price*qty;
|
||||
$(this).html(total.toFixed(2).replace('.', ','))
|
||||
});
|
||||
},
|
||||
refreshItemsAndView: function (data){
|
||||
var _self = IqPromotionCart;
|
||||
//console.log(data.html_cart);
|
||||
|
|
@ -106,15 +120,15 @@ var IqPromotionCart = {
|
|||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
})
|
||||
.done(function (data) {
|
||||
// console.log('performRequest');
|
||||
// console.log(data);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(jqXHR);
|
||||
console.log(jqXHR.responseText);
|
||||
console.log(textStatus);
|
||||
console.log(errorThrown);
|
||||
console.log("Sorry, there was a problem!");
|
||||
});
|
||||
.done(function (data) {
|
||||
// console.log('performRequest');
|
||||
// console.log(data);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(jqXHR);
|
||||
console.log(jqXHR.responseText);
|
||||
console.log(textStatus);
|
||||
console.log(errorThrown);
|
||||
console.log("Sorry, there was a problem!");
|
||||
});
|
||||
}
|
||||
};
|
||||
58
public/js/shop.js
Normal file
58
public/js/shop.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
$(function() {
|
||||
|
||||
$('select').selectpicker();
|
||||
|
||||
|
||||
$('#modals-load-content').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
if (!button.data('id')) {
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
$.each(button.data(), function(index, value){
|
||||
if(index !== 'bs.tooltip'){
|
||||
data[index] = value;
|
||||
}
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
loadModalInner(this, data);
|
||||
|
||||
});
|
||||
|
||||
function loadModalInner(self, data){
|
||||
var url = data.route,
|
||||
contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
contentType: contentType,
|
||||
encode: true,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
if(data.response.modal){
|
||||
$(data.response.target).find('.modal-dialog').addClass(data.response.modal);
|
||||
}
|
||||
$(data.response.target).find('.modal-dialog').html(data.html);
|
||||
//$(data.response.target).find('.selectpicker').selectpicker('refresh');
|
||||
},
|
||||
error: function(xhr, status, errorThrown) {
|
||||
console.log(xhr);
|
||||
console.log(xhr.responseText);
|
||||
console.log(errorThrown);
|
||||
console.log("Sorry, there was a problem!");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
function _scrollTo(to, offset) {
|
||||
$('html,body').animate({scrollTop: $(to).offset().top - offset}, 800);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue