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

@@ -99,10 +99,7 @@ class ApproveAdminAdapter extends LogViewAdapter {
}
isSubProfileTable() {
if (this.user.user_level == 'Admin') {
return false;
}
return true;
return this.user.user_level !== 'Admin' && this.user.user_level !== 'Restricted Admin';
}
getStatusOptionsData(currentStatus) {

View File

@@ -180,6 +180,8 @@ class FormValidation {
}
} else if (inputObject.hasClass('simplemde')) {
inputValue = $(`#${that.formId} #${id}`).data('simplemde').value();
} else if (inputObject.hasClass('code')) {
inputValue = $(`#${that.formId} #${id}`).data('codemirror').getValue();
} else if (inputObject.hasClass('tinymce')) {
inputValue = tinyMCE.get(id).getContent({ format: 'raw' });
} else {

View File

@@ -1010,8 +1010,41 @@ class ModuleBase {
return params;
}
validatePassword(password) {
if (password.length < 8) {
return this.gt('Password too short');
}
if (password.length > 20) {
return this.gt('Password too long');
}
const numberTester = /.*[0-9]+.*$/;
if (!password.match(numberTester)) {
return this.gt('Password must include at least one number');
}
const lowerTester = /.*[a-z]+.*$/;
if (!password.match(lowerTester)) {
return this.gt('Password must include at least one lowercase letter');
}
const upperTester = /.*[A-Z]+.*$/;
if (!password.match(upperTester)) {
return this.gt('Password must include at least one uppercase letter');
}
const symbolTester = /.*[\W]+.*$/;
if (!password.match(symbolTester)) {
return this.gt('Password must include at least one symbol');
}
return null;
}
/**
* Override this method to inject attitional parameters or modify existing parameters retrived from add/edit form before sending to the server
* Override this method to inject attitional parameters or modify existing parameters retrived from
* add/edit form before sending to the server
* @method forceInjectValuesBeforeSave
* @param params {Array} keys and values in form
* @returns {Array} modified parameters
@@ -1345,6 +1378,20 @@ class ModuleBase {
// simplemde.value($(this).val());
});
const codeMirror = this.codeMirror;
if (codeMirror) {
$tempDomObj.find('.code').each(function () {
const editor = codeMirror.fromTextArea($(this)[0], {
lineNumbers: false,
matchBrackets: true,
continueComments: 'Enter',
extraKeys: { 'Ctrl-Q': 'toggleComment' },
});
$(this).data('codemirror', editor);
});
}
// $tempDomObj.find('.select2Field').select2();
$tempDomObj.find('.select2Field').each(function () {
$(this).select2().select2('val', $(this).find('option:eq(0)').val());
@@ -2050,6 +2097,11 @@ class ModuleBase {
}
} else if (fields[i][1].type === 'simplemde') {
$(`${formId} #${fields[i][0]}`).data('simplemde').value(object[fields[i][0]]);
} else if (fields[i][1].type === 'code') {
const cm = $(`${formId} #${fields[i][0]}`).data('codemirror');
if (cm) {
cm.getDoc().setValue(object[fields[i][0]]);
}
} else {
$(`${formId} #${fields[i][0]}`).val(object[fields[i][0]]);
}
@@ -2079,10 +2131,8 @@ class ModuleBase {
field[1].label = `${field[1].label}<font class="redFont">*</font>`;
}
}
if (field[1].type === 'text' || field[1].type === 'textarea' || field[1].type === 'hidden' || field[1].type === 'label' || field[1].type === 'placeholder') {
t = t.replace(/_id_/g, field[0]);
t = t.replace(/_label_/g, field[1].label);
} else if (field[1].type === 'select' || field[1].type === 'select2' || field[1].type === 'select2multi') {
if (field[1].type === 'select' || field[1].type === 'select2' || field[1].type === 'select2multi') {
t = t.replace(/_id_/g, field[0]);
t = t.replace(/_label_/g, field[1].label);
if (field[1].source !== undefined && field[1].source != null) {
@@ -2131,6 +2181,9 @@ class ModuleBase {
} else if (field[1].type === 'tinymce' || field[1].type === 'simplemde') {
t = t.replace(/_id_/g, field[0]);
t = t.replace(/_label_/g, field[1].label);
} else {
t = t.replace(/_id_/g, field[0]);
t = t.replace(/_label_/g, field[1].label);
}