/** * Author: Thilina Hasantha */ function SubProfileEnabledAdapterBase(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); } SubProfileEnabledAdapterBase.inherits(AdapterBase); SubProfileEnabledAdapterBase.method('isSubProfileTable', function() { if(this.user.user_level == "Admin"){ return false; }else{ return true; } }); function EmployeeAdapter(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); this.fieldNameMap = {}; this.hiddenFields = {}; this.tableFields = {}; this.formOnlyFields = {}; this.customFields = []; } EmployeeAdapter.inherits(SubProfileEnabledAdapterBase); EmployeeAdapter.method('setFieldNameMap', function(fields) { var field; for(var i=0;i
'; }); EmployeeAdapter.method('setCustomFields', function(fields) { var field, parsed; for(var i=0;i
#_delete_##_edit_#Date: #_date_#
#_note_#
', "validation":"none", "sort-function":function (a,b){ var t1 = Date.parse(a.date).getTime(); var t2 = Date.parse(b.date).getTime(); return (t1
#_delete_##_edit_#Date: #_date_#
#_note_#
', "validation":"none", "sort-function":function (a,b){ var t1 = Date.parse(a.date).getTime(); var t2 = Date.parse(b.date).getTime(); return (t1'; return addBtn + "Skills"; }); EmployeeSubSkillsAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

'+nl2br(item[3])+'

'); return itemHtml; }); /** * @class EmployeeSubEducationAdapter * @param endPoint * @param tab * @param filter * @param orderBy * @returns */ function EmployeeSubEducationAdapter(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); } EmployeeSubEducationAdapter.inherits(SubAdapterBase); EmployeeSubEducationAdapter.method('getDataMapping', function() { return [ "id", "employee", "education_id", "institute", "date_start", "date_end" ]; }); EmployeeSubEducationAdapter.method('getHeaders', function() { return [ { "sTitle": "ID", "bVisible":false}, { "sTitle": "Employee" }, { "sTitle": "Qualification" }, { "sTitle": "Institute"}, { "sTitle": "Start Date"}, { "sTitle": "Completed On"}, ]; }); EmployeeSubEducationAdapter.method('getFormFields', function() { return [ [ "id", {"label":"ID","type":"hidden"}], [ "employee", {"label":"Employee","type":"hidden"}], [ "education_id", {"label":"Qualification","type":"select2","allow-null":false,"remote-source":["Education","id","name"]}], [ "institute", {"label":"Institute","type":"text","validation":""}], [ "date_start", {"label":"Start Date","type":"date","validation":"none"}], [ "date_end", {"label":"Completed On","type":"date","validation":"none"}] ]; }); EmployeeSubEducationAdapter.method('forceInjectValuesBeforeSave', function(params) { params['employee'] = this.parent.currentId; return params; }); EmployeeSubEducationAdapter.method('getSubHeaderTitle', function() { var addBtn = ''; return addBtn + "Education"; }); EmployeeSubEducationAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { var start = ""; try{ stat = Date.parse(item[4]).toString('MMM d, yyyy'); }catch(e){} var end = ""; try{ end = Date.parse(item[5]).toString('MMM d, yyyy'); }catch(e){} //var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

'+nl2br(item[3])+'

'); var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

Start: '+start+'

'+' Completed: '+end+'

'+' Institute: '+item[3]+'

'); return itemHtml; }); /** * @class EmployeeSubCertificationAdapter * @param endPoint * @param tab * @param filter * @param orderBy * @returns */ function EmployeeSubCertificationAdapter(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); } EmployeeSubCertificationAdapter.inherits(SubAdapterBase); EmployeeSubCertificationAdapter.method('getDataMapping', function() { return [ "id", "employee", "certification_id", "institute", "date_start", "date_end" ]; }); EmployeeSubCertificationAdapter.method('getHeaders', function() { return [ { "sTitle": "ID","bVisible":false}, { "sTitle": "Employee" }, { "sTitle": "Certification" }, { "sTitle": "Institute"}, { "sTitle": "Granted On"}, { "sTitle": "Valid Thru"} ]; }); EmployeeSubCertificationAdapter.method('getFormFields', function() { return [ [ "id", {"label":"ID","type":"hidden"}], [ "employee", {"label":"Employee","type":"hidden"}], [ "certification_id", {"label":"Certification","type":"select2","allow-null":false,"remote-source":["Certification","id","name"]}], [ "institute", {"label":"Institute","type":"text","validation":""}], [ "date_start", {"label":"Granted On","type":"date","validation":"none"}], [ "date_end", {"label":"Valid Thru","type":"date","validation":"none"}] ]; }); EmployeeSubCertificationAdapter.method('forceInjectValuesBeforeSave', function(params) { params['employee'] = this.parent.currentId; return params; }); EmployeeSubCertificationAdapter.method('getSubHeaderTitle', function() { var addBtn = ''; return addBtn + "Certifications"; }); EmployeeSubCertificationAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { var start = ""; try{ start = Date.parse(item[4]).toString('MMM d, yyyy'); }catch(e){} var end = ""; try{ end = Date.parse(item[5]).toString('MMM d, yyyy'); }catch(e){} var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

Granted On: '+start+'

'+' Valid Thru: '+end+'

'+' Institute: '+item[3]+'

'); return itemHtml; }); /** * @class EmployeeSubLanguageAdapter * @param endPoint * @param tab * @param filter * @param orderBy * @returns */ function EmployeeSubLanguageAdapter(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); } EmployeeSubLanguageAdapter.inherits(SubAdapterBase); EmployeeSubLanguageAdapter.method('getDataMapping', function() { return [ "id", "employee", "language_id", "reading", "speaking", "writing", "understanding" ]; }); EmployeeSubLanguageAdapter.method('getHeaders', function() { return [ { "sTitle": "ID", "bVisible":false }, { "sTitle": "Employee" }, { "sTitle": "Language" }, { "sTitle": "Reading"}, { "sTitle": "Speaking"}, { "sTitle": "Writing"}, { "sTitle": "Understanding"} ]; }); EmployeeSubLanguageAdapter.method('getFormFields', function() { var compArray = [["Elementary Proficiency","Elementary Proficiency"], ["Limited Working Proficiency","Limited Working Proficiency"], ["Professional Working Proficiency","Professional Working Proficiency"], ["Full Professional Proficiency","Full Professional Proficiency"], ["Native or Bilingual Proficiency","Native or Bilingual Proficiency"]]; return [ [ "id", {"label":"ID","type":"hidden"}], [ "employee", {"label":"Employee","type":"hidden"}], [ "language_id", {"label":"Language","type":"select2","allow-null":false,"remote-source":["Language","id","name"]}], [ "reading", {"label":"Reading","type":"select","source":compArray}], [ "speaking", {"label":"Speaking","type":"select","source":compArray}], [ "writing", {"label":"Writing","type":"select","source":compArray}], [ "understanding", {"label":"Understanding","type":"select","source":compArray}] ]; }); EmployeeSubLanguageAdapter.method('forceInjectValuesBeforeSave', function(params) { params['employee'] = this.parent.currentId; return params; }); EmployeeSubLanguageAdapter.method('getSubHeaderTitle', function() { var addBtn = ''; return addBtn + "Languages"; }); EmployeeSubLanguageAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

Reading: '+item[3]+'

'+' Speaking: '+ item[4] +'

'+' Writing: '+item[5]+'

'+' Understanding: '+item[6]+'

'); return itemHtml; }); EmployeeSubLanguageAdapter.method('isSubProfileTable', function() { if(this.user.user_level == "Admin"){ return false; }else{ return true; } }); /** * @class EmployeeSubDocumentAdapter * @param endPoint * @param tab * @param filter * @param orderBy * @returns */ function EmployeeSubDocumentAdapter(endPoint,tab,filter,orderBy) { this.initAdapter(endPoint,tab,filter,orderBy); } EmployeeSubDocumentAdapter.inherits(SubAdapterBase); EmployeeSubDocumentAdapter.method('getDataMapping', function() { return [ "id", "employee", "document", "details", "date_added", "valid_until", "status", "attachment" ]; }); EmployeeSubDocumentAdapter.method('getHeaders', function() { return [ { "sTitle": "ID" ,"bVisible":false}, { "sTitle": "Employee" }, { "sTitle": "Document" }, { "sTitle": "Details" }, { "sTitle": "Date Added"}, { "sTitle": "Status"}, { "sTitle": "Attachment","bVisible":false} ]; }); EmployeeSubDocumentAdapter.method('getFormFields', function() { return [ [ "id", {"label":"ID","type":"hidden"}], [ "employee", {"label":"Employee","type":"hidden"}], [ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}], [ "date_added", {"label":"Date Added","type":"date","validation":""}], [ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}], [ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}], [ "details", {"label":"Details","type":"textarea","validation":"none"}], [ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}] ]; }); EmployeeSubDocumentAdapter.method('forceInjectValuesBeforeSave', function(params) { params['employee'] = this.parent.currentId; return params; }); EmployeeSubDocumentAdapter.method('getSubHeaderTitle', function() { var addBtn = ''; return addBtn + "Documents"; }); EmployeeSubDocumentAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { var expire = ""; try{ expire = Date.parse(item[5]).toString('MMM d, yyyy'); }catch(e){} var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

'+nl2br(item[3])+'

'+' Expire On: '+expire+'

'); return itemHtml; }); EmployeeSubDocumentAdapter.method('isSubProfileTable', function() { if(this.user.user_level == "Admin"){ return false; }else{ return true; } }); /** * EmployeeDocumentAdapter */ function EmployeeDocumentAdapter(endPoint) { this.initAdapter(endPoint); } EmployeeDocumentAdapter.inherits(AdapterBase); EmployeeDocumentAdapter.method('getDataMapping', function() { return [ "id", "employee", "document", "details", "date_added", "status", "attachment" ]; }); EmployeeDocumentAdapter.method('getHeaders', function() { return [ { "sTitle": "ID" ,"bVisible":false}, { "sTitle": "Employee" }, { "sTitle": "Document" }, { "sTitle": "Details" }, { "sTitle": "Date Added"}, { "sTitle": "Status"}, { "sTitle": "Attachment","bVisible":false} ]; }); EmployeeDocumentAdapter.method('getFormFields', function() { return [ [ "id", {"label":"ID","type":"hidden"}], ["employee", { "label": "Employee", "type": "select2", "sort": "none", "allow-null": false, "remote-source": ["Employee", "id", "first_name+last_name", "getActiveSubordinateEmployees"] }], [ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}], [ "date_added", {"label":"Date Added","type":"date","validation":""}], [ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}], [ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}], [ "details", {"label":"Details","type":"textarea","validation":"none"}], [ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}] ]; }); EmployeeDocumentAdapter.method('getFilters', function() { return [ [ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}] ]; }); EmployeeDocumentAdapter.method('getActionButtonsHtml', function(id,data) { var html = '
'; html = html.replace(/_id_/g,id); html = html.replace(/_attachment_/g,data[6]); html = html.replace(/_BASE_/g,this.baseUrl); return html; }); EmployeeDocumentAdapter.method('isSubProfileTable', function() { if(this.user.user_level == "Admin"){ return false; }else{ return true; } });