Add latest changes from icehrm pro
This commit is contained in:
@@ -26,7 +26,6 @@ function EmployeeAdapter(endPoint) {
|
||||
this.hiddenFields = {};
|
||||
this.tableFields = {};
|
||||
this.formOnlyFields = {};
|
||||
this.customFields = [];
|
||||
}
|
||||
|
||||
EmployeeAdapter.inherits(AdapterBase);
|
||||
@@ -51,28 +50,6 @@ EmployeeAdapter.method('setFieldNameMap', function(fields) {
|
||||
}
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('setCustomFields', function(fields) {
|
||||
var field, parsed;
|
||||
for(var i=0;i<fields.length;i++){
|
||||
field = fields[i];
|
||||
if(field.display != "Hidden" && field.data != "" && field.data != undefined){
|
||||
try{
|
||||
parsed = JSON.parse(field.data);
|
||||
if(parsed == undefined || parsed == null){
|
||||
continue;
|
||||
}else if(parsed.length != 2){
|
||||
continue;
|
||||
}else if(parsed[1].type == undefined || parsed[1].type == null){
|
||||
continue;
|
||||
}
|
||||
this.customFields.push(parsed);
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
EmployeeAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
@@ -258,8 +235,8 @@ EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
|
||||
|
||||
for(var i=0;i<fields.length;i++) {
|
||||
if(this.fieldNameMap[fields[i][0]] != undefined && this.fieldNameMap[fields[i][0]] != null){
|
||||
title = this.fieldNameMap[fields[i][0]].textMapped;
|
||||
html = html.replace("#_label_"+fields[i][0]+"_#",title);
|
||||
var title = this.fieldNameMap[fields[i][0]].textMapped;
|
||||
html = html.replace("#_label_"+fields[i][0]+"_#",this.gt(title));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +278,7 @@ EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
|
||||
for (index in data.customFields) {
|
||||
|
||||
if(!data.customFields[index][1]){
|
||||
data.customFields[index][1] = 'Other Details';
|
||||
data.customFields[index][1] = this.gt('Other Details');
|
||||
}
|
||||
|
||||
sectionId = data.customFields[index][1].toLocaleLowerCase();
|
||||
@@ -317,7 +294,14 @@ EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
|
||||
|
||||
customFieldHtml = ct;
|
||||
customFieldHtml = customFieldHtml.replace('#_label_#', index);
|
||||
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index][0]);
|
||||
if (data.customFields[index][2] === 'fileupload') {
|
||||
customFieldHtml = customFieldHtml.replace(
|
||||
'#_value_#',
|
||||
'<button onclick="download(\''+data.customFields[index][0]+'\');return false;" class="btn btn-mini btn-inverse" type="button">View: '+index+'</button>'
|
||||
);
|
||||
} else {
|
||||
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index][0]);
|
||||
}
|
||||
$("#cont_"+sectionId).append($(customFieldHtml));
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -89,21 +89,32 @@ EmployeeTravelRecordAdapter.method('getHeaders', function() {
|
||||
});
|
||||
|
||||
EmployeeTravelRecordAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "type", {"label":"Travel Type","type":"select","source":[["Local","Local"],["International","International"]]}],
|
||||
[ "purpose", {"label":"Purpose of Travel","type":"textarea","validation":""}],
|
||||
[ "travel_from", {"label":"Travel From","type":"text","validation":""}],
|
||||
[ "travel_to", {"label":"Travel To","type":"text","validation":""}],
|
||||
[ "travel_date", {"label":"Travel Date","type":"datetime","validation":""}],
|
||||
[ "return_date", {"label":"Return Date","type":"datetime","validation":""}],
|
||||
[ "details", {"label":"Notes","type":"textarea","validation":"none"}],
|
||||
[ "currency", {"label":"Currency","type":"select2","allow-null":false,"remote-source":["CurrencyType","id","code"]}],
|
||||
[ "funding", {"label":"Total Funding Proposed","type":"text","validation":"float"}],
|
||||
[ "attachment1", {"label":"Itinerary / Cab Receipt","type":"fileupload","validation":"none"}],
|
||||
[ "attachment2", {"label":"Other Attachment 1","type":"fileupload","validation":"none"}],
|
||||
[ "attachment3", {"label":"Other Attachment 2","type":"fileupload","validation":"none"}]
|
||||
];
|
||||
return this.addCustomFields([
|
||||
["id", {"label": "ID", "type": "hidden"}],
|
||||
["type", {
|
||||
"label": "Means of Transportation",
|
||||
"type": "select",
|
||||
"source": [
|
||||
["Plane", "Plane"],
|
||||
["Rail", "Rail"],
|
||||
["Taxi", "Taxi"],
|
||||
["Own Vehicle", "Own Vehicle"],
|
||||
["Rented Vehicle", "Rented Vehicle"],
|
||||
["Other", "Other"]
|
||||
]
|
||||
}],
|
||||
["purpose", {"label": "Purpose of Travel", "type": "textarea", "validation": ""}],
|
||||
["travel_from", {"label": "Travel From", "type": "text", "validation": ""}],
|
||||
["travel_to", {"label": "Travel To", "type": "text", "validation": ""}],
|
||||
["travel_date", {"label": "Travel Date", "type": "datetime", "validation": ""}],
|
||||
["return_date", {"label": "Return Date", "type": "datetime", "validation": ""}],
|
||||
["details", {"label": "Notes", "type": "textarea", "validation": "none"}],
|
||||
["currency", {"label": "Currency", "type": "select2", "allow-null":false, "remote-source": ["CurrencyType", "id", "code"]}],
|
||||
["funding", {"label": "Total Funding Proposed", "type": "text", "validation": "float", "default":"0.00", "mask":"9{0,10}.99"}],
|
||||
["attachment1", {"label": "Attachment", "type": "fileupload", "validation": "none"}],
|
||||
["attachment2", {"label": "Attachment", "type": "fileupload", "validation": "none"}],
|
||||
["attachment3", {"label": "Attachment", "type": "fileupload", "validation": "none"}]
|
||||
]);
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user