Compare commits
5
Commits
f555d88936
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a889c8c7d8 | ||
|
|
7c61c24e67 | ||
|
|
13a350cf9a | ||
|
|
9e22467a0a | ||
|
|
1694a623ba |
+1
-1
@@ -1,7 +1,7 @@
|
||||
var myManifest = {
|
||||
Debug: (window.location.port !== ""),
|
||||
Name: "Il Management",
|
||||
Version: "0.3.2.0",
|
||||
Version: "0.4.0.0",
|
||||
Author: "Denis Ironi",
|
||||
Settings: {
|
||||
DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"),
|
||||
|
||||
@@ -114,7 +114,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/addingr/addingrViewTem
|
||||
$("#isNote").jqxCheckBox(
|
||||
{
|
||||
width: 75,
|
||||
height: 16
|
||||
height: 16,
|
||||
checked:false
|
||||
});
|
||||
|
||||
$("#isNote").on('change', function (event) {
|
||||
@@ -135,7 +136,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/addingr/addingrViewTem
|
||||
$("#isHeading").jqxCheckBox(
|
||||
{
|
||||
width: 75,
|
||||
height: 16
|
||||
height: 16,
|
||||
checked:false
|
||||
});
|
||||
|
||||
$("#isHeading").on('change', function (event) {
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/editmulino/editmulinoViewTemplate.html', 'modules/base/baseView',
|
||||
'controls/window/window', 'modules/addingr/addingr', 'jqx'],
|
||||
function($, _, Backbone, editmulinoViewTemplate, BaseView, Window, AddIngrDlg) {
|
||||
var FarineEnum = {
|
||||
Tipo00: 1,
|
||||
Tipo0: 2,
|
||||
Tipo1: 4,
|
||||
Integrale: 8,
|
||||
Manitoba: 16,
|
||||
Semola: 32,
|
||||
Speciale: 64
|
||||
};
|
||||
|
||||
var MacinaturaEnum = {
|
||||
Rulli: 1,
|
||||
Pietra: 2
|
||||
};
|
||||
|
||||
var EditMuliniView = BaseView.extend({
|
||||
dataAdapter: undefined,
|
||||
//initialize template
|
||||
template: _.template(editmulinoViewTemplate),
|
||||
addIngrDlg: null,
|
||||
fullScrDlg: null,
|
||||
initialize: function() {
|
||||
EditMuliniView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
mulinoEditing: null,
|
||||
checkValue: function(val, check){
|
||||
return (val & check) == check;
|
||||
},
|
||||
openMulino: function(mulino_id) {
|
||||
|
||||
if (mulino_id)
|
||||
{
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/mulino/body/" + mulino_id,
|
||||
dataType: "jsonp",
|
||||
crossDomain: true
|
||||
}).then(function(response) {
|
||||
var mulino = response[0];
|
||||
self.mulinoEditing = mulino;
|
||||
$('#jqxTabs').jqxTabs('select', 0);
|
||||
$("#mulinoID").val(mulino.mulino_id);
|
||||
$("#nomeMulino").val(unescape(mulino.nome));
|
||||
$("#email").val(mulino.email);
|
||||
$("#telefono").val(mulino.telefono);
|
||||
$("#linkWebSite").val(mulino.linkWebSite);
|
||||
$('#address').val(unescape(mulino.address));
|
||||
$('#comune').val(unescape(mulino.comune));
|
||||
$('#CAP').val(mulino.CAP);
|
||||
$('#provincia').val(mulino.provincia);
|
||||
$('#regione').val(mulino.regione);
|
||||
|
||||
// show the popup window.
|
||||
$("#popupWindow").jqxWindow('open');
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#jqxTabs').jqxTabs('select', 0);
|
||||
// $("#mulinoID").val('');
|
||||
// $("#categoria").jqxDropDownList('selectIndex', -1 );
|
||||
// $("#titolo").val('');
|
||||
// $("#autore").val('');
|
||||
// $("#lvlDiff").val(0);
|
||||
// $("#linkFonte").val('');
|
||||
// $("#linkYouTube").val('');
|
||||
// $('#procedimento').val('');
|
||||
|
||||
$("#popupWindow").jqxWindow('open');
|
||||
}
|
||||
},
|
||||
validate: function()
|
||||
{
|
||||
if ($("#categoria").val() > 0 &&
|
||||
$("#titolo").val() !== "")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
save:function(callback)
|
||||
{
|
||||
if (this.validate()) {
|
||||
var diffi = $('#lvlDiff').val();
|
||||
|
||||
var ingr = $('#listbox').jqxListBox('source');
|
||||
|
||||
var sendobj = {
|
||||
"mulinoID": $("#mulinoID").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/mulino/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";
|
||||
EditMuliniView.__super__.render.call(this);
|
||||
var self = this;
|
||||
|
||||
this.$el.append(this.template());
|
||||
|
||||
this.$el.find("#popupWindow").jqxWindow({
|
||||
width: "750px",
|
||||
height: "500px",
|
||||
resizable: true,
|
||||
isModal: true,
|
||||
autoOpen: false,
|
||||
cancelButton: this.$el.find("#Cancel"),
|
||||
modalOpacity: 0.01,
|
||||
initContent: function() {
|
||||
$('#jqxTabs').jqxTabs({
|
||||
width: '100%',
|
||||
height: "90%",
|
||||
position: 'top',
|
||||
initTabContent: function(tab) {
|
||||
if (tab === 0)
|
||||
{
|
||||
$("#nomeMulino").jqxInput({placeHolder: "Nome:", width: '350px', height: 25});
|
||||
$("#email").jqxInput({placeHolder: "Email:", width: '350px', height: 25});
|
||||
$("#telefono").jqxInput({placeHolder: "Telefono:", width: '350px', height: 25});
|
||||
$("#linkWebSite").jqxInput({placeHolder: "Sito Web:", width: '350px', height: 25});
|
||||
|
||||
$('#logoUpload').jqxFileUpload({ width: '50%',
|
||||
fileInputName: 'image',
|
||||
multipleFilesUpload: false,
|
||||
accept: 'image/*',
|
||||
uploadUrl: myManifest.Settings.DefaultURL + '/backend/photo/mulino' });
|
||||
|
||||
$('#logoUpload').on('uploadStart', function (event) {
|
||||
$('form[action="' + myManifest.Settings.DefaultURL + '/backend/photo/mulino' + '"]').
|
||||
append('<input type="hidden" name="mulino_name" value="' + escape($("#nomeMulino").val()) +'" />');
|
||||
});
|
||||
}
|
||||
else if (tab === 1)
|
||||
{
|
||||
$("#address").jqxInput({placeHolder: "Indirizzo:", width: '350px', height: 25});
|
||||
$("#provincia").jqxInput({placeHolder: "Provincia:", width: '350px', height: 25,
|
||||
source: function (query, response) {
|
||||
var dataAdapter = new $.jqx.dataAdapter
|
||||
(
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields:
|
||||
[
|
||||
{ name: 'Provincia' },
|
||||
{ name: 'Regione' }
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/profile/province/"+query
|
||||
},
|
||||
{
|
||||
autoBind: true,
|
||||
loadComplete: function (data) {
|
||||
response(data);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
$("#comune").jqxInput({placeHolder: "Comune:", width: '350px', height: 25,
|
||||
source: function (query, response) {
|
||||
var dataAdapter = new $.jqx.dataAdapter
|
||||
(
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields:
|
||||
[
|
||||
{ name: 'Comune' },
|
||||
{ name: 'CAP' }
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/profile/comuni/" + $("#provincia").val() + "/"+query
|
||||
},
|
||||
{
|
||||
autoBind: true,
|
||||
loadComplete: function (data) {
|
||||
response(data);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
$("#CAP").jqxInput({placeHolder: "CAP:", width: '350px', height: 25});
|
||||
$("#regione").jqxInput({placeHolder: "Regione:", width: '350px', height: 25});
|
||||
}
|
||||
else if (tab === 3)
|
||||
{
|
||||
$("#farine").jqxDropDownList(
|
||||
{
|
||||
width: "250px",
|
||||
height: "25px",
|
||||
source: new $.jqx.dataAdapter({
|
||||
datatype: 'array',
|
||||
datafields: [
|
||||
{name: 'value'},
|
||||
{name: 'label'}
|
||||
],
|
||||
localdata: [
|
||||
{value: '1', label: 'Tipo00'},
|
||||
{value: '2', label: 'Tipo0'},
|
||||
{value: '4', label: 'Tipo1'},
|
||||
{value: '8', label: 'Integrale'},
|
||||
{value: '16', label: 'Manitoba'},
|
||||
{value: '32', label: 'Semola'},
|
||||
{value: '64', label: 'Speciale'}
|
||||
]
|
||||
}),
|
||||
//selectedIndex: -1,
|
||||
displayMember: "label",
|
||||
valueMember: "value"
|
||||
});
|
||||
$("#farSpeciali").jqxInput({placeHolder: "Farine Speciali:", width: '350px', height: 25});
|
||||
$("#macinatura").jqxDropDownList(
|
||||
{
|
||||
width: "250px",
|
||||
height: "25px",
|
||||
source: new $.jqx.dataAdapter({
|
||||
datatype: 'array',
|
||||
datafields: [
|
||||
{name: 'value'},
|
||||
{name: 'label'}
|
||||
],
|
||||
localdata: [
|
||||
{value: '1', label: 'Rulli'},
|
||||
{value: '2', label: 'Pietra'}
|
||||
]
|
||||
}),
|
||||
//selectedIndex: -1,
|
||||
displayMember: "label",
|
||||
valueMember: "value"
|
||||
});
|
||||
|
||||
$("#prezzo").jqxSlider({height: 60, min: 0, max: 10, value: 0, step: 0.10});
|
||||
|
||||
var text = $('#spedizione').val();
|
||||
$('#spedizione').jqxEditor({width: '100%', height: "20%"});
|
||||
if (text)
|
||||
$('#spedizione').jqxEditor('val', text);
|
||||
}
|
||||
else if (tab === 3)
|
||||
{
|
||||
var text = $('#procedimento').val();
|
||||
$('#procedimento').jqxEditor({width: '100%', height: "50%"});
|
||||
if (text)
|
||||
$('#procedimento').jqxEditor('val', text);
|
||||
|
||||
var text = $('#note').val();
|
||||
$('#note').jqxEditor({width: '100%', height: "50%"});
|
||||
if (text)
|
||||
$('#note').jqxEditor('val', text);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#Save").jqxButton({width: '48%', height: 40});
|
||||
|
||||
$('#Save').on('click', function() {
|
||||
self.save(function(msg){
|
||||
alert(msg.message);
|
||||
if (msg.result)
|
||||
$("#popupWindow").jqxWindow('close');
|
||||
});
|
||||
});
|
||||
|
||||
$("#Cancel").jqxButton({width: '48%', height: 40});
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return EditMuliniView;
|
||||
});
|
||||
@@ -0,0 +1,87 @@
|
||||
<div id="content">
|
||||
<div id="popupWindow" style="overflow: hidden; display: none;">
|
||||
<div>Edit</div>
|
||||
<div>
|
||||
<input type="hidden" id="mulinoID" />
|
||||
<div id='jqxTabs'>
|
||||
<ul>
|
||||
<li style="margin-left: 30px;">Informazioni Generali</li>
|
||||
<li>Indirizzo</li>
|
||||
<li>Farine</li>
|
||||
<li>Descrizione</li>
|
||||
</ul>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">Nome:</td>
|
||||
<td align="left"><input id="nomeMulino" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Logo:</td>
|
||||
<td align="left"><div id='logoUpload'></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Email:</td>
|
||||
<td align="left"><input id="email" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Telefono:</td>
|
||||
<td align="left"><input id="telefono" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Sito Web:</td>
|
||||
<td align="left"><input id="linkWebSite" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">Indirizzo:</td>
|
||||
<td align="left"><input id="address" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Provincia:</td>
|
||||
<td align="left"><div id="provincia" /> Regione: <div id="regione" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Comune:</td>
|
||||
<td align="left"><input id='comune'></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CAP:</td>
|
||||
<td align="left"><input id="CAP" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">Farine:</td>
|
||||
<td align="left"><div id="farine" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Specifica Speciali:</td>
|
||||
<td align="left"><input id='farSpeciali'></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Macinatura:</td>
|
||||
<td align="left"><div id='macinatura'></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Prezzo (Min-Max):</td>
|
||||
<td align="left"><div id='prezzo'></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Spedizione:</td>
|
||||
<td align="left"><textarea id='spedizione'></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div><textarea id="descrizione"></textarea>
|
||||
<textarea id="note"></textarea></div>
|
||||
</div>
|
||||
<input style="margin-right: 5px;" type="button" id="Save" value="Save" /><input id="Cancel" type="button" value="Cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
{name: 'from_profile_id', type: 'string'},
|
||||
{name: 'uploaded_date', type: 'datetime'},
|
||||
{name: 'profile_name', type: 'string'},
|
||||
{name: 'published', type: 'bool'}
|
||||
{name: 'published', type: 'bool'},
|
||||
{name: 'bCover', type: 'bool'}
|
||||
];
|
||||
var photoAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
@@ -423,6 +424,12 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
return "<div style='margin: 4px;' class='jqx-center-align'>" + valueBool + "</div>";
|
||||
}
|
||||
},
|
||||
{text: 'Cover', editable: false, dataField: 'bCover', width: "70px",
|
||||
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
|
||||
var valueBool = rowdata.bCover;
|
||||
return "<div style='margin: 4px;' class='jqx-center-align'>" + valueBool + "</div>";
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'FullView', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "View Full";
|
||||
@@ -453,6 +460,25 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
}
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Cover', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Copertina";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
var items = $("#gridPhotos").jqxGrid('source');
|
||||
var item = items.records[row];
|
||||
if(item.bCover === false)
|
||||
{
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/photo/set_cover/" + item.id_photo,
|
||||
//dataType: "json",
|
||||
type: 'GET'
|
||||
}).then(function (response) {
|
||||
$("#gridPhotos").jqxGrid('updatebounddata');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Cancella', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Cancella";
|
||||
|
||||
+114
-4
@@ -1,13 +1,22 @@
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html',
|
||||
'modules/base/baseView', 'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/photos/photos', 'modules/statistics/statistics',
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html', 'modules/base/baseView',
|
||||
'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/editricetta/editricetta',
|
||||
'modules/mulini/mulini', 'modules/editmulino/editmulino', 'modules/editmulino/editmulino',
|
||||
'modules/photos/photos', 'modules/statistics/statistics', 'text!modules/home/inputWindow.html',
|
||||
'jqx'],
|
||||
function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView, StatisticsView) {
|
||||
function($, _, Backbone, homeViewTemplate, BaseView,
|
||||
RicetteView, EditRicettaView, EditRicetta,
|
||||
MuliniView, EditMulinoView, EditMulino,
|
||||
PhotosView, StatisticsView, inputWindowTemplate) {
|
||||
|
||||
var HomeView = BaseView.extend({
|
||||
ricetteView: null,
|
||||
muliniView: null,
|
||||
statiView: null,
|
||||
editorRicetta: null,
|
||||
editorMulino: null,
|
||||
//initialize template
|
||||
template: _.template(homeViewTemplate),
|
||||
templateInputWindow: _.template(inputWindowTemplate),
|
||||
initialize: function() {
|
||||
HomeView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
@@ -30,6 +39,66 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
||||
else
|
||||
this.ricetteView.render();
|
||||
},
|
||||
modifyByIDRicetta: function() {
|
||||
var self = this;
|
||||
//e.preventDefault();
|
||||
if(this.editorRicetta == null)
|
||||
{
|
||||
this.editorRicetta = new EditRicetta();
|
||||
this.editorRicetta.render();
|
||||
$('body').append(this.editorRicetta.$el);
|
||||
}
|
||||
$('#openBtn').off('click');
|
||||
$('#openBtn').on('click', function () {
|
||||
$('#inputWindow').jqxWindow('close');
|
||||
self.editorRicetta.openRicetta($('#ricettaId').val());
|
||||
});
|
||||
$('#cancelButton').off('click');
|
||||
$('#cancelButton').on('click', function () {
|
||||
$('#inputWindow').jqxWindow('close');
|
||||
});
|
||||
$('#ricettaId').val("");
|
||||
$('#inputWindow').jqxWindow('open');
|
||||
$('#ricettaId').focus();
|
||||
|
||||
},
|
||||
addMulino: function() {
|
||||
var editMuliniView = new EditMulinoView();
|
||||
editMuliniView.render();
|
||||
$('body').append(editMuliniView.$el);
|
||||
editMuliniView.openMulino();
|
||||
},
|
||||
modifyMulino: function() {
|
||||
if(this.muliniView == null)
|
||||
{
|
||||
this.muliniView = new MuliniView();
|
||||
this.muliniView.render();
|
||||
$('body').append(this.muliniView.$el);
|
||||
}
|
||||
else
|
||||
this.muliniView.render();
|
||||
},
|
||||
modifyByIDMulino: function() {
|
||||
var self = this;
|
||||
if(this.editorMulino == null)
|
||||
{
|
||||
this.editorMulino = new EditMulino();
|
||||
this.editorMulino.render();
|
||||
$('body').append(this.editorMulino.$el);
|
||||
}
|
||||
$('#openBtn').off('click');
|
||||
$('#openBtn').on('click', function () {
|
||||
$('#inputWindow').jqxWindow('close');
|
||||
self.editorMulino.openMulino($('#mulinoId').val());
|
||||
});
|
||||
$('#cancelButton').off('click');
|
||||
$('#cancelButton').on('click', function () {
|
||||
$('#inputWindow').jqxWindow('close');
|
||||
});
|
||||
$('#mulinoId').val("");
|
||||
$('#inputWindow').jqxWindow('open');
|
||||
$('#mulinoId').focus();
|
||||
},
|
||||
photosView: function(){
|
||||
var photosView = new PhotosView();
|
||||
photosView.render();
|
||||
@@ -58,6 +127,26 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
||||
{
|
||||
event.data.scope.modifyRicetta();
|
||||
}
|
||||
else if(item[0].id === "modifyByIDRicetta" ||
|
||||
item[0].lastChild.id === "modifyByIDRicetta")
|
||||
{
|
||||
event.data.scope.modifyByIDRicetta();
|
||||
}
|
||||
else if(item[0].id === "addMulino" ||
|
||||
item[0].lastChild.id === "addMulino")
|
||||
{
|
||||
event.data.scope.addMulino();
|
||||
}
|
||||
else if(item[0].id === "modifyMulino" ||
|
||||
item[0].lastChild.id === "modifyMulino")
|
||||
{
|
||||
event.data.scope.modifyMulino();
|
||||
}
|
||||
else if(item[0].id === "modifyByIDMulino" ||
|
||||
item[0].lastChild.id === "modifyByIDMulino")
|
||||
{
|
||||
event.data.scope.modifyByIDMulino();
|
||||
}
|
||||
else if(item[0].id === "viewPhotos" ||
|
||||
item[0].lastChild.id === "viewPhotos")
|
||||
{
|
||||
@@ -73,10 +162,11 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
||||
render: function() {
|
||||
//this.header.title = "pippo";
|
||||
HomeView.__super__.render.call(this);
|
||||
|
||||
var self = this;
|
||||
if ($('#jqxMenu').length === 0)
|
||||
{
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.templateInputWindow());
|
||||
|
||||
this.$el.find("#jqxMenu").jqxMenu({
|
||||
width: '60%',
|
||||
@@ -84,6 +174,26 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
||||
});
|
||||
|
||||
this.$el.find('#jqxMenu').on('itemclick', { scope: this }, this.clickMenu);
|
||||
|
||||
var offset = this.$el.offset();
|
||||
this.$el.find('#inputWindow').jqxWindow({ width: 400,
|
||||
height: 110, resizable: false,
|
||||
cancelButton: $('#cancelButton'),
|
||||
okButton: $('#openBtn'),
|
||||
autoOpen: false,
|
||||
position: { x: offset.left + 50, y: offset.top + 50},
|
||||
initContent: function () {
|
||||
$('#openBtn').jqxButton({ width: '80px' });
|
||||
$('#cancelButton').jqxButton({ width: '80px' });
|
||||
}
|
||||
});
|
||||
|
||||
$('#inputWindow').keypress(function(e){
|
||||
if ( e.which == 13 ) {
|
||||
e.preventDefault();
|
||||
$('#openBtn').trigger('click');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
|
||||
@@ -3,8 +3,16 @@
|
||||
<ul>
|
||||
<li>Gestione Ricette
|
||||
<ul style='width: 250px;'>
|
||||
<li><a id="modifyRicetta" href="#">Lista</a></li>
|
||||
<li><a id="addRicetta" href="#">Aggiungi</a></li>
|
||||
<li><a id="modifyRicetta" href="#">Modifica</a></li>
|
||||
<li><a id="modifyByIDRicetta" href="#">Modifica per ID</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Gestione Mulini
|
||||
<ul style='width: 250px;'>
|
||||
<li><a id="modifyMulino" href="#">Lista</a></li>
|
||||
<li><a id="addMulino" href="#">Aggiungi</a></li>
|
||||
<li><a id="modifyByIDMulino" href="#">Modifica per ID</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<!--
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<div id="inputWindow">
|
||||
<div id="customWindowHeader">
|
||||
<span id="captureContainer" style="float: left">Inserire ID Ricetta</span>
|
||||
</div>
|
||||
<div id="customWindowContent" style="overflow: hidden">
|
||||
<div style="margin: 10px">
|
||||
ID Ricetta:
|
||||
<input type="text" style="width: 175px; border: 1px solid #aaa" id="ricettaId" />
|
||||
<div style="float: right">
|
||||
<input type="button" value="Open" style="margin-bottom: 5px;" id="openBtn" /><br />
|
||||
<input type="button" value="Cancel" id="cancelButton" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,120 @@
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/mulini/muliniViewTemplate.html', 'modules/base/baseView',
|
||||
'controls/window/window', 'modules/editmulino/editmulino', 'jqx'],
|
||||
function($, _, Backbone, muliniViewTemplate, BaseView, Window, EditMulino) {
|
||||
|
||||
var MuliniView = BaseView.extend({
|
||||
dataAdapter: undefined,
|
||||
//initialize template
|
||||
template: _.template(muliniViewTemplate),
|
||||
window:null,
|
||||
editorMulino: null,
|
||||
|
||||
initialize: function() {
|
||||
MuliniView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
openMulino: function(row) {
|
||||
var editrow = row;
|
||||
var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
|
||||
this.editorMulino.openMulino(dataRecord.mulino_id);
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function() {
|
||||
//this.header.title = "pippo";
|
||||
MuliniView.__super__.render.call(this);
|
||||
var self = this;
|
||||
|
||||
if(self.window === null)
|
||||
{
|
||||
self.window = new Window({
|
||||
id: "mulini",
|
||||
title: "Mulini",
|
||||
width: "850px",
|
||||
resizable: true,
|
||||
height: "510px",
|
||||
maxHeight: 1000,
|
||||
maxWidth: 1000,
|
||||
content: "<p><div id=\"jqxgrid\"></div></p>",
|
||||
initContentFn: function() {
|
||||
// prepare the data
|
||||
self.dataAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'mulino_id', type: 'int'},
|
||||
{name: 'nome', type: 'string'},
|
||||
{name: 'regione', type: 'string'}
|
||||
],
|
||||
id: 'mulino_id',
|
||||
url: myManifest.Settings.DefaultURL + "/backend/mulini"
|
||||
});
|
||||
$("#jqxgrid").jqxGrid({
|
||||
width: "100%",
|
||||
height: "95%",
|
||||
source: self.dataAdapter,
|
||||
filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Titolo', dataField: 'titolo', width: "50%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: 'Autore', dataField: 'autore', width: "30%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Edit', columntype: 'button', width: '10%', filterable: false, sortable: false, menu: false,
|
||||
cellsrenderer: function() {
|
||||
return "Modifica";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
self.openMulino(row);
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Del', columntype: 'button', width: '10%', filterable: false, sortable: false, menu: false,
|
||||
cellsrenderer: function() {
|
||||
return "Elimina";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
var items = $("#jqxgrid").jqxGrid('source');
|
||||
var item = items.records[row];
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/mulino/" + item.mulino_id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
var msg = response;
|
||||
alert(msg.message);
|
||||
$("#jqxgrid").jqxGrid('updatebounddata');
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#jqxgrid').on('rowdoubleclick', function(event)
|
||||
{
|
||||
var args = event.args;
|
||||
var row = args.rowindex;
|
||||
self.openMulino(row);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.$el.append(this.template());
|
||||
this.$el.find("#content").append(self.window.$el);
|
||||
self.window.render();
|
||||
|
||||
this.editorMulino = new EditMulino();
|
||||
this.$el.find("#content").append(this.editorMulino.$el);
|
||||
|
||||
this.editorMulino.render();
|
||||
}
|
||||
else
|
||||
self.window.open();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return MuliniView;
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
<div id="content">
|
||||
</div>
|
||||
Reference in New Issue
Block a user