" + 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()");