$(document).ready(function() {
kjset.initEvent();
startTimer();
setTimeout(function() { $(".set-options input").trigger('change'); } , 500);
});
var kjset = {
$("button[data-target='#" + btn_id + "'").html(str_opts);
{% if (options) %}
<div class="dm-com-vd-button-1"><button type="button" class="btn btn-primary open-options" data-toggle="modal" data-target="#sets-popup-{{ modal_id }}">{{ text_sets_options }}</button></div>
{% endif %}
$(".set-options select,.set-options input[type='radio'],.set-options input[type='checkbox']").change(function() {
var options = $(this).parents('.set-options').find("select option:selected,input[type='radio']:checked,input[type='checkbox']:checked");
var btn_id = $(this).parents('.set-options').attr("id");
var product = $("button[data-target='#" + btn_id + "'").parents('.set-product');
obj.current_set = $(product).parents('.set');
var cprice = parseFloat($(product).find("input[name='sp_cprice']").val());
var eq_mod = false;
var total = cprice;
var str_opts = "";
$(options).each(function() {
//console.log($(this).parents('.form-group').find('label'));
str_opts += $(this).parents('.form-group').find('label').eq(0).text().trim();
str_opts += ": ";
str_opts += $(this).parent('label').text().trim();
str_opts += "<br/>";
// console.log(str_opts);
var pre = $(this).data('prefix');
var price = parseFloat($(this).data('price'));
if (pre.length != 0 && isNaN(price) == false) {
switch (pre) {
case '-':
total -= price;
break;
case '+':
total += price;
break;
case '=':
total = price;
break;
case '*':
total *= price;
break;
case '/':
total /= price;
break;
case 'u':
total = total + (($total * price) / 100);
break;
case 'd':
total = total - ((total * price) / 100);
break;
default:
break;
}
}
});
$("button[data-target='#" + btn_id + "'").html(str_opts);
//console.log(str_opts);
total -= cprice;
$(product).find("input[name='sp_option_price']").val(total);
obj.update_total();
});