pdf_form.insertAfter(".gform_confirmation_message");
pdf_form.css("display", "block");
+ var poster_form = page.find("#gform_2");
+ var poster_input = poster_form.find('.ginput_quantity');
+ var prod_values = [];
+ var price_total;
+ var poster_array = [3,19,6,7,16,18,17,5];
+ var quantity = 0;
+
+ // poster form calculations //////////////////////////////////
+ function calculate_poster(){
+ price_total = 0;
+ var qty_total = 0;
+ for(var i = 3; i < 20; i++){
+ if( $.inArray(i, poster_array ) !== -1 ){
+ if( $('#ginput_quantity_2_' + i).val() !== undefined && $('#ginput_quantity_2_' + i).val() !== '' ){
+ qty_total += parseInt($('#ginput_quantity_2_' + i).val(), 10);
+ }
+ }
+ }
+
+ if(qty_total > 4){
+ price_total = (qty_total - 4) * 10 + 30;
+ } else if( qty_total === 4){
+ price_total = 30;
+ } else if( qty_total < 4){
+ price_total = qty_total * 10;
+ }
+
+ $('.ginput_total_2').text('$' + price_total + '.00');
+ $('#input_2_15').val(price_total);
+ }
+
+ $(window).on("load", function(){
+ calculate_poster();
+ });
+
+ poster_input.each(function(index){
+ if( $(this).val() !== '') {
+ quantity += parseInt($(this).val());
+ }
+ $(document).on("change",$(this),calculate_poster);
+ if( $(this).val() ){
+ prod_values.push($(this));
+ }
+ });
+
+ if(quantity >= 4){
+ $.each(prod_values.slice(0,1), function(){
+ if( $(this).val() === '1'){
+ $(this).prev().prev().val('0');
+ } else {
+ var price_calc = parseInt( $(this).val() ) * 10 - 10;
+ var new_price = ( price_calc / parseInt( $(this).val() ) );
+ $(this).prev().prev().val( new_price );
+ }
+ });
+ }
+ //end poster form calculations ///////////////////////////////////
+
+ // token order form
$(document).on("change, keyup", "#ginput_quantity_4_36", function(){
if( $(this).val() > 0){
for(var i = 12; i < 36; i++){
if( $.inArray(i, field_array ) == -1 ){
if( $('#ginput_quantity_4_' + i).val() !== undefined && $('#ginput_quantity_4_' + i).val() !== '' ){
- console.log($('#ginput_quantity_4_' + i).val());
qty_total += parseInt($('#ginput_quantity_4_' + i).val(), 10);
}
}
pdf_form.insertAfter(".gform_confirmation_message");
pdf_form.css("display", "block");
+ var poster_form = page.find("#gform_2");
+ var poster_input = poster_form.find('.ginput_quantity');
+ var prod_values = [];
+ var price_total;
+ var poster_array = [3,19,6,7,16,18,17,5];
+ var quantity = 0;
+
+ // poster form calculations //////////////////////////////////
+ function calculate_poster(){
+ price_total = 0;
+ var qty_total = 0;
+ for(var i = 3; i < 20; i++){
+ if( $.inArray(i, poster_array ) !== -1 ){
+ if( $('#ginput_quantity_2_' + i).val() !== undefined && $('#ginput_quantity_2_' + i).val() !== '' ){
+ qty_total += parseInt($('#ginput_quantity_2_' + i).val(), 10);
+ }
+ }
+ }
+
+ if(qty_total > 4){
+ price_total = (qty_total - 4) * 10 + 30;
+ } else if( qty_total === 4){
+ price_total = 30;
+ } else if( qty_total < 4){
+ price_total = qty_total * 10;
+ }
+
+ $('.ginput_total_2').text('$' + price_total + '.00');
+ $('#input_2_15').val(price_total);
+ }
+
+ $(window).on("load", function(){
+ calculate_poster();
+ });
+
+ poster_input.each(function(index){
+ if( $(this).val() !== '') {
+ quantity += parseInt($(this).val());
+ }
+ $(document).on("change",$(this),calculate_poster);
+ if( $(this).val() ){
+ prod_values.push($(this));
+ }
+ });
+
+ if(quantity >= 4){
+ $.each(prod_values.slice(0,1), function(){
+ if( $(this).val() === '1'){
+ $(this).prev().prev().val('0');
+ } else {
+ var price_calc = parseInt( $(this).val() ) * 10 - 10;
+ var new_price = ( price_calc / parseInt( $(this).val() ) );
+ $(this).prev().prev().val( new_price );
+ }
+ });
+ }
+ //end poster form calculations ///////////////////////////////////
+
+ // token order form
$(document).on("change, keyup", "#ginput_quantity_4_36", function(){
if( $(this).val() > 0){
for(var i = 12; i < 36; i++){
if( $.inArray(i, field_array ) == -1 ){
if( $('#ginput_quantity_4_' + i).val() !== undefined && $('#ginput_quantity_4_' + i).val() !== '' ){
- console.log($('#ginput_quantity_4_' + i).val());
qty_total += parseInt($('#ginput_quantity_4_' + i).val(), 10);
}
}