Fix issue: employee not be selected when filtering employee documents

This commit is contained in:
Alan Cell
2020-11-06 19:32:52 +01:00
parent 1ee4fb4ba1
commit d986a2b5bb
3 changed files with 227 additions and 218 deletions

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -154,7 +154,7 @@ class EmployeeDocumentAdapter extends AdapterBase {
getFilters() { getFilters() {
return [ return [
['employee', { label: 'Employee', type: 'select2', 'remote-source': ['Employee', 'id', 'first_name+last_name'] }], ['employee', { label: 'Employee', type: 'select2', 'remote-source': ['Employee', 'id', 'first_name+last_name', 'getActiveSubordinateEmployees'] }],
]; ];
} }

View File

@@ -61,10 +61,10 @@ class ModuleBase {
} }
/** /**
* Some browsers do not support sending JSON in get parameters. Set this to true to avoid sending JSON * Some browsers do not support sending JSON in get parameters. Set this to true to avoid sending JSON
* @method setNoJSONRequests * @method setNoJSONRequests
* @param val {Boolean} * @param val {Boolean}
*/ */
setNoJSONRequests(val) { setNoJSONRequests(val) {
this.noJSONRequests = val; this.noJSONRequests = val;
} }
@@ -79,12 +79,12 @@ class ModuleBase {
} }
/** /**
* Check if the current user has a permission * Check if the current user has a permission
* @method checkPermission * @method checkPermission
* @param permission {String} * @param permission {String}
* @example * @example
* this.checkPermission("Upload/Delete Profile Image") * this.checkPermission("Upload/Delete Profile Image")
*/ */
checkPermission(permission) { checkPermission(permission) {
if (this.permissions[permission] === undefined || this.permissions[permission] == null || this.permissions[permission] === 'Yes') { if (this.permissions[permission] === undefined || this.permissions[permission] == null || this.permissions[permission] === 'Yes') {
return 'Yes'; return 'Yes';
@@ -168,15 +168,15 @@ class ModuleBase {
} }
/** /**
* If this method returned false the action buttons in data table for modules will not be displayed. * If this method returned false the action buttons in data table for modules will not be displayed.
* Override this method in module lib.js to hide action buttons * Override this method in module lib.js to hide action buttons
* @method showActionButtons * @method showActionButtons
* @param permission {String} * @param permission {String}
* @example * @example
* EmployeeLeaveEntitlementAdapter.method('showActionButtons() { * EmployeeLeaveEntitlementAdapter.method('showActionButtons() {
* return false; * return false;
* } * }
*/ */
showActionButtons() { showActionButtons() {
return true; return true;
} }
@@ -201,30 +201,30 @@ class ModuleBase {
} }
/** /**
* Get the current profile * Get the current profile
* @method getCurrentProfile * @method getCurrentProfile
* @returns Profile of the current user if the profile is not switched if not switched profile * @returns Profile of the current user if the profile is not switched if not switched profile
*/ */
getCurrentProfile() { getCurrentProfile() {
return this.currentProfile; return this.currentProfile;
} }
/** /**
* Retrive data required to create select boxes for add new /edit forms for a given module. This is called when loading the module * Retrive data required to create select boxes for add new /edit forms for a given module. This is called when loading the module
* @method initFieldMasterData * @method initFieldMasterData
* @param callback {Function} call this once loading completed * @param callback {Function} call this once loading completed
* @param callback {Function} call this once all field loading completed. This indicate that the form can be displayed saftly * @param callback {Function} call this once all field loading completed. This indicate that the form can be displayed saftly
* @example * @example
* ReportAdapter.method('renderForm(object) { * ReportAdapter.method('renderForm(object) {
* var that = this; * var that = this;
* this.processFormFieldsWithObject(object); * this.processFormFieldsWithObject(object);
* var cb = function(){ * var cb = function(){
* that.super.renderForm(object); * that.super.renderForm(object);
* }; * };
* this.initFieldMasterData(cb); * this.initFieldMasterData(cb);
* } * }
*/ */
initFieldMasterData(callback, loadAllCallback, loadAllCallbackData) { initFieldMasterData(callback, loadAllCallback, loadAllCallbackData) {
this.fieldMasterData = {}; this.fieldMasterData = {};
this.fieldMasterDataKeys = {}; this.fieldMasterDataKeys = {};
@@ -236,10 +236,11 @@ class ModuleBase {
for (let i = 0; i < remoteSourceFields.length; i++) { for (let i = 0; i < remoteSourceFields.length; i++) {
const fieldRemote = remoteSourceFields[i]; const fieldRemote = remoteSourceFields[i];
if (fieldRemote[1]['remote-source'] !== undefined && fieldRemote[1]['remote-source'] != null) { if (fieldRemote[1]['remote-source'] !== undefined && fieldRemote[1]['remote-source'] != null) {
let key = `${fieldRemote[1]['remote-source'][0]}_${fieldRemote[1]['remote-source'][1]}_${fieldRemote[1]['remote-source'][2]}`; // let key = `${fieldRemote[1]['remote-source'][0]}_${fieldRemote[1]['remote-source'][1]}_${fieldRemote[1]['remote-source'][2]}`;
if (fieldRemote[1]['remote-source'].length === 4) { // if (fieldRemote[1]['remote-source'].length === 4) {
key = `${key}_${fieldRemote[1]['remote-source'][3]}`; // key = `${key}_${fieldRemote[1]['remote-source'][3]}`;
} // }
const key = this.getRemoteSourceKey(fieldRemote);
this.fieldMasterDataKeys[key] = false; this.fieldMasterDataKeys[key] = false;
const callBackData = {}; const callBackData = {};
@@ -320,26 +321,26 @@ class ModuleBase {
} }
/** /**
* Pass true to this method after creating module JS object to open new/edit entry form for the module on a popup. * Pass true to this method after creating module JS object to open new/edit entry form for the module on a popup.
* @method setShowFormOnPopup * @method setShowFormOnPopup
* @param val {Boolean} * @param val {Boolean}
* @example * @example
* modJs.subModJsList['tabCandidateApplication'] = new CandidateApplicationAdapter('Application','CandidateApplication',{"candidate":data.id} * modJs.subModJsList['tabCandidateApplication'] = new CandidateApplicationAdapter('Application','CandidateApplication',{"candidate":data.id}
* modJs.subModJsList['tabCandidateApplication'].setShowFormOnPopup(true); * modJs.subModJsList['tabCandidateApplication'].setShowFormOnPopup(true);
*/ */
setShowFormOnPopup(val) { setShowFormOnPopup(val) {
this.showFormOnPopup = val; this.showFormOnPopup = val;
} }
/** /**
* Set this to true to if you need the datatable to load data page by page instead of loading all data at once. * Set this to true to if you need the datatable to load data page by page instead of loading all data at once.
* @method setRemoteTable * @method setRemoteTable
* @param val {Boolean} * @param val {Boolean}
* @example * @example
* modJs.subModJsList['tabCandidateApplication'] = new CandidateApplicationAdapter('Application','CandidateApplication',{"candidate":data.id} * modJs.subModJsList['tabCandidateApplication'] = new CandidateApplicationAdapter('Application','CandidateApplication',{"candidate":data.id}
* modJs.subModJsList['tabCandidateApplication'].setRemoteTable(true); * modJs.subModJsList['tabCandidateApplication'].setRemoteTable(true);
*/ */
setRemoteTable(val) { setRemoteTable(val) {
this.createRemoteTable = val; this.createRemoteTable = val;
@@ -372,14 +373,14 @@ class ModuleBase {
} }
if (this.fieldMasterDataCallback !== null if (this.fieldMasterDataCallback !== null
&& this.fieldMasterDataCallback !== undefined && this.fieldMasterDataCallback !== undefined
&& this.isAllLoaded(this.fieldMasterDataKeys) && this.isAllLoaded(this.fieldMasterDataKeys)
&& (this.fieldMasterDataCallbackData !== null && this.fieldMasterDataCallbackData !== undefined) && (this.fieldMasterDataCallbackData !== null && this.fieldMasterDataCallbackData !== undefined)
) { ) {
this.fieldMasterDataCallback(this.fieldMasterDataCallbackData); this.fieldMasterDataCallback(this.fieldMasterDataCallbackData);
} else if (this.fieldMasterDataCallback !== null } else if (this.fieldMasterDataCallback !== null
&& this.fieldMasterDataCallback !== undefined && this.fieldMasterDataCallback !== undefined
&& this.isAllLoaded(this.fieldMasterDataKeys) && this.isAllLoaded(this.fieldMasterDataKeys)
) { ) {
this.fieldMasterDataCallback(); this.fieldMasterDataCallback();
} }
@@ -597,10 +598,10 @@ class ModuleBase {
} }
/** /**
* Create the data table on provided element id * Create the data table on provided element id
* @method createTable * @method createTable
* @param val {Boolean} * @param val {Boolean}
*/ */
createTable(elementId) { createTable(elementId) {
const that = this; const that = this;
@@ -678,10 +679,10 @@ class ModuleBase {
} }
/** /**
* Create a data table on provided element id which loads data page by page * Create a data table on provided element id which loads data page by page
* @method createTableServer * @method createTableServer
* @param val {Boolean} * @param val {Boolean}
*/ */
createTableServer(elementId) { createTableServer(elementId) {
const that = this; const that = this;
@@ -748,10 +749,10 @@ class ModuleBase {
} }
/** /**
* This should be overridden in module lib.js classes to return module headers which are used to create the data table. * This should be overridden in module lib.js classes to return module headers which are used to create the data table.
* @method getHeaders * @method getHeaders
* @example * @example
SettingAdapter.method('getHeaders() { SettingAdapter.method('getHeaders() {
return [ return [
{ "sTitle": "ID" ,"bVisible":false}, { "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" }, { "sTitle": "Name" },
@@ -759,17 +760,17 @@ class ModuleBase {
{ "sTitle": "Details"} { "sTitle": "Details"}
]; ];
} }
*/ */
getHeaders() { getHeaders() {
} }
/** /**
* This should be overridden in module lib.js classes to return module field values which are used to create the data table. * This should be overridden in module lib.js classes to return module field values which are used to create the data table.
* @method getDataMapping * @method getDataMapping
* @example * @example
SettingAdapter.method('getDataMapping() { SettingAdapter.method('getDataMapping() {
return [ return [
"id", "id",
"name", "name",
@@ -777,23 +778,23 @@ class ModuleBase {
"description" "description"
]; ];
} }
*/ */
getDataMapping() { getDataMapping() {
} }
/** /**
* This should be overridden in module lib.js classes to return module from fields which are used to create the add/edit form and also used for initializing select box values in form. * This should be overridden in module lib.js classes to return module from fields which are used to create the add/edit form and also used for initializing select box values in form.
* @method getFormFields * @method getFormFields
* @example * @example
SettingAdapter.method('getFormFields() { SettingAdapter.method('getFormFields() {
return [ return [
[ "id", {"label":"ID","type":"hidden"}], [ "id", {"label":"ID","type":"hidden"}],
[ "value", {"label":"Value","type":"text","validation":"none"}] [ "value", {"label":"Value","type":"text","validation":"none"}]
]; ];
} }
*/ */
getFormFields() { getFormFields() {
} }
@@ -807,26 +808,26 @@ class ModuleBase {
} }
/** /**
* This can be overridden in module lib.js classes inorder to show a filter form * This can be overridden in module lib.js classes inorder to show a filter form
* @method getFilters * @method getFilters
* @example * @example
EmployeeAdapter.method('getFilters() { EmployeeAdapter.method('getFilters() {
return [ return [
[ "job_title", {"label":"Job Title","type":"select2","allow-null":true,"null-label":"All Job Titles","remote-source":["JobTitle","id","name"]}], [ "job_title", {"label":"Job Title","type":"select2","allow-null":true,"null-label":"All Job Titles","remote-source":["JobTitle","id","name"]}],
[ "department", {"label":"Department","type":"select2","allow-null":true,"null-label":"All Departments","remote-source":["CompanyStructure","id","title"]}], [ "department", {"label":"Department","type":"select2","allow-null":true,"null-label":"All Departments","remote-source":["CompanyStructure","id","title"]}],
[ "supervisor", {"label":"Supervisor","type":"select2","allow-null":true,"null-label":"Anyone","remote-source":["Employee","id","first_name+last_name"]}] [ "supervisor", {"label":"Supervisor","type":"select2","allow-null":true,"null-label":"Anyone","remote-source":["Employee","id","first_name+last_name"]}]
]; ];
} }
*/ */
getFilters() { getFilters() {
return null; return null;
} }
/** /**
* Show the edit form for an item * Show the edit form for an item
* @method edit * @method edit
* @param id {int} id of the item to edit * @param id {int} id of the item to edit
*/ */
edit(id) { edit(id) {
this.currentId = id; this.currentId = id;
this.getElement(id, []); this.getElement(id, []);
@@ -890,10 +891,10 @@ class ModuleBase {
} }
/** /**
* Delete an item * Delete an item
* @method deleteRow * @method deleteRow
* @param id {int} id of the item to edit * @param id {int} id of the item to edit
*/ */
deleteRow(id) { deleteRow(id) {
this.deleteParams.id = id; this.deleteParams.id = id;
@@ -902,17 +903,17 @@ class ModuleBase {
} }
/** /**
* Show a popup with message * Show a popup with message
* @method showMessage * @method showMessage
* @param title {String} title of the message box * @param title {String} title of the message box
* @param message {String} message * @param message {String} message
* @param closeCallback {Function} this will be called once the dialog is closed (optional) * @param closeCallback {Function} this will be called once the dialog is closed (optional)
* @param closeCallback {Function} data to pass to close callback (optional) * @param closeCallback {Function} data to pass to close callback (optional)
* @param closeCallbackData * @param closeCallbackData
* @param isPlain {Boolean} if true buttons are not shown (optional / default = true) * @param isPlain {Boolean} if true buttons are not shown (optional / default = true)
* @example * @example
* this.showMessage("Error Occured while Applying Leave", callBackData); * this.showMessage("Error Occured while Applying Leave", callBackData);
*/ */
showMessage(title, message, closeCallback = null, closeCallbackData = null, isPlain = false) { showMessage(title, message, closeCallback = null, closeCallbackData = null, isPlain = false) {
const that = this; const that = this;
let modelId = ''; let modelId = '';
@@ -1005,11 +1006,11 @@ class ModuleBase {
/** /**
* Create or edit an element * Create or edit an element
* @method save * @method save
* @param getFunctionCallBackData {Array} once a success is returned call get() function for this module with these parameters * @param getFunctionCallBackData {Array} once a success is returned call get() function for this module with these parameters
* @param successCallback {Function} this will get called after success response * @param successCallback {Function} this will get called after success response
*/ */
save(callGetFunction, successCallback) { save(callGetFunction, successCallback) {
const validator = new FormValidation(`${this.getTableName()}_submit`, true, { ShowPopup: false, LabelErrorClass: 'error' }); const validator = new FormValidation(`${this.getTableName()}_submit`, true, { ShowPopup: false, LabelErrorClass: 'error' });
@@ -1040,7 +1041,7 @@ class ModuleBase {
const fields = this.getFormFields(); const fields = this.getFormFields();
fields.forEach((field) => { fields.forEach((field) => {
if ((field[1].type === 'date' || field[1].type === 'datetime') if ((field[1].type === 'date' || field[1].type === 'datetime')
&& (params[field[0]] === '' || params[field[0]] === '0000-00-00' || params[field[0]] === '0000-00-00 00:00:00')) { && (params[field[0]] === '' || params[field[0]] === '0000-00-00' || params[field[0]] === '0000-00-00 00:00:00')) {
if (field[1].validation === 'none') { if (field[1].validation === 'none') {
params[field[0]] = 'NULL'; params[field[0]] = 'NULL';
} else { } else {
@@ -1084,23 +1085,23 @@ class ModuleBase {
} }
/** /**
* Override this method to inject attitional parameters or modify existing parameters retrived from * Override this method to inject attitional parameters or modify existing parameters retrived from
* add/edit form before sending to the server * add/edit form before sending to the server
* @method forceInjectValuesBeforeSave * @method forceInjectValuesBeforeSave
* @param params {Array} keys and values in form * @param params {Array} keys and values in form
* @returns {Array} modified parameters * @returns {Array} modified parameters
*/ */
forceInjectValuesBeforeSave(params) { forceInjectValuesBeforeSave(params) {
return params; return params;
} }
/** /**
* Override this method to do custom validations at client side * Override this method to do custom validations at client side
* @method doCustomValidation * @method doCustomValidation
* @param params {Array} keys and values in form * @param params {Array} keys and values in form
* @returns {Null or String} return null if validation success, returns error message if unsuccessful * @returns {Null or String} return null if validation success, returns error message if unsuccessful
* @example * @example
EmployeeLeaveAdapter.method('doCustomValidation(params) { EmployeeLeaveAdapter.method('doCustomValidation(params) {
try{ try{
if(params['date_start'] != params['date_end']){ if(params['date_start'] != params['date_end']){
var ds = new Date(params['date_start']); var ds = new Date(params['date_start']);
@@ -1114,7 +1115,7 @@ class ModuleBase {
} }
return null; return null;
} }
*/ */
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
doCustomValidation(params) { doCustomValidation(params) {
return null; return null;
@@ -1177,7 +1178,12 @@ class ModuleBase {
value = 'Not Selected'; value = 'Not Selected';
} }
} else { } else {
value = this.fieldMasterData[`${rmf[0]}_${rmf[1]}_${rmf[2]}`][filters[prop]]; let key = `${rmf[0]}_${rmf[1]}_${rmf[2]}`;
if (rmf.length > 3) {
key = `${key}_${rmf[3]}`;
}
//value = this.fieldMasterData[`${rmf[0]}_${rmf[1]}_${rmf[2]}`][filters[prop]];
value = this.fieldMasterData[key][filters[prop]];
valueOrig = value; valueOrig = value;
} }
} else { } else {
@@ -1231,20 +1237,20 @@ class ModuleBase {
} }
/** /**
* Override this method to do custom validations at client side for values selected in filters * Override this method to do custom validations at client side for values selected in filters
* @method doCustomFilterValidation * @method doCustomFilterValidation
* @param params {Array} keys and values in form * @param params {Array} keys and values in form
* @returns {Null or String} return null if validation success, returns error message if unsuccessful * @returns {Null or String} return null if validation success, returns error message if unsuccessful
*/ */
doCustomFilterValidation(params) { doCustomFilterValidation(params) {
return true; return true;
} }
/** /**
* Reset selected filters * Reset selected filters
* @method resetFilters * @method resetFilters
*/ */
resetFilters() { resetFilters() {
this.filter = this.origFilter; this.filter = this.origFilter;
@@ -1332,7 +1338,8 @@ class ModuleBase {
try { try {
modJs.filterQuery(); modJs.filterQuery();
} catch (err) { } catch (err) {
// Do Nothing console.log(err);
console.log(err.message);
} }
return false; return false;
}); });
@@ -1344,20 +1351,20 @@ class ModuleBase {
/** /**
* Override this method in your module class to make changes to data fo the form before showing the form * Override this method in your module class to make changes to data fo the form before showing the form
* @method preRenderForm * @method preRenderForm
* @param object {Array} keys value list for populating form * @param object {Array} keys value list for populating form
*/ */
preRenderForm(object) { preRenderForm(object) {
} }
/** /**
* Create the form * Create the form
* @method renderForm * @method renderForm
* @param object {Array} keys value list for populating form * @param object {Array} keys value list for populating form
*/ */
renderForm(object) { renderForm(object) {
const signatureIds = []; const signatureIds = [];
@@ -1581,28 +1588,28 @@ class ModuleBase {
} }
/** /**
* Override this method in your module class to make changes to data fo the form after showing it * Override this method in your module class to make changes to data fo the form after showing it
* @method postRenderForm * @method postRenderForm
* @param object {Array} keys value list for populating form * @param object {Array} keys value list for populating form
* @param $tempDomObj {DOM} a DOM element for the form * @param $tempDomObj {DOM} a DOM element for the form
* @example * @example
* UserAdapter.method('postRenderForm(object, $tempDomObj) { * UserAdapter.method('postRenderForm(object, $tempDomObj) {
if(object == null || object == undefined){ if(object == null || object == undefined){
$tempDomObj.find("#changePasswordBtn").remove(); $tempDomObj.find("#changePasswordBtn").remove();
} }
} }
*/ */
postRenderForm(object, $tempDomObj) { postRenderForm(object, $tempDomObj) {
} }
/** /**
* Convert data group field to HTML * Convert data group field to HTML
* @method dataGroupToHtml * @method dataGroupToHtml
* @param val {String} value in the field * @param val {String} value in the field
* @param field {Array} field meta data * @param field {Array} field meta data
*/ */
dataGroupToHtml(val, field) { dataGroupToHtml(val, field) {
const data = JSON.parse(val); const data = JSON.parse(val);
@@ -1657,10 +1664,10 @@ class ModuleBase {
} }
/** /**
* Reset the DataGroup for a given field * Reset the DataGroup for a given field
* @method resetDataGroup * @method resetDataGroup
* @param field {Array} field meta data * @param field {Array} field meta data
*/ */
resetDataGroup(field) { resetDataGroup(field) {
$(`#${field[0]}`).val(''); $(`#${field[0]}`).val('');
$(`#${field[0]}_div`).html(''); $(`#${field[0]}_div`).html('');
@@ -2054,12 +2061,12 @@ class ModuleBase {
/** /**
* Fill a form with required values after showing it * Fill a form with required values after showing it
* @method fillForm * @method fillForm
* @param object {Array} form data * @param object {Array} form data
* @param formId {String} id of the form * @param formId {String} id of the form
* @param formId {Array} field meta data * @param formId {Array} field meta data
*/ */
fillForm(object, formId, fields) { fillForm(object, formId, fields) {
let placeHolderVal; let placeHolderVal;
@@ -2094,7 +2101,8 @@ class ModuleBase {
$(`${formId} #${fields[i][0]}`).html(object[fields[i][0]]); $(`${formId} #${fields[i][0]}`).html(object[fields[i][0]]);
} else if (fields[i][1].type === 'placeholder') { } else if (fields[i][1].type === 'placeholder') {
if (fields[i][1]['remote-source'] !== undefined && fields[i][1]['remote-source'] != null) { if (fields[i][1]['remote-source'] !== undefined && fields[i][1]['remote-source'] != null) {
const key = `${fields[i][1]['remote-source'][0]}_${fields[i][1]['remote-source'][1]}_${fields[i][1]['remote-source'][2]}`; //const key = `${fields[i][1]['remote-source'][0]}_${fields[i][1]['remote-source'][1]}_${fields[i][1]['remote-source'][2]}`;
const key = this.getRemoteSourceKey(fields[i]);
placeHolderVal = this.fieldMasterData[key][object[fields[i][0]]]; placeHolderVal = this.fieldMasterData[key][object[fields[i][0]]];
} else { } else {
placeHolderVal = object[fields[i][0]]; placeHolderVal = object[fields[i][0]];
@@ -2172,7 +2180,7 @@ class ModuleBase {
} }
} else if (fields[i][1].type === 'signature') { } else if (fields[i][1].type === 'signature') {
if (object[fields[i][0]] !== '' || object[fields[i][0]] !== undefined if (object[fields[i][0]] !== '' || object[fields[i][0]] !== undefined
|| object[fields[i][0]] != null) { || object[fields[i][0]] != null) {
$(`${formId} #${fields[i][0]}`).data('signaturePad').fromDataURL(object[fields[i][0]]); $(`${formId} #${fields[i][0]}`).data('signaturePad').fromDataURL(object[fields[i][0]]);
} }
} else if (fields[i][1].type === 'simplemde') { } else if (fields[i][1].type === 'simplemde') {
@@ -2189,9 +2197,9 @@ class ModuleBase {
} }
/** /**
* Cancel edit or add new on modules * Cancel edit or add new on modules
* @method cancel * @method cancel
*/ */
cancel() { cancel() {
$(`#${this.getTableName()}Form`).hide(); $(`#${this.getTableName()}Form`).hide();
@@ -2218,10 +2226,11 @@ class ModuleBase {
if (field[1].source !== undefined && field[1].source != null) { if (field[1].source !== undefined && field[1].source != null) {
t = t.replace('_options_', this.renderFormSelectOptions(field[1].source, field)); t = t.replace('_options_', this.renderFormSelectOptions(field[1].source, field));
} else if (field[1]['remote-source'] !== undefined && field[1]['remote-source'] != null) { } else if (field[1]['remote-source'] !== undefined && field[1]['remote-source'] != null) {
let key = `${field[1]['remote-source'][0]}_${field[1]['remote-source'][1]}_${field[1]['remote-source'][2]}`; // let key = `${field[1]['remote-source'][0]}_${field[1]['remote-source'][1]}_${field[1]['remote-source'][2]}`;
if (field[1]['remote-source'].length === 4) { // if (field[1]['remote-source'].length === 4) {
key = `${key}_${field[1]['remote-source'][3]}`; // key = `${key}_${field[1]['remote-source'][3]}`;
} // }
const key = this.getRemoteSourceKey(field);
t = t.replace('_options_', this.renderFormSelectOptionsRemote(this.fieldMasterData[key], field)); t = t.replace('_options_', this.renderFormSelectOptionsRemote(this.fieldMasterData[key], field));
} }
} else if (field[1].type === 'colorpick') { } else if (field[1].type === 'colorpick') {
@@ -2413,49 +2422,49 @@ class ModuleBase {
} }
/** /**
* Override this method to change add new button label * Override this method to change add new button label
* @method getAddNewLabel * @method getAddNewLabel
*/ */
getAddNewLabel() { getAddNewLabel() {
return 'Add New'; return 'Add New';
} }
/** /**
* Used to set whether to show the add new button for a module * Used to set whether to show the add new button for a module
* @method setShowAddNew * @method setShowAddNew
* @param showAddNew {Boolean} value * @param showAddNew {Boolean} value
*/ */
setShowAddNew(showAddNew) { setShowAddNew(showAddNew) {
this.showAddNew = showAddNew; this.showAddNew = showAddNew;
} }
/** /**
* Used to set whether to show delete button for each entry in module * Used to set whether to show delete button for each entry in module
* @method setShowDelete * @method setShowDelete
* @param val {Boolean} value * @param val {Boolean} value
*/ */
setShowDelete(val) { setShowDelete(val) {
this.showDelete = val; this.showDelete = val;
} }
/** /**
* Used to set whether to show edit button for each entry in module * Used to set whether to show edit button for each entry in module
* @method setShowEdit * @method setShowEdit
* @param val {Boolean} value * @param val {Boolean} value
*/ */
setShowEdit(val) { setShowEdit(val) {
this.showEdit = val; this.showEdit = val;
} }
/** /**
* Used to set whether to show save button in form * Used to set whether to show save button in form
* @method setShowSave * @method setShowSave
* @param val {Boolean} value * @param val {Boolean} value
*/ */
setShowSave(val) { setShowSave(val) {
@@ -2464,20 +2473,20 @@ class ModuleBase {
/** /**
* Used to set whether to show cancel button in form * Used to set whether to show cancel button in form
* @method setShowCancel * @method setShowCancel
* @param val {Boolean} value * @param val {Boolean} value
*/ */
setShowCancel(val) { setShowCancel(val) {
this.showCancel = val; this.showCancel = val;
} }
/** /**
* Datatable option array will be extended with associative array provided here * Datatable option array will be extended with associative array provided here
* @method getCustomTableParams * @method getCustomTableParams
* @param val {Boolean} value * @param val {Boolean} value
*/ */
getCustomTableParams() { getCustomTableParams() {
@@ -2490,12 +2499,12 @@ class ModuleBase {
/** /**
* This return html for action buttons in each row. Override this method if you need to make changes to action buttons. * This return html for action buttons in each row. Override this method if you need to make changes to action buttons.
* @method getActionButtonsHtml * @method getActionButtonsHtml
* @param id {int} id of the row * @param id {int} id of the row
* @param data {Array} data for the row * @param data {Array} data for the row
* @returns {String} html for action buttons * @returns {String} html for action buttons
*/ */
getActionButtonsHtml(id, data) { 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 editButton = '<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>';
@@ -2528,11 +2537,11 @@ class ModuleBase {
/** /**
* Generates a random string * Generates a random string
* @method generateRandom * @method generateRandom
* @param length {int} required length of the string * @param length {int} required length of the string
* @returns {String} random string * @returns {String} random string
*/ */
generateRandom(length) { generateRandom(length) {
const d = new Date(); const d = new Date();
@@ -2593,10 +2602,10 @@ class ModuleBase {
} }
/** /**
* Override this method in a module to provide the help link for the module. Help link of the module on frontend will get updated with this. * Override this method in a module to provide the help link for the module. Help link of the module on frontend will get updated with this.
* @method getHelpLink * @method getHelpLink
* @returns {String} help link * @returns {String} help link
*/ */
getHelpLink() { getHelpLink() {
return null; return null;