var IbimecController = { Name: "IBIMEC", RequireLogin: true }; function InitCustomCodeImpostazioniValoriVariabile() { }; function ApriMenuCustomImpostazioniValoriVariabile(codice) { if (codice == "AGGIORNAMENTI_IBPM") { UI.CloseWindow("FrmIbimecListaAggiornamenti"); var FrmInstance = new FrmIbimecListaAggiornamenti("IBPM"); UI.AddForm(FrmInstance); FrmInstance.Show(); }; if (codice == "AGGIORNAMENTI_FMEA") { UI.CloseWindow("FrmIbimecListaAggiornamenti"); var FrmInstance = new FrmIbimecListaAggiornamenti("FMEANET"); UI.AddForm(FrmInstance); FrmInstance.Show(); }; if (codice == "CHIAVI_FMEA") { UI.CloseWindow("FrmIbimecListaChiavi"); var FrmInstance = new FrmIbimecListaChiavi("FMEANET"); UI.AddForm(FrmInstance); FrmInstance.Show(); }; if (codice == "CHIAVI_IBPM") { UI.CloseWindow("FrmIbimecListaChiavi"); var FrmInstance = new FrmIbimecListaChiavi("IBPM"); UI.AddForm(FrmInstance); FrmInstance.Show(); }; if (codice == "INTERVENTI_FMEA") { UI.CloseWindow("FrmIbimecListaInterventi"); var FrmInstance = new FrmIbimecListaInterventi("FMEANET"); UI.AddForm(FrmInstance); FrmInstance.Show(); }; if (codice == "INTERVENTI_IBPM") { UI.CloseWindow("FrmIbimecListaInterventi"); var FrmInstance = new FrmIbimecListaInterventi("IBPM"); UI.AddForm(FrmInstance); FrmInstance.Show(); }; }; function VisualizzaDettaglioInserimentoAggiornamneto(p, formPadre, FormPadre2) { Service(IbimecController, "GetHTMLGestioneInserimentoAggiornamenti", undefined, "", function (result) { if (result) { if (result !== '') { $("body").append(result); var hh = 600; var ww = 1000; if (IsPhoneDevice()) { hh = screen.availHeight - 10; ww = screen.availWidth - 10; } ChiudiSelezione = function () { if (UI.currpopup) { UI.currpopup.dialog("close"); UI.currpopup = null; UI.afterClosePopup = false; }; }; var dialog = $$("FrmIbimecInserisciAggiornamento").dialog({ autoOpen: false, height: hh, width: ww, modal: true, title: "Registra/Modifica Aggiornamento", buttons: { Annulla: function () { ChiudiSelezione(); }, Salva: function () { p.Ambiente = $("#FrmIbimecGestioneAggiornamentiAmbienteIns").val(); p.Utente = $("#FrmIbimecGestioneAggiornamentiUtenteIns").val(); p.Data = $("#FrmIbimecGestioneAggiornamentiDataIns").val(); p.Versione = $("#FrmIbimecGestioneAggiornamentiVersioneIns").val(); p.Note = $("#FrmIbimecGestioneAggiornamentiNoteIns").val(); Service(IbimecController, "SalvaAggiornamentiCliente", p, "", function (result) { ChiudiSelezione(); if (formPadre) { formPadre.RicaricaGriglia(formPadre); }; if (FormPadre2) { FormPadre2.GetDateUpdate(FormPadre2); } }); } }, close: function () { dialog.remove(); $("body").removeClass("modal-open"); } }); $("body").addClass("modal-open"); $("#FrmIbimecGestioneAggiornamentiDataIns").datepicker({ dateFormat: "dd/mm/yy", mask: "39/19/9999", }); $("#FrmIbimecGestioneAggiornamentiUtenteIns").val(p.Utente); $("#FrmIbimecGestioneAggiornamentiDataIns").datepicker("setDate", p.Data); $("#FrmIbimecGestioneAggiornamentiAmbienteIns").val(p.Ambiente); $("#FrmIbimecGestioneAggiornamentiVersioneIns").val(p.Versione); $("#FrmIbimecGestioneAggiornamentiNoteIns").val(p.Note); dialog.dialog("open"); UI.currpopup = dialog; } } }); }; function VisualizzaDettaglioInserimentoChiave(p, formPadre) { Service(IbimecController, "GetHTMLGestioneInserimentoChiaveSw", undefined, "", function (result) { if (result) { if (result !== '') { $("body").append(result); var hh = 600; var ww = 1000; if (IsPhoneDevice()) { hh = screen.availHeight - 10; ww = screen.availWidth - 10; } ChiudiSelezione = function () { if (UI.currpopup) { UI.currpopup.dialog("close"); UI.currpopup = null; UI.afterClosePopup = false; }; }; var dialog = $$("FrmIbimecInserimentoChiave").dialog({ autoOpen: false, height: hh, width: ww, modal: true, title: "Registra/Modifica Chiave", buttons: { Annulla: function () { ChiudiSelezione(); }, Salva: function () { p.Ambiente = $("#FrmIbimecInserimChiaveAmbienteIns").val(); p.Utente = $("#FrmIbimecInserimChiaveUtenteIns").val(); p.Data = $("#FrmIbimecInserimChiaveDataIns").val(); p.Chiave = $("#FrmIbimecInserimChiaveChiaveIns").val(); p.Note = $("#FrmIbimecInserimChiaveNoteIns").val(); Service(IbimecController, "SalvaChiaveCliente", p, "", function (result) { ChiudiSelezione(); if (formPadre) { formPadre.RicaricaGriglia(formPadre); }; }); } }, close: function () { dialog.remove(); $("body").removeClass("modal-open"); } }); $("body").addClass("modal-open"); $("#FrmIbimecInserimChiaveDataIns").datepicker({ dateFormat: "dd/mm/yy", mask: "39/19/9999", }); $("#FrmIbimecInserimChiaveUtenteIns").val(p.Utente); $("#FrmIbimecInserimChiaveDataIns").datepicker("setDate", p.Data); $("#FrmIbimecInserimChiaveAmbienteIns").val(p.Ambiente); $("#FrmIbimecInserimChiaveChiaveIns").val(p.Chiave); $("#FrmIbimecInserimChiaveNoteIns").val(p.Note); dialog.dialog("open"); UI.currpopup = dialog; } } }); }; function VisualizzaDettaglioInserimentoIntervento(p, formPadre) { Service(IbimecController, "GetHTMLInseriemntoIntervento", undefined, "", function (result) { if (result) { if (result !== '') { $("body").append(result); var hh = 600; var ww = 1000; if (IsPhoneDevice()) { hh = screen.availHeight - 10; ww = screen.availWidth - 10; } ChiudiSelezione = function () { if (UI.currpopup) { UI.currpopup.dialog("close"); UI.currpopup = null; UI.afterClosePopup = false; }; }; var dialog = $$("FrmIbimecInserimentoIntervento").dialog({ autoOpen: false, height: hh, width: ww, modal: true, title: "Registra/Modifica Intervento", buttons: { Annulla: function () { ChiudiSelezione(); }, Salva: function () { p.Ambiente = $("#FrmIbimecInserimInterventoAmbienteIns").val(); p.Utente = $("#FrmIbimecInserimInterventoUtenteIns").val(); p.Data = $("#FrmIbimecInserimInterventoDataIns").val(); p.Note = $("#FrmIbimecInserimInterventoNoteIns").val(); Service(IbimecController, "SalvaInterventoCliente", p, "", function (result) { ChiudiSelezione(); if (formPadre) { formPadre.RicaricaGriglia(formPadre); }; }); } }, close: function () { dialog.remove(); $("body").removeClass("modal-open"); } }); $("body").addClass("modal-open"); $("#FrmIbimecInserimInterventoDataIns").datepicker({ dateFormat: "dd/mm/yy", mask: "39/19/9999", }); $("#FrmIbimecInserimInterventoUtenteIns").val(p.Utente); $("#FrmIbimecInserimInterventoDataIns").datepicker("setDate", p.Data); $("#FrmIbimecInserimInterventoAmbienteIns").val(p.Ambiente); $("#FrmIbimecInserimInterventoNoteIns").val(p.Note); dialog.dialog("open"); UI.currpopup = dialog; } } }); }; function EseguiPersonalizzazionepaginaWebVars(codice, dati, viewModelVars) { }; function FrmIbimecGestioneAggiornamenti(fPadre) { this.Name = "FrmIbimecGestioneAggiornamenti"; this.Title = "Aggiornamenti"; this.MainForm = undefined; this.CurrentData = undefined; this.IdCliente = fPadre.IdCliente; this.Prodotto = fPadre.Prodotto; this.DescrCliente = fPadre.DescrCliente; this.DatiUpdate = null; this.FormPadre = fPadre; var gg = this; //Inizializzazione parametro di creazione della griglia this.gridParameter = { dataSource: null, keyExpr: "ID", height: '100%', editing: { allowAdding: false, allowDeleting: false, allowUpdating: false }, selection: { mode: "single", showCheckBoxesMode: "never", allowSelectAll: false }, showBorders: true, filterRow: { visible: true }, headerFilter: { visible: true }, columns: [ { dataField: "Data", caption: "Data", allowEditing: false, dataType: "date", format: 'dd/MM/yyyy', alignment: "right", width: 150 }, { dataField: "Tipo", caption: "Tipo", allowEditing: false, width: 150 }, { dataField: "name", caption: "Numero", allowEditing: false, width: 150 }, { dataField: "Titolo", caption: "Titolo", allowEditing: false, width: 300 }, { dataField: "Stato", caption: "Stato", allowEditing: false, width: 150 }, { dataField: "link", caption: "Link", allowEditing: false, width: 250 , cellTemplate: function (container, options) { $('').addClass('dx-link') .text("Link al Ticket") .on('dxclick', function (kkk, ppp, hhh) { var link = options.data.link; window.open(link); }) .appendTo(container); } } ], allowColumnReordering: true, allowColumnResizing: true, columnAutoWidth: true, loadPanel: { enabled: true }, columnResizingMode: 'widget', wordWrapEnabled: false, scrolling: { showScrollbar: 'always' }, customizeText: function (cellInfo) { return cellInfo.value.replace(/(?:\r\n|\r|\n)/g, '
'); //TODO: sfruttare cellinfo x sapere se la colonna รจ MEMO? // oppure fare questo mestiere lato server } }; this.Init = function () { var me = this; me.MainForm = this.$; Service(IbimecController, "GetHTMLGestioneAggiornamenti", undefined, me.Name, function (result) { if (result) { if (result !== '') { me.MainForm.append(result); $("#FrmIbimecGestioneAggiornamentiData").datepicker({ dateFormat: "dd/mm/yy", mask: "39/19/9999", onSelect: function () { me.RicaricaGriglia(me); } }); $("#FrmIbimecGestioneAggiornamentiDataCli").datepicker({ dateFormat: "dd/mm/yy", mask: "39/19/9999", onSelect: function () { me.RicaricaGriglia(me); } }); $("#FrmIbimecGestioneAggiornamentiAmbiente").val("PRODUZIONE"); $("#FrmIbimecGestioneAggiornamentiCliente").val(me.DescrCliente); $("#FrmIbimecGestioneAggiornamentiAmbiente").on('change', function () { me.GetDateUpdate(me); }); $("#FrmIbimecGestioneAggiornamentiDownloadUpdate").button().click(function () { Service(IbimecController, "ScaricaFileUpdate", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto }, me.Name, function (result) { if (result.Result) { ShowDownload(result); } else { ErrorBox(result.FailReason); } }); }); $("#FrmIbimecGestioneAggiornamentiDownloadSetup").button().click(function () { Service(IbimecController, "ScaricaFileSetup", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto }, me.Name, function (result) { if (result.Result) { ShowDownload(result); } else { ErrorBox(result.FailReason); } }); }); $("#FrmIbimecGestioneAggiornamentiDownloadSetupFmea").button().click(function () { Service(IbimecController, "ScaricaFileSetupFmea", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto }, me.Name, function (result) { if (result.Result) { ShowDownload(result); } else { ErrorBox(result.FailReason); } }); }); if (me.Prodotto != "FMEANET") { $("#FrmIbimecGestioneAggiornamentiDownloadSetupFmea").hide(); $("#FrmIbimecGestioneAggiornamentiDownloadSetup").html('DOWNLOAD SETUP') }; $("#FrmIbimecGestioneAggiornamentiAddRow").button().click(function () { if (me.IdCliente) { if (me.DatiUpdate) { var p = {}; p.Data = new Date(); p.Utente = me.DatiUpdate.Utente; p.Prodotto = me.Prodotto; p.IdCliente = me.IdCliente; p.Ambiente = $("#FrmIbimecGestioneAggiornamentiAmbiente").val(); p.Chiave = ''; p.Versione = me.DatiUpdate.VersioneUpdate; p.Note = ''; p.ID = -1; VisualizzaDettaglioInserimentoAggiornamneto(p, me.FormPadre,me); } } }); me.GetDateUpdate(me); } } }); }; this.GetDateUpdate = function (me) { if (me.IdCliente) { Service(IbimecController, "GetDataUpdateCliente", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto, Ambiente: $("#FrmIbimecGestioneAggiornamentiAmbiente").val() }, me.Name, function (result) { $("#FrmIbimecGestioneAggiornamentiData").datepicker("setDate", result.DataUpdate); $("#FrmIbimecGestioneAggiornamentiDataCli").datepicker("setDate", result.DataAggCliente); me.DatiUpdate = result; me.RicaricaGriglia(me); }); } }; this.RicaricaGriglia = function (me) { if (me.IdCliente) { Service(IbimecController, "GetElencoModifichePerCliente", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto, Ambiente: $("#FrmIbimecGestioneAggiornamentiAmbiente").val() }, me.Name, function (result) { if (result) { me.CurrentData = result; me.gridParameter.dataSource = result; $("#FrmIbimecGestioneAggiornamentiGriglia").dxDataGrid(me.gridParameter).dxDataGrid("instance").clearSelection(); } }); } }; }; function FrmIbimecListaAggiornamenti(prod) { this.Name = "FrmIbimecListaAggiornamenti"; this.Title = "Aggiornamenti"; this.MainForm = undefined; this.CurrentData = undefined; this.IdCliente = undefined; this.DescrCliente = undefined; this.Prodotto = prod; var gg = this; var me = this; //Inizializzazione parametro di creazione della griglia this.gridParameter = { dataSource: null, keyExpr: "ID", height: '100%', editing: { allowAdding: false, allowDeleting: false, allowUpdating: false }, selection: { mode: "single", showCheckBoxesMode: "never", allowSelectAll: false }, showBorders: true, filterRow: { visible: true }, headerFilter: { visible: true }, columns: [ { dataField: "data", caption: "Data", allowEditing: false, dataType: "date", format: 'dd/MM/yyyy', alignment: "right", width: 150 }, { dataField: "Utente", caption: "Utente", allowEditing: false, width: 150 }, { dataField: "Prodotto", caption: "Prodotto", allowEditing: false, width: 150 }, { dataField: "Ambiente", caption: "Ambiente", allowEditing: false, width: 150 }, { dataField: "Versione", caption: "Versione", allowEditing: false, width: 300 }, { dataField: "Note", caption: "Note", allowEditing: false, width: 300 } ], allowColumnReordering: true, allowColumnResizing: true, columnAutoWidth: true, loadPanel: { enabled: true }, columnResizingMode: 'widget', wordWrapEnabled: false, scrolling: { showScrollbar: 'always' }, customizeText: function (cellInfo) { return cellInfo.value.replace(/(?:\r\n|\r|\n)/g, '
'); }, onRowClick: function (e) { var component = e.component; prevClickTime = component.lastClickTime; component.lastClickTime = new Date(); if (prevClickTime && (component.lastClickTime - prevClickTime < 300)) { var kk = []; kk.push(e.key); component.selectRows(kk, false); var mrow = _.findWhere(gg.CurrentData, { ID: e.key }); //var FormToBringToFront = _.find(UI.OpenedForms, { // Name: "FrmIBIMECEditBollatura" //}); //if (FormToBringToFront) { // FormToBringToFront.Close(); //} var p = {}; p.Data = mrow.data; p.Utente = mrow.Utente; p.Prodotto = mrow.Prodotto; p.Ambiente = mrow.Ambiente; p.Versione = mrow.Versione; p.Note = mrow.Note; p.ID = e.key; VisualizzaDettaglioInserimentoAggiornamneto(p, me); }; } }; this.Init = function () { var me = this; me.MainForm = this.$; Service(IbimecController, "GetHTMLListaAggiornamenti", undefined, me.Name, function (result) { if (result) { if (result !== '') { me.MainForm.append(result); $("#FrmIbimecListaAggiornamentiSelCli").button().click(function () { me.SelezionaCliente(); }); $("#FrmIbimecListaAggiornamentiUpdate").button().click(function () { if (me.IdCliente) { var FrmInstance = new FrmIbimecGestioneAggiornamenti(me); UI.AddForm(FrmInstance); FrmInstance.Show(); } }); } } }); }; this.Closing = function (e) { UI.CloseWindow("FrmIbimecGestioneAggiornamenti"); }; this.SelezionaCliente = function () { var me = this; Service(IbimecController, "GetElencoClienti", undefined, me.Name, function (result) { var FunzioneSel = function (dati) { var riga = dati[0]; $("#FrmIbimecListaAggiornamentiCliente").val(riga.Cliente); me.IdCliente = riga.ID; me.DescrCliente = riga.Cliente; me.RicaricaGriglia(me); }; var cols = new Array(); cols.push({ dataField: "Cliente", caption: "Cliente", allowEditing: false }); cols.push({ dataField: "ID", caption: "ID", allowEditing: false }); ShowSelectionForm(false, FunzioneSel, cols, result, "Clienti"); }); }; this.RicaricaGriglia = function (me) { if (me.IdCliente) { Service(IbimecController, "GetElencoAggiornamentiCliente", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto }, me.Name, function (result) { if (result) { me.CurrentData = result; me.gridParameter.dataSource = result; $("#FrmIbimecListaAggiornamentiGriglia").dxDataGrid(me.gridParameter).dxDataGrid("instance").clearSelection(); } }); } }; }; function FrmIbimecListaChiavi(prod) { this.Name = "FrmIbimecListaChiavi"; this.Title = "Chiavi Software"; this.MainForm = undefined; this.CurrentData = undefined; this.IdCliente = undefined; this.DescrCliente = undefined; this.Prodotto = prod; var gg = this; var me = this; //Inizializzazione parametro di creazione della griglia this.gridParameter = { dataSource: null, keyExpr: "ID", height: '100%', editing: { allowAdding: false, allowDeleting: false, allowUpdating: false }, selection: { mode: "single", showCheckBoxesMode: "never", allowSelectAll: false }, showBorders: true, filterRow: { visible: true }, headerFilter: { visible: true }, columns: [ { dataField: "data", caption: "Data", allowEditing: false, dataType: "date", format: 'dd/MM/yyyy', alignment: "right", width: 150 }, { dataField: "Utente", caption: "Utente", allowEditing: false, width: 150 }, { dataField: "Prodotto", caption: "Prodotto", allowEditing: false, width: 150 }, { dataField: "Ambiente", caption: "Ambiente", allowEditing: false, width: 150 }, { dataField: "Chiave", caption: "Chiave", allowEditing: false, width: 300 }, { dataField: "Note", caption: "Note", allowEditing: false, width: 300 } ], allowColumnReordering: true, allowColumnResizing: true, columnAutoWidth: false, loadPanel: { enabled: true }, columnResizingMode: 'widget', wordWrapEnabled: false, scrolling: { showScrollbar: 'always' }, customizeText: function (cellInfo) { return cellInfo.value.replace(/(?:\r\n|\r|\n)/g, '
'); }, onRowClick: function (e) { var component = e.component; prevClickTime = component.lastClickTime; component.lastClickTime = new Date(); if (prevClickTime && (component.lastClickTime - prevClickTime < 300)) { var kk = []; kk.push(e.key); component.selectRows(kk, false); var mrow = _.findWhere(gg.CurrentData, { ID: e.key }); //var FormToBringToFront = _.find(UI.OpenedForms, { // Name: "FrmIBIMECEditBollatura" //}); //if (FormToBringToFront) { // FormToBringToFront.Close(); //} var p = {}; p.Data = mrow.data; p.IdCliente p.IdCliente = me.IdCliente; p.Utente = mrow.Utente; p.Prodotto = mrow.Prodotto; p.Ambiente = mrow.Ambiente; p.Chiave = mrow.Chiave; p.Note = mrow.Note; p.ID = e.key; VisualizzaDettaglioInserimentoChiave(p, me); }; } }; this.Init = function () { var me = this; me.MainForm = this.$; Service(IbimecController, "GetHTMLListaChiavi", undefined, me.Name, function (result) { if (result) { if (result !== '') { me.MainForm.append(result); $("#FrmIbimecListaChiaviSelCli").button().click(function () { me.SelezionaCliente(); }); $("#FrmIbimecListaChiaviUpdate").button().click(function () { if (me.IdCliente) { var p = {}; p.Data = new Date(); p.Utente = Session.UserName; p.Prodotto = me.Prodotto; p.Ambiente = "PRODUZIONE"; p.IdCliente = me.IdCliente; p.Chiave = ""; p.Note =""; p.ID = -1; VisualizzaDettaglioInserimentoChiave(p, me); } }); } } }); }; this.SelezionaCliente = function () { var me = this; Service(IbimecController, "GetElencoClienti", undefined, me.Name, function (result) { var FunzioneSel = function (dati) { var riga = dati[0]; $("#FrmIbimecListaChiaviCliente").val(riga.Cliente); me.IdCliente = riga.ID; me.DescrCliente = riga.Cliente; me.RicaricaGriglia(me); }; var cols = new Array(); cols.push({ dataField: "Cliente", caption: "Cliente", allowEditing: false }); cols.push({ dataField: "ID", caption: "ID", allowEditing: false }); ShowSelectionForm(false, FunzioneSel, cols, result, "Clienti"); }); }; this.RicaricaGriglia = function (me) { if (me.IdCliente) { Service(IbimecController, "GetElencoChiaviCliente", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto }, me.Name, function (result) { if (result) { me.CurrentData = result; me.gridParameter.dataSource = result; $("#FrmIbimecListaChiaviGriglia").dxDataGrid(me.gridParameter).dxDataGrid("instance").clearSelection(); } }); } }; }; function FrmIbimecListaInterventi(prod) { this.Name = "FrmIbimecListaInterventi"; this.Title = "Interventi"; this.MainForm = undefined; this.CurrentData = undefined; this.IdCliente = undefined; this.DescrCliente = undefined; this.Prodotto = prod; var gg = this; var me = this; //Inizializzazione parametro di creazione della griglia this.gridParameter = { dataSource: null, keyExpr: "ID", height: '100%', editing: { allowAdding: false, allowDeleting: false, allowUpdating: false }, selection: { mode: "single", showCheckBoxesMode: "never", allowSelectAll: false }, showBorders: true, filterRow: { visible: true }, headerFilter: { visible: true }, columns: [ { dataField: "data", caption: "Data", allowEditing: false, dataType: "date", format: 'dd/MM/yyyy', alignment: "right", width: 150 }, { dataField: "Utente", caption: "Utente", allowEditing: false, width: 150 }, { dataField: "Prodotto", caption: "Prodotto", allowEditing: false, width: 150 }, { dataField: "Ambiente", caption: "Ambiente", allowEditing: false, width: 150 }, { dataField: "Note", caption: "Note", allowEditing: false, width: 600 } ], allowColumnReordering: true, allowColumnResizing: true, columnAutoWidth: false, loadPanel: { enabled: true }, columnResizingMode: 'widget', wordWrapEnabled: false, scrolling: { showScrollbar: 'always' }, customizeText: function (cellInfo) { return cellInfo.value.replace(/(?:\r\n|\r|\n)/g, '
'); }, onRowClick: function (e) { var component = e.component; prevClickTime = component.lastClickTime; component.lastClickTime = new Date(); if (prevClickTime && (component.lastClickTime - prevClickTime < 300)) { var kk = []; kk.push(e.key); component.selectRows(kk, false); var mrow = _.findWhere(gg.CurrentData, { ID: e.key }); //var FormToBringToFront = _.find(UI.OpenedForms, { // Name: "FrmIBIMECEditBollatura" //}); //if (FormToBringToFront) { // FormToBringToFront.Close(); //} var p = {}; p.Data = mrow.data; p.IdCliente p.IdCliente = me.IdCliente; p.Utente = mrow.Utente; p.Prodotto = mrow.Prodotto; p.Ambiente = mrow.Ambiente; p.Note = mrow.Note; p.ID = e.key; VisualizzaDettaglioInserimentoIntervento(p, me); }; } }; this.Init = function () { var me = this; me.MainForm = this.$; Service(IbimecController, "GetHTMLListaIntervento", undefined, me.Name, function (result) { if (result) { if (result !== '') { me.MainForm.append(result); $("#FrmIbimecListaInterventiSelCli").button().click(function () { me.SelezionaCliente(); }); $("#FrmIbimecListaInterventiUpdate").button().click(function () { if (me.IdCliente) { var p = {}; p.Data = new Date(); p.Utente = Session.UserName; p.Prodotto = me.Prodotto; p.Ambiente = "PRODUZIONE"; p.IdCliente = me.IdCliente; p.Note =""; p.ID = -1; VisualizzaDettaglioInserimentoIntervento(p, me); } }); } } }); }; this.SelezionaCliente = function () { var me = this; Service(IbimecController, "GetElencoClienti", undefined, me.Name, function (result) { var FunzioneSel = function (dati) { var riga = dati[0]; $("#FrmIbimecListaInterventiCliente").val(riga.Cliente); me.IdCliente = riga.ID; me.DescrCliente = riga.Cliente; me.RicaricaGriglia(me); }; var cols = new Array(); cols.push({ dataField: "Cliente", caption: "Cliente", allowEditing: false }); cols.push({ dataField: "ID", caption: "ID", allowEditing: false }); ShowSelectionForm(false, FunzioneSel, cols, result, "Clienti"); }); }; this.RicaricaGriglia = function (me) { if (me.IdCliente) { Service(IbimecController, "GetElencoInterventiCliente", { IDCLIENTE: me.IdCliente, Prodotto: me.Prodotto }, me.Name, function (result) { if (result) { me.CurrentData = result; me.gridParameter.dataSource = result; $("#FrmIbimecListaInterventiGriglia").dxDataGrid(me.gridParameter).dxDataGrid("instance").clearSelection(); } }); } }; };