Latest updates from IceHrmPro
This commit is contained in:
@@ -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;"> #_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([]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user