git-svn-id: https://msi/svn/firstRepo/Management/trunk@57 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+3
-1
@@ -2,7 +2,9 @@ var myManifest = {
|
||||
Debug: (window.location.port !== ""),
|
||||
Name: "Il Management",
|
||||
Version: "0.3.0.0",
|
||||
Author: "Denis Ironi",
|
||||
<<<<<<< .mine Version: "0.2.1.0",
|
||||
======= Version: "0.3.0.0",
|
||||
>>>>>>> .theirs Author: "Denis Ironi",
|
||||
Settings: {
|
||||
DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"),
|
||||
JQueryVersion: "1.11.1",
|
||||
|
||||
@@ -84,6 +84,48 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
save:function(callback)
|
||||
{
|
||||
if (this.validate()) {
|
||||
var diffi = $('#lvlDiff').val();
|
||||
|
||||
var ingr = $('#listbox').jqxListBox('source');
|
||||
|
||||
var sendobj = {
|
||||
"ricettaID": $("#ricettaID").val(),
|
||||
"categoria_id": $("#categoria").val(),
|
||||
"titolo": escape($("#titolo").val()),
|
||||
"ingredienti": [],
|
||||
"preparazione": $("#procedimento").val(),
|
||||
"autore": escape($("#autore").val()),
|
||||
"linkFonte": $("#linkFonte").val(),
|
||||
"linkVideo": $("#linkYouTube").val(),
|
||||
"difficolta": diffi
|
||||
};
|
||||
|
||||
$.each(ingr, function(i, val) {
|
||||
var newItem = {
|
||||
"ingrediente_id": val.id_tipo_ingredienti,
|
||||
"quantita": val.quantita,
|
||||
"tipo_quantita_id": val.id_tipo_quantita,
|
||||
"note": escape(unescape(val.note))
|
||||
};
|
||||
sendobj.ingredienti.push(newItem);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/body",
|
||||
//dataType: "json",
|
||||
type: 'POST',
|
||||
data: {bodydata: JSON.stringify(sendobj)}
|
||||
}).then(function(response) {
|
||||
if(callback)
|
||||
callback(response);
|
||||
});
|
||||
}
|
||||
else
|
||||
alert("Inserire almeno categoria e titolo");
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function() {
|
||||
//this.header.title = "pippo";
|
||||
@@ -339,14 +381,20 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
uploadUrl: myManifest.Settings.DefaultURL + '/backend/photo' });
|
||||
|
||||
$('#jqxFileUpload').on('uploadStart', function (event) {
|
||||
self.save(function(msg){
|
||||
//alert(msg.message);
|
||||
if (msg.result)
|
||||
{
|
||||
var profileID = "10203753344023406";
|
||||
|
||||
if($("#autorePhoto").val() != 0)
|
||||
profileID = $("#autorePhoto").val();
|
||||
|
||||
$('form[action="' + myManifest.Settings.DefaultURL + '/backend/photo' + '"]').
|
||||
append('<input type="hidden" name="ricetta_id" value="' + self.ricettaEditing.ricetta_id +'" />').
|
||||
append('<input type="hidden" name="ricetta_id" value="' + msg.ricettaID +'" />').
|
||||
append('<input type="hidden" name="keyStore" value="' + profileID + '" />');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#jqxFileUpload').on('uploadEnd', function (event) {
|
||||
$("#gridPhotos").jqxGrid('updatebounddata');
|
||||
@@ -426,47 +474,11 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
$("#Save").jqxButton({width: '48%', height: 40});
|
||||
|
||||
$('#Save').on('click', function() {
|
||||
if (self.validate()) {
|
||||
var diffi = $('#lvlDiff').val();
|
||||
|
||||
var ingr = $('#listbox').jqxListBox('source');
|
||||
|
||||
var sendobj = {
|
||||
"ricettaID": $("#ricettaID").val(),
|
||||
"categoria_id": $("#categoria").val(),
|
||||
"titolo": escape($("#titolo").val()),
|
||||
"ingredienti": [],
|
||||
"preparazione": $("#procedimento").val(),
|
||||
"autore": escape($("#autore").val()),
|
||||
"linkFonte": $("#linkFonte").val(),
|
||||
"linkVideo": $("#linkYouTube").val(),
|
||||
"difficolta": diffi
|
||||
};
|
||||
|
||||
$.each(ingr, function(i, val) {
|
||||
var newItem = {
|
||||
"ingrediente_id": val.id_tipo_ingredienti,
|
||||
"quantita": val.quantita,
|
||||
"tipo_quantita_id": val.id_tipo_quantita,
|
||||
"note": escape(unescape(val.note))
|
||||
};
|
||||
sendobj.ingredienti.push(newItem);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/body",
|
||||
//dataType: "json",
|
||||
type: 'POST',
|
||||
data: {bodydata: JSON.stringify(sendobj)}
|
||||
}).then(function(response) {
|
||||
var msg = response;
|
||||
self.save(function(msg){
|
||||
alert(msg.message);
|
||||
if (msg.result)
|
||||
$("#popupWindow").jqxWindow('close');
|
||||
});
|
||||
}
|
||||
else
|
||||
alert("Inserire almeno categoria e titolo");
|
||||
});
|
||||
|
||||
$("#Cancel").jqxButton({width: '48%', height: 40});
|
||||
|
||||
@@ -114,13 +114,16 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
return "Elimina";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
var items = $("#jqxgrid").jqxGrid('source');
|
||||
var item = items.records[row];
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + row.id,
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + item.ricetta_id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
var msg = response;
|
||||
alert(msg.message);
|
||||
$("#jqxgrid").jqxGrid('updatebounddata');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user