mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-06 18:53:47 +01:00
Miglioramento JS per gestione input in form AJAX
This commit is contained in:
parent
d572da3314
commit
593c727dde
11
add.php
11
add.php
@ -80,11 +80,11 @@ if (isAjaxRequest()) {
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#form_'.$id_module.'-'.$id_plugin.'").find("form").submit(function () {
|
$("#form_'.$id_module.'-'.$id_plugin.'").find("form").submit(function () {
|
||||||
let $form = $(this);
|
let $form = $(this);
|
||||||
$form.variables = new Object();
|
|
||||||
$form.variables.id_module = \''.$id_module.'\';
|
|
||||||
$form.variables.id_plugin = \''.$id_plugin.'\';
|
|
||||||
|
|
||||||
submitAjax(this, $form.variables, function(response) {
|
salvaForm(this, {
|
||||||
|
id_module: "'.$id_module.'",
|
||||||
|
id_plugin: "'.$id_plugin.'",
|
||||||
|
}).then(function(response) {
|
||||||
// Selezione automatica nuovo valore per il select
|
// Selezione automatica nuovo valore per il select
|
||||||
let select = "#'.get('select').'";
|
let select = "#'.get('select').'";
|
||||||
if ($(select).val() !== undefined) {
|
if ($(select).val() !== undefined) {
|
||||||
@ -93,8 +93,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form.closest("div[id^=bs-popup").modal("hide");
|
$form.closest("div[id^=bs-popup").modal("hide");
|
||||||
|
})
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
248
assets/src/js/functions/form.js
Normal file
248
assets/src/js/functions/form.js
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @param form
|
||||||
|
* @param data
|
||||||
|
* @param callback
|
||||||
|
* @param errorCallback
|
||||||
|
* @returns {*|jQuery}
|
||||||
|
*/
|
||||||
|
function submitAjax(form, data, callback, errorCallback) {
|
||||||
|
let valid = $(form).parsley().validate();
|
||||||
|
if (!valid) {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) data = {};
|
||||||
|
|
||||||
|
// Lettura dei contenuti degli input
|
||||||
|
data = {...getInputsData(form), ...data};
|
||||||
|
|
||||||
|
$("#main_loading").show();
|
||||||
|
content_was_modified = false;
|
||||||
|
|
||||||
|
// Fix per gli id di default
|
||||||
|
data.id_module = data.id_module ? data.id_module : globals.id_module;
|
||||||
|
data.id_record = data.id_record ? data.id_record : globals.id_record;
|
||||||
|
data.id_plugin = data.id_plugin ? data.id_plugin : globals.id_plugin;
|
||||||
|
data.ajax = 1;
|
||||||
|
|
||||||
|
prepareForm(form);
|
||||||
|
|
||||||
|
// Invio dei dati
|
||||||
|
$(form).ajaxSubmit({
|
||||||
|
url: globals.rootdir + "/actions.php",
|
||||||
|
data: data,
|
||||||
|
type: "post",
|
||||||
|
success: function (data) {
|
||||||
|
let response = data.trim();
|
||||||
|
|
||||||
|
// Tentativo di conversione da JSON
|
||||||
|
try {
|
||||||
|
response = JSON.parse(response);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(response);
|
||||||
|
|
||||||
|
$("#main_loading").fadeOut();
|
||||||
|
|
||||||
|
renderMessages();
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
$("#main_loading").fadeOut();
|
||||||
|
|
||||||
|
toastr["error"](data);
|
||||||
|
|
||||||
|
if (errorCallback) errorCallback(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param form
|
||||||
|
*/
|
||||||
|
function prepareForm(form) {
|
||||||
|
$(form).find('input:disabled, select:disabled').prop('disabled', false);
|
||||||
|
|
||||||
|
let hash = window.location.hash;
|
||||||
|
if (hash) {
|
||||||
|
var input = $('<input/>', {
|
||||||
|
type: 'hidden',
|
||||||
|
name: 'hash',
|
||||||
|
value: hash,
|
||||||
|
});
|
||||||
|
|
||||||
|
$(form).append(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funzione per la gestione delle animazioni di caricamento sui pulsanti cliccati e appositamente predisposti,
|
||||||
|
*
|
||||||
|
* @param button
|
||||||
|
* @returns {[*, *]}
|
||||||
|
*/
|
||||||
|
function buttonLoading(button) {
|
||||||
|
let $this = $(button);
|
||||||
|
|
||||||
|
let result = [
|
||||||
|
$this.html(),
|
||||||
|
$this.attr("class")
|
||||||
|
];
|
||||||
|
|
||||||
|
$this.html('<i class="fa fa-spinner fa-pulse fa-fw"></i> Attendere...');
|
||||||
|
$this.addClass("btn-warning");
|
||||||
|
$this.prop("disabled", true);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funzione per ripristinare un pulsante con animazioni allo stato precedente.
|
||||||
|
*
|
||||||
|
* @param button
|
||||||
|
* @param loadingResult
|
||||||
|
*/
|
||||||
|
function buttonRestore(button, loadingResult) {
|
||||||
|
let $this = $(button);
|
||||||
|
|
||||||
|
$this.html(loadingResult[0]);
|
||||||
|
|
||||||
|
$this.attr("class", "");
|
||||||
|
$this.addClass(loadingResult[1]);
|
||||||
|
$this.prop("disabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funzione per salvare i contenuti di un form via AJAX, utilizzando una struttura più recente fondata sull'utilizzo di Promise.
|
||||||
|
*
|
||||||
|
* @param button
|
||||||
|
* @param form
|
||||||
|
* @param data
|
||||||
|
* @returns {Promise<unknown>}
|
||||||
|
*/
|
||||||
|
function salvaForm(form, data = {}, button = null) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
// Caricamento visibile nel pulsante
|
||||||
|
let restore = buttonLoading(button);
|
||||||
|
|
||||||
|
// Messaggio in caso di eventuali errori
|
||||||
|
let valid = $(form).parsley().validate();
|
||||||
|
if (!valid) {
|
||||||
|
swal({
|
||||||
|
type: "error",
|
||||||
|
title: globals.translations.ajax.missing.title,
|
||||||
|
text: globals.translations.ajax.missing.text,
|
||||||
|
});
|
||||||
|
buttonRestore(button, restore);
|
||||||
|
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione grafica di salvataggio
|
||||||
|
$("#main_loading").show();
|
||||||
|
content_was_modified = false;
|
||||||
|
|
||||||
|
// Lettura dei contenuti degli input
|
||||||
|
data = {...getInputsData(form), ...data};
|
||||||
|
data.ajax = 1;
|
||||||
|
|
||||||
|
// Fix per gli id di default
|
||||||
|
data.id_module = data.id_module ? data.id_module : globals.id_module;
|
||||||
|
data.id_record = data.id_record ? data.id_record : globals.id_record;
|
||||||
|
data.id_plugin = data.id_plugin ? data.id_plugin : globals.id_plugin;
|
||||||
|
|
||||||
|
// Invio dei dati
|
||||||
|
$.ajax({
|
||||||
|
url: globals.rootdir + "/actions.php",
|
||||||
|
data: data,
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
let response = data.trim();
|
||||||
|
|
||||||
|
// Tentativo di conversione da JSON
|
||||||
|
try {
|
||||||
|
response = JSON.parse(response);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione grafica del successo
|
||||||
|
$("#main_loading").fadeOut();
|
||||||
|
renderMessages();
|
||||||
|
buttonRestore(button, restore);
|
||||||
|
|
||||||
|
resolve(response);
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
toastr["error"](data);
|
||||||
|
|
||||||
|
// Gestione grafica dell'errore
|
||||||
|
$("#main_loading").fadeOut();
|
||||||
|
swal({
|
||||||
|
type: "error",
|
||||||
|
title: globals.translations.ajax.error.title,
|
||||||
|
text: globals.translations.ajax.error.text,
|
||||||
|
});
|
||||||
|
buttonRestore(button, restore);
|
||||||
|
|
||||||
|
reject(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funzione per recuperare come oggetto i contenuti degli input interni a un tag HTML.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement|string|jQuery} form
|
||||||
|
* @returns {{}}
|
||||||
|
*/
|
||||||
|
function getInputsData(form) {
|
||||||
|
let place = $(form);
|
||||||
|
let data = {};
|
||||||
|
|
||||||
|
// Gestione input previsti con sistema JS integrato
|
||||||
|
let inputs = place.find('.openstamanager-input');
|
||||||
|
for (const x of inputs) {
|
||||||
|
const i = input(x);
|
||||||
|
const name = i.getElement().attr('name');
|
||||||
|
const value = i.get();
|
||||||
|
|
||||||
|
data[name] = value ? value : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione input HTML standard
|
||||||
|
let standardInputs = place.find(':input').not('.openstamanager-input').serializeArray();
|
||||||
|
for (const x of standardInputs) {
|
||||||
|
data[x.name] = x.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione hash dell'URL
|
||||||
|
let hash = window.location.hash;
|
||||||
|
if (hash) {
|
||||||
|
data['hash'] = hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
@ -360,72 +360,6 @@ function getCookie(cname) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitAjax(form, data, callback, errorCallback) {
|
|
||||||
let valid = $(form).parsley().validate();
|
|
||||||
if (!valid) {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data) data = {};
|
|
||||||
|
|
||||||
$("#main_loading").show();
|
|
||||||
content_was_modified = false;
|
|
||||||
|
|
||||||
// Fix per gli id di default
|
|
||||||
data.id_module = data.id_module ? data.id_module : globals.id_module;
|
|
||||||
data.id_record = data.id_record ? data.id_record : globals.id_record;
|
|
||||||
data.id_plugin = data.id_plugin ? data.id_plugin : globals.id_plugin;
|
|
||||||
data.ajax = 1;
|
|
||||||
|
|
||||||
prepareForm(form);
|
|
||||||
|
|
||||||
// Invio dei dati
|
|
||||||
$(form).ajaxSubmit({
|
|
||||||
url: globals.rootdir + "/actions.php",
|
|
||||||
data: data,
|
|
||||||
type: "post",
|
|
||||||
success: function (data) {
|
|
||||||
let response = data.trim();
|
|
||||||
|
|
||||||
// Tentativo di conversione da JSON
|
|
||||||
try {
|
|
||||||
response = JSON.parse(response);
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(response);
|
|
||||||
|
|
||||||
$("#main_loading").fadeOut();
|
|
||||||
|
|
||||||
renderMessages();
|
|
||||||
},
|
|
||||||
error: function (data) {
|
|
||||||
$("#main_loading").fadeOut();
|
|
||||||
|
|
||||||
toastr["error"](data);
|
|
||||||
|
|
||||||
if (errorCallback) errorCallback(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepareForm(form) {
|
|
||||||
$(form).find('input:disabled, select:disabled').prop('disabled', false);
|
|
||||||
|
|
||||||
var hash = window.location.hash;
|
|
||||||
if (hash) {
|
|
||||||
var input = $('<input/>', {
|
|
||||||
type: 'hidden',
|
|
||||||
name: 'hash',
|
|
||||||
value: hash,
|
|
||||||
});
|
|
||||||
|
|
||||||
$(form).append(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visualizzazione dei messaggi attivi tramite toastr.
|
* Visualizzazione dei messaggi attivi tramite toastr.
|
||||||
*/
|
*/
|
||||||
@ -457,10 +391,20 @@ function renderMessages() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rimuove l'hash dall'URL corrente.
|
||||||
|
*/
|
||||||
function removeHash() {
|
function removeHash() {
|
||||||
history.replaceState(null, null, ' ');
|
history.replaceState(null, null, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param str
|
||||||
|
* @param find
|
||||||
|
* @param replace
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
function replaceAll(str, find, replace) {
|
function replaceAll(str, find, replace) {
|
||||||
return str.replace(new RegExp(find, "g"), replace);
|
return str.replace(new RegExp(find, "g"), replace);
|
||||||
}
|
}
|
||||||
@ -495,7 +439,7 @@ function restart_inputs() {
|
|||||||
*/
|
*/
|
||||||
function alertPush() {
|
function alertPush() {
|
||||||
if ($(window).width() > 1023) {
|
if ($(window).width() > 1023) {
|
||||||
var i = 0;
|
let i = 0;
|
||||||
|
|
||||||
$('.alert-success.push').each(function () {
|
$('.alert-success.push').each(function () {
|
||||||
i++;
|
i++;
|
||||||
@ -524,7 +468,7 @@ function alertPush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fuinzione per l'apertura del messaggi di rimozione elemento standard.
|
* Funzione per l'apertura del messaggi di rimozione elemento standard.
|
||||||
*
|
*
|
||||||
* @param button
|
* @param button
|
||||||
* @param title
|
* @param title
|
||||||
@ -542,101 +486,6 @@ function confirmDelete(button, title, message) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione per la gestione delle animazioni di caricamento sui pulsanti cliccati e appositamente predisposti,
|
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* @returns {[*, *]}
|
|
||||||
*/
|
|
||||||
function buttonLoading(button) {
|
|
||||||
var $this = $(button);
|
|
||||||
|
|
||||||
var result = [
|
|
||||||
$this.html(),
|
|
||||||
$this.attr("class")
|
|
||||||
];
|
|
||||||
|
|
||||||
$this.html('<i class="fa fa-spinner fa-pulse fa-fw"></i> Attendere...');
|
|
||||||
$this.addClass("btn-warning");
|
|
||||||
$this.prop("disabled", true);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione per ripristinare un pulsante con animazioni allo stato precedente.
|
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* @param loadingResult
|
|
||||||
*/
|
|
||||||
function buttonRestore(button, loadingResult) {
|
|
||||||
var $this = $(button);
|
|
||||||
|
|
||||||
$this.html(loadingResult[0]);
|
|
||||||
|
|
||||||
$this.attr("class", "");
|
|
||||||
$this.addClass(loadingResult[1]);
|
|
||||||
$this.prop("disabled", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione per serializzare i contenuti di un form in JSON.
|
|
||||||
*
|
|
||||||
* @param form
|
|
||||||
* @returns {object}
|
|
||||||
*/
|
|
||||||
function serializeForm(form) {
|
|
||||||
let obj = {};
|
|
||||||
|
|
||||||
let formData = new FormData(form);
|
|
||||||
for (let key of formData.keys()) {
|
|
||||||
obj[key] = formData.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Funzione per salvare i contenuti di un form via AJAX, utilizzando una struttura più recente fondata sull'utilizzo di Promise.
|
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* @param form
|
|
||||||
* @param data
|
|
||||||
* @returns {Promise<unknown>}
|
|
||||||
*/
|
|
||||||
function salvaForm(button, form, data = {}) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
// Caricamento visibile nel pulsante
|
|
||||||
let restore = buttonLoading(button);
|
|
||||||
|
|
||||||
// Messaggio in caso di eventuali errori
|
|
||||||
let valid = $(form).parsley().validate();
|
|
||||||
if (!valid) {
|
|
||||||
swal({
|
|
||||||
type: "error",
|
|
||||||
title: globals.translations.ajax.missing.title,
|
|
||||||
text: globals.translations.ajax.missing.text,
|
|
||||||
});
|
|
||||||
buttonRestore(button, restore);
|
|
||||||
|
|
||||||
resolve(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
submitAjax(form, data, function (response) {
|
|
||||||
buttonRestore(button, restore);
|
|
||||||
resolve(true);
|
|
||||||
}, function (data) {
|
|
||||||
swal({
|
|
||||||
type: "error",
|
|
||||||
title: globals.translations.ajax.error.title,
|
|
||||||
text: globals.translations.ajax.error.text,
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonRestore(button, restore);
|
|
||||||
resolve(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nasconde una specifica colonna di una tabella indicata.
|
* Nasconde una specifica colonna di una tabella indicata.
|
||||||
@ -697,6 +546,7 @@ function hideTableColumn(table, column) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione per aggiungere in un *endpoint* il contenuto di uno specifico *template*, effettuando delle sostituzioni di base e inizializzando i campi aggiunti.
|
* Funzione per aggiungere in un *endpoint* il contenuto di uno specifico *template*, effettuando delle sostituzioni di base e inizializzando i campi aggiunti.
|
||||||
|
*
|
||||||
* @param {string|jQuery|HTMLElement} endpoint_selector
|
* @param {string|jQuery|HTMLElement} endpoint_selector
|
||||||
* @param {string|jQuery|HTMLElement} template_selector
|
* @param {string|jQuery|HTMLElement} template_selector
|
||||||
* @param {object} replaces
|
* @param {object} replaces
|
||||||
|
@ -104,13 +104,11 @@ Input.prototype.init = function () {
|
|||||||
|
|
||||||
// Inizializzazione per textarea
|
// Inizializzazione per textarea
|
||||||
else if (this.element.hasClass('autosize') || htmlElement.hasAttribute('maxlength')) {
|
else if (this.element.hasClass('autosize') || htmlElement.hasAttribute('maxlength')) {
|
||||||
|
|
||||||
if (this.element.hasClass('autosize'))
|
if (this.element.hasClass('autosize'))
|
||||||
initCompleted = initTextareaInput(htmlElement);
|
initCompleted = initTextareaInput(htmlElement);
|
||||||
|
|
||||||
if (htmlElement.hasAttribute('charcounter'))
|
if (htmlElement.hasAttribute('charcounter'))
|
||||||
initCompleted = initCharCounter(htmlElement);
|
initCompleted = initCharCounter(htmlElement);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inizializzazione per select
|
// Inizializzazione per select
|
||||||
@ -240,6 +238,11 @@ Input.prototype.getData = function () {
|
|||||||
Input.prototype.get = function () {
|
Input.prototype.get = function () {
|
||||||
let value = this.element.val();
|
let value = this.element.val();
|
||||||
|
|
||||||
|
// Gestione dei valori per select
|
||||||
|
if (this.element.hasClass("select-input")) {
|
||||||
|
value = value ? value : null;
|
||||||
|
}
|
||||||
|
|
||||||
// Gestione dei valori per l'editor
|
// Gestione dei valori per l'editor
|
||||||
if (this.element.hasClass("editor-input")) {
|
if (this.element.hasClass("editor-input")) {
|
||||||
const name = this.element.attr("id");
|
const name = this.element.attr("id");
|
||||||
|
@ -30,7 +30,6 @@ function initCharCounter(input) {
|
|||||||
let $input = $(input);
|
let $input = $(input);
|
||||||
|
|
||||||
if (input.hasAttribute('maxlength')) {
|
if (input.hasAttribute('maxlength')) {
|
||||||
|
|
||||||
$input.maxlength({
|
$input.maxlength({
|
||||||
warningClass: "help-block",
|
warningClass: "help-block",
|
||||||
limitReachedClass: "help-block text-danger",
|
limitReachedClass: "help-block text-danger",
|
||||||
@ -46,7 +45,6 @@ function initCharCounter(input) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$input.attr('maxlength', '65535');
|
$input.attr('maxlength', '65535');
|
||||||
|
|
||||||
$input.maxlength({
|
$input.maxlength({
|
||||||
@ -58,10 +56,8 @@ function initCharCounter(input) {
|
|||||||
appendToParent: true,
|
appendToParent: true,
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,9 +73,7 @@ function waitCKEditor(input) {
|
|||||||
*/
|
*/
|
||||||
function initEditorInput(input) {
|
function initEditorInput(input) {
|
||||||
if (window.CKEDITOR && CKEDITOR.status === "loaded") {
|
if (window.CKEDITOR && CKEDITOR.status === "loaded") {
|
||||||
$(document).ready(function () {
|
|
||||||
initCKEditor(input);
|
initCKEditor(input);
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
waitCKEditor(input);
|
waitCKEditor(input);
|
||||||
}
|
}
|
||||||
|
@ -364,10 +364,8 @@ function gestioneDescrizione(button) {
|
|||||||
|
|
||||||
async function gestioneRiga(button, options) {
|
async function gestioneRiga(button, options) {
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
// Apertura modal
|
|
||||||
if (valid) {
|
|
||||||
// Lettura titolo e chiusura tooltip
|
// Lettura titolo e chiusura tooltip
|
||||||
let title = $(button).tooltipster("content");
|
let title = $(button).tooltipster("content");
|
||||||
$(button).tooltipster("close")
|
$(button).tooltipster("close")
|
||||||
@ -376,7 +374,6 @@ async function gestioneRiga(button, options) {
|
|||||||
options = options ? options : "is_riga";
|
options = options ? options : "is_riga";
|
||||||
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||||
@ -524,7 +521,6 @@ $(document).ready(function() {
|
|||||||
data_accettazione.data("DateTimePicker").date(e.date);
|
data_accettazione.data("DateTimePicker").date(e.date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
?>
|
?>
|
||||||
|
@ -225,9 +225,8 @@ async function modificaRiga(button) {
|
|||||||
let type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -235,7 +234,6 @@ async function modificaRiga(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviRiga(button) {
|
function rimuoviRiga(button) {
|
||||||
swal({
|
swal({
|
||||||
|
@ -396,10 +396,8 @@ function gestioneDescrizione(button) {
|
|||||||
|
|
||||||
async function gestioneRiga(button, options) {
|
async function gestioneRiga(button, options) {
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
// Apertura modal
|
|
||||||
if (valid) {
|
|
||||||
// Lettura titolo e chiusura tooltip
|
// Lettura titolo e chiusura tooltip
|
||||||
let title = $(button).tooltipster("content");
|
let title = $(button).tooltipster("content");
|
||||||
$(button).tooltipster("close")
|
$(button).tooltipster("close")
|
||||||
@ -408,7 +406,6 @@ async function gestioneRiga(button, options) {
|
|||||||
options = options ? options : "is_riga";
|
options = options ? options : "is_riga";
|
||||||
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||||
|
@ -283,9 +283,8 @@ async function modificaRiga(button) {
|
|||||||
let type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -293,7 +292,6 @@ async function modificaRiga(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviRiga(button) {
|
function rimuoviRiga(button) {
|
||||||
swal({
|
swal({
|
||||||
|
@ -852,10 +852,8 @@ function gestioneDescrizione(button) {
|
|||||||
|
|
||||||
async function gestioneRiga(button, options) {
|
async function gestioneRiga(button, options) {
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
// Apertura modal
|
|
||||||
if (valid) {
|
|
||||||
// Lettura titolo e chiusura tooltip
|
// Lettura titolo e chiusura tooltip
|
||||||
let title = $(button).tooltipster("content");
|
let title = $(button).tooltipster("content");
|
||||||
$(button).tooltipster("close")
|
$(button).tooltipster("close")
|
||||||
@ -864,7 +862,6 @@ async function gestioneRiga(button, options) {
|
|||||||
options = options ? options : "is_riga";
|
options = options ? options : "is_riga";
|
||||||
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||||
|
@ -402,9 +402,8 @@ async function modificaRiga(button) {
|
|||||||
let type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -412,7 +411,6 @@ async function modificaRiga(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviRiga(button) {
|
function rimuoviRiga(button) {
|
||||||
swal({
|
swal({
|
||||||
|
@ -154,7 +154,7 @@ switch (post('op')) {
|
|||||||
$intervento->id_preventivo = post('idpreventivo');
|
$intervento->id_preventivo = post('idpreventivo');
|
||||||
$intervento->id_contratto = post('idcontratto');
|
$intervento->id_contratto = post('idcontratto');
|
||||||
$intervento->id_ordine = post('idordine');
|
$intervento->id_ordine = post('idordine');
|
||||||
$intervento->richiesta = post('richiesta_add');
|
$intervento->richiesta = post('richiesta');
|
||||||
$intervento->idsede_destinazione = $idsede_destinazione;
|
$intervento->idsede_destinazione = $idsede_destinazione;
|
||||||
$intervento->data_scadenza = $data_scadenza;
|
$intervento->data_scadenza = $data_scadenza;
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ echo '
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{[ "type": "ckeditor", "label": "'.tr('Richiesta').'", "name": "richiesta_add", "required": 1, "value": "'.$richiesta.'", "extra": "style=\'max-height:80px;\'" ]}
|
{[ "type": "ckeditor", "label": "'.tr('Richiesta').'", "name": "richiesta", "id": "richiesta_add", "required": 1, "value": "'.$richiesta.'", "extra": "style=\'max-height:80px;\'" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ if (!empty($id_intervento)) {
|
|||||||
input("idzona").disable();
|
input("idzona").disable();
|
||||||
input("idtipointervento").disable();
|
input("idtipointervento").disable();
|
||||||
input("idstatointervento").disable();
|
input("idstatointervento").disable();
|
||||||
input("richiesta_add").disable();
|
input("richiesta").disable();
|
||||||
input("data_richiesta").disable();
|
input("data_richiesta").disable();
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
@ -520,10 +520,9 @@ if (filter('orario_fine') !== null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Submit dinamico tramite AJAX
|
// Submit dinamico tramite AJAX
|
||||||
let valid = await salvaForm(button, "#add-form", {
|
let response = await salvaForm("#add-form", {
|
||||||
id_module: "'.$id_module.'", // Fix creazione da Dashboard
|
id_module: "'.$id_module.'", // Fix creazione da Dashboard
|
||||||
});
|
}, button);
|
||||||
if (!valid) return;
|
|
||||||
|
|
||||||
// Se l\'aggiunta intervento proviene dalla scheda di pianificazione ordini di servizio della dashboard, la ricarico
|
// Se l\'aggiunta intervento proviene dalla scheda di pianificazione ordini di servizio della dashboard, la ricarico
|
||||||
if (ref == "dashboard") {
|
if (ref == "dashboard") {
|
||||||
|
@ -250,9 +250,8 @@ async function modificaSessione(button) {
|
|||||||
var id = riga.data("id");
|
var id = riga.data("id");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -260,7 +259,6 @@ async function modificaSessione(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica sessione').'", "'.$module->fileurl('modals/manage_sessione.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_sessione=" + id);
|
openModal("'.tr('Modifica sessione').'", "'.$module->fileurl('modals/manage_sessione.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_sessione=" + id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function calcolaConflittiTecnici() {
|
function calcolaConflittiTecnici() {
|
||||||
let tecnici = [input("nuovo_tecnico").get()];
|
let tecnici = [input("nuovo_tecnico").get()];
|
||||||
|
@ -530,10 +530,8 @@ function gestioneDescrizione(button) {
|
|||||||
|
|
||||||
async function gestioneRiga(button, options) {
|
async function gestioneRiga(button, options) {
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
// Apertura modal
|
|
||||||
if (valid) {
|
|
||||||
// Lettura titolo e chiusura tooltip
|
// Lettura titolo e chiusura tooltip
|
||||||
let title = $(button).tooltipster("content");
|
let title = $(button).tooltipster("content");
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -542,7 +540,6 @@ async function gestioneRiga(button, options) {
|
|||||||
options = options ? options : "is_riga";
|
options = options ? options : "is_riga";
|
||||||
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||||
|
@ -184,9 +184,8 @@ async function modificaRiga(button) {
|
|||||||
let type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -194,7 +193,6 @@ async function modificaRiga(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica sessione').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Modifica sessione').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviRiga(button) {
|
function rimuoviRiga(button) {
|
||||||
swal({
|
swal({
|
||||||
|
@ -185,9 +185,8 @@ echo '
|
|||||||
let qta_input = input("qta");
|
let qta_input = input("qta");
|
||||||
let tipo_movimento = $("#tipo_movimento").val();
|
let tipo_movimento = $("#tipo_movimento").val();
|
||||||
|
|
||||||
let valid = await salvaForm(button, "#add-form");
|
await salvaForm("#add-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
let articolo = $("#idarticolo").selectData();
|
let articolo = $("#idarticolo").selectData();
|
||||||
|
|
||||||
let prezzo_acquisto = parseFloat(articolo.prezzo_acquisto);
|
let prezzo_acquisto = parseFloat(articolo.prezzo_acquisto);
|
||||||
@ -240,7 +239,6 @@ echo '
|
|||||||
$("#barcode").focus();
|
$("#barcode").focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
if (setting('Attiva scorciatoie da tastiera')) {
|
if (setting('Attiva scorciatoie da tastiera')) {
|
||||||
|
@ -285,10 +285,8 @@ function gestioneDescrizione(button) {
|
|||||||
|
|
||||||
async function gestioneRiga(button, options) {
|
async function gestioneRiga(button, options) {
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
// Apertura modal
|
|
||||||
if (valid) {
|
|
||||||
// Lettura titolo e chiusura tooltip
|
// Lettura titolo e chiusura tooltip
|
||||||
let title = $(button).tooltipster("content");
|
let title = $(button).tooltipster("content");
|
||||||
$(button).tooltipster("close")
|
$(button).tooltipster("close")
|
||||||
@ -297,7 +295,6 @@ async function gestioneRiga(button, options) {
|
|||||||
options = options ? options : "is_riga";
|
options = options ? options : "is_riga";
|
||||||
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||||
|
@ -306,9 +306,8 @@ async function modificaRiga(button) {
|
|||||||
let type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -316,7 +315,6 @@ async function modificaRiga(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviRiga(button) {
|
function rimuoviRiga(button) {
|
||||||
swal({
|
swal({
|
||||||
|
@ -292,10 +292,8 @@ function gestioneDescrizione(button) {
|
|||||||
|
|
||||||
async function gestioneRiga(button, options) {
|
async function gestioneRiga(button, options) {
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
// Apertura modal
|
|
||||||
if (valid) {
|
|
||||||
// Lettura titolo e chiusura tooltip
|
// Lettura titolo e chiusura tooltip
|
||||||
let title = $(button).tooltipster("content");
|
let title = $(button).tooltipster("content");
|
||||||
$(button).tooltipster("close")
|
$(button).tooltipster("close")
|
||||||
@ -304,7 +302,6 @@ async function gestioneRiga(button, options) {
|
|||||||
options = options ? options : "is_riga";
|
options = options ? options : "is_riga";
|
||||||
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
openModal(title, "'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&" + options);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||||
|
@ -251,9 +251,8 @@ async function modificaRiga(button) {
|
|||||||
let type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
await salvaForm("#edit-form", {}, button);
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
// Chiusura tooltip
|
// Chiusura tooltip
|
||||||
if ($(button).hasClass("tooltipstered"))
|
if ($(button).hasClass("tooltipstered"))
|
||||||
$(button).tooltipster("close");
|
$(button).tooltipster("close");
|
||||||
@ -261,7 +260,6 @@ async function modificaRiga(button) {
|
|||||||
// Apertura modal
|
// Apertura modal
|
||||||
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Modifica riga').'", "'.$module->fileurl('row-edit.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviRiga(button) {
|
function rimuoviRiga(button) {
|
||||||
swal({
|
swal({
|
||||||
|
@ -269,8 +269,8 @@ echo '
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generaFE(button) {
|
function generaFE(button) {
|
||||||
salvaForm(button, "#edit-form").then(function(valid) {
|
salvaForm("#edit-form", {}, button)
|
||||||
if (valid) {';
|
.then(function(valid) {';
|
||||||
|
|
||||||
if ($generata) {
|
if ($generata) {
|
||||||
echo '
|
echo '
|
||||||
@ -294,13 +294,12 @@ echo '
|
|||||||
$("#form-xml").submit();';
|
$("#form-xml").submit();';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
} else {
|
}).catch(function() {
|
||||||
swal({
|
swal({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "'.tr('Errore').'",
|
title: "'.tr('Errore').'",
|
||||||
text: "'.tr('Alcuni campi obbligatori non sono stati compilati correttamente').'.",
|
text: "'.tr('Alcuni campi obbligatori non sono stati compilati correttamente').'.",
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>';
|
</script>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user