Commit cf7f6f0f authored by Adrien PARROT's avatar Adrien PARROT
Browse files

change m_ prefix for concept table, add combobox for create concept

parent 3a11e232
......@@ -28,7 +28,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
}
}) ],
contentMiddle : [ new sap.m.Label({
text : "{conceptDetail>/concept_name}"
text : "{conceptDetailModel>/concept_name}"
}) ]
});
......@@ -43,31 +43,31 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
// title : "Responsive ObjectHeader with attributes",
// number : "3.628.000",
// numberUnit : "EUR",
title : "{conceptDetail>/concept_name}",
number : "{conceptDetail>/standard_concept}",
numberUnit : "{conceptDetail>/invalid_reason}",
title : "{conceptDetailModel>/concept_name}",
number : "{conceptDetailModel>/standard_concept}",
numberUnit : "{conceptDetailModel>/invalid_reason}",
attributes : [
new sap.m.ObjectAttribute({
title : "concept_id",
text : "{conceptDetail>/concept_id}",
text : "{conceptDetailModel>/concept_id}",
active : true,
press : function() {
alert("you press me");
}
}), new sap.m.ObjectAttribute({
title : "concept_code",
text : "{conceptDetail>/concept_code}",
text : "{conceptDetailModel>/concept_code}",
}), new sap.m.ObjectAttribute({
title : "concept_class_id",
text : "{conceptDetail>/concept_class_id}",
text : "{conceptDetailModel>/concept_class_id}",
active : true,
}), new sap.m.ObjectAttribute({
title : "vocabulary_id",
text : "{conceptDetail>/vocabulary_id}",
text : "{conceptDetailModel>/vocabulary_id}",
}), new sap.m.ObjectAttribute({
title : "domain_id",
text : "{conceptDetail>/domain_id}",
text : "{conceptDetailModel>/domain_id}",
}),
]
......@@ -85,11 +85,11 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
// headerText : "relations list",
});
oRelationList.bindItems({
path : "conceptDetail>/relations",
path : "conceptDetailModel>/relations",
template : new sap.m.ObjectListItem({
title : "{conceptDetail>concept_name}",
number : "{conceptDetail>standard_concept}",
numberUnit : "{conceptDetail>invalid_reason}",
title : "{conceptDetailModel>concept_name}",
number : "{conceptDetailModel>standard_concept}",
numberUnit : "{conceptDetailModel>invalid_reason}",
type:"Active",
press: function(){
app.back();
......@@ -97,28 +97,28 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
attributes : [
new sap.m.ObjectAttribute({
title : "concept_id",
text : "{conceptDetail>concept_id}",
text : "{conceptDetailModel>concept_id}",
active : true,
press : function() {
alert("you press me");
}
}), new sap.m.ObjectAttribute({
title : "concept_code",
text : "{conceptDetail>concept_code}",
text : "{conceptDetailModel>concept_code}",
}), new sap.m.ObjectAttribute({
title : "concept_class_id",
text : "{conceptDetail>concept_class_id}",
text : "{conceptDetailModel>concept_class_id}",
active : true,
}), new sap.m.ObjectAttribute({
title : "vocabulary_id",
text : "{conceptDetail>vocabulary_id}",
text : "{conceptDetailModel>vocabulary_id}",
}), new sap.m.ObjectAttribute({
title : "domain_id",
text : "{conceptDetail>domain_id}",
text : "{conceptDetailModel>domain_id}",
}), new sap.m.ObjectAttribute({
title : "relationship_id",
text : "{conceptDetail>relationship_id}",
text : "{conceptDetailModel>relationship_id}",
}),
]
......
sap.ui.controller("conceptmapper.searchPage", {
function getConceptsAjax(oData, oTable_ref, oRowsNumber) {
var URL_concepts = "http://127.0.0.1:5000/concepts";
// var URL_concepts = "http://omop-mapper.fgh.ovh/concepts";
console.log("concepts");
searcher : function (oEvt) {
var URL_concepts = "http://127.0.0.1:5000/concepts";
// var URL_concepts = "http://omop-mapper.fgh.ovh/concepts";
$.ajax({
type:"GET",
url:URL_concepts,
dataType:"json",
data: {"json" : JSON.stringify(oData)},
async: false,
//processData: false,
header: {
"Content-Type": "application/json",
},
success: function(data) {
if (oData.limit) {
oTable_ref.setVisibleRowCount(oRowsNumber);
}
console.log(data);
var oModel = new sap.ui.model.json.JSONModel(data);
sap.ui.getCore().setModel(oModel, "conceptsModel");
console.log("connection");
},
error : function(error) {
sap.m.MessageToast.show("Connexion error");
console.log(error);
}
});
}
function getConceptAjax(sVal) {
var URL_concept = "http://127.0.0.1:5000/concept/";
// var URL_concept = "http://omop-mapper.fgh.ovh/concept/";
if (sVal !== undefined) {
$.ajax({
type:"GET",
url: URL_concept + sVal,
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, "conceptDetailModel");
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
}
})}
}
var oItemTemplateValid = new sap.ui.core.Item({
key : "{isValidModel>key}",
text : "{isValidModel>text}",
enabled : "{isValidModel>enabled}"
});
var oItemTemplateStandard = new sap.ui.core.Item({
key : "{isStandardModel>key}",
text : "{isStandardModel>text}",
enabled : "{isStandardModel>enabled}"
});
sap.ui.controller("conceptmapper.searchPage", {
searcher : function (oEvt) {
var oStandardMCB_ref = sap.ui.getCore().byId('oStandardMCB').getSelectedItems();
var oStandardMCB_list = [];
......@@ -62,71 +132,34 @@ sap.ui.controller("conceptmapper.searchPage", {
// oData.user_id = [];
// oData.frequency_id = [];
console.log(oData),
$.ajax({
type:"GET",
url:URL_concepts,
dataType:"json",
data: {"json" : JSON.stringify(oData)},
async: false,
//processData: false,
header: {
"Content-Type": "application/json",
},
success: function(data) {
if (oData.limit) {
oTable_ref.setVisibleRowCount(oRowsNumber);
}
console.log(data);
var oModel = new sap.ui.model.json.JSONModel(data);
sap.ui.getCore().setModel(oModel, "concept");
console.log("connection");
},
error : function(error) {
sap.m.MessageToast.show("Connexion error");
console.log(error);
}
});
debugger;
// GET AJAX call on conceptSSSSS
getConceptsAjax(oData, oTable_ref, oRowsNumber);
},
goToConceptDetail : function (oEvt) {
var URL_concept = "http://127.0.0.1:5000/concept/";
// var URL_concept = "http://omop-mapper.fgh.ovh/concept/";
var sVal = oEvt.getParameters().rowBindingContext.getProperty('concept_id');
// GET AJAX call on concept
getConceptAjax(sVal);
debugger;
if (sVal !== undefined) {
$.ajax({
type:"GET",
url: URL_concept + sVal,
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, "conceptDetail");
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
}
})}
app.to('idConceptDetailPage', 'slide'); //('fade', 'flip', 'show', 'slide =default')
},
/******* CREATE *******/
openCreateDialog : function (oEvt) {
var oCreateDialog = new sap.m.Dialog({
......@@ -166,13 +199,31 @@ sap.ui.controller("conceptmapper.searchPage", {
value : ""
}), new sap.m.Label({
text : "{i18n>validity}"
}), new sap.ui.commons.TextField({
value : ""
}), new sap.m.Label({
}), new sap.m.ComboBox({
// width : "400px",
//placeholder : "Standard Concepts",
items : {
path : "isValidModel>/items",
template : oItemTemplateValid
},
selectedKeys : {
path : "isValidModel>/selected",
template : "{isValidModel>selected}"
},
}) , new sap.m.Label({
text : "{i18n>standard_concept}"
}), new sap.ui.commons.TextField({
value : ""
}),
}), new sap.m.ComboBox({
// width : "400px",
//placeholder : "Standard Concepts",
items : {
path : "isStandardModel>/items",
template : oItemTemplateStandard
},
selectedKeys : {
path : "isStandardModel>/selected",
template : "{isStandardModel>selected}"
},
})
]
});
......@@ -198,9 +249,9 @@ sap.ui.controller("conceptmapper.searchPage", {
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.invalid_reason && oData.standard_concept ) {
if (oData.concept_id !== "" && Number.isInteger(parseInt(oData.concept_id)) && oData.concept_name !== ""
&& oData.concept_code !== "" && oData.concept_class_id !== "" && oData.vocabulary_id !== ""
&& oData.domain_id !== "" && oData.invalid_reason !== "" && oData.standard_concept !== "" ) {
var URL_concept = "http://127.0.0.1:5000/concept/";
// var URL_concept = "http://omop-mapper.fgh.ovh/concept/";
......@@ -228,7 +279,9 @@ sap.ui.controller("conceptmapper.searchPage", {
// oModel.setProperty("/names", aData);
// backend creation
sap.m.MessageToast.show("New concept : '" + oData.concept_name + "' created");
// debugger;
// sap.m.MessageToast.show("New concept : '" + oData.concept_name + "' created");
sap.m.MessageToast.show(xhr.responseJSON.help);
console.log("connection");
},
error : function(error) {
......@@ -359,7 +412,7 @@ sap.ui.controller("conceptmapper.searchPage", {
},
success: function(data, response, xhr) {
// front update
var oModel = sap.ui.getCore().getModel('concept');
var oModel = sap.ui.getCore().getModel('conceptsModel');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1, oData);
oModel.setProperty("/names", aData);
......@@ -457,7 +510,7 @@ sap.ui.controller("conceptmapper.searchPage", {
},
success: function(data, response, xhr) {
// front update
var oModel = sap.ui.getCore().getModel('concept');
var oModel = sap.ui.getCore().getModel('conceptsModel');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1, oData);
oModel.setProperty("/names", aData);
......@@ -495,16 +548,16 @@ sap.ui.controller("conceptmapper.searchPage", {
/**
* 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.searchPage
*/
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.searchPage
*/
// onInit: function() {
//
//
//
// },
/**
......@@ -606,6 +659,48 @@ sap.ui.controller("conceptmapper.searchPage", {
};
oModel.setData(mData);
sap.ui.getCore().setModel(oModel, "language");
var oModel = new sap.ui.model.json.JSONModel();
var mData = {
"selected" : [],
"items" : [{
"key" : "Standard",
"text" : "Standard"
},
{
"key" : "Non-Standard",
"text" : "Non-Standard"
},
{
"key" : "Classification",
"text" : "Classification"
}
]
};
oModel.setData(mData);
sap.ui.getCore().setModel(oModel, "isStandardModel");
var oModel = new sap.ui.model.json.JSONModel();
var mData = {
"selected" : [],
"items" : [{
"key" : "Valid",
"text" : "Valid"
},
{
"key" : "Updated",
"text" : "Updated"
},
{
"key" : "Deleted",
"text" : "Deleted"
}]
};
oModel.setData(mData);
sap.ui.getCore().setModel(oModel, "isValidModel");
},
......
......@@ -22,26 +22,10 @@ sap.ui.jsview("conceptmapper.searchPage", {
var oSplitContainer = new sap.m.SplitContainer();
// Master Page
var oStandardCB = new sap.m.CheckBox({
id : "oStandardConcepts",
visible : true,
selected : true,
enabled : true,
text : "Standard concepts"
});
var oValidCB = new sap.m.CheckBox({
id : "oValidConcepts",
visible : true,
selected : true,
enabled : true,
text : "Valid concepts"
});
//
var oItemTemplateStandard = new sap.ui.core.Item({
key : "{standardConcept>key}",
text : "{standardConcept>text}",
......@@ -68,7 +52,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
});
var oValidMCB = new sap.m.MultiComboBox({
id : "oValidMCB",
// width : "400px",
placeholder : "Valid concept",
items : {
path : "invalidReason>/items",
......@@ -80,7 +63,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
},
});
///////////////
var oItemTemplateDomain = new sap.ui.core.Item({
key : "{domain>key}",
......@@ -89,7 +71,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
});
var oDomainMCB = new sap.m.MultiComboBox({
id : "oDomainMCB",
// width : "400px",
placeholder : "Choose your domain",
items : {
path : "domain>/items",
......@@ -99,22 +80,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
path : "domain>/selected",
template : "{domain>selected}"
},
// change : function(oControlEvent) {
// jQuery.sap.log.info('Event fired: "change" value property to ' +
// oControlEvent.getParameter("value") + " on "
// + this);
// },
// selectionChange : function(oControlEvent) {
// jQuery.sap.log.info('Event fired: "selectionChange" value property to
// ' + oControlEvent.getParameter("changedItem")
// + " with selected=" + oControlEvent.getParameter("selected") + " on "
// + this);
// },
// selectionFinish : function(oControlEvent) {
// jQuery.sap.log.info('Event fired: "selectionFinish" value property to
// ' + oControlEvent.getParameter("selectedItems")
// + " on " + this);
// }
});
var oItemTemplateVoc = new sap.ui.core.Item({
......@@ -124,7 +89,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
});
var oVocMCB = new sap.m.MultiComboBox({
id : "oVocMCB",
// width : "400px",
placeholder : "Choose your vocabulary",
items : {
path : "vocabulary>/items",
......@@ -153,7 +117,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
});
var oLangMCB = new sap.m.MultiComboBox({
id : "oLangMCB",
// width : "400px",
placeholder : "Choose your language",
items : {
path : "language>/items",
......@@ -165,8 +128,6 @@ sap.ui.jsview("conceptmapper.searchPage", {
},
});
var oMasterPage = new sap.m.Page({
title : "Filters",
......@@ -231,7 +192,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>concept_id}"
}),
template : new sap.m.Text({
text : "{concept>concept_id}"
text : "{conceptsModel>concept_id}"
}),
editable : false,
sortProperty : "concept_id"
......@@ -241,7 +202,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>concept_name}"
}),
template : sap.m.FormattedText({
htmlText : "{concept>concept_name}"
htmlText : "{conceptsModel>concept_name}"
}),
editable : false,
sortProperty : "concept_id"
......@@ -251,7 +212,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>concept_code}"
}),
template : new sap.m.Text({
text : "{concept>concept_code}"
text : "{conceptsModel>concept_code}"
}),
sortProperty : "concept_code",
editable : false,
......@@ -261,7 +222,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>concept_class_id}"
}),
template : new sap.m.Text({
text : "{concept>concept_class_id}"
text : "{conceptsModel>concept_class_id}"
}),
sortProperty : "concept_class_id",
editable : false,
......@@ -271,7 +232,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>vocabulary_id}"
}),
template : new sap.m.Text({
text : "{concept>vocabulary_id}"
text : "{conceptsModel>vocabulary_id}"
}),
sortProperty : "vocabulary_id",
editable : false,
......@@ -281,7 +242,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>standard_concept}"
}),
template : new sap.m.Text({
text : "{concept>standard_concept}"
text : "{conceptsModel>standard_concept}"
}),
sortProperty : "standard_concept",
editable : false,
......@@ -292,7 +253,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>validity}"
}),
template : new sap.m.Text({
text : "{concept>invalid_reason}"
text : "{conceptsModel>invalid_reason}"
}),
sortProperty : "validity",
editable : false,
......@@ -303,7 +264,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
text : "{i18n>domain_id}"
}),
template : new sap.m.Text({
text : "{concept>domain_id}"
text : "{conceptsModel>domain_id}"
}),
sortProperty : "domain_id",
editable : false,
......@@ -311,7 +272,7 @@ sap.ui.jsview("conceptmapper.searchPage", {
}));
oTable.bindRows({
path : "concept>/names"
path : "conceptsModel>/names"
});
var icoToolbar = new sap.m.IconTabBar({
......@@ -320,19 +281,18 @@ sap.ui.jsview("conceptmapper.searchPage", {
items : [ new sap.m.IconTabFilter({
text : "concepts",
showAll : true,
count : "{concept>/total_concepts}",
// iconColor : "Critical"
count : "{conceptsModel>/total_concepts}",