/* variabili aggiunte per la pubblicazione */ var mostraBtnResidualCalculaton = true; /* MODELLI PER IL CALCOLO DELLA PORTATA */ var truckObj = new calcFormObj("LIFT TRUCK",[ ["LOAD CENTRE (C):","C","mm"], ["RATED CAPACITY (QST):","QST","kg"], ["DIMENSION (X):","X","mm"], ["FORK THICKNESS (S):","S","mm"] ]); var forkObj = new calcFormObj("ATTACHMENT",[ ["MODEL"], ["WEIGHT (W):","W","kg"], ["CENTRE OF GRAVITY (HCG):", "HCG", "mm"], ["THICKNESS (LL):", "LL", "mm"] ]); var loadObj = new calcFormObj("LOAD", [ ["LOAD CENTRE (BP):", "BP", "mm"], ["", "COMPUTE", "RESIDUAL CAPACITY: "] ]); /* MODELLI PER IL DISEGNO DEL FORM DI ORDINE */ var baleClampsOrder = new orderObject("WORKING FACTORS", [ new groupObject("BALES OF", "checkBox", [ new inputObject("load_type0", "Paper", "default", 0, ""), new inputObject("load_type1", "Textile Wast", "default", 0, ""), new inputObject("load_type2", "Soft Cellulose", "default", 0, ""), new inputObject("load_type3", "Compressed Cellulose", "default", 0, ""), new inputObject("load_type4", "Other", "checkWithNote", 0, "") ], ""), new groupObject("EACH BALE DIMENSIONS", "input", [ new inputObject("single_load_width_mm", "Single load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_height_mm", "Single load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_length_mm", "Single load length", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_weight_kg", "Single load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("TOTAL LOAD DIMENSIONS", "inputWithImage", [ new inputObject("img/workingsheet-bale.jpg", "img/workingsheet-bale.jpg", "", ""), new inputObject("total_load_quantity", "Quantity of Bales", "onlyNumbers", 1, ""), new inputObject("total_load_width_mm", "L = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_height_mm", "H = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_length_mm", "P = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Total load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), /*new groupObject("Position", "select", [ new inputObject("POSV", "Vertical", "default", 0, ""), new inputObject("POSH", "Horizontal", "default", 0, ""), new inputObject("POSB", "Both", "default", 0, "") ], "total_load_position"),*/ new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 1, ""), new inputObject("SPD2", "2", "default", 1, ""), new inputObject("SPD3", "3", "default", 1, "") ], "shifts_per_day"), new groupObject("Condition of use", "select", [ new inputObject("COULight", "Light", "default", 1, ""), new inputObject("COUStd", "Std", "default", 1, ""), new inputObject("COUHeavy", "Heavy duty", "default", 1, "") ], "condition_of_use"), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 0); var paperRollClampsOrder = new orderObject("WORKING FACTORS", [ new groupObject("ROLL OF", "checkBox", [ new inputObject("load_type0", "Kraft Paper", "default", 0, ""), new inputObject("load_type1", "Newspaper", "default", 0, ""), new inputObject("load_type2", "Tissue", "default", 0, ""), new inputObject("load_type3", "Carton", "default", 0, ""), new inputObject("load_type4", "Other", "checkWithNote", 0, "") ], ""), /*new groupObject("EACH ROLL DIMENSIONS", "input", [ new inputObject("single_load_width_mm", "Single load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_height_mm", "Single load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_weight_kg", "Single load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""),*/ new groupObject("TOTAL LOAD DIMENSION", "inputWithImage", [ new inputObject("img/workingsheet-roll.jpg", "img/workingsheet-roll.jpg", "", ""), new inputObject("total_load_quantity", "Quantity of Rolls", "onlyNumbers", 1, ""), new inputObject("total_load_width_mm", "Diameters D", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_height_mm", "H = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Total load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ]), new groupObject("Position", "select", [ new inputObject("POSV", "Vertical", "default", 0, ""), new inputObject("POSH", "Horizontal", "default", 0, ""), new inputObject("POSB", "Both", "default", 0, "") ], "total_load_position"), new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 0, ""), new inputObject("SPD2", "2", "default", 0, ""), new inputObject("SPD3", "3", "default", 0, "") ], "shifts_per_day"), new groupObject("Condition of use", "select", [ new inputObject("COULight", "Light", "default", 0, ""), new inputObject("COUStd", "Std", "default", 0, ""), new inputObject("COUHeavy", "Heavy duty", "default", 0, "") ], "condition_of_use"), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 1); var cartonClampsOrder = new orderObject("FACTORS", [ new groupObject("APPLIANCES", "checkBox", [ new inputObject("load_type0", "Washing Machines", "default", 0, ""), new inputObject("load_type1", "Televisions", "default", 0, ""), new inputObject("load_type2", "Refrigerators", "default", 0, ""), new inputObject("load_type3", "Other", "checkWithNote", 0, "") ], ""), new groupObject("KIND OF PACKAGING", "checkBox", [ new inputObject("kind_of_package0", "Carton Boxes", "default", 0, ""), new inputObject("kind_of_package1", "Nylon Wrapping", "default", 0, ""), new inputObject("kind_of_package2", "Polystyrene Edge", "default", 0, ""), new inputObject("kind_of_package3", "Wooden Edge", "default", 0, "") ], ""), new groupObject("DIMENSIONS & UNIT LOAD", "inputWithImage", [ new inputObject("img/workingsheet-carton.jpg", "img/workingsheet-carton.jpg", "", ""), new inputObject("single_load_height_mm", "A = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_width_mm", "B = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_length_mm", "C = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_weight_kg", "Single load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("BOX DIMENSIONS", "input", [ new inputObject("total_load_height_mm", "D = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_width_mm", "E = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_length_mm", "F = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Total load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 0, ""), new inputObject("SPD2", "2", "default", 0, ""), new inputObject("SPD3", "3", "default", 0, "") ], "shifts_per_day"), new groupObject("Condition of use", "select", [ new inputObject("COULight", "Light", "default", 0, ""), new inputObject("COUStd", "Std", "default", 0, ""), new inputObject("COUHeavy", "Heavy duty", "default", 0, "") ], "condition_of_use"), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 2); var palletForkClampsOrder = new orderObject("WORKING FACTORS", [ new groupObject("PALLET/LOAD OF", "checkBox", [ new inputObject("load_type0", "Wood", "default", 0, ""), new inputObject("load_type1", "Metal", "default", 0, ""), new inputObject("load_type2", "Plastic", "default", 0, ""), new inputObject("load_type3", "Other", "checkWithNote", 0, "") ], ""), new groupObject("EACH PALLET/LOAD DIMENSIONS", "input", [ new inputObject("single_load_length_mm", "Single load length", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_height_mm", "Single load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_width_mm", "Single load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("single_load_weight_kg", "Single load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("TOTAL PALLET/LOAD DIMENSIONS", "input", [ new inputObject("total_load_quantity", "Quantity of Bales", "onlyNumbers", ""), new inputObject("total_load_length_mm", "Total load length", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_height_mm", "Total load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_width_mm", "Total load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Total load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("Position", "select", [ new inputObject("POSV", "Vertical", "default", 0, ""), new inputObject("POSH", "Horizontal", "default", 0, ""), new inputObject("POSB", "Both", "default", 0, "") ], "total_load_position"), new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 0, ""), new inputObject("SPD2", "2", "default", 0, ""), new inputObject("SPD3", "3", "default", 0, "") ], "shifts_per_day"), new groupObject("Condition of use", "select", [ new inputObject("COULight", "Light", "default", 0, ""), new inputObject("COUStd", "Std", "default", 0, ""), new inputObject("COUHeavy", "Heavy duty", "default", 0, "") ], "condition_of_use"), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 3); var multipalletHandlersOrder = new orderObject("WORKING FACTORS", [ new groupObject("TYPE OF LOAD", "checkBox", [ new inputObject("load_type0", "Beverage", "default", 0, ""), new inputObject("load_type1", "Brick Industry", "default", 0, ""), new inputObject("load_type2", "Cardboard Packages", "default", 0, ""), new inputObject("load_type3", "Glass Industry", "default", 0, ""), new inputObject("load_type4", "Other", "checkWithNote", 0, "") ], ""), new groupObject("NUMBER OF PALLETS", "checkBox", [ new inputObject("number_of_pallets_handled0", "1-2", "default", 0, ""), new inputObject("number_of_pallets_handled1", "1-3-6", "default", 0, ""), new inputObject("number_of_pallets_handled2", "2-4-8", "default", 0, ""), new inputObject("number_of_pallets_handled3", "Other", "checkWithNote", 0, "") ], ""), new groupObject("COMPLETE PACKAGE DIMENSION", "input", [ new inputObject("total_load_height_mm", "Total load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_length_mm", "Total load length", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_width_mm", "Total load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Total load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("SINGLE PALLET DIMENSION", "inputWithImage", [ new inputObject("img/scheda_bancale.png", "img/scheda_bancale_little.png", "", ""), new inputObject("pallet_way_width_mm", "B = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_lateral_feet_width_mm", "C = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_width_mm", "D = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_central_feet_width_mm", "A = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_length_mm", "S = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_way_height_mm", "E = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_weight_kg", "Weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("DISTANCES", "input", [ new inputObject("distance_between_pallets_mm", "Distance between the pallets", "onlyNumbersWithUnitMeasure", 1, "mm") ], ""), new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 0, ""), new inputObject("SPD2", "2", "default", 0, ""), new inputObject("SPD3", "3", "default", 0, "") ], "shifts_per_day"), new groupObject("Condition of use", "select", [ new inputObject("COULight", "Light", "default", 0, ""), new inputObject("COUStd", "Std", "default", 0, ""), new inputObject("COUHeavy", "Heavy duty", "default", 0, "") ], "condition_of_use"), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 4); var forkPositionersOrder = new orderObject("WORKING FACTORS", [ new groupObject("TYPE OF LOAD", "checkBox", [ new inputObject("load_type0", "Pallets", "default", 0, ""), new inputObject("load_type1", "Bins/Containers", "default", 0, ""), new inputObject("load_type2", "Wood panels", "default", 0, ""), new inputObject("load_type3", "Very wide panels and/or load", "default", 0, ""), new inputObject("load_type4", "Other", "checkWithNote", 0, "") ], ""), new groupObject("LOAD DIMENSIONS", "input", [ new inputObject("total_load_height_mm", "Load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_length_mm", "Load length", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_width_mm", "Load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject("PALLET DIMENSIONS", "inputWithImage", [ new inputObject("img/scheda_bancale.png", "img/scheda_bancale_little.png", "", ""), new inputObject("pallet_height_mm", "Pallet height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_length_mm", "S = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_width_mm", "D = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_side_way_width_mm", "N = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("pallet_way_width_mm", "M = ", "onlyNumbersWithUnitMeasure", 1, "mm") ], ""), new groupObject("FORK POCKETS DIMENSIONS", "input", [ new inputObject("fork_width_mm", "Fork width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("fork_height_mm", "Fork height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("fork_length_mm", "Required fork length", "onlyNumbersWithUnitMeasure", 1, "mm") ], ""), new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 0, ""), new inputObject("SPD2", "2", "default", 0, ""), new inputObject("SPD3", "3", "default", 0, "") ], "shifts_per_day"), new groupObject("Condition of use", "select", [ new inputObject("COULight", "Light", "default", 0, ""), new inputObject("COUStd", "Std", "default", 0, ""), new inputObject("COUHeavy", "Heavy duty", "default", 0, "") ], "condition_of_use"), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 5); var liftTablesOrder = new orderObject("LIFTING TABLES", [ new groupObject("LOAD DISTRIBUTION", "checkBox", [ new inputObject("load_distribution0", "even", "default", 0, ""), new inputObject("load_distribution1", "other", "checkWithNote", 0, "") ], ""), new groupObject("OVERALL DIMENSIONS", "inputWithImage", [ new inputObject("img/lift_tables_order.png", "img/lift_tables_order.png", "", ""), new inputObject("capacity_platform_kg", "Capacity Kg = ", "onlyNumbersWithUnitMeasure", 1, "kg"), new inputObject("capacity_platform_a_mm", "Platform A = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("capacity_platform_b_mm", "Platform B = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("capacity_collapsed_height_h_mm", "Collapsed height H = ", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("capacity_stroke_e_mm", "Stroke E = ", "onlyNumbersWithUnitMeasure", 1, "mm") ], ""), new groupObject("OPERATING VOLTAGE", "input", [ new inputObject("operating_voltage_v", "V = ", "onlyNumbersWithUnitMeasure", 1, ""), new inputObject("operating_voltage_hz", "Hz = ", "onlyNumbersWithUnitMeasure", 1, ""), new inputObject("operating_voltage_phase", "Phase = ", "onlyNumbersWithUnitMeasure", 1, "") ], ""), new groupObject("POWER PACK", "checkBox", [ new inputObject("power_pack0", "inside", "default", 0, ""), new inputObject("power_pack1", "outside", "default", 0, "") ], ""), new groupObject("INSTALLATION", "checkBox", [ new inputObject("installation0", "indoor", "default", 0, ""), new inputObject("installation1", "outdoor", "default", 0, "") ], ""), new groupObject("CONDITION OF USE", "input", [ new inputObject("cycles_hours", "Cycles Hours", "onlyNumbers", 1, "") ], ""), new groupObject("Shifts per day", "select", [ new inputObject("SPD1", "1", "default", 0, ""), new inputObject("SPD2", "2", "default", 0, ""), new inputObject("SPD3", "3", "default", 0, "") ], "shifts_per_day"), new groupObject("QUANTITY", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 6); var generalModuleOrder = new orderObject("WORKING FACTORS", [ new groupObject("TYPE OF LOAD", "checkBox", [ new inputObject("load_type0", "Other", "checkWithNote", 0, "") ], ""), new groupObject("LOAD DIMENSIONS", "input", [ new inputObject("total_load_height_mm", "Load height", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_length_mm", "Load length", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_width_mm", "Load width", "onlyNumbersWithUnitMeasure", 1, "mm"), new inputObject("total_load_weight_kg", "Load weight", "onlyNumbersWithUnitMeasure", 1, "kg") ], ""), new groupObject(" ", "input", [ new inputObject("required_quantity", "Required quantity", "onlyNumbers", 1, "") ], "") ], 7); var sparePartsSNOrder = new orderObject("SPARE PARTS AND USER MANUALS", [ new groupObject(" ", "input", [ new inputObject("keywords", "Serial number", "default", 1, "") ], "") ], 8); var sparePartsROrder = new orderObject("SPARE PARTS AND USER MANUALS", [ new groupObject(" ", "input", [ new inputObject("mancode", "Reference", "default", 1, "") ], "") ], 9); /* pn: portata nominale del carrello q: quota x sf: G spessore della forca bpn: baricentro della portata nominale bc: baricentro del carico w: peso attrezzatura hcg: baricentro attrezzatura ll: spessore attrezzatura */ function portataResiduaAjax(pn, q, sf, bpn, bc, w, hcg, ll) { lastC = bpn; lastQST = pn; lastX = q; lastS = sf; lastBP = bc; var needsMoreInfo = false; if (!pn) { //console && console.log("Portata nominale mancante"); needsMoreInfo = true; } if (!q) { //console && console.log("Quota mancante"); needsMoreInfo = true; } if (!sf) { //console && console.log("Spessore forca mancante"); needsMoreInfo = true; } if (!bpn) { //console && console.log("Baricentro della portata nominale mancante"); needsMoreInfo = true; } if (!bc) { //console && console.log("Baricentro del carico mancante"); needsMoreInfo = true; } if (!w) { //console && console.log("Peso attrezzatura mancante"); needsMoreInfo = true; } if (!hcg) { //console && console.log("Baricentro attrezzatura mancante"); needsMoreInfo = true; } if (!ll) { //console && console.log("Spessore attrezzatura mancante"); needsMoreInfo = true; } if (needsMoreInfo) { alert("Invalid or missing data"); return 0; } //pn = parseInt(pn); //q = parseInt(q); //sf = parseInt(sf); //bpn = parseInt(bpn); //bc = parseInt(bc); //w = parseInt(w); //hcg = parseInt(hcg); //ll = parseInt(ll); $.post("get_portata_residua.php", { qst: pn, x: q, s: sf, c: bpn, bp: bc, w1: w, hcg1: hcg, ll1: ll, suffisso: "_uk" }, function(data,status){ //alert(data); document.getElementById("result").innerHTML = data; } ); } function portataResidua(pn, q, sf, bpn, bc, w, hcg, ll) { lastC = bpn; lastQST = pn; lastX = q; lastS = sf; lastBP = bc; var needsMoreInfo = false; if (!pn) { //console && console.log("Portata nominale mancante"); needsMoreInfo = true; } if (!q) { //console && console.log("Quota mancante"); needsMoreInfo = true; } if (!sf) { //console && console.log("Spessore forca mancante"); needsMoreInfo = true; } if (!bpn) { //console && console.log("Baricentro della portata nominale mancante"); needsMoreInfo = true; } if (!bc) { //console && console.log("Baricentro del carico mancante"); needsMoreInfo = true; } if (!w) { //console && console.log("Peso attrezzatura mancante"); needsMoreInfo = true; } if (!hcg) { //console && console.log("Baricentro attrezzatura mancante"); needsMoreInfo = true; } if (!ll) { //console && console.log("Spessore attrezzatura mancante"); needsMoreInfo = true; } if (needsMoreInfo) { alert("Invalid or missing data"); return 0; } pn = parseInt(pn); q = parseInt(q); sf = parseInt(sf); bpn = parseInt(bpn); bc = parseInt(bc); w = parseInt(w); hcg = parseInt(hcg); ll = parseInt(ll); var result = Math.round(((pn * (q + bpn)) - (w * (q + hcg - sf))) / (q - sf + ll + bc)); return result; } function calcFormObj(title, inputList) { this.title = title; this.inputList = inputList; } var calcDivisionList = [truckObj, forkObj, loadObj]; function parseXML(rawString) { var parsedXML; if (window.DOMParser) { var parser = new DOMParser(); parsedXML = parser.parseFromString(rawString, "text/xml"); } else {// Internet Explorer parsedXML = new ActiveXObject("Microsoft.XMLDOM"); parsedXML.async = false; parsedXML.loadXML(rawString); } return parsedXML; } var lastFamiliesList = []; function family(id, description, image) { this.id = id; this.description = description; this.image = image; } function loadFamilies() { var families = []; $.getJSON("get_families.php", function (data) { for (var i = 0; i < data.length; i++) { var oneFamily = data[i]; families.push(new family(oneFamily.id,oneFamily.name_uk,oneFamily.image)); } lastFamiliesList = families; populateFamiliesLevel(families); }).error(function (error) { animating = false; console.log(error); }); } var lastCategoriesList = []; function category(id, description,image) { this.id = id; this.description = description; this.image = image; } function loadCategories(familyId) { var categories = []; lastChosenFamilyId = familyId; $.getJSON("get_categories.php", { family_id: familyId }, function (data) { for (var i = 0; i < data.length; i++) { var oneCategorty = data[i]; categories.push(new category(oneCategorty.id,oneCategorty.name_uk,oneCategorty.image)); } lastCategoriesList = categories; populateCategoriesLevel(categories); }).error(function (error) { clearChosenFromButtons("familiesList"); animating = false; lastChosenFamilyId = -1; console.log(error); }); } var lastProductsReceived = []; function loadProducts(categoryId) { var products = []; lastChosenCategoryId = categoryId; $.getJSON("get_products.php", { category_id: categoryId }, function (data) { for (var i = 0; i < data.length; i++) { var oneProduct = data[i]; products.push(oneProduct); } lastProductsReceived = products; populateProductsLevel(products); }).error(function (error) { clearChosenFromButtons("categoriesList"); animating = false; lastChosenCategoryId = -1; console.log("ERROR"); console.log(error); }); } function loadAllProductsForWorksheets() { var products = []; $.getJSON("get_all_products.php", { }, function (data) { for (var i = 0; i < data.length; i++) { var oneProduct = data[i]; products.push(oneProduct); } allProductsList = products; //console.log(allProductsList); fillProductsSelect(); }).error(function (error) { console.log("ERROR"); console.log(error); }); } var lastModelsList = []; //legge l'elenco dei prodotti (della categoria della famiglia function loadModels(productId) { //alert("product: " + productId); var models = []; lastChosenProductId = productId; $.getJSON("get_models.php", { product_id: productId }, function (data) { for (var i = 0; i < data.length; i++) { var oneModel = data[i]; models.push(oneModel); } lastModelsList = models; populateOneProductLevel(productId); }).error(function (error) { lastChosenProductId = -1; animating = false; console.log("ERROR"); console.log(error); }); } //legge le varianti del prodotti function getFamilyDetails(familyId, fillInOrdersPage, orderId) { $.getJSON("get_family_details.php", { family_id: familyId }, function (data) { if (fillInOrdersPage) { fillFamilyDetailsInOrdersPage(data[0], orderId); } }).error(function (error) { console.log("ERROR"); console.log(error); }); } function getProductDetails(productId, fillInOrdersPage, orderId) { alert("product detail: " + productId); $.getJSON("get_product_details.php", { product_id: productId }, function (data) { if (fillInOrdersPage) { fillProductDetailsInOrdersPage(data[0], orderId); } }).error(function (error) { console.log("ERROR"); console.log(error); }); } function getModelDetails(modelId, fillInOrdersPage, orderId) { $.getJSON("get_model_details.php", { model_id: modelId }, function (data) { if (fillInOrdersPage) { fillModelDetailsInOrdersPage(data[0], orderId); } }).error(function (error) { console.log("ERROR"); console.log(error); }); } function orderToSendObject( family_id, product_id, model_id, customer_country, customer_name, customer_phone, customer_address, customer_email, customer_timezone, customer_locale, customer_forklift_brand, customer_forklift_model, customer_forklift_capacity_kg, customer_forklift_plug_type) { this.family_id = family_id; this.product_id = product_id; this.model_id = model_id; this.customer_country = customer_country; this.customer_name = customer_name; this.customer_phone = customer_phone; this.customer_address = customer_address; this.customer_email = customer_email; this.customer_timezone = customer_timezone; this.customer_locale = customer_locale; this.customer_forklift_brand = customer_forklift_brand; this.customer_forklift_model = customer_forklift_model; this.customer_forklift_capacity_kg = customer_forklift_capacity_kg; this.customer_forklift_plug_type = customer_forklift_plug_type; } function detailsToSendObject(load_type, kind_of_package, single_load_height_mm, single_load_length_mm, single_load_width_mm, single_load_weight_kg, total_load_quantity, total_load_position, total_load_length_mm, total_load_height_mm, total_load_width_mm, total_load_weight_kg, shifts_per_day, condition_of_use, required_quantity, order_note, pallet_height_mm, pallet_width_mm, pallet_length_mm, pallet_side_way_width_mm, pallet_way_width_mm, pallet_weight_kg, pallet_lateral_feet_width_mm, pallet_central_feet_width_mm, pallet_way_height_mm, distance_between_pallets_mm, number_of_pallets_handled, fork_height_mm, fork_width_mm, required_fork_length_mm, capacity_kg, capacity_a_mm, capacity_b_mm, capacity_h_mm, capacity_s_mm, operating_v, operating_hz, operating_ph, load_distribution, power_pack, installation, cycles_h) { this.load_type = load_type; this.kind_of_package = kind_of_package; this.single_load_height_mm = single_load_height_mm; this.single_load_length_mm = single_load_length_mm; this.single_load_width_mm = single_load_width_mm; this.single_load_weight_kg = single_load_weight_kg; this.total_load_quantity = total_load_quantity; this.total_load_position = total_load_position; this.total_load_length_mm = total_load_length_mm; this.total_load_height_mm = total_load_height_mm; this.total_load_width_mm = total_load_width_mm; this.total_load_weight_kg = total_load_weight_kg; this.shifts_per_day = shifts_per_day; this.condition_of_use = condition_of_use; this.required_quantity = required_quantity; this.order_note = order_note; this.pallet_height_mm = pallet_height_mm; this.pallet_width_mm = pallet_width_mm; this.pallet_length_mm = pallet_length_mm; this.pallet_side_way_width_mm = pallet_side_way_width_mm; this.pallet_way_width_mm = pallet_way_width_mm; this.pallet_weight_kg = pallet_weight_kg; this.pallet_lateral_feet_width_mm = pallet_lateral_feet_width_mm; this.pallet_central_feet_width_mm = pallet_central_feet_width_mm; this.pallet_way_height_mm = pallet_way_height_mm; this.distance_between_pallets_mm = distance_between_pallets_mm; this.number_of_pallets_handled = number_of_pallets_handled; this.fork_height_mm = fork_height_mm; this.fork_width_mm = fork_width_mm; this.required_fork_length_mm = required_fork_length_mm; this.capacity_platform_kg = capacity_kg; this.capacity_platform_a_mm = capacity_a_mm; this.capacity_platform_b_mm = capacity_b_mm; this.capacity_collapsed_height_h_mm = capacity_h_mm; this.capacity_stroke_e_mm = capacity_s_mm; this.operating_voltage_v = operating_v; this.operating_voltage_hz = operating_hz; this.operating_voltage_phase = operating_ph; this.load_distribution = load_distribution; this.power_pack = power_pack; this.installation = installation; this.cycles_hours = cycles_h; } function detailsToSendSPObject(keywords, mancode) { this.keywords = keywords; this.mancode = mancode; } function sendSPSearch(keywords,mancode) { var myform1 = '
'; var myform2 = ''; var myform3 = ''; var myform4 = ''; var myform5 = '
'; var myform = myform1 + myform2 + myform3 + myform4 + myform5; $(myform).appendTo('body').submit(); composingOrSending = false; } function sendOrder(orderObj, detailsObj) { console.log(orderObj); console.log(detailsObj); // return; $.post("insert_order.php", { order: JSON.stringify(orderObj), order_details: JSON.stringify(detailsObj) }, function(data) { composingOrSending = false; alert("Request successfully sent"); //console.log(data); animating = true; if (typeof worksheetPage === 'undefined') { changeStateDispatcher("initial"); } else { backToWorksheetChoice(); } }).error(function(error) { composingOrSending = false; // console.log("[sendOrder] ERRORE!!"); // console.log(error); alert(error.responseText); }); } var lastOrderList = null; function loadOrders() { $.getJSON("get_orders.php", function(data) { lastOrderList = data; if (lastOrderList.length === 0) { alert("No requests to show"); } else { drawOrdersForUser(); } }).error(function(error) { console.log("[loadOrders] ERRORE!!"); console.log(error); }); } function loadOrderDetails(orderId, caller) { $.getJSON("get_order_details.php", { order_id: orderId }, function(data) { fillOrderDetails(data[0], caller); }).error(function(error) { console.log("[loadOrderDetails] ERRORE!!"); console.log(error); }); }