Latest updates from IceHrmPro

This commit is contained in:
Thilina Pituwala
2020-05-20 18:47:29 +02:00
parent 60c92d7935
commit 7453a58aad
18012 changed files with 2089245 additions and 10173 deletions

View File

@@ -149,7 +149,7 @@ class AttendanceAdapter extends AdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
showPunchImages(id) {
@@ -190,12 +190,16 @@ class AttendanceAdapter extends AdapterBase {
if (callBackData.image_in) {
$('#attendancePhoto').show();
const myCanvas = document.getElementById('attendnaceCanvasIn');
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.image_in;
try {
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.image_in;
} catch (e) {
console.log(e);
}
}
if (callBackData.out_time) {
@@ -205,12 +209,16 @@ class AttendanceAdapter extends AdapterBase {
if (callBackData.image_out) {
$('#attendancePhoto').show();
const myCanvas = document.getElementById('attendnaceCanvasOut');
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.image_out;
try {
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.image_out;
} catch (e) {
console.log(e);
}
}
if (callBackData.map_lat) {
@@ -233,23 +241,31 @@ class AttendanceAdapter extends AdapterBase {
if (callBackData.map_snapshot) {
$('#attendanceMap').show();
const myCanvas = document.getElementById('attendnaceMapCanvasIn');
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.map_snapshot;
try {
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.map_snapshot;
} catch (e) {
console.log(e);
}
}
if (callBackData.map_out_snapshot) {
$('#attendanceMap').show();
const myCanvas = document.getElementById('attendnaceMapCanvasOut');
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.map_out_snapshot;
try {
const ctx = myCanvas.getContext('2d');
const img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0); // Or at whatever offset you like
};
img.src = callBackData.map_out_snapshot;
} catch (e) {
console.log(e);
}
}
}
@@ -261,7 +277,7 @@ class AttendanceAdapter extends AdapterBase {
getActionButtonsHtml(id, data) {
const editButton = '<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>';
const deleteButton = '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>';
const photoButton = '<img class="tableActionButton" src="_BASE_images/map.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Show Photo" onclick="modJs.showPunchImages(_id_);return false;"></img>';
const photoButton = '<img class="tableActionButton" src="_BASE_images/map.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Show Location Details" onclick="modJs.showPunchImages(_id_);return false;"></img>';
let html;
if (this.photoAttendance === 1) {
@@ -288,6 +304,10 @@ class AttendanceAdapter extends AdapterBase {
html = html.replace(/_BASE_/g, this.baseUrl);
return html;
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/time-and-attendance/attendance-time-management';
}
}
@@ -342,7 +362,11 @@ class AttendanceStatusAdapter extends AdapterBase {
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/time-and-attendance/attendance-time-management';
}
}

View File

@@ -61,6 +61,10 @@ class CompanyStructureAdapter extends AdapterBase {
$tempDomObj.find('#field_heads').hide();
}
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/employees/employee-information-setup';
}
}
@@ -304,7 +308,7 @@ class CompanyGraphAdapter extends CompanyStructureAdapter {
}
getHelpLink() {
return 'https://thilinah.gitbooks.io/icehrm-guide/content/employee-information-setup.html';
return 'https://icehrm.gitbook.io/icehrm/employees/employee-information-setup';
}
}

View File

@@ -2,7 +2,7 @@
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
*/
/* global dependOnField */
/* global dependOnField, window, modJs */
import AdapterBase from '../../../api/AdapterBase';
/**
@@ -32,33 +32,126 @@ class DataImportAdapter extends AdapterBase {
return [
['id', { label: 'ID', type: 'hidden' }],
['name', { label: 'Name', type: 'text', validation: '' }],
['dataType', { label: 'Data Type', type: 'text', validation: '' }],
['dataType', {
label: 'Data Type',
type: 'select',
sort: 'none',
source: [
['EmployeeDataImporter', 'Employee Data'],
['AttendanceDataImporter', 'Attendance Data'],
['PayrollDataImporter', 'Payroll Data'],
['UserDataImporter', 'User Data'],
['CommonDataImporter', 'Common Data Importer'],
],
}],
['objectType', {
label: 'Object Type',
type: 'select',
sort: 'none',
'allow-null': true,
'null-label': 'None',
source: [
['LeaveStartingBalance', 'Leave Starting Balance'],
['HoliDay', 'Holidays'],
['EmployeeExpense', 'Employee Expenses'],
['Project', 'Projects'],
['EmployeeProject', 'Employee Projects'],
['EmployeeSalary', 'Employee Salary'],
['PayrollEmployee', 'Company Payroll'],
['Client', 'Clients'],
['Province', 'Provinces'],
['Industry', 'Industry'],
['Industry', 'Industry'],
['EmergencyContact', 'Emergency Contacts'],
['Ethnicity', 'Ethnicity'],
['Nationality', 'Nationality'],
['JobTitle', 'Job Titles'],
['PayFrequency', 'Pay Frequency'],
['PayrollEmployee', 'Payroll Employees'],
['SalaryComponent', 'Salary Components'],
['EmployeeSalary', 'Employee Salary'],
['CompanyStructure', 'Company Structure'],
],
}],
['details', { label: 'Details', type: 'textarea', validation: 'none' }],
['columns', {
label: 'Columns',
type: 'datagroup',
form: [
['name', { label: 'Name', type: 'text', validation: '' }],
['title', { label: 'Filed Title', type: 'text', validation: 'none' }],
['name', { label: 'CSV Field Name', type: 'text', validation: '' }],
['title', { label: 'Field Title', type: 'text', validation: 'none' }],
['type', {
label: 'Type', type: 'select', sort: 'none', source: [['Normal', 'Normal'], ['Reference', 'Reference'], ['Attached', 'Attached']],
label: 'Type', type: 'select', sort: 'none', source: [['Normal', 'Normal'], ['Reference', 'Reference']],
}],
['dependOn', {
label: 'Depends On',
type: 'select',
'allow-null': true,
'null-label': 'N/A',
source: [['EmergencyContact', 'Emergency Contacts'], ['Ethnicity', 'Ethnicity'], ['Nationality', 'Nationality'], ['JobTitle', 'JobTitle'], ['PayFrequency', 'PayFrequency'], ['PayGrade', 'PayGrade'], ['EmploymentStatus', 'EmploymentStatus'], ['CompanyStructure', 'CompanyStructure'], ['Employee', 'Employee']],
source: [
['EmergencyContact', 'Emergency Contacts'],
['Ethnicity', 'Ethnicity'],
['Nationality', 'Nationality'],
['JobTitle', 'JobTitle'],
['PayFrequency', 'Pay Frequency'],
['PayGrade', 'Pay Grade'],
['EmploymentStatus', 'Employment Status'],
['CompanyStructure', 'Company Structure'],
['Employee', 'Employee'],
['ImmigrationStatus', 'Immigration Status'],
['Industry', 'Industry'],
['CurrencyType', 'CurrencyType'],
['Document', 'Document'],
['Education', 'Education'],
['ExpensesCategory', 'Expenses Category'],
['ExpensesPaymentMethod', 'Expenses Payment Method'],
['ExperienceLevel', 'Experience Level'],
['Form', 'Form'],
['HiringPipeline', 'Hiring Pipeline'],
['HoliDay', 'HoliDay'],
['Language', 'Language'],
['LeaveGroup', 'Leave Group'],
['LeavePeriod', 'Leave Period'],
['LeaveRule', 'Leave Rule'],
['LeaveType', 'Leave Type'],
['OvertimeCategory', 'Overtime Category'],
['Project', 'Project'],
['Client', 'Client'],
['ReviewTemplate', 'Review Template'],
['SalaryComponent', 'Salary Component'],
['SalaryComponentType', 'Salary Component Type'],
['Skill', 'Skill'],
['Timezone', 'Timezone'],
['AssetType', 'Asset Type'],
['Benifit', 'Benifit'],
['Certification', 'Certification'],
['Country', 'Country'],
['Province', 'Province'],
['TrainingSession', 'TrainingSession'],
['User', 'User'],
],
}],
['dependOnField', { label: 'Depends On Field', type: 'text', validation: 'none' }],
['isKeyField', {
label: 'Is Key Field', type: 'select', validation: '', source: [['No', 'No'], ['Yes', 'Yes']],
['dependOnField', {
label: 'Depends On Field',
type: 'select',
'allow-null': true,
'null-label': 'N/A',
source: [
['id', 'id'],
['employee_id', 'employee_id'],
['name', 'name'],
['code', 'code'],
['title', 'title'],
['employee', 'employee'],
],
}],
['idField', {
label: 'Is ID Field', type: 'select', validation: '', source: [['No', 'No'], ['Yes', 'Yes']],
}],
['sampleValue', { label: 'Sample Value', type: 'text' }],
['help', { label: 'Help Text', type: 'text' }],
],
html: '<div id="#_id_#" class="panel panel-default"><div class="panel-heading"><b>#_name_#</b> #_delete_##_edit_#</div><div class="panel-body"><b>Header Title: </b>#_title_#<br/><span style="color:#999;font-size:11px;font-weight:bold">Type: #_type_# </span><br/></div></div>',
html: '<div id="#_id_#" class="panel panel-default"><div class="panel-heading"><b>#_name_#</b> #_delete_##_edit_#</div><div class="panel-body"><b>Title: </b>#_title_#<br/><span style="color:#999;font-size:11px;font-weight:bold">Type: #_type_# </span><br/><b>Sample: </b>#_sampleValue_#<br/><i class="fa fa-info-circle help-info" style="font-size: 11px;"/><span style="color:#999;font-size:11px;">&nbsp;#_help_#</span><br/></div></div>',
validation: 'none',
'custom-validate-function': function (data) {
const res = {};
@@ -66,12 +159,20 @@ class DataImportAdapter extends AdapterBase {
res.valid = true;
if (data.type === 'Reference') {
if (data.dependOn === 'NULL') {
res.message = 'If the type is Reference this field should referring another table';
res.message = 'If the type is Reference this field should referring another object';
res.valid = false;
} else if (dependOnField === null || dependOnField === undefined) {
} else if (dependOnField == null || dependOnField === 'NULL') {
res.message = "If the type is Reference then 'Depends On Field' can not be empty";
res.valid = false;
}
} else if (data.type === 'Normal') {
if (data.dependOn !== 'NULL') {
res.message = 'If the type is Reference this field should not refer another object';
res.valid = false;
} else if (dependOnField == null || dependOnField === 'NULL') {
res.message = "If the type is Reference then 'Depends On Field' should be empty";
res.valid = false;
}
}
return res;
@@ -80,6 +181,49 @@ class DataImportAdapter extends AdapterBase {
}],
];
}
getActionButtonsHtml(id, data) {
const editButton = '<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>';
const download = '<img class="tableActionButton" src="_BASE_images/download.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Download CSV Template" onclick="modJs.downloadTemplate(_id_);return false;"></img>';
const deleteButton = '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>';
const cloneButton = '<img class="tableActionButton" src="_BASE_images/clone.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Copy" onclick="modJs.copyRow(_id_);return false;"></img>';
let html = '<div style="width:120px;">_edit__download__clone__delete_</div>';
if (this.showAddNew) {
html = html.replace('_clone_', cloneButton);
} else {
html = html.replace('_clone_', '');
}
if (this.showDelete) {
html = html.replace('_delete_', deleteButton);
} else {
html = html.replace('_delete_', '');
}
if (this.showEdit) {
html = html.replace('_edit_', editButton);
} else {
html = html.replace('_edit_', '');
}
html = html.replace('_download_', download);
html = html.replace(/_id_/g, id);
html = html.replace(/_status_/g, data[6]);
html = html.replace(/_BASE_/g, this.baseUrl);
return html;
}
downloadTemplate(id) {
const params = { t: this.table, sa: 'downloadTemplate', mod: 'admin=data' };
params.req = JSON.stringify({ id });
const downloadUrl = modJs.getCustomActionUrl('ca', params);
window.open(downloadUrl, '_blank');
}
}
@@ -160,7 +304,6 @@ class DataImportFileAdapter extends AdapterBase {
process(id) {
const that = this;
const object = { id };
const reqJson = JSON.stringify(object);
@@ -174,6 +317,7 @@ class DataImportFileAdapter extends AdapterBase {
processSuccessCallBack(callBackData) {
this.showMessage('Success', 'File imported successfully.');
this.get([]);
}

View File

@@ -0,0 +1,5 @@
import { DocumentAdapter, CompanyDocumentAdapter, EmployeeDocumentAdapter } from './lib';
window.DocumentAdapter = DocumentAdapter;
window.CompanyDocumentAdapter = CompanyDocumentAdapter;
window.EmployeeDocumentAdapter = EmployeeDocumentAdapter;

View File

@@ -0,0 +1,180 @@
/*
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
*/
import AdapterBase from '../../../api/AdapterBase';
/**
* DocumentAdapter
*/
class DocumentAdapter extends AdapterBase {
getDataMapping() {
return [
'id',
'name',
'details',
];
}
getHeaders() {
return [
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Name' },
{ sTitle: 'Details' },
];
}
getFormFields() {
return [
['id', { label: 'ID', type: 'hidden' }],
['name', { label: 'Name', type: 'text', validation: '' }],
['expire_notification', { label: 'Notify Expiry', type: 'select', source: [['Yes', 'Yes'], ['No', 'No']] }],
['expire_notification_month', { label: 'Notify Expiry Before One Month', type: 'select', source: [['Yes', 'Yes'], ['No', 'No']] }],
['expire_notification_week', { label: 'Notify Expiry Before One Week', type: 'select', source: [['Yes', 'Yes'], ['No', 'No']] }],
['expire_notification_day', { label: 'Notify Expiry Before One Day', type: 'select', source: [['Yes', 'Yes'], ['No', 'No']] }],
// [ "sign", {"label":"Require Signature","type":"select","source":[["Yes","Yes"],["No","No"]]}],
// [ "sign_label", {"label":"Signature Description","type":"textarea","validation":"none"}],
['details', { label: 'Details', type: 'textarea', validation: 'none' }],
];
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/training-and-reviews/document-management';
}
}
/**
* CompanyDocumentAdapter
*/
class CompanyDocumentAdapter extends AdapterBase {
getDataMapping() {
return [
'id',
'name',
'details',
'status',
];
}
getHeaders() {
return [
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Name' },
{ sTitle: 'Details' },
{ sTitle: 'Status' },
];
}
getFormFields() {
return [
['id', { label: 'ID', type: 'hidden' }],
['name', { label: 'Name', type: 'text', validation: '' }],
['details', { label: 'Details', type: 'textarea', validation: 'none' }],
['status', { label: 'Status', type: 'select', source: [['Active', 'Active'], ['Inactive', 'Inactive'], ['Draft', 'Draft']] }],
['attachment', { label: 'Attachment', type: 'fileupload' }],
[
'share_departments',
{
label: 'Share Departments',
type: 'select2multi',
'allow-null': true,
'null-label': 'All Departments',
'remote-source': ['CompanyStructure', 'id', 'title'],
help: 'This document will be visible to employees from selected department. If no department is selected only Admin users can see this',
},
],
[
'share_employees',
{
label: 'Share Employees',
type: 'select2multi',
'allow-null': true,
'null-label': 'All Employees',
'remote-source': ['Employee', 'id', 'first_name+last_name'],
validation: 'none',
help: 'Instead of sharing with all the employees in a department, you can share it only with specific employees',
},
],
];
}
}
/**
* EmployeeDocumentAdapter
*/
class EmployeeDocumentAdapter extends AdapterBase {
getDataMapping() {
return [
'id',
'employee',
'document',
'details',
'date_added',
'status',
'attachment',
];
}
getHeaders() {
return [
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Employee' },
{ sTitle: 'Document' },
{ sTitle: 'Details' },
{ sTitle: 'Date Added' },
{ sTitle: 'Status' },
{ sTitle: 'Attachment', bVisible: false },
];
}
getFormFields() {
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: '' }],
];
}
getFilters() {
return [
['employee', { label: 'Employee', type: 'select2', 'remote-source': ['Employee', 'id', 'first_name+last_name'] }],
];
}
getActionButtonsHtml(id, data) {
let html = '<div style="width:80px;">'
+ '<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>'
+ '<img class="tableActionButton" src="_BASE_images/download.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Download Document" onclick="download(\'_attachment_\');return false;"></img>'
+ '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>'
+ '</div>';
html = html.replace(/_id_/g, id);
html = html.replace(/_attachment_/g, data[6]);
html = html.replace(/_BASE_/g, this.baseUrl);
return html;
}
isSubProfileTable() {
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
module.exports = { DocumentAdapter, CompanyDocumentAdapter, EmployeeDocumentAdapter };

View File

@@ -296,7 +296,7 @@ class EmployeeSubLanguageAdapter extends SubAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -504,16 +504,13 @@ class EmployeeSubDocumentAdapter extends SubAdapterBase {
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
class SubProfileEnabledAdapterBase extends AdapterBase {
isSubProfileTable() {
if (this.user.user_level === 'Admin') {
return false;
}
return true;
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin'
}
}
@@ -592,7 +589,7 @@ class EmployeeAdapter extends SubProfileEnabledAdapterBase {
const newTableFields = [];
for (let i = 0; i < tableFields.length; i++) {
if ((this.hiddenFields[tableFields[i]] === undefined || this.hiddenFields[tableFields[i]] === null)
&& (this.formOnlyFields[tableFields[i]] === undefined || this.formOnlyFields[tableFields[i]] === null)) {
&& (this.formOnlyFields[tableFields[i]] === undefined || this.formOnlyFields[tableFields[i]] === null)) {
newTableFields.push(tableFields[i]);
}
}
@@ -610,7 +607,7 @@ class EmployeeAdapter extends SubProfileEnabledAdapterBase {
for (let i = 0; i < tableFields.length; i++) {
if ((this.hiddenFields[tableFields[i]] === undefined || this.hiddenFields[tableFields[i]] === null)
&& (this.formOnlyFields[tableFields[i]] === undefined || this.formOnlyFields[tableFields[i]] === null)) {
&& (this.formOnlyFields[tableFields[i]] === undefined || this.formOnlyFields[tableFields[i]] === null)) {
if (this.fieldNameMap[tableFields[i]] !== undefined && this.fieldNameMap[tableFields[i]] !== null) {
title = this.fieldNameMap[tableFields[i]].textMapped;
if (title === undefined || title === null || title === '') {
@@ -639,7 +636,7 @@ class EmployeeAdapter extends SubProfileEnabledAdapterBase {
['last_name', { label: 'Last Name', type: 'text', validation: '' }],
['nationality', { label: 'Nationality', type: 'select2', 'remote-source': ['Nationality', 'id', 'name'] }],
['birthday', { label: 'Date of Birth', type: 'date', validation: '' }],
['gender', { label: 'Gender', type: 'select', source: [['Male', 'Male'], ['Female', 'Female']] }],
['gender', { label: 'Gender', type: 'select', source: [['Male', 'Male'], ['Female', 'Female'], ['Divers', 'Divers']] }],
['marital_status', { label: 'Marital Status', type: 'select', source: [['Married', 'Married'], ['Single', 'Single'], ['Divorced', 'Divorced'], ['Widowed', 'Widowed'], ['Other', 'Other']] }],
['ethnicity', {
label: 'Ethnicity', type: 'select2', 'allow-null': true, 'remote-source': ['Ethnicity', 'id', 'name'],
@@ -752,7 +749,7 @@ class EmployeeAdapter extends SubProfileEnabledAdapterBase {
deleteBtn = '';
}
// eslint-disable-next-line max-len
let html = `<div style="width:110px;"><img class="tableActionButton" src="_BASE_images/user.png" style="cursor:pointer;" rel="tooltip" title="Login as this Employee" onclick="modJs.setAdminProfile(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="View" onclick="modJs.view(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/edit.png" style="display:none;cursor:pointer;margin-left:15px;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>${deleteBtn}</div>`;
let html = `<div style="width:110px;"><img class="tableActionButton" src="_BASE_images/user.png" style="cursor:pointer;" rel="tooltip" title="Login as this Employee" onclick="modJs.setAdminProfile(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/view.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="View" onclick="modJs.view(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;margin-left:15px;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>${deleteBtn}</div>`;
html = html.replace(/_id_/g, id);
html = html.replace(/_BASE_/g, this.baseUrl);
return html;
@@ -1141,7 +1138,7 @@ class TerminatedEmployeeAdapter extends EmployeeAdapter {
['last_name', { label: 'Last Name', type: 'text', validation: '' }],
['nationality', { label: 'Nationality', type: 'select2', 'remote-source': ['Nationality', 'id', 'name'] }],
['birthday', { label: 'Date of Birth', type: 'date', validation: '' }],
['gender', { label: 'Gender', type: 'select', source: [['Male', 'Male'], ['Female', 'Female']] }],
['gender', { label: 'Gender', type: 'select', source: [['Male', 'Male'], ['Female', 'Female'], ['Divers', 'Divers']] }],
['marital_status', { label: 'Marital Status', type: 'select', source: [['Married', 'Married'], ['Single', 'Single'], ['Divorced', 'Divorced'], ['Widowed', 'Widowed'], ['Other', 'Other']] }],
['ssn_num', { label: 'SSN/NRIC', type: 'text', validation: 'none' }],
['nic_num', { label: 'NIC', type: 'text', validation: 'none' }],
@@ -1269,7 +1266,7 @@ class ArchivedEmployeeAdapter extends SubProfileEnabledAdapterBase {
['first_name', { label: 'First Name', type: 'text', validation: '' }],
['middle_name', { label: 'Middle Name', type: 'text', validation: 'none' }],
['last_name', { label: 'Last Name', type: 'text', validation: '' }],
['gender', { label: 'Gender', type: 'select', source: [['Male', 'Male'], ['Female', 'Female']] }],
['gender', { label: 'Gender', type: 'select', source: [['Male', 'Male'], ['Female', 'Female'], ['Divers', 'Divers']] }],
['ssn_num', { label: 'SSN/NRIC', type: 'text', validation: 'none' }],
['nic_num', { label: 'NIC', type: 'text', validation: 'none' }],
['other_id', { label: 'Other ID', type: 'text', validation: 'none' }],
@@ -1371,7 +1368,7 @@ class EmployeeSkillAdapter extends SubProfileEnabledAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1440,7 +1437,7 @@ class EmployeeEducationAdapter extends SubProfileEnabledAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1510,7 +1507,7 @@ class EmployeeCertificationAdapter extends SubProfileEnabledAdapterBase {
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1588,7 +1585,7 @@ class EmployeeLanguageAdapter extends SubProfileEnabledAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1651,7 +1648,7 @@ class EmployeeDependentAdapter extends SubProfileEnabledAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1717,7 +1714,7 @@ class EmergencyContactAdapter extends SubProfileEnabledAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1780,7 +1777,7 @@ class EmployeeImmigrationAdapter extends SubProfileEnabledAdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}
@@ -1850,7 +1847,7 @@ class EmployeeDocumentAdapter extends AdapterBase {
}
isSubProfileTable() {
return this.user.user_level !== 'Admin';
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
}

View File

@@ -39,13 +39,14 @@ class ModuleAdapter extends AdapterBase {
['id', { label: 'ID', type: 'hidden' }],
['label', { label: 'Label', type: 'text', validation: '' }],
['status', { label: 'Status', type: 'select', source: [['Enabled', 'Enabled'], ['Disabled', 'Disabled']] }],
['user_levels', { label: 'User Levels', type: 'select2multi', source: [['Admin', 'Admin'], ['Manager', 'Manager'], ['Employee', 'Employee'], ['Other', 'Other']] }],
['user_levels', { label: 'User Levels', type: 'select2multi', source: [['Admin', 'Admin'], ['Manager', 'Manager'], ['Employee', 'Employee']] }],
['user_roles', { label: 'User Roles', type: 'select2multi', 'remote-source': ['UserRole', 'id', 'name'] }],
];
}
getActionButtonsHtml(id, data) {
/*
const nonEditableFields = {};
nonEditableFields['admin_Company Structure'] = 1;
nonEditableFields.admin_Employees = 1;
@@ -65,6 +66,7 @@ class ModuleAdapter extends AdapterBase {
if (nonEditableFields[`${data[3]}_${data[1]}`] === 1) {
return '';
}
*/
let html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"/></div>';
html = html.replace(/_id_/g, id);
html = html.replace(/_BASE_/g, this.baseUrl);

View File

@@ -6,6 +6,12 @@
import AdapterBase from '../../../api/AdapterBase';
import TableEditAdapter from '../../../api/TableEditAdapter';
require('codemirror/mode/javascript/javascript');
require('codemirror/addon/edit/closebrackets');
require('codemirror/addon/display/autorefresh');
const CodeMirror = require('codemirror');
/**
* PaydayAdapter
*/
@@ -102,7 +108,7 @@ class PayrollAdapter extends AdapterBase {
label: 'Pay Frequency', type: 'select', 'remote-source': ['PayFrequency', 'id', 'name'], sort: 'none',
}],
['deduction_group', {
label: 'Calculation Group', type: 'select', 'remote-source': ['DeductionGroup', 'id', 'name'], sort: 'none',
label: 'Payroll Group', type: 'select', 'remote-source': ['DeductionGroup', 'id', 'name'], sort: 'none',
}],
['payslipTemplate', { label: 'Payslip Template', type: 'select', 'remote-source': ['PayslipTemplate', 'id', 'name'] }],
['department', {
@@ -192,6 +198,10 @@ class PayrollAdapter extends AdapterBase {
modJsList.tabPayrollData.setCurrentPayroll(null);
super.get(callBackData);
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management';
}
}
@@ -258,6 +268,10 @@ class PayrollDataAdapter extends TableEditAdapter {
document.body.removeChild(element);
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management';
}
}
@@ -266,6 +280,11 @@ class PayrollDataAdapter extends TableEditAdapter {
*/
class PayrollColumnAdapter extends AdapterBase {
constructor(endPoint, tab, filter, orderBy) {
super(endPoint, tab, filter, orderBy);
this.codeMirror = CodeMirror;
}
getDataMapping() {
return [
'id',
@@ -284,7 +303,7 @@ class PayrollColumnAdapter extends AdapterBase {
{ sTitle: 'Name' },
{ sTitle: 'Column Order' },
{ sTitle: 'Calculation Method' },
{ sTitle: 'Calculation Group' },
{ sTitle: 'Payroll Group' },
{ sTitle: 'Editable' },
{ sTitle: 'Enabled' },
];
@@ -314,7 +333,7 @@ class PayrollColumnAdapter extends AdapterBase {
label: 'Predefined Calculations', type: 'select2', 'allow-null': true, 'null-label': 'None', 'remote-source': ['CalculationHook', 'code', 'name'],
}],
['deduction_group', {
label: 'Calculation Group', type: 'select2', 'allow-null': true, 'null-label': 'Common', 'remote-source': ['DeductionGroup', 'id', 'name'],
label: 'Payroll Group', type: 'select2', 'allow-null': true, 'null-label': 'Common', 'remote-source': ['DeductionGroup', 'id', 'name'],
}],
['salary_components', { label: 'Salary Components', type: 'select2multi', 'remote-source': ['SalaryComponent', 'id', 'name'] }],
['deductions', { label: 'Calculation Method', type: 'select2multi', 'remote-source': ['Deduction', 'id', 'name'] }],
@@ -325,17 +344,22 @@ class PayrollColumnAdapter extends AdapterBase {
['enabled', { label: 'Enabled', type: 'select', source: [['Yes', 'Yes'], ['No', 'No']] }],
['default_value', { label: 'Default Value', type: 'text', validation: '' }],
fucntionColumnList,
['calculation_function', { label: 'Function', type: 'text', validation: 'none' }],
['function_type', { label: 'Function Type', type: 'select', source: [['Advanced', 'Advanced'], ['Simple', 'Simple']] }],
['calculation_function', { label: 'Function', type: 'code', validation: 'none' }],
];
}
getFilters() {
return [
['deduction_group', {
label: 'Calculation Group', type: 'select2', 'allow-null': true, 'null-label': 'Any', 'remote-source': ['DeductionGroup', 'id', 'name'],
label: 'Payroll Group', type: 'select2', 'allow-null': false, 'remote-source': ['DeductionGroup', 'id', 'name'],
}],
];
}
getHelpLink() {
return 'https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management';
}
}
@@ -388,7 +412,7 @@ class PayrollEmployeeAdapter extends AdapterBase {
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Employee' },
{ sTitle: 'Pay Frequency' },
{ sTitle: 'Calculation Group' },
{ sTitle: 'Payroll Group' },
{ sTitle: 'Currency' },
];
}
@@ -400,7 +424,7 @@ class PayrollEmployeeAdapter extends AdapterBase {
['pay_frequency', { label: 'Pay Frequency', type: 'select2', 'remote-source': ['PayFrequency', 'id', 'name'] }],
['currency', { label: 'Currency', type: 'select2', 'remote-source': ['CurrencyType', 'id', 'code'] }],
['deduction_group', {
label: 'Calculation Group', type: 'select2', 'allow-null': true, 'null-label': 'None', 'remote-source': ['DeductionGroup', 'id', 'name'],
label: 'Payroll Group', type: 'select2', 'allow-null': true, 'null-label': 'None', 'remote-source': ['DeductionGroup', 'id', 'name'],
}],
['deduction_exemptions', {
label: 'Calculation Exemptions', type: 'select2multi', 'remote-source': ['Deduction', 'id', 'name'], validation: 'none',
@@ -436,7 +460,7 @@ class DeductionAdapter extends AdapterBase {
return [
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Name' },
{ sTitle: 'Calculation Group' },
{ sTitle: 'Payroll Group' },
];
}
@@ -507,7 +531,7 @@ class DeductionAdapter extends AdapterBase {
}],
rangeAmounts,
['deduction_group', {
label: 'Calculation Group', type: 'select2', 'allow-null': true, 'null-label': 'None', 'remote-source': ['DeductionGroup', 'id', 'name'],
label: 'Payroll Group', type: 'select2', 'allow-null': false, 'remote-source': ['DeductionGroup', 'id', 'name'],
}],
];
@@ -543,6 +567,46 @@ class DeductionGroupAdapter extends AdapterBase {
['description', { label: 'Details', type: 'textarea', validation: 'none' }],
];
}
getActionButtonsHtml(id) {
let html = '<div style="width:150px;">'
+ '<img class="tableActionButton" src="_BASE_images/edit.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>'
+ '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deletePayrollGroup(_id_);return false;"></img>'
+ '<img class="tableActionButton" src="_BASE_images/clone.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Duplicate" onclick="modJs.copyRow(_id_);return false;"></img>'
+ '</div>';
html = html.replace(/_id_/g, id);
html = html.replace(/_BASE_/g, this.baseUrl);
return html;
}
deletePayrollGroup(id) {
if (confirm('Are you sure you want to delete this payroll group? Deleting the payroll group will delete all the Payroll columns and Saved calculations attached to this Payroll Group')) {
// Terminate
} else {
return;
}
const params = {};
params.id = id;
const reqJson = JSON.stringify(params);
const callBackData = [];
callBackData.callBackData = [];
callBackData.callBackSuccess = 'deletePayrollGroupSuccessCallback';
callBackData.callBackFail = 'deletePayrollGroupFailCallback';
this.customAction('deletePayrollGroup', 'admin=payroll', reqJson, callBackData);
}
deletePayrollGroupSuccessCallback(callBackData) {
this.showMessage('Success', 'Payroll Group Deleted ');
this.get([]);
}
deletePayrollGroupFailCallback(callBackData) {
this.showMessage('Error occured while deleting Payroll Group', callBackData);
}
}

View File

@@ -1,9 +1,7 @@
import {
ClientAdapter,
ProjectAdapter,
EmployeeProjectAdapter,
} from './lib';
window.ClientAdapter = ClientAdapter;
window.ProjectAdapter = ProjectAdapter;
window.EmployeeProjectAdapter = EmployeeProjectAdapter;

View File

@@ -5,64 +5,6 @@
import AdapterBase from '../../../api/AdapterBase';
/**
* ClientAdapter
*/
class ClientAdapter extends AdapterBase {
getDataMapping() {
return [
'id',
'name',
'details',
'address',
'contact_number',
];
}
getHeaders() {
return [
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Name' },
{ sTitle: 'Details' },
{ sTitle: 'Address' },
{ sTitle: 'Contact Number' },
];
}
getFormFields() {
if (this.showSave) {
return [
['id', { label: 'ID', type: 'hidden' }],
['name', { label: 'Name', type: 'text' }],
['details', { label: 'Details', type: 'textarea', validation: 'none' }],
['address', { label: 'Address', type: 'textarea', validation: 'none' }],
['contact_number', { label: 'Contact Number', type: 'text', validation: 'none' }],
['contact_email', { label: 'Contact Email', type: 'text', validation: 'none' }],
['company_url', { label: 'Company Url', type: 'text', validation: 'none' }],
['status', { label: 'Status', type: 'select', source: [['Active', 'Active'], ['Inactive', 'Inactive']] }],
['first_contact_date', { label: 'First Contact Date', type: 'date', validation: 'none' }],
];
}
return [
['id', { label: 'ID', type: 'hidden' }],
['name', { label: 'Name', type: 'placeholder' }],
['details', { label: 'Details', type: 'placeholder', validation: 'none' }],
['address', { label: 'Address', type: 'placeholder', validation: 'none' }],
['contact_number', { label: 'Contact Number', type: 'placeholder', validation: 'none' }],
['contact_email', { label: 'Contact Email', type: 'placeholder', validation: 'none' }],
['company_url', { label: 'Company Url', type: 'placeholder', validation: 'none' }],
['status', { label: 'Status', type: 'placeholder', source: [['Active', 'Active'], ['Inactive', 'Inactive']] }],
['first_contact_date', { label: 'First Contact Date', type: 'placeholder', validation: 'none' }],
];
}
getHelpLink() {
return 'http://blog.icehrm.com/docs/projects/';
}
}
/**
* ProjectAdapter
*/
@@ -157,7 +99,6 @@ class EmployeeProjectAdapter extends AdapterBase {
}
module.exports = {
ClientAdapter,
ProjectAdapter,
EmployeeProjectAdapter,
};

View File

@@ -36,10 +36,27 @@ class UserAdapter extends AdapterBase {
['employee', {
label: 'Employee', type: 'select2', 'allow-null': true, 'remote-source': ['Employee', 'id', 'first_name+last_name'],
}],
['user_level', { label: 'User Level', type: 'select', source: [['Admin', 'Admin'], ['Manager', 'Manager'], ['Employee', 'Employee'], ['Other', 'Other']] }],
['user_level',
{
label: 'User Level',
type: 'select',
source: [
['Admin', 'Admin'],
['Manager', 'Manager'],
['Employee', 'Employee'],
['Restricted Admin', 'Restricted Admin'],
['Restricted Manager', 'Restricted Manager'],
['Restricted Employee', 'Restricted Employee'],
],
},
],
['user_roles', { label: 'User Roles', type: 'select2multi', 'remote-source': ['UserRole', 'id', 'name'] }],
['lang', {
label: 'Language', type: 'select2', 'allow-null': true, 'remote-source': ['SupportedLanguage', 'id', 'description'],
}],
['default_module', {
label: 'Default Module', type: 'select2', 'null-label': 'No Default Module', 'allow-null': true, 'remote-source': ['Module', 'id', 'name', 'getUserModules'],
}],
];
}
@@ -53,6 +70,7 @@ class UserAdapter extends AdapterBase {
$('#adminUsersModel').modal('show');
$('#adminUsersChangePwd #newpwd').val('');
$('#adminUsersChangePwd #conpwd').val('');
$('#adminUsersChangePwd_error').hide();
}
saveUserSuccessCallBack(callBackData, serverData) {
@@ -71,7 +89,7 @@ class UserAdapter extends AdapterBase {
doCustomValidation(params) {
let msg = null;
if ((params.user_level !== 'Admin' && params.user_level !== 'Other') && params.employee === 'NULL') {
if ((params.user_level !== 'Admin' && params.user_level !== 'Restricted Admin') && params.employee === 'NULL') {
msg = 'For this user type, you have to assign an employee when adding or editing the user.<br/>';
msg += " You may create a new employee through 'Admin'->'Employees' menu";
}
@@ -112,23 +130,23 @@ class UserAdapter extends AdapterBase {
changePasswordConfirm() {
$('#adminUsersChangePwd_error').hide();
const passwordValidation = function (str) {
return str.length > 7;
};
const password = $('#adminUsersChangePwd #newpwd').val();
if (!passwordValidation(password)) {
$('#adminUsersChangePwd_error').html('Password should be longer than 7 characters');
$('#adminUsersChangePwd_error').show();
return;
}
const conPassword = $('#adminUsersChangePwd #conpwd').val();
if (conPassword !== password) {
$('#adminUsersChangePwd_error').html("Passwords don't match");
$('#adminUsersChangePwd_error').show();
return;
}
const validatePasswordResult = this.validatePassword(password);
if (validatePasswordResult != null) {
$('#adminUsersChangePwd_error').html(validatePasswordResult);
$('#adminUsersChangePwd_error').show();
return;
}