Commit 1e8f38af authored by Adrien PARROT's avatar Adrien PARROT
Browse files

Ajax CRUD on user ok on natus

parent b430668b
sap.ui.controller("conceptmapper.conceptDetailPage", {
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf conceptmapper.conceptDetailPage
*/
// onInit: function() {
//
// },
/**
* Called when a controller is instantiated and its View controls (if
* available) are already created. Can be used to modify the View before it
* is displayed, to bind event handlers and do other one-time
* initialization.
*
* @memberOf conceptmapper.conceptDetailPage
*/
onInit : function(oEvt) {
},
/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf conceptmapper.conceptDetailPage
*/
// onBeforeRendering: function() {
//
// },
* Similar to onAfterRendering, but this hook is invoked before the controller's
* View is re-rendered (NOT before the first rendering! onInit() is used for
* that one!).
*
* @memberOf conceptmapper.conceptDetailPage
*/
/**
* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
* This hook is the same one that SAPUI5 controls get after being rendered.
* @memberOf conceptmapper.conceptDetailPage
*/
// onAfterRendering: function() {
//
// },
* Called when the View has been rendered (so its HTML is part of the document).
* Post-rendering manipulations of the HTML could be done here. This hook is the
* same one that SAPUI5 controls get after being rendered.
*
* @memberOf conceptmapper.conceptDetailPage
*/
onAfterRendering: function() {
var oData = {
concept_id : "test",
concept_name : "fdfdfd",
concept_code : "34343-43",
concept_class_id : "parrot",
vocabulary_id : "SNOMED",
domain_id : "condition",
standard_concept : "S",
relations: [
{
concept_id : "12121",
concept_name : "lab Rate",
concept_code : "34343-43",
concept_class_id : "parrot",
vocabulary_id : "SNOMED",
domain_id : "condition",
validity : "Valid",
standard_concept : "S",
}, {
concept_id : "4545",
concept_name : "445454 Rate",
concept_code : "34343-43",
concept_class_id : "parrot",
vocabulary_id : "SNOMED",
domain_id : "condition",
validity : "Valid",
standard_concept : "S",
},
{
concept_id : 213121231,
concept_name : "Hematocssdjfkl fls sfdj lsfd flsdkjflsd slfj sdljsdlj fsdl fjrite",
concept_code : "334-21",
concept_class_id : "pondi",
vocabulary_id : "SNOMED",
domain_id : "LOINC",
validity : "Valid",
standard_concept : "S",
}
]
};
sap.ui.getCore().setModel(new sap.ui.model.json.JSONModel(oData), "conceptDetail");
// SUBHEADER
//debugger;
//lol = "{label>/concept_id}";
//var toaster = sap.m.MessageToast.show("{label>concept_id}");
var oModel = sap.ui.getCore().getModel('label');
// if (oModel !== undefined) {
// var aData = oModel.getProperty("/concept_id");
// alert(aData);
// }
// debugger;
},
/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
* @memberOf conceptmapper.conceptDetailPage
*/
// onExit: function() {
* Called when the Controller is destroyed. Use this one to free resources and
* finalize activities.
*
* @memberOf conceptmapper.conceptDetailPage
*/
// onExit: function() {
//
// }
// }
});
\ No newline at end of file
......@@ -19,7 +19,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
* @memberOf conceptmapper.conceptDetailPage
*/
createContent : function(oController) {
// SUBHEADER
var oSubHeader = new sap.m.Bar({
contentLeft : [ new sap.m.Button({
icon : "sap-icon://nav-back",
......@@ -28,7 +28,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
}
}) ],
contentMiddle : [ new sap.m.Label({
text : "{label>/concept_name}"
text : "{conceptDetail>/concept_name}"
}) ]
});
......@@ -43,9 +43,9 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
// title : "Responsive ObjectHeader with attributes",
// number : "3.628.000",
// numberUnit : "EUR",
title : "{label>/concept_name}",
number : "{label>/standard_concept}",
numberUnit : "{label>/validity}",
title : "{conceptDetail>/concept_name}",
number : "{conceptDetail>/standard_concept}",
numberUnit : "{conceptDetail>/validity}",
attributes : [
new sap.m.ObjectAttribute({
title : "concept_id",
......@@ -56,18 +56,18 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
}
}), new sap.m.ObjectAttribute({
title : "concept_code",
text : "{label>/concept_code}",
text : "{conceptDetail>/concept_code}",
}), new sap.m.ObjectAttribute({
title : "concept_class_id",
text : "{label>/concept_class_id}",
text : "{conceptDetail>/concept_class_id}",
active : true,
}), new sap.m.ObjectAttribute({
title : "vocabulary_id",
text : "{label>/vocabulary_id}",
text : "{conceptDetail>/vocabulary_id}",
}), new sap.m.ObjectAttribute({
title : "domain_id",
text : "{label>/domain_id}",
text : "{conceptDetail>/domain_id}",
}),
]
......@@ -85,11 +85,11 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
// headerText : "relations list",
});
oRelationList.bindItems({
path : "label>/relations",
path : "conceptDetail>/relations",
template : new sap.m.ObjectListItem({
title : "{label>concept_name}",
number : "{label>standard_concept}",
numberUnit : "{label>validity}",
title : "{conceptDetail>concept_name}",
number : "{conceptDetail>standard_concept}",
numberUnit : "{conceptDetail>validity}",
type:"Active",
press: function(){
app.back();
......@@ -97,47 +97,31 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
attributes : [
new sap.m.ObjectAttribute({
title : "concept_id",
text : "{label>concept_id}",
text : "{conceptDetail>concept_id}",
active : true,
press : function() {
alert("you press me");
}
}), new sap.m.ObjectAttribute({
title : "concept_code",
text : "{label>concept_code}",
text : "{conceptDetail>concept_code}",
}), new sap.m.ObjectAttribute({
title : "concept_class_id",
text : "{label>concept_class_id}",
text : "{conceptDetail>concept_class_id}",
active : true,
}), new sap.m.ObjectAttribute({
title : "vocabulary_id",
text : "{label>vocabulary_id}",
text : "{conceptDetail>vocabulary_id}",
}), new sap.m.ObjectAttribute({
title : "domain_id",
text : "{label>domain_id}",
text : "{conceptDetail>domain_id}",
}),
]
})
});
var oRelationsPanelHeader = new sap.m.ObjectHeader(
"oRelationsPanelHeader", {
// title : "Relations!!!!",
// number : "3.628.000",
// numberUnit : "EUR",
responsive : true,
// attributes : oAttrsRelations
});
oRelationsPanelHeader.bindAggregation("attributes", {
path : "test>/tester",
template : new sap.m.ObjectAttribute({
title : "concept_id",
text : "{test>Name}"
}),
});
var oHeaderPanel = new sap.m.Panel("oHeaderPanel", {
expandable : true,
......
......@@ -24,10 +24,10 @@ sap.ui.jsview("conceptmapper.homePage", {
title : "{i18n>tile_importCSV}",
press:[oController.goToCSV,oController]
});
var oTileAlgos = new sap.m.StandardTile({
title : "{i18n>tile_algos}",
// press:[oController.goToProductAnalytics,oController]
});
// var oTileAlgos = new sap.m.StandardTile({
// title : "{i18n>tile_algos}",
// // press:[oController.goToProductAnalytics,oController]
// });
var oTileSearch = new sap.m.StandardTile({
title : "{i18n>tile_search}",
press:[oController.goToSearch,oController]
......@@ -44,7 +44,7 @@ sap.ui.jsview("conceptmapper.homePage", {
});
var oTileCont = new sap.m.TileContainer({
tiles : [ oTileImportCSV, oTileUsers, oTileAlgos, oTileSearch,
tiles : [ oTileImportCSV, oTileUsers, oTileSearch,
oTileMap ]
});
......
......@@ -17,39 +17,6 @@ sap.ui.controller("conceptmapper.searchPage", {
domain_id : "condition",
validity : "Valid",
standard_concept : "S",
relations: [
{
concept_id : "12121",
concept_name : "lab Rate",
concept_code : "34343-43",
concept_class_id : "parrot",
vocabulary_id : "SNOMED",
domain_id : "condition",
validity : "Valid",
standard_concept : "S",
}, {
concept_id : "4545",
concept_name : "445454 Rate",
concept_code : "34343-43",
concept_class_id : "parrot",
vocabulary_id : "SNOMED",
domain_id : "condition",
validity : "Valid",
standard_concept : "S",
},
{
concept_id : 213121231,
concept_name : "Hematocssdjfkl fls sfdj lsfd flsdkjflsd slfj sdljsdlj fsdl fjrite",
concept_code : "334-21",
concept_class_id : "pondi",
vocabulary_id : "SNOMED",
domain_id : "LOINC",
validity : "Valid",
standard_concept : "S",
}
]
} , {
concept_id : 213121231,
concept_name : "Hematocssdjfkl fls sfdj lsfd flsdkjflsd slfj sdljsdlj fsdl fjrite",
......@@ -59,7 +26,6 @@ sap.ui.controller("conceptmapper.searchPage", {
domain_id : "LOINC",
validity : "Valid",
standard_concept : "S",
relations : []
} ],
"total_concepts": 5,
"total_valid_concepts": 4,
......@@ -136,20 +102,27 @@ sap.ui.controller("conceptmapper.searchPage", {
var sVal = oEvt.getParameters().rowBindingContext.getProperty('concept_id');
if (sVal !== undefined) {
var oData = {
"concept_id": oEvt.getParameters().rowBindingContext.getProperty('concept_id'),
"concept_name": oEvt.getParameters().rowBindingContext.getProperty('concept_name'),
"concept_code": oEvt.getParameters().rowBindingContext.getProperty('concept_code'),
"concept_class_id": oEvt.getParameters().rowBindingContext.getProperty('concept_class_id'),
"vocabulary_id": oEvt.getParameters().rowBindingContext.getProperty('vocabulary_id'),
"domain_id": oEvt.getParameters().rowBindingContext.getProperty('domain_id'),
"validity": oEvt.getParameters().rowBindingContext.getProperty('validity'),
"standard_concept": oEvt.getParameters().rowBindingContext.getProperty('standard_concept'),
"relations": oEvt.getParameters().rowBindingContext.getProperty('relations'),
"concept_id": sVal,
// "concept_name": oEvt.getParameters().rowBindingContext.getProperty('concept_name'),
// "concept_code": oEvt.getParameters().rowBindingContext.getProperty('concept_code'),
// "concept_class_id": oEvt.getParameters().rowBindingContext.getProperty('concept_class_id'),
// "vocabulary_id": oEvt.getParameters().rowBindingContext.getProperty('vocabulary_id'),
// "domain_id": oEvt.getParameters().rowBindingContext.getProperty('domain_id'),
// "validity": oEvt.getParameters().rowBindingContext.getProperty('validity'),
// "standard_concept": oEvt.getParameters().rowBindingContext.getProperty('standard_concept'),
// "relations": oEvt.getParameters().rowBindingContext.getProperty('relations'),
};
sap.ui.getCore().setModel(new sap.ui.model.json.JSONModel(oData), "label");
}
app.to('idConceptDetailPage', 'slide', {'adrienparrot': "jesuisgrand"}); //('fade', 'flip', 'show', 'slide =default')
this.getView().addEventDelegate({
onBeforeHide: function(event) {
var targetView = event.to;
var dataToPass = /*...*/
targetView.data("data", dataToPass);
}
}, this);
app.to('idConceptDetailPage', 'slide', {concept_id: oEvt.getParameters().rowBindingContext.getProperty('concept_id')}); //('fade', 'flip', 'show', 'slide =default')
},
......
......@@ -8,55 +8,17 @@ sap.ui.controller("conceptmapper.userPage", {
*
* @memberOf conceptmapper.userPage
*/
onInit : function() {
// $.ajax({
// type:"GET",
// url:"http://127.0.0.1:5000/users",
// dataType:"json",
// async: false,
// header: {
// "Content-Type": "application/json",
// },
// success: function(oData, response, xhr) {
// //debugger;
// var oModel = new sap.ui.model.json.JSONModel(oData);
// sap.ui.getCore().setModel(oModel, "user");
// console.log("connection");
// },
// error : function(error) {
// alert("pb in the connection");
// console.log(error);
// }
//
// });
var oData1 = {
"names" : [ {
username : "aparrot",
password : "toto",
firstname : "adrien",
lastname : "parrot",
address : "142",
email : "adrien.parrot@caramail.fr",
} , {
username : "mpondi",
password : "toto",
firstname : "marcy",
lastname : "pondi",
address : "142",
email : "marcy.pondi@caramail.fr",
} ]
};
var oModel = new sap.ui.model.json.JSONModel(oData1);
sap.ui.getCore().setModel(oModel, "user");
},
// onInit : function() {
//
// },
/******* CREATE *******/
openCreateDialog : function (oEvt) {
var URL_user = "http://omop-mapper.fgh.ovh/user/"
var oCreateDialog = new sap.m.Dialog({
title : "{i18n>create_user}",
icon : "sap-icon://employee"
......@@ -121,7 +83,7 @@ sap.ui.controller("conceptmapper.userPage", {
$.ajax({
type:"POST",
url:"http://127.0.0.1:5000/user/" + oData.username,
url: URL_user + oData.username,
dataType:"json",
data: oData,
async: false,
......@@ -170,6 +132,8 @@ sap.ui.controller("conceptmapper.userPage", {
/******* UPDATE *******/
openUpdateDialog : function(oEvt) {
var URL_user = "http://omop-mapper.fgh.ovh/user/"
var button_press = oEvt.getParameters().id;
var oTable_ref = sap.ui.getCore().byId(button_press).getParent().getParent();
idx = oTable_ref.getSelectedIndices();
......@@ -241,7 +205,7 @@ sap.ui.controller("conceptmapper.userPage", {
$.ajax({
type:"PUT",
url:"http://127.0.0.1:5000/user/" + oData.username,
url:URL_user + oData.username,
dataType:"json",
data: oData,
async: false,
......@@ -291,6 +255,8 @@ sap.ui.controller("conceptmapper.userPage", {
/******* DELETE *******/
openDeleteDialog : function (oEvt) {
var URL_user = "http://omop-mapper.fgh.ovh/user/"
var button_press = oEvt.getParameters().id;
var oTable_ref = sap.ui.getCore().byId(button_press).getParent().getParent();
idx = oTable_ref.getSelectedIndices();
......@@ -317,7 +283,7 @@ sap.ui.controller("conceptmapper.userPage", {
press: function () {
var URL = "http://127.0.0.1:5000/user/";
var URL = URL_user;
URL = URL + oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text');
$.ajax({
type:"DELETE",
......@@ -375,9 +341,50 @@ sap.ui.controller("conceptmapper.userPage", {
*
* @memberOf conceptmapper.userPage
*/
// onBeforeRendering: function() {
//
// },
onBeforeRendering: function() {
var URL_users = "http://omop-mapper.fgh.ovh/users"
$.ajax({
type:"GET",
url: URL_users,
dataType:"json",
async: false,
header: {
"Content-Type": "application/json",
},
success: function(oData, response, xhr) {
//debugger;
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "user");
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
}
});
// var oData1 = {
// "names" : [ {
// username : "aparrot",
// password : "toto",
// firstname : "adrien",
// lastname : "parrot",
// address : "142",
// email : "adrien.parrot@caramail.fr",
// } , {
// username : "mpondi",
// password : "toto",
// firstname : "marcy",
// lastname : "pondi",
// address : "142",
// email : "marcy.pondi@caramail.fr",
// } ]
// };
// var oModel = new sap.ui.model.json.JSONModel(oData1);
// sap.ui.getCore().setModel(oModel, "user");
},
/**
* Called when the View has been rendered (so its HTML is part of the document).
* Post-rendering manipulations of the HTML could be done here. This hook is the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment