More Related Content Similar to Splitapp coding Similar to Splitapp coding (20) Splitapp coding1. Detailsview:
createContent : function(oController) {
var oForm = new sap.ui.layout.form.SimpleForm(
"sf1",
{
maxContainerCols: 1,
editable: false,
content:[
new sap.ui.core.Title({text:"RRF
Details"}),
new sap.ui.commons.Label({text:"RRF
ID",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/Rrfid}", id:"Rrfid", editable:false}),
new
sap.ui.commons.Label({text:"Start
Date",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/StartDate}", id:"StartDate" ,
editable:false}),
new sap.ui.commons.Label({text:"End
Date",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/EndDate}", id:"EndDate" ,
editable:false}),
new sap.ui.core.Title({text:"Job
Description"}),
new sap.ui.commons.Label({text:"Job
Title",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/Jobtitle}", id:"Jobtitle",
editable:false}),
new sap.ui.commons.Label({text:"Work
Experience",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/Workexperience}", id:"Workexperience",
editable:false}),
new
sap.ui.commons.Label({text:"No.of
Vacancy",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/NoOfVacancy}", id:"NoOfVacancy",
editable:false}),
new sap.ui.commons.Label({text:"Work
Location",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/Worklocation}", id:"Worklocation",
editable:false}),
new
sap.ui.core.Title({text:"Qualification"}),
new
sap.ui.commons.Label({text:"Qualification",design:sap.ui.commons.TextViewDesign.Bo
ld}),
2. new
sap.ui.commons.TextField({value:"{item>/Qualification}", id:"Qualification",
editable:false}),
new sap.ui.core.Title({text:"Manager
Details"}),
new
sap.ui.commons.Label({text:"Personnel
Officer",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/PersonnelOfficer}", id:"PersonnelOfficer"
, editable:false}),
new sap.ui.commons.Label({text:"Line
Manager",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/LineManager}", id:"LineManager" ,
editable:false}),
new
sap.ui.commons.Label({text:"Status",design:sap.ui.commons.TextViewDesign.Bold}),
new
sap.ui.commons.TextField({value:"{item>/Status}", id:"Status" , editable:false}),
new sap.ui.core.Title({text:""}),
new sap.ui.commons.Button({
id:"b4",
text: "Accept",
style:
sap.ui.commons.ButtonStyle.Accept,
press: function()
{
oController.accept1();
}
}),
new sap.ui.commons.Button({
id:"b5",
text: "Reject",
style:
sap.ui.commons.ButtonStyle.Reject,
press: function()
{
oController.reject1();
}
}),
new sap.ui.commons.Button({
id:"b6",
text: "Home",
style:
sap.ui.commons.ButtonStyle.Emph,
press: function()
{
var app =
sap.ui.getCore().byId("idapp");
app.to("masterid");
}
})
]
});
3. return new sap.m.Page({
title: "RRF APPROVAL PAGE",
content: [oForm]
});
}
});
Details.controller:
accept1: function() {
var oEntry = {};
oEntry.Rrfid= sap.ui.getCore().byId("Rrfid").getValue();
oEntry.Jobtitle= sap.ui.getCore().byId("Jobtitle").getValue();
oEntry.Workexperience=
sap.ui.getCore().byId("Workexperience").getValue();
oEntry.NoOfVacancy= sap.ui.getCore().byId("NoOfVacancy").getValue();
oEntry.Qualification= sap.ui.getCore().byId("Qualification").getValue();
oEntry.Worklocation= sap.ui.getCore().byId("Worklocation").getValue();
oEntry.StartDate= sap.ui.getCore().byId("StartDate").getValue();
oEntry.EndDate= sap.ui.getCore().byId("EndDate").getValue();
oEntry.PersonnelOfficer=
sap.ui.getCore().byId("PersonnelOfficer").getValue();
oEntry.LineManager= sap.ui.getCore().byId("LineManager").getValue();
oEntry.Status= sap.ui.getCore().byId("Status").getValue();
oEntry.Approvaldate= "";
OData.request({
requestUri :
"proxy/http/192.168.100.13:8000/sap/opu/odata/sap/ZHCM_REC_CEORRF_SRV/ZHCM_REC_CEO
PROCESSSet",
method : "GET",
headers : {
"X-Requested-With" :
"XMLHttpRequest",
"Content-Type" :
"application/atom+xml",
"DataServiceVersion" : "2.0",
"X-CSRF-Token" : "Fetch"
}
},
function(data, response) {
header_xcsrf_token =
response.headers['x-csrf-token'];
var oHeaders = {
"x-csrf-token" :
header_xcsrf_token,
'Accept' :
'application/json',
};
OData.request({
requestUri :
"proxy/http/192.168.100.13:8000/sap/opu/odata/sap/ZHCM_REC_CEORRF_SRV/ZHCM_REC_CEO
PROCESSSet",
method : "POST",
4. headers : oHeaders,
data:oEntry
},
function(data,request) {
alert("RRF Approved Successfully ");
location.reload(true);
}, function(err) {
alert("RRF Approved Successfully ");
location.reload(true);
});
}, function(err) {
var request = err.request;
var response = err.response;
alert("Error in Get -- Request " +
request + " Response " + response);
});
},
//Reject
reject1: function() {
var oEntry = {};
oEntry.Rrfid=
sap.ui.getCore().byId("Rrfid").getValue();
OData.request({
requestUri :
"proxy/http/192.168.100.13:8000/sap/opu/odata/sap/ZHCM_REC_CEORRF_SRV/ZHCM_REC_CEO
PROCESSSet",
method :
"GET",
headers
: {
"X-Requested-With" : "XMLHttpRequest",
"Content-Type" : "application/atom+xml",
"DataServiceVersion" : "2.0",
"X-CSRF-Token" : "Fetch"
}
},
function(data, response) {
header_xcsrf_token = response.headers['x-csrf-token'];
var oHeaders = {
"x-csrf-token" : header_xcsrf_token,
5. 'Accept' : 'application/json',
};
OData.request({
requestUri :
"proxy/http/192.168.100.13:8000/sap/opu/odata/sap/ZHCM_REC_CEORRF_SRV/ZHCM_REC_CEO
PROCESSSet('" + oEntry.Rrfid + "')",
method : "PUT",
headers : oHeaders,
data:oEntry
},
function(data,request) {
alert("Rejected Performed");
location.reload(true);
}, function(err) {
alert("Rejection Failed");
});
},
function(err) {
var request = err.request;
var response = err.response;
alert("Error in Get -- Request " + request + " Response " + response);
});
}
});
Master view:
createContent : function(oController) {
var oList = new sap.m.List({
id: "listid",
mode: sap.m.ListMode.SingleSelect,
select: function(){
oController.itemSelected();
}
});
var oitemTemplate = new sap.m.StandardListItem({
6. id: "sList",
title:"{Rrfid}",
description:"{Jobtitle}"
});
oList.bindAggregation("items","/results",oitemTemplate);
return new sap.m.Page({
title: "Open RRF Details",
content: [oList]
});
}
});
Master Controller:
onInit: function() {
var oModel = new
sap.ui.model.odata.ODataModel("proxy/http/192.168.100.13:8000/sap/opu/odata/sap/ZH
CM_REC_CEORRF_SRV", true);
var oJsonModel = new sap.ui.model.json.JSONModel();
oModel.read("/ZHCM_REC_CEOPROCESSSet?",null,null,true,function(oData,response){
oJsonModel.setData(oData);
});
sap.ui.getCore().setModel(oJsonModel);
},
onExit: function() {
//
// }
itemSelected: function()
{
var app= sap.ui.getCore().byId("appid");
var list= sap.ui.getCore().byId("listid");
var sItem=list.getSelectedItem();
var spath = sItem.oBindingContexts.undefined.sPath;
var item = sap.ui.getCore().getModel().getProperty(spath);
var oModel1 = new sap.ui.model.json.JSONModel(item);
sap.ui.getCore().setModel(oModel1,'item');
app.to('detailid',"flip","duration:'slow'");
}
});
Topview:
createContent : function(oController) {
return new sap.m.Page({
title: "RRF APPROVALS",
content: [
new sap.ui.commons.TextView({
text: "RRF APPROVAL HOME PAGE",
design: sap.ui.commons.TextViewDesign.WS
7. })
]
});
}});
Topview controller:
No coding
Index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m,sap.ui.commons,sap.ui.layout"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal"
theme -->
<script>
sap.ui.localResources("sapliappjs");
var osplitapp = new sap.m.SplitApp("appid",{});
var oIntrapage = sap.ui.view({
id: "introId",
viewName: "sapliappjs.topview",
type: sap.ui.core.mvc.ViewType.JS
});
var oMasterpage = sap.ui.view({
id: "masterid",
viewName: "sapliappjs.Master",
type: sap.ui.core.mvc.ViewType.JS
});
var oDetailpage = sap.ui.view({
id: "detailid",
viewName: "sapliappjs.Details",
type: sap.ui.core.mvc.ViewType.JS
});
osplitapp.addDetailPage(oIntrapage).addDetailPage(oDetailpage);
osplitapp.addMasterPage(oMasterpage);
osplitapp.setInitialDetail("introId");
osplitapp.setInitialMaster("masterid");
osplitapp.setMode("PopoverMode");
osplitapp.placeAt("content");