You are not currently a member of any group. If you believe this is an error, please request the registration URL from your organization contact.
Please Log in to view the report.
jQuery(function($){$(document).ready(function(){UO_Groups_Buy.init()})
var UO_Groups_Buy={form:null,elements:{error_box:null,quantity_input:null,course_checkbox:null,course_checkbox_checked:null,prevorder_input:null,totals:{subtotal:null,prevorder:null,discount:null,total:null}},
config:{is_course_addition:false,has_bulk_discounts_enabled:null},
init:function(){this.form=$('#uo-groups-buy-courses') this.elements.error_box=$('#uo-groups-buy-courses .uo_groups_error') this.elements.quantity_input=$('#uo-groups-buy-courses #uo-groups-quantity') this.elements.course_checkbox=$('#uo-groups-buy-courses #uo-groups-buy-courses-select input[type="checkbox"]') this.elements.prevorder_input=$('#uo-groups-buy-courses #prevorder')
this.elements.totals.subtotal=$('#uo-groups-buy-courses .uo-groups-subtotal .digits') this.elements.totals.prevorder=$('#uo-groups-buy-courses .uo-groups-prevorder .digits') this.elements.totals.discount=$('#uo-groups-buy-courses .uo-groups-discount .digits') this.elements.totals.total=$('#uo-groups-buy-courses .uo-groups-total .digits')
this.elements.course_checkbox_checked=$('#uo-groups-buy-courses #uo-groups-buy-courses-select :checked')
this.form.submit(function(event){if(!UO_Groups_Buy.validate()){event.preventDefault()}})
this.elements.quantity_input.on('input',function(){UO_Groups_Buy.update_totals(UO_Groups_Buy.get_totals())})
this.elements.course_checkbox.change(function(){UO_Groups_Buy.elements.course_checkbox_checked=$('#uo-groups-buy-courses #uo-groups-buy-courses-select :checked')
UO_Groups_Buy.select_course_row($(this)) UO_Groups_Buy.update_totals(UO_Groups_Buy.get_totals())})},
validate:function(){
let response=false
if(this.elements.course_checkbox_checked.length>0){this.elements.error_box.html('').hide() response=true} else{this.elements.error_box.html('Please select at least one course to continue.').show() response=false}
return response},
select_course_row:function(checkbox){let is_checked=checkbox.is(':checked')
let $row=checkbox.closest('.uo-groups-table-row')
if(is_checked){$row.addClass('uo-groups-table-row--selected')} else{$row.removeClass('uo-groups-table-row--selected')}},
update_totals:function(data){
if(this.config.is_course_addition){ui_update_total(this.elements.totals.prevorder,data.prevorder)}
ui_update_total(this.elements.totals.subtotal,data.subtotal) ui_update_total(this.elements.totals.discount,data.discount) ui_update_total(this.elements.totals.total,data.total)
function ui_update_total(element,content){element.fadeOut(50).html(content).fadeIn(150)}},
get_totals:function(){
let discount=0,subtotal=0,quantity=0,prevorder=0,decimal_points=2;
let total=0
this.elements.course_checkbox_checked.each(function(){subtotal=parseFloat(subtotal)+parseFloat($(this).data('price'))})
quantity=this.elements.quantity_input.val()
if(this.config.is_course_addition){prevorder=this.elements.prevorder_input.val() prevorder=prevorder*quantity}
subtotal=subtotal*quantity
if(this.config.has_bulk_discounts_enabled){var coefficient=this.get_coefficient(quantity) total=(subtotal-prevorder)*coefficient discount=-Math.abs(subtotal-prevorder-((subtotal-prevorder)*coefficient))} else{total=subtotal}
if(this.config.is_course_addition){total=total-prevorder}
total=total<0?0:total return{subtotal:subtotal.toFixed(decimal_points),discount:discount.toFixed(decimal_points),prevorder:(prevorder*-1).toFixed(2),total:total.toFixed(decimal_points),}},get_coefficient:function(quantity){let q=[0.0],d=[0.0],coeff=1,bulk_discount=[];if(Object.keys(bulk_discount).length>0){if('yes'==bulk_discount['enabled']){var available_discounts=bulk_discount['discounts'] for(let i=1;i<=10;i++){if(i in available_discounts){q.push(available_discounts[i]['qty']) d.push(available_discounts[i]['percent']?available_discounts[i]['percent']:0.0) if(parseInt(quantity)>=parseInt(q[i])&&parseInt(q[i])>parseInt(q[0])){q[0]=parseInt(q[i]) d[0]=d[i]}}} coeff=Math.min(1.0,Math.max(0,(100.0-Math.round(d[0],2))/100.0))}}
return coeff}}})
You do not have permission to manage groups.
Login to view informationYou must be logged in to view this report.
You do not have permission to manage groups.