Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LEAF 4258 orgchart group and position, fix report builder display when not found #2629

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions LEAF_Request_Portal/sources/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2671,17 +2671,27 @@ public function getCustomData(array $recordID_list, string|null $indicatorID_lis
}
break;
case 'orgchart_position':
$positionTitle = $this->position->getTitle($item['data']);
$positionData = $this->position->getAllData($item['data']);

$item['dataOrgchart'] = $positionData;
$item['dataOrgchart']['positionID'] = $item['data'];
$item['data'] = "{$positionTitle} ({$positionData[2]['data']}-{$positionData[13]['data']}-{$positionData[14]['data']})";
$dataDisplay = "";
if(!empty(trim($item['data']))) {
$positionTitle = $this->position->getTitle($item['data']);
if ($positionTitle !== false) {
$positionData = $this->position->getAllData($item['data']);
$dataDisplay = "{$positionTitle} ({$positionData[2]['data']}-{$positionData[13]['data']}-{$positionData[14]['data']})";
$item['dataOrgchart'] = $positionData;
$item['dataOrgchart']['positionID'] = $item['data'];
} else {
$dataDisplay = "Position #" . $item['data'] ." no longer available";
}
}
$item['data'] = $dataDisplay;
break;
case 'orgchart_group':
$groupTitle = $this->group->getTitle($item['data']);

$item['data'] = $groupTitle;
$dataDisplay = "";
if(!empty(trim($item['data']))) {
$groupTitle = $this->group->getTitle($item['data']);
$dataDisplay = $groupTitle !== false ? $groupTitle : "Group #" . $item['data'] ." no longer available";
}
$item['data'] = $dataDisplay;
break;
case 'raw_data':
if($indicators[$item['indicatorID']]['htmlPrint'] != '') {
Expand Down
63 changes: 35 additions & 28 deletions LEAF_Request_Portal/templates/subindicators.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -979,39 +979,46 @@
<div id="indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->" style="padding: 0px">
<script>
$(function() {
$.ajax({
type: 'GET',
url: "<!--{$orgchartPath}-->/api/position/<!--{$indicator.value|strip_tags}-->",
dataType: 'json',
success: function(data) {
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').html('<b>' + data.title + '</b>'
/* Pay Plan, Series, Pay Grade */ + '<br />' + data[2].data + '-' + data[13].data + '-' + data[14].data);
const displayValue = '<!--{$indicator.displayedValue|strip_tags}-->';
if(displayValue !== '') {
$.ajax({
type: 'GET',
url: "<!--{$orgchartPath}-->/api/position/<!--{$indicator.value|strip_tags}-->",
dataType: 'json',
success: function(data) {
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').html('<b>' + data.title + '</b>'
/* Pay Plan, Series, Pay Grade */ + '<br />' + data[2].data + '-' + data[13].data + '-' + data[14].data);

if(data[3].data != '') {
for(i in data[3].data) {
var pdLink = document.createElement('a');
pdLink.innerHTML = data[3].data[i];
pdLink.setAttribute('href', '<!--{$orgchartPath}-->/file.php?categoryID=2&UID=<!--{$indicator.value|strip_tags}-->&indicatorID=3&file=' + encodeURIComponent(data[3].data[i]));
pdLink.setAttribute('class', 'printResponse');
pdLink.setAttribute('target', '_blank');
if(data[3].data != '') {
for(i in data[3].data) {
var pdLink = document.createElement('a');
pdLink.innerHTML = data[3].data[i];
pdLink.setAttribute('href', '<!--{$orgchartPath}-->/file.php?categoryID=2&UID=<!--{$indicator.value|strip_tags}-->&indicatorID=3&file=' + encodeURIComponent(data[3].data[i]));
pdLink.setAttribute('class', 'printResponse');
pdLink.setAttribute('target', '_blank');

$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append('<br />Position Description: ');
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append(pdLink);
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append('<br />Position Description: ');
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append(pdLink);
}
}
}

br = document.createElement('br');
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append(br);
br = document.createElement('br');
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append(br);

var ocLink = document.createElement('div');
ocLink.innerHTML = '<img src="dynicons/?img=preferences-system-windows.svg&w=32" alt="" /> View Details in Org. Chart';
ocLink.setAttribute('onclick', "window.open('<!--{$orgchartPath}-->/?a=view_position&positionID=<!--{$indicator.value|strip_tags}-->','Resource_Request','width=870,resizable=yes,scrollbars=yes,menubar=yes');");
ocLink.setAttribute('class', 'buttonNorm');
ocLink.setAttribute('style', 'margin-top: 8px');
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append(ocLink);
},
cache: false
});
var ocLink = document.createElement('div');
ocLink.innerHTML = '<img src="dynicons/?img=preferences-system-windows.svg&w=32" alt="" /> View Details in Org. Chart';
ocLink.setAttribute('onclick', "window.open('<!--{$orgchartPath}-->/?a=view_position&positionID=<!--{$indicator.value|strip_tags}-->','Resource_Request','width=870,resizable=yes,scrollbars=yes,menubar=yes');");
ocLink.setAttribute('class', 'buttonNorm');
ocLink.setAttribute('style', 'margin-top: 8px');
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').append(ocLink);
},
cache: false
});
} else {
$('#indata_<!--{$indicator.indicatorID|strip_tags}-->_<!--{$indicator.series|strip_tags}-->').html(
`Position #<!--{$indicator.value|strip_tags}--> no longer available`
);
}
});
</script>
Loading...
Expand Down
Loading