Commit 101b2680 authored by Adrien PARROT's avatar Adrien PARROT
Browse files

searchPage create and delete concept ok => ToDo update concept

parent befca0de
......@@ -239,38 +239,38 @@ sap.ui.controller("conceptmapper.searchPage", {
//
var oModel = sap.ui.getCore().getModel('concept');
var aData = oModel.getProperty("/names");
aData.push(oData);
oModel.setProperty("/names", aData);
// var oModel = sap.ui.getCore().getModel('concept');
// var aData = oModel.getProperty("/names");
// aData.push(oData);
// oModel.setProperty("/names", aData);
// $.ajax({
// type:"POST",
// 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
$.ajax({
type:"POST",
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.push(oData);
// oModel.setProperty("/names", aData);
//
// // backend creation
// sap.m.MessageToast.show("New concept : '" + oData.concept_name + "' created");
// console.log("connection");
// },
// error : function(error) {
//
//
// sap.m.MessageToast.show("Connexion error");
// console.log(error);
// }
// });
// backend creation
sap.m.MessageToast.show("New concept : '" + oData.concept_name + "' created");
console.log("connection");
},
error : function(error) {
sap.m.MessageToast.show("Connexion error");
console.log(error);
}
});
} else {
sap.m.MessageToast.show("Nothing created!! \nYou have to file all the fields");
}
......@@ -442,6 +442,9 @@ sap.ui.controller("conceptmapper.searchPage", {
sap.m.MessageToast.show("You can delete on concept each time");
return;
}
var concept = oTable_ref.getRows()[idx[0]].getCells();
var oDeleteDialog = new sap.m.Dialog({
title : "{i18n>delete_concept}",
......@@ -457,40 +460,50 @@ sap.ui.controller("conceptmapper.searchPage", {
icon: "sap-icon://accept",
press: function () {
var oData = {};
var oModel = sap.ui.getCore().getModel('concept');
var aData = oModel.getProperty("/names");
aData.splice(idx[0], 1);
oModel.setProperty("/names", aData);
oData.concept_id = concept[0].getProperty('text');
oData.concept_name = concept[1].getProperty('text');
oData.concept_code = concept[2].getProperty('text');
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.domain_id = concept[7].getProperty('text');
// var oModel = sap.ui.getCore().getModel('concept');
// var aData = oModel.getProperty("/names");
// aData.splice(idx[0], 1, oData);
// oModel.setProperty("/names", aData);
// var URL = "http://127.0.0.1:5000/concept/";
// URL = URL + oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text');
// $.ajax({
// type:"DELETE",
// url:URL,
// dataType:"json",
// 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);
// 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);
//
// }
// });
var URL = "http://127.0.0.1:5000/concept/";
URL = URL + oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text');
$.ajax({
type:"DELETE",
url:URL,
dataType:"json",
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);
}
});
oDeleteDialog.close();
}
......
Markdown is supported
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