Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($) {
- getValue("#quantityOrder", ".product-quant-body");
- getValue("#quantityColor", ".product-quant-color-body");
- getCalcVal(".price-desc .product-name", "productNameVal");
- // getCalcVal(".price-desc .product-name", "input[name=productNameVal]");
- // getCalcVal("price-cal-header.desktop .product-color", "input[name=color]");
- // getCalcVal(".price-cal-body .product-color-body span", "input[name=colorVal]");
- // getCalcVal("price-cal-header.desktop .product-tech-print", "input[name=technology]");
- // getCalcVal(".price-cal-body .product-tech-print-body span", "input[name=technologyVal]");
- // getCalcVal("price-cal-header.desktop .product-area-print", "input[name=surface]");
- // getCalcVal(".price-cal-body .product-area-print-body span", "input[name=surfaceVal]");
- // getCalcVal("price-cal-header.desktop .product-quant", "input[name=productAmount]");
- // getCalcVal(".price-cal-body .product-quant-body span", "input[name=productAmountVal]");
- // getCalcVal("price-cal-header.desktop .product-quant-color", "input[name=colorAmount]");
- // getCalcVal(".price-cal-body .product-quant-color-body span", "input[name=colorAmountVal]");
- // getCalcVal("price-cal-header.desktop .product-quant-price", "input[name=price]");
- // getCalcVal(".price-cal-body .product-quant-price-body span", "input[name=priceVal]");
- // getCalcVal("price-cal-header.desktop .product-prepress", "input[name=prepare]");
- // getCalcVal(".price-cal-body .product-prepress-body span", "input[name=prepareVal]");
- // getCalcVal("price-cal-header.desktop .product-final ", "input[name=sumPrice]");
- // getCalcVal(".price-cal-body .product-final-body span", "input[name=sumPriceVal]");
- $("#quantityOrder").focusin(function() {
- $(this).keyup(function() {
- if ($(this).val() < 100) {
- $(".min-val.order").fadeIn();
- } else {
- $(".min-val.order").fadeOut();
- }
- checkValidation();
- });
- });
- $("#quantityColor").focusin(function() {
- $(this).keyup(function() {
- if ($(this).val() < 1) {
- $(".min-val.color").fadeIn();
- $(".max-val.color").fadeOut();
- } else if ($(this).val() > 10) {
- $(".max-val.color").fadeIn();
- $(".min-val.color").fadeOut();
- } else {
- $(".min-val.color").fadeOut();
- $(".max-val.color").fadeOut();
- }
- checkValidation();
- });
- });
- function checkValidation() {
- var inpObj = document.getElementById("quantityOrder");
- var inpObj2 = document.getElementById("quantityColor");
- if (inpObj.checkValidity() && inpObj2.checkValidity()) {
- $(".product-calc .product-calc-buttons button").prop("disabled", false)
- } else {
- $(".product-calc .product-calc-buttons button").prop("disabled", true)
- }
- }
- $(".product-calc-buttons .btn-fill-avant").on("click", function() {
- getValue("#quantityOrder", ".product-quant-body");
- getValue("#quantityColor", ".product-quant-color-body");
- // ------- Pobieranie koloru ------ //
- var productFilterColor = $("#productFilterColor").children("option:selected").text();
- $(".product-color-body span").text(productFilterColor);
- // ------- Pobieranie technologi ------ //
- var productTech = $("#productTech").children("option:selected").text();
- $(".product-tech-print-body span").text(productTech);
- // ------- Pobieranie powierzchni ------ //
- var productSurface = $("#productSurface").children("option:selected").text();
- $(".product-area-print-body span").text(productSurface);
- // ------- Pobieranie ilości sztuk i kolorów ------ //
- var quantityOrder = $("#quantityOrder").val();
- var quantityColor = $("#quantityColor").val();
- // ------- Pobieranie ceny 1 sztuki ------ //
- var productPrice = $(".product-quant-price-body span").text();
- var productPriceNum = parseInt(productPrice);
- // ------- Pobieranie ceny przygotowalni ------ //
- var preparePrice = $(".product-prepress-body span").text();
- var preparePriceNum = parseInt(preparePrice);
- var colorPrice = 130;
- if ($("#productTech").val() == 'nadruk-chemoutwardzalny') {
- switch (quantityOrder) {
- case 100:
- colorPrice = 5
- break;
- case 200:
- colorPrice = 20
- break;
- }
- }
- if (quantityColor > 1) {
- colorPrice = 130 + (quantityColor - 1) * 50;
- }
- var num = quantityOrder * productPriceNum + colorPrice + preparePriceNum;
- var result = num.toFixed(2)
- document.getElementById("result").innerHTML = result + " zł";
- $("#price_calculation").fadeIn();
- $("#price_calculation .price-rever").fadeIn();
- });
- });
- // ------- Pobieranie ilości sztuk i kolorów ------ //
- function getValue(buttonID, fieldClass) {
- var value = $(buttonID).val();
- $(fieldClass).text(value);
- }
- function getCalcVal(calcField, inputVal) {
- var value = $(calcField).text();
- $("input[name=" + inputVal + "]").val(value);
- }
- $("#createCsv").on("click", function() {
- console.log(inputVal);
- // getCalcVal(".price-desc .product-name", "productNameVal");
- getCalcVal("price-cal-header.desktop .product-color", "name=color");
- // getCalcVal(".price-cal-body .product-color-body span", "input[name=colorVal]");
- // getCalcVal("price-cal-header.desktop .product-tech-print", "input[name=technology]");
- // getCalcVal(".price-cal-body .product-tech-print-body span", "input[name=technologyVal]");
- // getCalcVal("price-cal-header.desktop .product-area-print", "input[name=surface]");
- // getCalcVal(".price-cal-body .product-area-print-body span", "input[name=surfaceVal]");
- // getCalcVal("price-cal-header.desktop .product-quant", "input[name=productAmount]");
- // getCalcVal(".price-cal-body .product-quant-body span", "input[name=productAmountVal]");
- // getCalcVal("price-cal-header.desktop .product-quant-color", "input[name=colorAmount]");
- // getCalcVal(".price-cal-body .product-quant-color-body span", "input[name=colorAmountVal]");
- // getCalcVal("price-cal-header.desktop .product-quant-price", "input[name=price]");
- // getCalcVal(".price-cal-body .product-quant-price-body span", "input[name=priceVal]");
- // getCalcVal("price-cal-header.desktop .product-prepress", "input[name=prepare]");
- // getCalcVal(".price-cal-body .product-prepress-body span", "input[name=prepareVal]");
- // getCalcVal("price-cal-header.desktop .product-final ", "input[name=sumPrice]");
- // getCalcVal(".price-cal-body .product-final-body span", "input[name=sumPriceVal]");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement