Add latest changes from icehrm pro
This commit is contained in:
@@ -23,7 +23,6 @@ function EmployeeAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.hiddenFields = {};
|
||||
this.tableFields = {};
|
||||
this.formOnlyFields = {};
|
||||
this.customFields = [];
|
||||
}
|
||||
|
||||
EmployeeAdapter.inherits(SubProfileEnabledAdapterBase);
|
||||
@@ -77,29 +76,6 @@ EmployeeAdapter.method('getTableHTMLTemplate', function() {
|
||||
return '<div class="box-body table-responsive"><table cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="grid"></table></div>';
|
||||
});
|
||||
|
||||
|
||||
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('getTableFields', function() {
|
||||
var tableFields = [
|
||||
"id",
|
||||
@@ -311,7 +287,7 @@ EmployeeAdapter.method('deleteEmployeeSuccessCallback', function(callBackData) {
|
||||
|
||||
|
||||
EmployeeAdapter.method('deleteEmployeeFailCallback', function(callBackData) {
|
||||
this.showMessage("Error occured while deleting Employee", callBackData);
|
||||
this.showMessage("Error occurred while deleting Employee", callBackData);
|
||||
});
|
||||
|
||||
|
||||
@@ -411,7 +387,7 @@ EmployeeAdapter.method('renderEmployee', 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;
|
||||
title = this.gt(this.fieldNameMap[fields[i][0]].textMapped);
|
||||
html = html.replace("#_label_"+fields[i][0]+"_#",title);
|
||||
}
|
||||
}
|
||||
@@ -463,7 +439,7 @@ EmployeeAdapter.method('renderEmployee', 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();
|
||||
@@ -478,8 +454,15 @@ EmployeeAdapter.method('renderEmployee', function(data) {
|
||||
}
|
||||
|
||||
customFieldHtml = ct;
|
||||
customFieldHtml = customFieldHtml.replace('#_label_#', index);
|
||||
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index][0]);
|
||||
customFieldHtml = customFieldHtml.replace('#_label_#', '');
|
||||
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{
|
||||
@@ -521,6 +504,7 @@ EmployeeAdapter.method('renderEmployee', function(data) {
|
||||
}
|
||||
for (var prop in modJs.subModJsList) {
|
||||
if(modJs.subModJsList.hasOwnProperty(prop)){
|
||||
modJs.subModJsList[prop].setTranslationsSubModules(this.translations);
|
||||
modJs.subModJsList[prop].setPermissions(this.permissions);
|
||||
modJs.subModJsList[prop].setFieldTemplates(this.fieldTemplates);
|
||||
modJs.subModJsList[prop].setTemplates(this.templates);
|
||||
@@ -1387,7 +1371,7 @@ EmployeeSubSkillsAdapter.method('forceInjectValuesBeforeSave', function(params)
|
||||
|
||||
EmployeeSubSkillsAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Skills";
|
||||
return addBtn + this.gt("Skills");
|
||||
});
|
||||
|
||||
EmployeeSubSkillsAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
@@ -1457,7 +1441,7 @@ EmployeeSubEducationAdapter.method('forceInjectValuesBeforeSave', function(param
|
||||
|
||||
EmployeeSubEducationAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Education";
|
||||
return addBtn + this.gt("Education");
|
||||
});
|
||||
|
||||
EmployeeSubEducationAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
@@ -1535,7 +1519,7 @@ EmployeeSubCertificationAdapter.method('forceInjectValuesBeforeSave', function(p
|
||||
|
||||
EmployeeSubCertificationAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Certifications";
|
||||
return addBtn + this.gt("Certifications");
|
||||
});
|
||||
|
||||
EmployeeSubCertificationAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
@@ -1622,7 +1606,7 @@ EmployeeSubLanguageAdapter.method('forceInjectValuesBeforeSave', function(params
|
||||
|
||||
EmployeeSubLanguageAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Languages";
|
||||
return addBtn + this.gt("Languages");
|
||||
});
|
||||
|
||||
EmployeeSubLanguageAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
@@ -1697,7 +1681,7 @@ EmployeeSubDependentAdapter.method('forceInjectValuesBeforeSave', function(param
|
||||
|
||||
EmployeeSubDependentAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Dependents";
|
||||
return addBtn + this.gt("Dependents");
|
||||
});
|
||||
|
||||
EmployeeSubDependentAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
@@ -1771,7 +1755,7 @@ EmployeeSubEmergencyContactAdapter.method('forceInjectValuesBeforeSave', functio
|
||||
|
||||
EmployeeSubEmergencyContactAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Emergency Contacts";
|
||||
return addBtn + this.gt("Emergency Contacts");
|
||||
});
|
||||
|
||||
EmployeeSubEmergencyContactAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
@@ -1851,7 +1835,7 @@ EmployeeSubDocumentAdapter.method('forceInjectValuesBeforeSave', function(params
|
||||
|
||||
EmployeeSubDocumentAdapter.method('getSubHeaderTitle', function() {
|
||||
var addBtn = '<button class="btn btn-small btn-success" onclick="modJs.subModJsList[\'tab'+this.tab+'\'].renderForm();" style="margin-right:10px;"><i class="fa fa-plus"></i></button>';
|
||||
return addBtn + "Documents";
|
||||
return addBtn + this.gt("Documents");
|
||||
});
|
||||
|
||||
EmployeeSubDocumentAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) {
|
||||
|
||||
@@ -46,100 +46,4 @@ FieldNameAdapter.method('getFormFields', function() {
|
||||
];
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
function CustomFieldAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
this.tableType = "";
|
||||
}
|
||||
|
||||
CustomFieldAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
CustomFieldAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"display",
|
||||
"display_order"
|
||||
];
|
||||
});
|
||||
|
||||
CustomFieldAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Display Status"},
|
||||
{ "sTitle": "Priority"}
|
||||
];
|
||||
});
|
||||
|
||||
CustomFieldAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
//[ "type", {"label":"Type","type":"placeholder","validation":""}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}],
|
||||
[ "display", {"label":"Display Status","type":"select","source":[["Form","Show"],["Hidden","Hidden"]]}],
|
||||
[ "field_type", {"label":"Field Type","type":"select","source":[["text","Text Field"],["textarea","Text Area"],["select","Select"],["select2","Select2"],["select2multi","Multi Select"],["fileupload","File Upload"],["date","Date"],["datetime","Date Time"],["time","Time"]]}],
|
||||
[ "field_label", {"label":"Field Label","type":"text","validation":""}],
|
||||
[ "field_validation", {"label":"Validation","type":"select","validation":"none","sort":"none","source":[["","Required"],["none","None"],["number","Number"],["numberOrEmpty","Number or Empty"],["float","Decimal"],["email","Email"],["emailOrEmpty","Email or Empty"]]}],
|
||||
[ "field_options", {"label":"Field Options","type":"datagroup",
|
||||
"form":[
|
||||
[ "label", {"label":"Label","type":"text","validation":""}],
|
||||
[ "value", {"label":"Value","type":"text","validation":"none"}]
|
||||
],
|
||||
"html":'<div id="#_id_#" class="panel panel-default"><div class="panel-body">#_delete_##_edit_#<span style="color:#999;font-size:13px;font-weight:bold">#_label_#</span>:#_value_#</div></div>',
|
||||
"validation":"none"
|
||||
}],
|
||||
[ "display_order", {"label":"Priority","type":"text","validation":"number"}],
|
||||
[ "display_section", {"label":"Display Section","type":"text","validation":""}]
|
||||
];
|
||||
});
|
||||
|
||||
CustomFieldAdapter.method('setTableType', function(type) {
|
||||
this.tableType = type;
|
||||
});
|
||||
|
||||
CustomFieldAdapter.method('doCustomValidation', function(params) {
|
||||
var validateName= function (str) {
|
||||
var name = /^[a-z][a-z0-9\._]+$/;
|
||||
return str != null && name.test(str);
|
||||
};
|
||||
|
||||
if(!validateName(params.name)){
|
||||
return "Invalid name for custom field";
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
CustomFieldAdapter.method('forceInjectValuesBeforeSave', function(params) {
|
||||
|
||||
|
||||
//Build data field
|
||||
var data = [params.name], options = [], optionsData;
|
||||
data.push({});
|
||||
data[1]['label'] = params.field_label;
|
||||
data[1]['type'] = params.field_type;
|
||||
data[1]['validation'] = params.field_validation;
|
||||
if(["select","select2","select2multi"].indexOf(params.field_type) >= 0){
|
||||
optionsData = JSON.parse(params.field_options);
|
||||
for(index in optionsData){
|
||||
options.push([optionsData[index].value, optionsData[index].label]);
|
||||
}
|
||||
data[1]['source'] = options;
|
||||
}
|
||||
if(params.field_validation == null || params.field_validation == undefined){
|
||||
params.field_validation = "";
|
||||
}
|
||||
params.data = JSON.stringify(data);
|
||||
params.type = this.tableType;
|
||||
return params;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ ImmigrationDocumentAdapter.method('getHeaders', function() {
|
||||
});
|
||||
|
||||
ImmigrationDocumentAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
var fields = [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text","validation":""}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
@@ -47,6 +47,12 @@ ImmigrationDocumentAdapter.method('getFormFields', function() {
|
||||
[ "alert_before_expiry", {"label":"Alert Before Expiry","type":"select","source":[["No","No"],["Yes","Yes"]]}],
|
||||
[ "alert_before_day_number", {"label":"Days for Expiry Alert","type":"text","validation":""}]
|
||||
];
|
||||
|
||||
for(var i=0;i<this.customFields.length;i++){
|
||||
fields.push(this.customFields[i]);
|
||||
}
|
||||
|
||||
return fields;
|
||||
});
|
||||
|
||||
|
||||
@@ -152,7 +158,7 @@ EmployeeTravelRecordAdminAdapter.method('getHeaders', function() {
|
||||
});
|
||||
|
||||
EmployeeTravelRecordAdminAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
return this.addCustomFields([
|
||||
["id", {"label": "ID", "type": "hidden"}],
|
||||
["employee", {
|
||||
"label": "Employee",
|
||||
@@ -162,9 +168,16 @@ EmployeeTravelRecordAdminAdapter.method('getFormFields', function() {
|
||||
"remote-source": ["Employee", "id", "first_name+last_name", "getActiveSubordinateEmployees"]
|
||||
}],
|
||||
["type", {
|
||||
"label": "Travel Type",
|
||||
"label": "Means of Transportation",
|
||||
"type": "select",
|
||||
"source": [["Local", "Local"], ["International", "International"]]
|
||||
"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": ""}],
|
||||
@@ -173,10 +186,10 @@ EmployeeTravelRecordAdminAdapter.method('getFormFields', function() {
|
||||
["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"}]
|
||||
];
|
||||
["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