Commit 1816cd9d authored by Adrien PARROT's avatar Adrien PARROT
Browse files

user and searchview working on omop

parent 101b2680
......@@ -230,12 +230,12 @@ sap.ui.controller("conceptmapper.searchPage", {
oData.concept_class_id = content[8].getValue();
oData.vocabulary_id = content[10].getValue();
oData.domain_id = content[12].getValue();
oData.validity = content[14].getValue();
oData.invalid_reason = content[14].getValue();
oData.standard_concept = content[16].getValue();
if (oData.concept_id !== "" && oData.concept_name !== ""
&& oData.concept_code && oData.concept_class_id && oData.vocabulary_id
&& oData.domain_id && oData.validity && oData.standard_concept ) {
&& oData.domain_id && oData.invalid_reason && oData.standard_concept ) {
//
......@@ -340,7 +340,7 @@ sap.ui.controller("conceptmapper.searchPage", {
}), new sap.ui.commons.TextField({
value : concept[4].getProperty('text')
}), new sap.m.Label({
text : "{i18n>domain_id}"
text : "{i18n>standard_concept}"
}), new sap.ui.commons.TextField({
value : concept[5].getProperty('text')
}), new sap.m.Label({
......@@ -348,10 +348,10 @@ sap.ui.controller("conceptmapper.searchPage", {
}), new sap.ui.commons.TextField({
value : concept[6].getProperty('text')
}), new sap.m.Label({
text : "{i18n>standard_concept}"
text : "{i18n>domain_id}"
}), new sap.ui.commons.TextField({
value : concept[7].getProperty('text')
}),
}),
]
});
......@@ -371,40 +371,41 @@ sap.ui.controller("conceptmapper.searchPage", {
oData.concept_code = content[6].getValue();
oData.concept_class_id = content[8].getValue();
oData.vocabulary_id = content[10].getValue();
oData.domain_id = content[12].getValue();
oData.validity = content[14].getValue();
oData.standard_concept = content[16].getValue();
oData.standard_concept = content[12].getValue();
oData.invalid_reason = content[14].getValue();
oData.domain_id = content[16].getValue();
var oModel = sap.ui.getCore().getModel('concept');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1, oData);
oModel.setProperty("/names", aData);
// var oModel = sap.ui.getCore().getModel('concept');
// var aData = oModel.getProperty("/names");
// aData.splice(idx[0], 1, oData);
// oModel.setProperty("/names", aData);
// $.ajax({
// type:"PUT",
// url:"http://127.0.0.1:5000/concept/" + oData.concept_id,
// dataType:"json",
// data: oData,
// async: false,
// header: {
// "Content-Type": "application/json",
// },
// success: function(data, response, xhr) {
// // front update
// var oModel = sap.ui.getCore().getModel('concept');
// var aData = oModel.getProperty("/names");
// aData.splice(idx[0], 1, oData);
// oModel.setProperty("/names", aData);
//
// // backend creation
// sap.m.MessageToast.show("New concept : '" + oData.concept_name + " 'updated");
// console.log("connection");
// },
// error : function(error) {
// sap.m.MessageToast.show("Connexion error");
// console.log(error);
// }
// });
$.ajax({
type:"PUT",
url:"http://127.0.0.1:5000/concept/" + oData.concept_id,
dataType:"json",
data: oData,
async: false,
header: {
"Content-Type": "application/json",
},
success: function(data, response, xhr) {
// front update
var oModel = sap.ui.getCore().getModel('concept');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1, oData);
oModel.setProperty("/names", aData);
// backend creation
sap.m.MessageToast.show("New concept : '" + oData.concept_name + " 'updated");
console.log("connection");
},
error : function(error) {
sap.m.MessageToast.show("Connexion error");
console.log(error);
}
});
......@@ -468,7 +469,7 @@ sap.ui.controller("conceptmapper.searchPage", {
oData.concept_class_id = concept[3].getProperty('text');
oData.vocabulary_id = concept[4].getProperty('text');
oData.standard_concept = concept[5].getProperty('text');
oData.validity = 'D';
oData.invalid_reason = 'D';
oData.domain_id = concept[7].getProperty('text');
// var oModel = sap.ui.getCore().getModel('concept');
......
......@@ -121,7 +121,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>validity}"
}),
template : new sap.m.Text({
text : "{concept>validity}"
text : "{concept>invalid_reason}"
}),
sortProperty : "validity",
editable : false,
......
var oItemTemplateAdmin = new sap.ui.core.Item({
key : "{adminModel>key}",
text : "{adminModel>text}",
enabled : "{adminModel>enabled}"
});
function getUsers() {
//var URL_users = "http://omop-mapper.fgh.ovh/users"
var URL_users = "http://127.0.0.1:5000/users";
$.ajax({
method:"GET",
url: URL_users,
dataType:"json",
async: false,
header: {
"Content-Type": "application/json",
},
success: function(oData, response, xhr) {
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "users");
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
}
})
}
function getUser(username) {
//var URL_users = "http://omop-mapper.fgh.ovh/users"
var URL_user = "http://127.0.0.1:5000/user/";
$.ajax({
method:"GET",
url: URL_user + username,
dataType:"json",
async: false,
header: {
"Content-Type": "application/json",
},
success: function(oData, response, xhr) {
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);
}
})
}
sap.ui.controller("conceptmapper.userPage", {
/**
......@@ -8,13 +65,36 @@ sap.ui.controller("conceptmapper.userPage", {
*
* @memberOf conceptmapper.userPage
*/
// onInit : function() {
//
// },
onInit : function() {
var oModel = new sap.ui.model.json.JSONModel();
var mData = {
"selected" : [],
"items" : [{
"key" : "Not Admin",
"text" : "Not Admin"
},
{
"key" : "Admin",
"text" : "Admin"
}]
};
oModel.setData(mData);
sap.ui.getCore().setModel(oModel, "adminModel");
},
/******* CREATE *******/
openCreateDialog : function (oEvt) {
// var URL_user = "http://omop-mapper.fgh.ovh/user/";
var URL_user = "http://127.0.0.1:5000/user/";
......@@ -25,6 +105,8 @@ sap.ui.controller("conceptmapper.userPage", {
});
// ariaDescribedBy: "p1",
// state: sap.ui.core.ValueState.Warning,
var oSimpleForm = new sap.ui.layout.form.SimpleForm({
// maxContainerCols : 2,
......@@ -35,6 +117,19 @@ sap.ui.controller("conceptmapper.userPage", {
}), new sap.ui.commons.TextField({
value : ""
}), new sap.m.Label({
text : "{i18n>is_admin}"
}), new sap.m.ComboBox({
// width : "400px",
//placeholder : "Standard Concepts",
items : {
path : "adminModel>/items",
template : oItemTemplateAdmin
},
selectedKeys : {
path : "adminModel>/selected",
template : "{adminModel>selected}"
},
}),new sap.m.Label({
text : "{i18n>password}"
}), new sap.ui.commons.TextField({
value : ""
......@@ -71,11 +166,13 @@ sap.ui.controller("conceptmapper.userPage", {
var oData = {};
oData.username = content[2].getValue();
oData.password = content[4].getValue();
oData.firstname = content[6].getValue();
oData.lastname = content[8].getValue();
oData.address = content[10].getValue();
oData.email = content[12].getValue();
oData.is_admin = content[4].getValue();
oData.password = content[6].getValue();
oData.firstname = content[8].getValue();
oData.lastname = content[10].getValue();
oData.address = content[12].getValue();
oData.email = content[14].getValue();
if (oData.username !== "" && oData.password !== ""
&& oData.firstname && oData.lastname && oData.address && oData.email){
......@@ -92,7 +189,7 @@ sap.ui.controller("conceptmapper.userPage", {
},
success: function(data, response, xhr) {
// front update
var oModel = sap.ui.getCore().getModel('user');
var oModel = sap.ui.getCore().getModel('users');
var aData = oModel.getProperty("/names");
aData.push(oData);
oModel.setProperty("/names", aData);
......@@ -153,6 +250,9 @@ sap.ui.controller("conceptmapper.userPage", {
icon : "sap-icon://employee"
});
// get the model called user to get the password
getUser(oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text'));
var oSimpleForm = new sap.ui.layout.form.SimpleForm({
// maxContainerCols : 2,
content : [ new sap.m.Title({
......@@ -161,27 +261,37 @@ sap.ui.controller("conceptmapper.userPage", {
text : "{i18n>username}"
}), new sap.ui.commons.TextField({
enabled: false,
value : user[0].getProperty('text')
value : "{user>/username}"
}), new sap.m.Label({
text : "{i18n>is_admin}"
}), new sap.m.ComboBox({
// width : "400px",
//placeholder : "Standard Concepts",
items : {
path : "adminModel>/items",
template : oItemTemplateAdmin
},
selectedKey : "{user>/is_admin}"
}), new sap.m.Label({
text : "{i18n>password}"
}), new sap.ui.commons.TextField({
value : user[1].getProperty('text')
value : "{user>/password}"
}), new sap.m.Label({
text : "{i18n>firstname}"
}), new sap.ui.commons.TextField({
value : user[2].getProperty('text')
value : "{user>/firstname}"
}), new sap.m.Label({
text : "{i18n>lastname}"
}), new sap.ui.commons.TextField({
value : user[3].getProperty('text')
value : "{user>/lastname}"
}), new sap.m.Label({
text : "{i18n>address}"
}), new sap.ui.commons.TextField({
value : user[4].getProperty('text')
value : "{user>/address}"
}), new sap.m.Label({
text : "{i18n>email}"
}), new sap.ui.commons.TextField({
value : user[5].getProperty('text')
value : "{user>/email}"
}),
]
});
......@@ -198,11 +308,13 @@ sap.ui.controller("conceptmapper.userPage", {
var oData = {};
oData.username = content[2].getValue();
oData.password = content[4].getValue();
oData.firstname = content[6].getValue();
oData.lastname = content[8].getValue();
oData.address = content[10].getValue();
oData.email = content[12].getValue();
oData.is_admin = content[4].getValue();
oData.password = content[6].getValue();
oData.firstname = content[8].getValue();
oData.lastname = content[10].getValue();
oData.address = content[12].getValue();
oData.email = content[14].getValue();
$.ajax({
type:"PUT",
......@@ -215,13 +327,13 @@ sap.ui.controller("conceptmapper.userPage", {
},
success: function(data, response, xhr) {
// front update
var oModel = sap.ui.getCore().getModel('user');
var oModel = sap.ui.getCore().getModel('users');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1, oData);
oModel.setProperty("/names", aData);
// backend creation
sap.m.MessageToast.show("New user : '" + oData.username + " 'updated");
sap.m.MessageToast.show("New user : '" + oData.username + "' updated");
console.log("connection");
},
error : function(error) {
......@@ -302,14 +414,13 @@ sap.ui.controller("conceptmapper.userPage", {
},
success: function(data, response, xhr) {
// front update
var oModel = sap.ui.getCore().getModel('user');
var oModel = sap.ui.getCore().getModel('users');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1);
oModel.setProperty("/names", aData);
oDeleteDialog.close();
// backend creation
sap.m.MessageToast.show("New user : '" + oData.username + " 'deleted");
sap.m.MessageToast.show("New user : '" + oData.username + "' deleted");
console.log("connection");
},
error : function(error) {
......@@ -353,7 +464,7 @@ sap.ui.controller("conceptmapper.userPage", {
var URL_users = "http://127.0.0.1:5000/users";
$.ajax({
type:"GET",
method:"GET",
url: URL_users,
dataType:"json",
async: false,
......@@ -362,7 +473,7 @@ sap.ui.controller("conceptmapper.userPage", {
},
success: function(oData, response, xhr) {
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "user");
sap.ui.getCore().setModel(oModel, "users");
console.log("connection");
},
error : function(error) {
......
......@@ -52,7 +52,7 @@ sap.ui.jsview("conceptmapper.userPage", {
text : "{i18n>username}"
}),
template : new sap.m.Text({
text : "{user>username}"
text : "{users>username}"
}),
editable : false,
sortProperty : "Username"
......@@ -60,10 +60,10 @@ sap.ui.jsview("conceptmapper.userPage", {
oTable.addColumn(new sap.ui.table.Column({
label : new sap.ui.commons.Label({
text : "{i18n>password}"
text : "{i18n>is_admin}"
}),
template : new sap.m.Text({
text : "{user>password}"
text : "{users>is_admin}"
}),
editable : false,
}));
......@@ -73,7 +73,7 @@ sap.ui.jsview("conceptmapper.userPage", {
text : "{i18n>firstname}"
}),
template : new sap.m.Text({
text : "{user>firstname}"
text : "{users>firstname}"
}),
sortProperty : "Firstname",
editable : false,
......@@ -84,7 +84,7 @@ sap.ui.jsview("conceptmapper.userPage", {
text : "{i18n>lastname}"
}),
template : new sap.m.Text({
text : "{user>lastname}"
text : "{users>lastname}"
}),
sortProperty : "Lastname",
editable : false,
......@@ -95,7 +95,7 @@ sap.ui.jsview("conceptmapper.userPage", {
text : "{i18n>address}"
}),
template : new sap.m.Text({
text : "{user>address}"
text : "{users>address}"
}),
sortProperty : "Address",
editable : false,
......@@ -106,7 +106,7 @@ sap.ui.jsview("conceptmapper.userPage", {
text : "{i18n>email}"
}),
template : new sap.m.Text({
text : "{user>email}"
text : "{users>email}"
}),
sortProperty : "Email",
editable : false,
......@@ -114,12 +114,12 @@ sap.ui.jsview("conceptmapper.userPage", {
}));
oTable.bindRows({
path : "user>/names"
path : "users>/names"
});
var oPage = new sap.m.Page({
title : "{i18n>app_head}",
showNavButton: true, //peut etre que c'est mieux de le mettre ici
showNavButton: true,
navButtonPress : function(oEvt) {
app.back();
},
......
......@@ -14,11 +14,12 @@ create_user=Create
update_user=Update
delete_user=Delete
username=Username
password=Password
is_admin=Administrator
firtname=Firtname
lastname=Lastname
address=Address
email=Email
password=Password
#searchPage
app_subhead_search=Research concept page
create_concept=Create
......
......@@ -14,11 +14,12 @@ create_user=Creation
update_user=Actualisation
delete_user=Suppression
username=Username
password=Mot de passe
is_admin=Administrateur
firstname=Prenom
lastname=Nom de famille
address=Adresse
email=email
password=Mot de passe
#searchPage
app_subhead_search=Recherche des concepts
create_concept=Creation
......
......@@ -17,7 +17,7 @@
// create an app
var app = new sap.m.App({
initialPage : "idSearchPage"
initialPage : "idHomePage"
});
// Adding all the pages to the app
......
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