Fix related to employee custom fields

This commit is contained in:
Thilina Hasantha
2016-08-04 17:09:17 +05:30
parent 698c5d3daa
commit 1e9e6f31a2
4 changed files with 60 additions and 12 deletions

View File

@@ -447,6 +447,43 @@ EmployeeAdapter.method('renderEmployee', function(data) {
$("#"+this.getTableName()+" #profile_image_"+data.id).attr('src',data.image);
var sectionTemplate = '<div class="row" style="margin-left:10px;margin-top:20px;"><div class="panel panel-default" style="width:97.5%;"><div class="panel-heading"><h4>#_section.name_#</h4></div> <div class="panel-body" id="cont_#_section_#"> </div></div></div>';
var sectionId = '';
var sectionHtml = '';
//Add custom fields
if(data.customFields != undefined && data.customFields != null && Object.keys(data.customFields).length > 0) {
var ct = '<div class="col-xs-6 col-md-3" style="font-size:16px;"><label class="control-label col-xs-12" style="font-size:13px;">#_label_#</label><label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;">#_value_#</label></div>';
var customFieldHtml;
for (index in data.customFields) {
if(!data.customFields[index][1]){
data.customFields[index][1] = 'Other Details';
}
sectionId = data.customFields[index][1].toLocaleLowerCase();
sectionId = sectionId.replace(' ','_');
if($("#cont_"+sectionId).length <= 0){
//Add section
sectionHtml = sectionTemplate;
sectionHtml = sectionHtml.replace('#_section_#', sectionId);
sectionHtml = sectionHtml.replace('#_section.name_#', data.customFields[index][1]);
$("#customFieldsCont").append($(sectionHtml));
}
customFieldHtml = ct;
customFieldHtml = customFieldHtml.replace('#_label_#', index);
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index][0]);
$("#cont_"+sectionId).append($(customFieldHtml));
}
}else{
$("#customFieldsCont").remove();
}
this.cancel();
if(!this.isModuleInstalled("admin","documents")) {

View File

@@ -167,14 +167,7 @@
<div class="row" id="customFieldsCont" style="margin-left:10px;margin-top:20px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Other Details</h4></div>
<div class="panel-body">
<div class="row-fluid" id="customFields">
</div>
</div>
</div>
</div>
@@ -214,4 +207,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -292,13 +292,31 @@ EmployeeAdapter.method('modEmployeeGetSuccessCallBack' , function(data) {
//Add custom fields
if(data.customFields != undefined && data.customFields != null && Object.keys(data.customFields).length > 0) {
var ct = '<div class="col-xs-6 col-md-3" style="font-size:16px;"><label class="control-label col-xs-12" style="font-size:13px;">#_label_#</label><label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;">#_value_#</label></div>';
var customFieldHtml;
for (index in data.customFields) {
if(!data.customFields[index][1]){
data.customFields[index][1] = 'Other Details';
}
sectionId = data.customFields[index][1].toLocaleLowerCase();
sectionId = sectionId.replace(' ','_');
if($("#cont_"+sectionId).length <= 0){
//Add section
sectionHtml = sectionTemplate;
sectionHtml = sectionHtml.replace('#_section_#', sectionId);
sectionHtml = sectionHtml.replace('#_section.name_#', data.customFields[index][1]);
$("#customFieldsCont").append($(sectionHtml));
}
customFieldHtml = ct;
customFieldHtml = customFieldHtml.replace('#_label_#', index);
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index]);
$("#customFields").append($(customFieldHtml));
customFieldHtml = customFieldHtml.replace('#_value_#', data.customFields[index][0]);
$("#cont_"+sectionId).append($(customFieldHtml));
}
}else{
$("#customFieldsCont").remove();

View File

@@ -533,10 +533,10 @@ Release note v18.0
* Allow indirect admins to allow travel requests
* Adding more languages to Language meta data table
* Improvements to report module
*
* Ability to select sections for placing custom fields on employee detail view screen
### Fixes
* Fix: suvordinates are not showing beyond first page issue.
* Fix: subordinates are not showing beyond first page issue.
Release note v16.1