Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /coca/genuinecarparts/include/localization.inc.php on line 2
function debug(v) { alert(isc.echoAll(v)); } function pad(number, length) { var str = '' + number; while (str.length < length) { str = '0' + str; } return str; } isc.RestDataSource.addProperties({ disableQueuing: true }); isc.DateItem.addProperties({ startDate: new Date(1970, 0, 1), endDate: new Date(2050, 11, 31) }); isc.ListGrid.addProperties({ leaveScrollbarGap:false, canDragSelectText:true, warnOnRemoval: true, warnOnRemovalMessage: "Are you sure you want to delete this record?" }); isc.DynamicForm.addProperties({ requiredTitlePrefix: "", requiredTitleSuffix: " :*" }); isc.Canvas.addProperties({ canSelectText:false }); Date.setInputFormat('YMD'); Date.setShortDisplayFormat(function () { return this.getFullYear() + "-" + (this.getMonth() + 1).stringify() + "-" + this.getDate().stringify(); }); Date.setNormalDisplayFormat(function () { return this.getFullYear() + "-" + (this.getMonth() + 1).stringify() + "-" + this.getDate().stringify() + " " + this.getHours().stringify() + ":" + this.getMinutes().stringify(); }); function strComp(a, b){ var abc = "-aábcdeéfghiíjklmnoóöőpqrstuúüűvwxyz"; var ABC = "-AÁBCDEÉFGHIÍJKLMNOÓÖŐPQRSTUÚÜŰVWXYZ"; var len_abc = abc.length; var len_a = a.length; var len_b = b.length; for (var n = 0; n < len_a && n < len_b; n++){ for (var k = 0; k < len_abc; k++){ if (a.charAt(n) == abc.charAt(k) || a.charAt(n) == ABC.charAt(k)){ var loc_a = k; } if (b.charAt(n) == abc.charAt(k) || b.charAt(n) == ABC.charAt(k)){ var loc_b = k; } } if (loc_a > loc_b){ return 1; } if (loc_a < loc_b){ return -1; } } if (len_a > len_b){ return 1; } if (len_a < len_b){ return -1; } return 0; } function sortValueMap (map) { var mapValues = isc.getValues(map); mapValues.sort(strComp); var newMap = {}; for (var i = 0; i < mapValues.length; i++) { newMap[isc.getKeyForValue(mapValues[i],map)] = mapValues[i]; } return newMap; } function newTab(tabSet,component,title,name) { if (!name) { var name = ''; } var newtab = tabSet.addTab({ canClose: true, title: title, pane: component, name: name }); tabSet.selectTab(newtab); return tabSet.getTab(newtab); } isc.ClassFactory.defineClass("ImageItem", "CanvasItem"); isc.ImageItem.addProperties({ src:'../../images/spacer.gif', init:function () { var ref = this; this.canvas = isc.Img.create({ autoDraw:false, src:ref.src, width:ref.width, height:ref.height }); return this.Super("init", arguments); }, setImgSrc: function(url) { this.canvas.setSrc(url); } }); isc.ClassFactory.defineClass("MultiFileUploadItem", "CanvasItem"); isc.MultiFileUploadItem.addProperties({ shouldSaveValue: false, iframeWidth: "100%", iframeHeight: 100, init:function () { var ref = this; var params = ''; if (this.params) { params = $.toJSON(this.params); } var iframeName = this.getID()+"_Iframe"; this.canvas = isc.VStack.create({ styleName: "textItem", autoDraw: false, members: [ isc.DynamicForm.create({ autoDraw:false, numCols: 2, action: "file_upload.php", target: iframeName, encoding: "multipart", fields: [ {name:"file",type:"upload", showTitle:false, colSpan:1, endRow: false, width:190, change: function(form, item, value, oldValue) { if (value!=null) { form.getField('progress').setImgSrc('../../images/icons/upload_progress.gif'); form.submitForm(); form.getField('file').setValue(null); } } }, {name:"progress", type:"ImageItem", showTitle:false, width:18, height:18}, {name:"params", type:"text",editorType:"hidden",defaultValue:params}, {name:"session_id", type:"text", editorType:"hidden"}, {name:"progressitem", type:"text", editorType:"hidden", defaultValue: this.getID()} ] }), isc.Canvas.create({ autoDraw: false, height:ref.iframeHeight, contents: '' }) ] }); return this.Super("init", arguments); }, reset: function(query_string) { var ref = this; var iframeName = this.getID()+"_Iframe"; try { document.getElementById(iframeName).src = "file_upload.php?"+query_string; } catch(err) { } this.canvas.members[0].getField("file").setValue(null); } }); Date.setShortDisplayFormat(function () { return this.getFullYear() + "-" + (this.getMonth() + 1).stringify() + "-" + this.getDate().stringify(); }); Date.prototype.today=function(){ var dd=this.getDate(); if(dd<10)dd='0'+dd; var mm=this.getMonth()+1; if(mm<10)mm='0'+mm; var yyyy=this.getFullYear(); return String(yyyy+"-"+mm+"-"+dd); } function number_format( number, decimals, dec_point, thousands_sep ) { // http://kevin.vanzonneveld.net // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfix by: Michael White (http://crestidg.com) // + bugfix by: Benjamin Lupton // + bugfix by: Allan Jensen (http://www.winternet.no) // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) // * example 1: number_format(1234.5678, 2, '.', ''); // * returns 1: 1234.57 var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; var d = dec_point == undefined ? "," : dec_point; var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : ""; var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); } function jog(jogkod) { if (typeof(eval('userRights.'+jogkod))!='undefined') { if (eval('userRights.'+jogkod)==1) { return true; } else { return false; } } else { return false; } } // ListGrid jogok utólagos állítása, ha kellene function listgrid_jogok(listgrid, edit, remove) { if (edit==true) { listgrid.canEdit = true; } else { listgrid.canEdit = false; } if (listgrid.isDrawn()==true) { var fields = listgrid.getAllFields(); if (listgrid.canRemoveRecords==true) { if (remove==true) { listgrid.showField(fields[fields.length-1]); } else { listgrid.hideField(fields[fields.length-1]); } } } } function addSeparatorsNF(value) { var inD = '.'; var outD = '.'; var sep = ' '; var nStr = String(value).replace(/\s/g,""); var dpos = nStr.indexOf(inD); var nStrEnd = ''; if (dpos != -1) { nStrEnd = outD + nStr.substring(dpos + 1, nStr.length); nStr = nStr.substring(0, dpos); } var rgx = /(\d+)(\d{3})/; while (rgx.test(nStr)) { nStr = nStr.replace(rgx, '$1' + sep + '$2'); } value = nStr + nStrEnd; return value; } isc.ClassFactory.defineClass("CurrencyItem", "TextItem"); isc.CurrencyItem.addProperties({ changed: function(form, item, value) { var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if (!is_chrome) { item.setValue(value); } }, parseEditorValue: function (value, record, form, item) { return value.replace(/ /g,""); }, formatEditorValue: function (value, record, form, item) { if (typeof(value)!="undefined") { if (value != null) { return addSeparatorsNF(value); } else { return ""; } } } }); isc.SimpleType.create({ name: "currency", inheritsFrom: "text", editorType: "CurrencyItem" }); function nl2br(str) { if (str) { return str.replace(/\n/g,'
'); } else { return ''; } } isc.RestDataSource.create({ ID: "keresoTileGrid_DS", fetchDataURL: "interface.php?op=brands", operationBindings: [ {operationType: 'fetch', dataProtocol: 'postXML'} ], fields: [ {name: "id", primaryKey: true}, {name: "name"}, {name: "logo"}, {name: "image"}, {name: "tooltip"} ] }); isc.RestDataSource.create({ ID: "searchListGrid_DS", fetchDataURL: "interface.php?op=search", operationBindings: [ {operationType: 'fetch', dataProtocol: 'postXML'} ], fields: [ {name: "item_id", primaryKey: true}, {name: "part_number"}, {name: "description"}, {name: "orig_list_price", type: "float"}, {name: "purchase_price", type: "float"}, {name: "price_without_tax", type: "float"}, {name: "original_number"} ] }); isc.RestDataSource.create({ ID: "cartListGrid_DS", fetchDataURL: "interface.php?op=cart_fetch", addDataURL: "interface.php?op=cart_change", updateDataURL: "interface.php?op=cart_change", removeDataURL: "interface.php?op=cart_change", operationBindings: [ {operationType: 'fetch', dataProtocol: 'postXML'}, {operationType: 'add', dataProtocol: 'postXML'}, {operationType: 'update', dataProtocol: 'postXML'}, {operationType: 'remove', dataProtocol: 'postXML'} ], fields: [ {name: "part_id", primaryKey: true}, {name: "part_number"}, {name: "description"}, {name: "price_without_tax", type: "float"}, {name: "pcs"}, {name: "price_sum", type: "float"} ] }); isc.RestDataSource.create({ ID: "regModDForm_DS", fetchDataURL: "interface.php?op=customer_fetch", addDataURL: "interface.php?op=registration", updateDataURL: "interface.php?op=customer_update", operationBindings: [ {operationType: 'fetch', dataProtocol: 'postXML'}, {operationType: 'add', dataProtocol: 'postXML'}, {operationType: 'update', dataProtocol: 'postXML'}, ], fields: [ {name: "name"}, {name: "login_name"}, {name: "contact_name"}, {name: "area_code"}, {name: "city"}, {name: "address"}, {name: "tax_number"}, {name: "phone"} ] }); isc.RestDataSource.create({ ID: "quotationDForm_DS", addDataURL: "interface.php?op=quotation_add", operationBindings: [ {operationType: 'add', dataProtocol: 'postXML'}, ], fields: [ {name: "partner_name"}, {name: "phone"}, {name: "email_address"}, {name: "brand_id"}, {name: "modell"}, {name: "modell_year"}, {name: "vin"}, {name: "motor_nr"}, {name: "parts_nr"}, {name: "pcs"}, {name: "description"} ] }); isc.RestDataSource.create({ ID: "changePwdDForm_DS", updateDataURL: "interface.php?op=change_password", operationBindings: [ {operationType: 'update', dataProtocol: 'postXML'}, ], fields: [ {name: "password_old"}, {name: "password_new"} ] }); isc.Img.create({ autoDraw: false, ID: "logoImg", src: "logo.png", imageType: "normal", imageWidth: 300 }); isc.DynamicForm.create({ autoDraw: false, ID: "loginForm", visibility: "hidden", numCols: 7, width: 530, submit: function() { this.getField("submit").click(); }, saveOnEnter: true, fields: [ { name: "username", title: "Login", type: "text", width: 100, titleStyle: "loginTitle", required: true }, { name: "password", showTitle: false, type: "password", width: 100, required: true }, { name: "submit", type: "button", title: "OK", width: 40, startRow: false, endRow: false, click: function() { if (this.form.validate()) { var post_body = "" + this.form.getValue("username") + "" + this.form.getValue("password") + ""; $.ajax({ type: "POST", url: "interface.php?op=login", data: post_body, success: function(data) { if ($(data).find("status").text() == "0") { if ($(data).find("loginOk").text() == "true") { if ($(data).find("admin").text() == "0") { searchListGrid.getField("purchase_price").showIf = "false"; searchListGrid.getField("orig_list_price").showIf = "false"; } preLoginContentHTMLFlow.hide(); markakHLayout.show(); keresoHLayout.show(); quotationSectionStack.hide(); regModSectionStack.hide(); keresoSectionStack.show(); var name = $(data).find("name").text(); var login_name = $(data).find("login_name").text(); var phone = $(data).find("phone").text(); quotationDForm1.getField("partner_name").setValue(name); quotationDForm1.getField("phone").setValue(phone); quotationDForm1.getField("email_address").setValue(login_name); loginForm.hide(); bejelentkezettLabel.setContents("Logged in: " + name); bejelentkezettHLayout.show(); searchDForm.getField("part_number").setDisabled(false); searchDForm.getField("search").setDisabled(false); cartListGrid.fetchData(); activateButton(bejelentkezettHLayoutSearchButton); } else { isc.warn("Incorrect login data!"); } } else if ($(data).find("status").text() == "-1") { isc.warn($(data).find("data").text()); } }, dataType: "xml", contentType: "text/xml", processData: false }); } } }, { name: "registration", type: "button", baseStyle: "gcpmenu", title: "Registration", startRow: false, endRow: false, click: function() { preLoginContentHTMLFlow.hide(); keresoHLayout.show(); initRegMod("reg"); activateButton(this); } }, { name: "quotations", type: "button", baseStyle: "gcpmenu", title: "Quotations", startRow: false, click: function() { preLoginContentHTMLFlow.hide(); keresoHLayout.show(); initQuotations(); activateButton(this); } } ] }); function initRegMod(func) { switch (func) { case "reg": regModSectionStack.getSection(0).setTitle("Registration"); regModDForm.mode = "add"; regModDForm.getField("change_password_link").hide(); break; case "mod": regModSectionStack.getSection(0).setTitle("Data modification"); regModDForm.fetchData(); regModDForm.mode = "update"; regModDForm.getField("change_password_link").show(); break; } quotationSectionStack.hide(); keresoSectionStack.hide(); regModSectionStack.show(); } isc.HStack.create({ autoDraw: false, ID: "flagsHStack", membersMargin: 5, width: 76, height: 35, members: [ /* isc.Img.create({ autoDraw: false, src: "flags/hu_HU.png", width: 22, height: 22, cursor: "pointer", click: function() { window.location = "index.php?locale=hu_HU"; }, layoutAlign: "center" }), */ isc.Img.create({ autoDraw: false, src: "flags/en_US.png", width: 22, height: 22, cursor: "pointer", click: function() { window.location = "index.php?locale=en_US"; }, layoutAlign: "center" }), isc.Img.create({ autoDraw: false, src: "flags/fr_FR.png", width: 22, height: 22, cursor: "pointer", click: function() { window.location = "index.php?locale=fr_FR"; }, layoutAlign: "center" }) ] }); isc.Label.create({ ID: "bejelentkezettLabel", autoDraw: false, autoFit: true, height: 22, wrap: false, styleName: "bejelentkezett", layoutAlign: "center" }); function initQuotations() { keresoSectionStack.hide(); regModSectionStack.hide(); quotationSectionStack.show(); //quotationDForm1.clearValues(); quotationDForm2.clearValues(); quotationListGrid.setData([{description: '', pcs: 1}]); } function activateButton(item) { loginForm.getField("registration").button.setBaseStyle("gcpmenu"); loginForm.getField("quotations").button.setBaseStyle("gcpmenu"); bejelentkezettHLayoutSearchButton.setBaseStyle("gcpmenu"); bejelentkezettHLayoutDataModButton.setBaseStyle("gcpmenu"); bejelentkezettHLayoutQuotationsButton.setBaseStyle("gcpmenu"); if (typeof(item.setBaseStyle) == "undefined") { item.button.setBaseStyle("gcpmenuActive"); } else { item.setBaseStyle("gcpmenuActive"); } } isc.HLayout.create({ ID: "bejelentkezettHLayout", autoDraw: false, width: 560, height: 35, defaultLayoutAlign: "right", visibility: "hidden", members: [ bejelentkezettLabel, isc.LayoutSpacer.create({width: 10}), isc.IButton.create({ ID: "bejelentkezettHLayoutSearchButton", autoDraw: false, autoFit: true, baseStyle: "gcpmenu", layoutAlign: "center", title: "Search", click: function() { quotationSectionStack.hide(); regModSectionStack.hide(); keresoSectionStack.show(); activateButton(this); } }), isc.LayoutSpacer.create({width: 10}), isc.IButton.create({ ID: "bejelentkezettHLayoutDataModButton", autoDraw: false, autoFit: true, baseStyle: "gcpmenu", layoutAlign: "center", title: "Data modification", click: function() { initRegMod("mod"); activateButton(this); } }), isc.LayoutSpacer.create({width: 10}), isc.IButton.create({ ID: "bejelentkezettHLayoutQuotationsButton", autoDraw: false, autoFit: true, baseStyle: "gcpmenu", layoutAlign: "center", title: "Quotations", click: function() { initQuotations(); activateButton(this); } }), isc.LayoutSpacer.create({width: 10}), isc.IButton.create({ autoDraw: false, autoFit: true, layoutAlign: "center", title: "Logout", click: function() { var post_body = ""; $.ajax({ type: "POST", url: "interface.php?op=logout", data: post_body, success: function(data) { if ($(data).find("status").text() == "0") { location.reload(); } else if ($(data).find("status").text() == "-1") { isc.warn($(data).find("data").text()); } }, dataType: "xml", contentType: "text/xml", processData: false }); } }) ] }); isc.HLayout.create({ autoDraw: false, ID: "topHLayout", width: "100%", height: 100, padding: 15, membersMargin: 20, members: [ logoImg, isc.LayoutSpacer.create(), loginForm, bejelentkezettHLayout, flagsHStack ] }); isc.TileGrid.create({ autoDraw: false, ID: "keresoTileGrid", dataSource: "keresoTileGrid_DS", autoFetchData: true, initialCriteria: { with_parts: true, webshop: true }, width: 944, expandMargins: false, layoutAlign: "center", tileMargin: 2, tileSize: 70, showEdges: false, selectionType: "single", recordClick: function (viewer, tile, record) { var img = new Image(); img.onload = function() { nagykepImg.hide(); nagykepImg.setWidth(this.width); nagykepImg.setHeight(this.height); nagykepImg.setSrc("brands/" + record.image); nagykepImg.show(); } img.src = Page.getImgURL() + "brands/" + record.image; }, getTileHTML: function(record) { var tileHTML = this.Super("getTileHTML", arguments); var tooltip = record.tooltip; if (typeof tooltip != "undefined") { return "
" + tileHTML + "
"; } else { return tileHTML; } }, fields: [ { name: "logo", type: "image", imageURLPrefix: "brands/" } ] }); isc.HLayout.create({ autoDraw: false, ID: "markakHLayout", visibility: "hidden", width: "100%", height: 152, align: "center", styleName: "gradient", members: [ keresoTileGrid ] }); isc.Img.create({ autoDraw: false, ID: "nagykepImg", imageType: "normal", src: "spacer.gif", layoutAlign: "center" }); isc.DynamicForm.create({ autoDraw: false, ID: "searchDForm", width: 520, numCols: 3, submit: function() { this.getField("search").click(); }, saveOnEnter: true, fields: [ { name: "part_number", type: "text", title: "Part number", width: 200, disabled: true }, { name: "search", title: "Search", type: "button", startRow: false, disabled: true, click: function() { if (typeof keresoTileGrid.getSelectedRecord() == "undefined") { isc.warn("Please choose a brand!"); } else if (typeof this.form.getValue("part_number") == "undefined") { isc.warn("Please fill in the Part number!"); } else { var brand_id = keresoTileGrid.getSelectedRecord().id; var part_number = this.form.getValue("part_number"); searchListGrid.fetchData({brand_id: brand_id, part_number: part_number}, function (dsResponse, data, dsRequest) { if (data.length > 0) { searchDForm2.getField("tocart").setDisabled(false); searchListGrid.selectRecord(0); searchListGrid.updateDetails(); } else { searchDForm2.getField("tocart").setDisabled(true); } }); } } } ] }); isc.ListGrid.create({ autoDraw: false, ID: "searchListGrid", dataSource: "searchListGrid_DS", canEdit: false, autoFetchData: false, formatCellValue: function(value, record, rowNum, colNum) { var colName = this.getField(colNum).name; switch (colName) { case 'price_without_tax': case 'purchase_price': case 'orig_list_price': return value + "€"; break; default: return value; break; } }, recordClick: "this.updateDetails()", updateDetails: function() { var record = this.getSelectedRecord(); searchDForm2.setData(record); }, fields: [ { name: "part_number", title: "Part number", type: "text", width: 110 }, { name: "description", title: "Description", type: "text" }, { name: "orig_list_price", title: "List price", type: "float", width: 135 }, { name: "purchase_price", title: "Purchase price", type: "float", width: 135 }, { name: "price_without_tax", title: "Price Without Tax", type: "float", width: 135 } ] }); isc.DynamicForm.create({ autoDraw: false, ID: "searchDForm2", numCols: 5, colWidths: [100,"*",30,50,60], fields: [ { name: "original_number", title: "Original number", type: "text", canEdit: false, wrapTitle: false }, { name: "pcs", title: "Pcs", editorType: "spinner", defaultValue: 1, step: 1, min: 1, width: 50 }, { name: "tocart", title: "To cart", type: "button", startRow: false, align: "right", disabled: true, click: function() { var newData = searchListGrid.getRecord(0); newData.pcs = searchDForm2.getValue("pcs"); cartListGrid.addData(newData, function (dsResponse, data, dsRequest) { if (dsResponse.status == 0) { searchDForm.clearValues(); searchListGrid.setData(Array()); } }); } } ] }); isc.VLayout.create({ autoDraw: false, ID: "searchVLayout", membersMargin: 5, padding: 5, members: [ searchDForm, searchListGrid, searchDForm2 ] }); isc.ListGrid.create({ autoDraw: false, ID: "cartListGrid", dataSource: "cartListGrid_DS", autoFetchData: false, canEdit: true, canRemoveRecords: true, removeFieldProperties: { width: 25 }, editEvent: "click", modalEditing: true, alternateRecordStyles: true, dataChanged: function() { cartDForm.getField("order").setDisabled(cartListGrid.data.getLength() == 0); this.recalculateSummaries(); }, formatCellValue: function(value, record, rowNum, colNum) { var colName = this.getField(colNum).name; switch (colName) { case 'price_without_tax': case 'price_sum': return value + "€"; break; default: return value; break; } }, showGridSummary: true, fields: [ { name: "part_number", title: "Part number", type: "text", canEdit: false, showGridSummary: false, width: 110 }, { name: "description", title: "Description", type: "text", canEdit: false, showGridSummary: false }, { name: "price_without_tax", title: "Price Without Tax", type: "float", width: 135, canEdit: false, showGridSummary: false }, { name: "pcs", title: "Pcs", type: "integer", width: 50, required: true, canEdit: true, showGridSummary: false, validators: [ {type:"integerRange", min:1} ] }, { name: "price_sum", title: "Summary", type: "float", width: 110, canEdit: false, showGridSummary: true, formatGridSummary: function(value) { return number_format(value, 2, ".", "") + "€"; } } ] }); isc.DynamicForm.create({ autoDraw: false, ID: "cartDForm", layoutAlign: "right", numCols: 4, colWidths: [0, "*", 0, 100], fields: [ { linkTitle: "cgv", editorType: "LinkItem", value: "http://genuinecarparts.eu/cgv.pdf", showTitle: false, cellStyle: "gcpLink" }, { name: "terms", title: "I accept the terms and conditions", type: "boolean", align: "right" }, { name: "order", title: "Order", type: "button", startRow: false, align: "right", disabled: true, click: function() { if (cartDForm.getValue("terms") !== true) { isc.warn("Please accept the terms and conditions!"); return; } var post_body = ""; $.ajax({ type: "POST", url: "interface.php?op=place_order", data: post_body, success: function(data) { if ($(data).find("status").text() == "0") { searchDForm.clearValues(); searchDForm2.clearValues(); cartDForm.clearValues(); searchListGrid.setData(Array()); cartListGrid.invalidateCache(); cartListGrid.fetchData(); isc.say("Your order was successful!"); } else if ($(data).find("status").text() == "-1") { isc.warn($(data).find("data").text()); } }, dataType: "xml", contentType: "text/xml", processData: false }); } } ] }); isc.VLayout.create({ autoDraw: false, ID: "cartVLayout", membersMargin: 5, padding: 5, members: [ cartListGrid, cartDForm ] }); isc.DynamicForm.create({ ID: "changePwdDForm", autoDraw: false, dataSource: "changePwdDForm_DS", wrapItemTitles: false, fields: [ { name: "password_old", type: "password", title: "Old password", required: true, defaultValue: "" }, { name: "password_new", type: "password", title: "New password", required: true, defaultValue: "" }, { name: "password_new", type: "password", title: "New password again", required: true, defaultValue: "" }, { type: "toolbar", width: 150, align: "center", buttons: [ { type: "button", title: "Submit", click: function() { if (changePwdDForm.validate()) { changePwdDForm.setSaveOperationType = "update"; changePwdDForm.submit( function (dsResponse, data, dsRequest) { if (dsResponse.status == 0) { isc.say("Successful password modification!", function() { changePwdDForm.clearValues(); changePwdWindow.hide(); }, {isModal: true, showModalMask: true}); } } ); } } }, { name: "cancel", title: "Cancel", click: function() { changePwdDForm.clearValues(); changePwdWindow.hide(); } } ] } ] }); isc.Window.create({ title: "Change password", ID: "changePwdWindow", autoDraw: false, isModal: true, showModalMask: true, autoCenter: true, autoSize: true, items: [ changePwdDForm ], closeClick: function() { changePwdDForm.clearValues(); changePwdWindow.hide(); } }); isc.DynamicForm.create({ autoDraw: false, ID: "quotationDForm1", /* dataSource: "quotationDForm_DS", autoFetchData: false, */ wrapItemTitles: false, width: "100%", padding: 5, fields: [ { name: "partner_name", type: "text", title: "Partner", required: true, width: 200 }, { name: "phone", type: "text", title: "Phone", required: false, width: 200 }, { name: "email_address", type: "text", title: "E-mail", required: true, width: 200, validators: [ { type: "regexp", expression: "^([a-zA-Z0-9_.%\\-+])+@(([a-zA-Z0-9.\\-])+\\.)+[a-zA-Z0-9]{2,64}$" } ] } ] }); isc.DynamicForm.create({ autoDraw: false, ID: "quotationDForm2", /* dataSource: "quotationDForm_DS", autoFetchData: false, */ wrapItemTitles: false, width: "100%", padding: 5, fields: [ { name: "brand_id", type: "text", title: "Brand", required: false, allowEmptyValue: true, optionDataSource: "keresoTileGrid_DS", valueField: "id", displayField: "name", sortField: 1, width: 200 }, { name: "modell", type: "text", title: "Modell", required: true, width: 200 }, { name: "modell_year", type: "integer", title: "Modell year", required: false, width: 80 }, { name: "vin", type: "text", title: "VIN", required: true, width: 200 }, { name: "motor_nr", type: "text", title: "Motor nr.", required: false, width: 200 } ] }); isc.DynamicForm.create({ autoDraw: false, ID: "quotationDForm3", /* dataSource: "quotationDForm_DS", autoFetchData: false, */ wrapItemTitles: false, width: "100%", padding: 5, fields: [ { type: "toolbar", align: "center", width: 90, buttons: [ { name: "submit", title: "Submit", click: function() { if (quotationDForm1.validate() && quotationDForm2.validate() && quotationListGrid.validate()) { /* quotationDForm.setSaveOperationType("add"); quotationDForm.submit( function (dsResponse, data, dsRequest) { if (dsResponse.status == 0) { var msg = "Your quote has been sent!"; isc.say(msg, function() { }, {isModal: true, showModalMask: true}); } } ); */ var values = Object.assign({}, quotationDForm1.getValuesAsCriteria(), quotationDForm2.getValuesAsCriteria()); values.parts_nr = ''; values.parts = {}; values.parts.record = []; for (var i=0; i"; $.ajax({ type: "POST", url: "interface.php?op=quotation_add", data: request, success: function(data) { if ($(data).find("status").text() == "0") { var msg = "Your quote has been sent!"; isc.say(msg, function() {}, {isModal: true, showModalMask: true}); initQuotations(); } else if ($(data).find("status").text() == "-1") { isc.warn($(data).find("data").text()); } }, error: function(jqXHR, textStatus, errorThrown) { isc.warn("POST error (" + op + "): " + textStatus); }, dataType: "xml", contentType: "text/xml", processData: false }); } } } ] } ] }); isc.ListGrid.create({ ID: "quotationListGrid", autoDraw: false, modalEditing: true, editEvent: "click", canRemoveRecords: true, canEdit: true, validate: function() { if (this.data.length == 0) { isc.warn("Please add the necessary part(s)!"); return false; } else { return true; } }, fields: [ { name: "description", title: "Description", type: "text", width: "80%", required: true }, { name: "pcs", title: "Pcs", type: "integer", required: true, defaultValue: 1, width: 40, align: "center" } ] }); isc.Img.create({ ID: "quotationAddRowImage", autoDraw: false, width: 22, height: 22, src: "add.png", cursor: "pointer", click: function() { quotationListGrid.startEditingNew(); } }); isc.HLayout.create({ ID: "quotationHLayout", autoDraw: false, margin: 15, height: 150, members: [ quotationListGrid, isc.LayoutSpacer.create({ width: 15 }), quotationAddRowImage ] }); isc.DynamicForm.create({ autoDraw: false, ID: "regModDForm", dataSource: "regModDForm_DS", autoFetchData: false, wrapItemTitles: false, width: "100%", padding: 5, fields: [ { name: "login_name", type: "text", title: "E-mail", hint: "(" + "This is your login name" + ")", required: true, width: 200, validators: [ { type: "regexp", expression: "^([a-zA-Z0-9_.%\\-+])+@(([a-zA-Z0-9.\\-])+\\.)+[a-zA-Z0-9]{2,64}$" } ] }, { name: "name", type: "text", title: "Company", required: true, width: 200 }, { name: "contact_name", type: "text", title: "Contact name", required: true, width: 200 }, { name: "area_code", type: "text", title: "Area code", required: true, width: 100 }, { name: "city", type: "text", title: "City", required: true, width: 200 }, { name: "address", type: "text", title: "Address", required: true, width: 200 }, { name: "tax_number", type: "text", title: "Tax number", required: true, width: 200 }, { name: "phone", type: "text", title: "Phone", required: true, width: 200 }, { colSpan: 2, align: "center", type: "link", name: "change_password_link", defaultValue: "Change password", showTitle: false, target: "javascript", click: function() { changePwdWindow.show(); }, canEdit: false }, { type: "toolbar", align: "center", width: 90, buttons: [ { name: "submit", title: "Submit", click: function() { if (regModDForm.validate()) { regModDForm.setSaveOperationType(regModDForm.mode); regModDForm.submit( function (dsResponse, data, dsRequest) { if (dsResponse.status == 0) { var msg = ""; switch (regModDForm.mode) { case "add": msg = "Successful registration! You will receive your password in e-mail."; break; case "update": msg = "Successful data modification!"; break; } isc.say(msg, function() { /* quotationSectionStack.hide(); regModSectionStack.hide(); keresoSectionStack.show(); */ if (regModDForm.mode == "add") regModDForm.clearValues(); }, {isModal: true, showModalMask: true}); } } ); } } } ] } ] }); isc.SectionStack.create({ ID: "quotationInnerSectionStack", autoDraw: false, visibilityMode: "multiple", margin: 15, overflow: "auto", sections: [ { title: "Where can we contact you", expanded: true, canCollapse: false, items: [quotationDForm1] }, { title: "Fill out the following car details", expanded: true, canCollapse: false, items: [quotationDForm2] }, { title: "Description of the necessary part(s)", expanded: true, canCollapse: false, items: [quotationHLayout, quotationDForm3] } ] }); isc.HLayout.create({ autoDraw: false, ID: "keresoHLayout", visibility: "hidden", width: "100%", members: [ isc.VLayout.create({ autoDraw: false, align: "center", width: "25%", members: [ nagykepImg ] }), isc.SectionStack.create({ ID: "keresoSectionStack", width: "50%", autoDraw: false, visibilityMode: "multiple", margin: 15, sections: [ { title: "Search", expanded: true, canCollapse: false, items: [searchVLayout] }, { title: "Cart", expanded: true, canCollapse: false, items: [cartVLayout] } ] }), isc.SectionStack.create({ ID: "regModSectionStack", width: "50%", autoDraw: false, visibilityMode: "multiple", visibility: "hidden", margin: 15, sections: [ { title: "Registration", expanded: true, canCollapse: false, items: [regModDForm] } ] }), isc.SectionStack.create({ ID: "quotationSectionStack", width: "50%", autoDraw: false, visibilityMode: "multiple", visibility: "hidden", margin: 15, overflow: "auto", sections: [ { title: "Quotations", expanded: true, canCollapse: false, items: [quotationInnerSectionStack] } ] }), /* isc.LayoutSpacer.create({ width: "25%" }) */ isc.SectionStack.create({ width: "25%", autoDraw: false, margin: 15, sections: [ { title: "Noticeboard", expanded: true, canCollapse: false, items: [ isc.HTMLPane.create({ ID: "noticeboard", autoDraw: false, overflow: "hidden", resized: function(){noticeboard.initContents()}, initContents: function() { var url = 'http://genuinecarparts.eu/noticeboard.html'; var contents = ''; noticeboard.setContents(contents); } }) ] } ] }) ] }); isc.HTMLFlow.create({ autoDraw: false, width: "100%", height: "100%", ID: "preLoginContentHTMLFlow", contentsURL: "info.html", visibility: "hidden" }); isc.VLayout.create({ ID: "pageVLayout", autoDraw: true, backgroundColor: "#f4f4f4", minWidth: 1024, width: "100%", height: "100%", members: [ topHLayout, preLoginContentHTMLFlow, markakHLayout, keresoHLayout ] }); function pageLoaded() { var historyId = isc.History.getCurrentHistoryId(); if (historyId == "quotations") { quotationSectionStack.show(); regModSectionStack.hide(); keresoSectionStack.hide(); } var post_body = ""; $.ajax({ type: "POST", url: "interface.php?op=checklogin", data: post_body, success: function(data) { if ($(data).find("status").text() == "0") { if ($(data).find("loginOk").text() == "true") { if ($(data).find("admin").text() == "0") { searchListGrid.getField("purchase_price").showIf = "false"; searchListGrid.getField("orig_list_price").showIf = "false"; } preLoginContentHTMLFlow.hide(); markakHLayout.show(); keresoHLayout.show(); var name = $(data).find("name").text(); var login_name = $(data).find("login_name").text(); var phone = $(data).find("phone").text(); quotationDForm1.getField("partner_name").setValue(name); quotationDForm1.getField("phone").setValue(phone); quotationDForm1.getField("email_address").setValue(login_name); bejelentkezettLabel.setContents("Logged in: " + name); bejelentkezettHLayout.show(); searchDForm.getField("part_number").setDisabled(false); searchDForm.getField("search").setDisabled(false); cartListGrid.fetchData(); activateButton(bejelentkezettHLayoutSearchButton); } else { preLoginContentHTMLFlow.show(); markakHLayout.hide(); keresoHLayout.hide(); loginForm.show(); } } else if ($(data).find("status").text() == "-1") { isc.warn($(data).find("data").text()); loginForm.show(); } }, dataType: "xml", contentType: "text/xml", processData: false }); } isc.Page.setEvent("load", "pageLoaded()");