Latest updates from IceHrmPro
This commit is contained in:
7
web/modules/src/documents/index.js
Normal file
7
web/modules/src/documents/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import {
|
||||
EmployeeDocumentAdapter,
|
||||
EmployeeCompanyDocumentAdapter,
|
||||
} from './lib';
|
||||
|
||||
window.EmployeeDocumentAdapter = EmployeeDocumentAdapter;
|
||||
window.EmployeeCompanyDocumentAdapter = EmployeeCompanyDocumentAdapter;
|
||||
130
web/modules/src/documents/lib.js
Normal file
130
web/modules/src/documents/lib.js
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
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';
|
||||
import ObjectAdapter from '../../../api/ObjectAdapter';
|
||||
|
||||
class EmployeeDocumentAdapter extends AdapterBase {
|
||||
getDataMapping() {
|
||||
return [
|
||||
'id',
|
||||
'document',
|
||||
'details',
|
||||
'date_added',
|
||||
'status',
|
||||
'attachment',
|
||||
];
|
||||
}
|
||||
|
||||
getHeaders() {
|
||||
return [
|
||||
{ sTitle: 'ID', bVisible: false },
|
||||
{ sTitle: 'Document' },
|
||||
{ sTitle: 'Details' },
|
||||
{ sTitle: 'Date Added' },
|
||||
{ sTitle: 'Status' },
|
||||
{ sTitle: 'Attachment', bVisible: false },
|
||||
];
|
||||
}
|
||||
|
||||
getFormFields() {
|
||||
return [
|
||||
['id', { label: 'ID', 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: '' }],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
getActionButtonsHtml(id, data) {
|
||||
const downloadButton = '<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>';
|
||||
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>';
|
||||
let html = '<div style="width:80px;">_edit__download__delete_</div>';
|
||||
|
||||
html = html.replace('_download_', downloadButton);
|
||||
|
||||
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(/_id_/g, id);
|
||||
html = html.replace(/_attachment_/g, data[5]);
|
||||
html = html.replace(/_BASE_/g, this.baseUrl);
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* EmployeeCompanyDocumentAdapter
|
||||
*/
|
||||
|
||||
class EmployeeCompanyDocumentAdapter extends ObjectAdapter {
|
||||
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: 'placeholder', validation: '' }],
|
||||
['details', { label: 'Details', type: 'placeholder', validation: 'none' }],
|
||||
['attachment', { label: 'Attachment', type: 'placeholder', validation: 'none' }],
|
||||
];
|
||||
}
|
||||
|
||||
addDomEvents(object) {
|
||||
|
||||
}
|
||||
|
||||
getTemplateName() {
|
||||
return 'file.html';
|
||||
}
|
||||
|
||||
preProcessTableData(row) {
|
||||
row.color = this.getColorByFileType(row.type);
|
||||
row.icon = this.getIconByFileType(row.type);
|
||||
row.details_long = this.nl2br(row.details);
|
||||
|
||||
if (row.details.length > 30) {
|
||||
row.details = row.details.substring(0, 30);
|
||||
}
|
||||
|
||||
if (row.size === undefined || row.size == null) {
|
||||
row.size = '';
|
||||
}
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
EmployeeDocumentAdapter,
|
||||
EmployeeCompanyDocumentAdapter,
|
||||
};
|
||||
@@ -133,7 +133,7 @@ class EmployeeAdapter extends AdapterBase {
|
||||
['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,
|
||||
['nic_num', { label: 'NIC', type: 'text', validation: 'none' }],
|
||||
@@ -334,28 +334,28 @@ class EmployeeAdapter extends AdapterBase {
|
||||
$('#adminUsersModel').modal('show');
|
||||
$('#adminUsersChangePwd #newpwd').val('');
|
||||
$('#adminUsersChangePwd #conpwd').val('');
|
||||
$('#adminUsersChangePwd_error').hide();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ class CompanyGraphAdapter extends CompanyStructureAdapter {
|
||||
.size([h, w]);
|
||||
|
||||
this.diagonal = d3.svg.diagonal()
|
||||
.projection(d => [d.y, d.x]);
|
||||
.projection((d) => [d.y, d.x]);
|
||||
|
||||
this.vis = d3.select('#tabPageCompanyGraph').append('svg:svg')
|
||||
.attr('width', w + m[1] + m[3])
|
||||
@@ -537,34 +537,34 @@ class CompanyGraphAdapter extends CompanyStructureAdapter {
|
||||
// Update the nodes<65>
|
||||
const node = that.vis.selectAll('g.node')
|
||||
// eslint-disable-next-line no-return-assign
|
||||
.data(nodes, d => d.id || (d.id = ++that.nodeIdCounter));
|
||||
.data(nodes, (d) => d.id || (d.id = ++that.nodeIdCounter));
|
||||
|
||||
// Enter any new nodes at the parent's previous position.
|
||||
const nodeEnter = node.enter().append('svg:g')
|
||||
.attr('class', 'node')
|
||||
.attr('transform', d => `translate(${source.y0},${source.x0})`)
|
||||
.attr('transform', (d) => `translate(${source.y0},${source.x0})`)
|
||||
.on('click', (d) => { that.toggle(d); that.update(d, tree, root); });
|
||||
|
||||
nodeEnter.append('svg:circle')
|
||||
.attr('r', 1e-6)
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
.style('fill', d => (d._children ? 'lightsteelblue' : '#fff'));
|
||||
.style('fill', (d) => (d._children ? 'lightsteelblue' : '#fff'));
|
||||
|
||||
nodeEnter.append('svg:text')
|
||||
.attr('x', d => (d.children || d._children ? -10 : 10))
|
||||
.attr('x', (d) => (d.children || d._children ? -10 : 10))
|
||||
.attr('dy', '.35em')
|
||||
.attr('text-anchor', d => (d.children || d._children ? 'end' : 'start'))
|
||||
.text(d => d.name)
|
||||
.attr('text-anchor', (d) => (d.children || d._children ? 'end' : 'start'))
|
||||
.text((d) => d.name)
|
||||
.style('fill-opacity', 1e-6);
|
||||
|
||||
// Transition nodes to their new position.
|
||||
const nodeUpdate = node.transition()
|
||||
.duration(duration)
|
||||
.attr('transform', d => `translate(${d.y},${d.x})`);
|
||||
.attr('transform', (d) => `translate(${d.y},${d.x})`);
|
||||
|
||||
nodeUpdate.select('circle')
|
||||
.attr('r', 4.5)
|
||||
.style('fill', d => (d._children ? 'lightsteelblue' : '#fff'));
|
||||
.style('fill', (d) => (d._children ? 'lightsteelblue' : '#fff'));
|
||||
|
||||
nodeUpdate.select('text')
|
||||
.style('fill-opacity', 1);
|
||||
@@ -572,7 +572,7 @@ class CompanyGraphAdapter extends CompanyStructureAdapter {
|
||||
// Transition exiting nodes to the parent's new position.
|
||||
const nodeExit = node.exit().transition()
|
||||
.duration(duration)
|
||||
.attr('transform', d => `translate(${source.y},${source.x})`)
|
||||
.attr('transform', (d) => `translate(${source.y},${source.x})`)
|
||||
.remove();
|
||||
|
||||
nodeExit.select('circle')
|
||||
@@ -583,7 +583,7 @@ class CompanyGraphAdapter extends CompanyStructureAdapter {
|
||||
|
||||
// Update the links<6B>
|
||||
const link = that.vis.selectAll('path.link')
|
||||
.data(tree.links(nodes), d => d.target.id);
|
||||
.data(tree.links(nodes), (d) => d.target.id);
|
||||
|
||||
// Enter any new links at the parent's previous position.
|
||||
link.enter().insert('svg:path', 'g')
|
||||
@@ -695,7 +695,7 @@ class ApiAccessAdapter extends AdapterBase {
|
||||
}
|
||||
|
||||
setApiUrl(apiUrl) {
|
||||
this.apiUrl = apiUrl;``
|
||||
this.apiUrl = apiUrl; '';
|
||||
}
|
||||
|
||||
setToken(token) {
|
||||
|
||||
Reference in New Issue
Block a user