var DepMan = this.DepartmentManager;
if (!DepMan.IsInitial() && this.DepartmentManagerName.IsInitial()
&& this.DepartmentManagerImageURI.IsInitial() && this.DepartmentManagerTitle.IsInitial()){
identification = Employee.Identification.Retrieve(DepMan);
if (identification.IsSet()){
employee = identification.ToParent;
if (employee.IsSet() && employee.CurrentCommon.IsSet()){
// Fetch Name
this.DepartmentManagerName = employee.CurrentCommon.BusinessPartnerFormattedName;
if (employee.IsSet() && employee.CurrentOrganisationalUnitAssignment.Count()>0
&& employee.CurrentOrganisationalUnitAssignment.Job.Count()>0){
// Fetch Title
this.DepartmentManagerTitle = employee.CurrentOrganisationalUnitAssignment.Job.GetFirst().CurrentName.Name.content;
}
empAttachment = employee.AttachmentFolder;
if (empAttachment.IsSet() && empAttachment.Document.Count()>0){
// Fetch Profile Image URL
employee_image = empAttachment.Document.GetFirst().FileContentURI.content;
}
}
}
// Custom logic to determine Department Manager status color - it can be varied based on your
requirement
if (Numeric.ParseFromString( DepManStepId) < this.CurrentApprovalStepId){
this. DepartmentManagerStatus = green;
}else{
if(Numeric.ParseFromString( DepManStepId)>this.CurrentApprovalStepId){
this. DepartmentManagerStatus = grey;
}else{
if(this.ApprovalStatus == approved){
this. DepartmentManagerStatus = green;
}else{
if(this.ApprovalStatus == inrevision){
this. DepartmentManagerStatus = blue;
}else{
if(this.ApprovalStatus == rejected){
this. DepartmentManagerStatus = red;
}else{
if((this.ApprovalStatus == approvalNotStarted)||(this.ApprovalStatus == inapproval)){
this. DepartmentManagerStatus = grey;
}
}
}
}
}
}
}
if (empAttachment.IsSet() && empAttachment.Document.Count()>0){
employee_image = empAttachment.Document.GetFirst().FileContentURI.content;
length = employee_image.Length();
trimlength =employee_image.Find("/sap",0,length-1);
this.SalesDepartmentManagerImageURI = employee_image.Substring(trimlength+4);
}
<!DOCTYPE html>
<html>
<head>
<title>Approval Process</title>
<style>
img {
border-radius: 100%;
}
.red
{
border:3px Solid Red;
}
.green
{
border:3px Solid Green;
}
.grey
{
border:3px Solid #7e7e7e;
}
.blue
{
border:3px Solid Blue;
}
.italic {
font-style: italic;
text-align: center;
font-size: 10px;
height:11px;
color:#484848;
}
</style>
<script>
// current session url
var CurrentSessionUrl = (sap.byd.ui.mashup.context.inport.CurrentSessionURL);
if(CurrentSessionUrl.includes('https/')){
CurrentSessionUrl = CurrentSessionUrl.split("https/").pop();
CurrentSessionUrl = "https://"+CurrentSessionUrl;
}
// Arrow Image
var ArrowImageURI = (sap.byd.ui.mashup.context.inport.ArrowImageURI);
ArrowImageURI = CurrentSessionUrl+ArrowImageURI;
//alert(ArrowImageURI);
// 2. DepartmentManager details
var DepartmentManagerName = (sap.byd.ui.mashup.context.inport.DepartmentManagerName);
var DepartmentManagerImageURI = (sap.byd.ui.mashup.context.inport.DepartmentManagerImageURI);
DepartmentManagerImageURI = CurrentSessionUrl+DepartmentManagerImageURI;
var DepartmentManagerTitle = (sap.byd.ui.mashup.context.inport.DepartmentManagerTitle);
var DepartmentManagerStatus = (sap.byd.ui.mashup.context.inport.DepartmentManagerStatus);
function myFunction(){
document.getElementById('DeptManagerPic').src = SalesDepartmentManagerImageURI;
if(SalesDepartmentManagerStatus == "1"){
document.getElementById('DeptManagerPic').classList.add('green');
}else if(SalesDepartmentManagerStatus == "2"){
document.getElementById('DeptManagerPic').classList.add('blue');
}else if(SalesDepartmentManagerStatus == "3"){
document.getElementById('DeptManagerPic').classList.add('red');
}else{
document.getElementById('DeptManagerPic').classList.add('grey');
}
document.getElementById('arrowPic1').src = ArrowImageURI;
}
</script>
</head>
<body onload="myFunction()">
<table style="font-family:Arial;color:#787878;font-size:12px;height:15px">
<tr>
<td><img id="DeptManagerPic" alt="No Image" height=75 width=75></img></th>
<td><img id="arrowPic1" alt="" height=100 width=100></img></th>
</tr>
<tr style="text-align:center;">
<td><script>document.write(DepartmentManagerName)</script></th>
</tr>
<tr class="italic">
<td><script>document.write(DepartmentManagerTitle)</script></th>
</tr>
</table>
</body>
<html>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |