Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Some of the sample codes I've developed
function tryAppStore() {
setTimeout(function() {
window.location = "https://appsto.re/tr/6XPCz.i";
}, 25);
window.location="Barcode://scan/";
}
function tryGoogleStore() {
setTimeout(function() {
window.location = "https://play.google.com/store/apps/details?id=com.google.zxing.client.android&hl=en";
}, 25);
window.location="zxing://scan/?ret=http%3A%2F%2Ffoo.com%2Fproducts%2F%7BCODE%7D%2Fdescription&SCAN_FORMATS=UPC_A,EAN_13";
}
function GetURLParameter(sParam) {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
if (window.navigator.userAgent.indexOf('iPhone') != -1) {
tryAppStore();
} else if (window.navigator.userAgent.indexOf('Android') != -1) {
tryGoogleStore();
} else {
alert("Please use an iOS or Android OS!..");
};
var barcode = GetURLParameter('barcode');
(function (page, pageDom) {
page.Extend({
_detail_Init: function (_data) {
return new Promise(function (resolve, reject) {
page.elements.detail.headerForm = page.elements.detail.content.find("#item_headerForm").pisform({
format: eg_util.getFields(page.Id, "main")
}).on("changed", function (_event, _eventData) {
});;
resolve({});
});
},
_detail_setData: function (_data) {
page.elements.detail.container.show();
if (_data === null) {
page.elements.detail.title.text(i18n.t("eg.fields.EXGO.createNew"));
} else if (_data === undefined) {
page.elements.detail.title.text("");
page.elements.detail.container.hide();
} else {
page.elements.detail.title.text(_data.NAME);
}
},
_detail_show: function (_data) {
if (_data != null) {
return page.callService({ MODE: "D", OBJ_TYPE: "EXGO", OBJ_ID: _data.EXGO_ID }, {}, {}).then(function (_wsResult) {
var dataDetail = _wsResult.response.EXGO[0];
page.detail_setData(dataDetail);
page.elements.detail.headerForm.pisform("setData", dataDetail);
});
}
},
_detail_clear: function () {
page.elements.detail.headerForm.pisform("clear");
},
_detail_delete: function () {
var objectData = page.detail_getData();
objectData.LOEKZ = "X";
var serviceData = {
MODE: "E",
OBJ_TYPE: "EXGO",
OBJ_ID: (objectData.EXGO_ID || ""),
INP_EXGO: [objectData]
}
return page.callService(serviceData, {}, { showSucMsg: true }).then(function (_wsResult) {
return objectData;
});;
},
_detail_validate: function (_for) {
},
_detail_save: function () {
var detailStatus = page.detail_getStatus();
var objectData = jQuery.extend(true,
page.detail_getData(),
page.elements.detail.headerForm.pisform("getData")
);
var serviceData = {
MODE: (detailStatus == "new" ? "I" : "E"),
OBJ_TYPE: "EXGO",
OBJ_ID: (objectData.EXGO_ID || ""),
INP_EXGO: [objectData]
}
return page.callService(serviceData, {}, { showSucMsg: true }).then(function (_wsResult) {
return _wsResult.response.EXGO_L[0];
});
},
});
})(controller.AppManager.GetActiveApp().GetActivePage(), controller.AppManager.GetActiveApp().GetActivePage().GetDom());
var eg_util = {
getFields: function (_structure, _section) {
return this.fields[_structure][_section];
},
fields: {
EXGO: {
main: {
NAME: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.EXGO.NAME") },
SURNAME: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.EXGO.SURNAME") },
TITLE: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.EXGO.TITLE") },
SEX: {
inptype: "native", addclass: "col-xs-12 col-md-5", showheader: true, label: null, label_txt: i18n.t("eg.fields.EXGO.SEX"), getoptions: function () {
return [
{ id: "E", n: i18n.t("eg.fields.EXGO.MALE") },
{ id: "K", n: i18n.t("eg.fields.EXGO.FEMALE") }
]
}
},
CELLPHONE: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.EXGO.PHONE") },
EMAIL: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.EXGO.EMAIL") },
DESIGN_SUPPORT: { inptype: "native", addclass: "col-xs-12 col-md-5", showheader: true, label: null, label_txt: i18n.t("eg.fields.EXGO.DESIGN_SUPPORT"), getoptions: function () { return [{ id: "_empty_", n: i18n.t("eg.fields.EXGO.DESIGN_SUPPORT_NO") }, { id: "X", n: i18n.t("eg.fields.EXGO.DESIGN_SUPPORT_YES") }] } },
DESIGNER: { inptype: "native", type: "r_avlbty", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.EXGO.DESIGNER") },
}
},
NEXP: {
main: {
EXP_NAME: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.NEXP.EXP_NAME") },
EXP_CLASS: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.NEXP.EXP_CLASS") },
EXP_TYPE: { inptype: "input", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.NEXP.EXP_TYPE") },
EXP_DATE: { inptype: "input", type: "dattim", datatype: "int", addclass: "col-xs-12 col-md-5", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.NEXP.EXP_DATE") },
EXP_NOTES: { inptype: "textarea", addclass: "col-xs-10", showheader: true, label: null, attmandatory: "1", label_txt: i18n.t("eg.fields.NEXP.EXP_NOTES") },
}
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment