This commit is contained in:
MatteoPistorello 2021-07-23 12:07:08 +02:00
commit bd3ce690ad
33 changed files with 700 additions and 481 deletions

View File

@ -81,7 +81,8 @@ input[type=file] {
position: fixed;
}
.ui-autocomplete {
.autocomplete, .ui-autocomplete {
background: white;
z-index: 10000;
min-width: 160px;
padding: 10px;
@ -94,8 +95,23 @@ input[type=file] {
border-radius: 5px;
}
.ui-autocomplete-category {
font-size: 150%;
.autocomplete .group, .ui-autocomplete-category {
font-size: 1.5em;
background: inherit;
}
.autocomplete > div {
padding: 5px;
}
.highlight {
background: #FFFF66;
}
.autocomplete > div:hover:not(.group),
.autocomplete > div.selected {
background: #F5F5F5;
cursor: pointer;
}
.ui-autocomplete-scrollable {
@ -1069,6 +1085,14 @@ div.tip {
background-color: rgba(255, 99, 71, 0.6) !important;
}
.login-box .img-responsive{
.login-box .img-responsive {
padding: 18px 0px 4px;
}
.no-selection {
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

View File

@ -138,7 +138,7 @@ $(document).ready(function () {
$(this).attr("data-id_records", "");
$(this).data("id_records", "");
} else {
swal(globals.translations.waiting, globals.translations.waiting_msg, "error");
swal(globals.translations.waiting, globals.translations.waitingMessage, "error");
}
});
});

View File

@ -40,21 +40,21 @@ $(document).ready(function () {
}
// Menu ordinabile
$(".sidebar-menu").sortable({
cursor: 'move',
if (!globals.is_mobile) {
sortable(".sidebar-menu", {
axis: "y",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".sidebar-menu > .treeview[data-id]").toArray().map(a => $(a).data("id"))
stop: function (event, ui) {
let order = $(this).sortable('toArray').toString();
$.post(globals.rootdir + "/actions.php?id_module=" + globals.order_manager_id, {
op: 'sort_modules',
ids: order
$.post(globals.rootdir + "/actions.php", {
id_module: globals.order_manager_id,
op: "sort_modules",
order: order.join(","),
});
}
});
if (globals.is_mobile) {
$(".sidebar-menu").sortable("disable");
});
}
$(".sidebar-toggle").click(function () {

View File

@ -17,88 +17,75 @@
*/
$(document).ready(function () {
$('#supersearch').keyup(function () {
$(document).ajaxStop();
const searchInput = $('#supersearch');
const searchButton = searchInput.parent().find('i');
const searches = [];
if ($(this).val() == '') {
$(this).removeClass('wait');
} else {
$(this).addClass('wait');
}
});
autocomplete({
minLength: 1,
input: searchInput[0],
emptyMsg: globals.translations.noResults,
debounceWaitMs: 500,
fetch: function(text, update) {
text = text.toLowerCase();
$.widget("custom.supersearch", $.ui.autocomplete, {
_create: function () {
this._super();
this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)");
},
_renderMenu: function (ul, items) {
if (items[0].value == undefined) {
$('#supersearch').removeClass('wait');
ul.html('');
} else {
var that = this,
currentCategory = "";
// Registrazione ricerca
searches.push(text);
searchButton
.removeClass('fa-search')
.addClass('fa-spinner fa-spin');
ul.addClass('ui-autocomplete-scrollable');
ul.css('z-index', '999');
$.each(items, function (index, item) {
if (item.category != currentCategory) {
ul.append("<li class='ui-autocomplete-category'>" + item.category + "</li>");
currentCategory = item.category;
}
that._renderItemData(ul, item);
});
}
},
_renderItem: function (ul, item) {
return $("<li>")
.append("<a href='" + item.link + "' title='Clicca per aprire'><b>" + item.value + "</b><br/>" + item.label + "</a>")
.appendTo(ul);
}
});
// Configurazione supersearch
var $super = $('#supersearch').supersearch({
minLength: 3,
select: function (event, ui) {
location.href = ui.item.link;
},
source: function (request, response) {
$.ajax({
url: globals.rootdir + '/ajax_search.php',
dataType: "json",
dataType: "JSON",
data: {
term: request.term
term: text,
},
complete: function (jqXHR) {
$('#supersearch').removeClass('wait');
},
success: function (data) {
if (data == null) {
response($.map(['a'], function (item) {
return false;
}));
} else {
response($.map(data, function (item) {
labels = (item.labels).toString();
labels = labels.replace('<br/>,', '<br/>');
// Fix per gestione risultati null
data = data ? data : [];
return {
label: labels,
category: item.category,
link: item.link,
value: item.title
}
}));
// Trasformazione risultati in formato leggibile
const results = data.map(function (result) {
return {
label: result.label ? result.label : '<h4>' + result.title + '</h4>' + result.labels
.join('').split('<br/>,').join('<br/>'),
group: result.category,
link: result.link,
value: result.title
}
});
// Rimozione ricerca in corso
searches.pop();
if (searches.length === 0) {
searchButton
.removeClass('fa-spinner fa-spin')
.addClass('fa-search');
}
update(results);
},
error: function (){
searchButton
.removeClass('fa-spinner fa-spin')
.addClass('fa-exclamation-triangle');
}
});
},
preventSubmit: true,
disableAutoSelect: true,
onSelect: function(item) {
window.location.href = item.link;
},
customize: function(input, inputRect, container, maxHeight) {
container.style.width = '600px';
},
render: function(item, currentValue){
const itemElement = document.createElement("div");
itemElement.innerHTML = item.label;
// <a href='" + item.link + "' title='Clicca per aprire'><b>" + item.value + "</b><br/>" + item.label + "</a>
return itemElement;
}
});
});

View File

@ -17,35 +17,36 @@
*/
$(document).ready(function () {
$("#widget-top, #widget-right").sortable({
const widgets = sortable("#widget-top, #widget-right", {
forcePlaceholderSize: true,
items: 'li',
cursor: 'move',
dropOnEmpty: true,
connectWith: '.widget',
acceptFrom: '.widget',
scroll: true,
helper: 'clone',
start: function (event, ui) {
// Salvo la lista da cui proviene il drag
src_list = ($(this).attr('id')).replace('widget-', '');
});
// Evidenzio le aree dei widget
$('.widget').addClass('bordered').sortable('refreshPositions');
},
stop: function (event, ui) {
for (const sorting of widgets) {
sorting.addEventListener("sortupdate", function (e) {
// Rimuovo l'evidenziazione dell'area widget
$('.widget').removeClass('bordered');
// Salvo la lista su cui ho eseguito il drop
dst_list = (ui.item.parent().attr('id')).replace('widget-', '');
const location = $(e.detail.destination.container).attr('id').replace('widget-', '');
var order = $(this).sortable('toArray').toString();
$.post(globals.rootdir + "/actions.php?id_module=" + globals.order_manager_id, {
op: 'sort_widgets',
location: dst_list,
ids: order,
let order = $(".widget li[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id_module: globals.order_manager_id,
id_module_widget: globals.id_module,
id_record: globals.id_record,
op: 'sort_widgets',
location: location,
order: order.join(','),
});
}
});
});
sorting.addEventListener("sortstart", function (e) {
// Evidenzio le aree dei widget
$('.widget').addClass('bordered');
});
}
});

View File

@ -0,0 +1,308 @@
/*
* 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/>.
*/
// Disabling autoDiscover, otherwise Dropzone will try to attach twice.
Dropzone.autoDiscover = false;
/**
* Restituisce filename ed estensione di un file indicato.
* @param path
* @returns [string, string]
*/
function getFilenameAndExtension(path) {
let filename_extension = path.replace(/^.*[\\\/]/, '');
let filename = filename_extension.substring(0, filename_extension.lastIndexOf('.'));
let ext = filename_extension.split('.').pop();
return [filename, ext];
}
/**
* Inizializza la gestione degli allegati.
* @param gestione
*/
function initGestioneAllegati(gestione) {
const dropzone_id = '#' + gestione.attr('id') + ' .dropzone';
const maxFilesize = gestione.data('max_filesize');
if ($(dropzone_id).length === 0) {
return;
}
let params = new URLSearchParams({
op: "aggiungi-allegato",
id_module: gestione.data('id_module'),
id_plugin: gestione.data('id_plugin'),
id_record: gestione.data('id_record'),
}).toString();
let dragdrop = new Dropzone(dropzone_id, {
dictDefaultMessage: globals.translations.allegati.messaggio + ".<br>(" + globals.translations.allegati.maxFilesize.replace('_SIZE_', maxFilesize) + ")",
paramName: "file",
maxFilesize: maxFilesize, // MB
uploadMultiple: false,
parallelUploads: 2,
addRemoveLinks: false,
autoProcessQueue: true,
autoQueue: true,
url: globals.rootdir + "/actions.php?" + params,
init: function (file, xhr, formData) {
this.on("success", function (file) {
dragdrop.removeFile(file);
});
this.on("complete", function (file) {
// Ricarico solo quando ho finito
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
ricaricaAllegati(gestione);
}
});
}
});
}
/**
* Funzione per l'apertura della schermata di modifica per una categoria di allegati.
* @param gestione
* @param pulsanteModifica
*/
function modificaCategoriaAllegati(gestione, pulsanteModifica) {
const categoria = $(pulsanteModifica).parent().parent();
console.log(categoria)
const nome = categoria.find(".box-title");
nome.addClass('hidden');
$(pulsanteModifica).addClass('hidden');
const pulsanteSalva = categoria.find(".category-save");
const pulsanteAnnulla = categoria.find(".category-cancel");
const inputNome = categoria.find(".category-name");
pulsanteSalva.removeClass("hidden");
pulsanteAnnulla.removeClass("hidden");
inputNome.removeClass("hidden");
}
/**
* Funzione per salvare le modifiche effettuate su una categoria di allegati.
* @param gestione
* @param pulsanteSalva
*/
function salvaCategoriaAllegati(gestione, pulsanteSalva) {
const categoria = $(pulsanteSalva).parent().parent();
const nome = categoria.find(".box-title");
const inputNome = categoria.find(".category-name");
mostraCaricamentoAllegati(gestione);
$.ajax({
url: globals.rootdir + "/actions.php",
cache: false,
type: "POST",
data: {
op: "modifica-categoria-allegato",
id_module: gestione.data('id_module'),
id_plugin: gestione.data('id_plugin'),
id_record: gestione.data('id_record'),
category: nome.text(),
name: inputNome.val(),
},
success: function (data) {
ricaricaAllegati(gestione);
},
error: function (gestione) {
ricaricaAllegati(gestione);
}
});
}
/**
* Funzione per caricare un nuovo allegato.
* @param gestione
*/
function aggiungiAllegato(gestione) {
const id = "#" + gestione.attr('id');
const form = $(id + " #upload-form");
form.ajaxSubmit({
url: globals.rootdir + "/actions.php",
data: data,
type: "post",
uploadProgress: function (event, position, total, percentComplete) {
$(id + " #upload").prop("disabled", true).html(percentComplete + "%").removeClass("btn-success").addClass("btn-info");
},
success: function (data) {
ricaricaAllegati(gestione);
},
error: function (data) {
alert(globals.translations.allegati.errore + ": " + data);
}
});
}
/**
* Funzione per mostrare il loader di caricamento per gli allegati.
* @param gestione
*/
function mostraCaricamentoAllegati(gestione) {
const id = "#" + gestione.attr('id');
localLoading($(id + " .panel-body"), true);
}
/**
* Funzione dedicata al caricamento dinamico degli allegati.
* @param gestione
*/
function ricaricaAllegati(gestione) {
const id = "#" + gestione.attr('id');
let params = new URLSearchParams({
op: "list_attachments",
id_module: gestione.data('id_module'),
id_plugin: gestione.data('id_plugin'),
id_record: gestione.data('id_record'),
}).toString();
$(id).load(globals.rootdir + "/ajax.php?" + params, function () {
localLoading($(id + " .panel-body"), false);
const nuovoAllegato = $(id + " table tr").eq(-1).attr("id");
if (nuovoAllegato !== undefined) {
$("#" + nuovoAllegato).effect("highlight", {}, 1500);
}
});
}
/**
* Funzione per l'apertura della pagina di gestione dei dati dell'allegato.
* @param button
*/
function modificaAllegato(button) {
const gestione = $(button).closest(".gestione-allegati");
const allegato = $(button).closest("tr").data();
let params = new URLSearchParams({
op: "visualizza-modifica-allegato",
id_module: gestione.data('id_module'),
id_plugin: gestione.data('id_plugin'),
id_record: gestione.data('id_record'),
id_allegato: allegato.id,
}).toString();
openModal(globals.translations.allegati.modifica, globals.rootdir + "/actions.php?" + params);
}
/**
* Funzione per gestire il download di un allegato.
* @param button
*/
function saggiungiAllegato(button) {
const gestione = $(button).closest(".gestione-allegati");
const allegato = $(button).closest("tr").data();
let params = new URLSearchParams({
op: "download-allegato",
id_module: gestione.data('id_module'),
id_plugin: gestione.data('id_plugin'),
id_record: gestione.data('id_record'),
id: allegato.id,
filename: allegato.filename,
}).toString();
window.open(globals.rootdir + "/actions.php?" + params, "_blank")
}
/**
* Funzione per l'apertura dell'anteprima di visualizzazione allegato.
* @param button
*/
function visualizzaAllegato(button) {
const allegato = $(button).closest("tr").data();
let params = new URLSearchParams({
file_id: allegato.id,
}).toString();
openModal(allegato.nome + ' <small style="color:white"><i>(' + allegato.filename + ')</i></small>', globals.rootdir + "/view.php?" + params);
}
/**
* Funzione per la gestione della rimozione di un allegato specifico.
*
* @param button
*/
function rimuoviAllegato(button) {
const gestione = $(button).closest(".gestione-allegati");
const allegato = $(button).closest("tr").data();
swal({
title: globals.translations.allegati.elimina,
type: "warning",
showCancelButton: true,
confirmButtonText: globals.translations.allegati.procedi,
}).then(function () {
mostraCaricamentoAllegati(gestione);
// Parametri della richiesta AJAX
let params = new URLSearchParams({
op: "rimuovi-allegato",
id_module: gestione.data('id_module'),
id_plugin: gestione.data('id_plugin'),
id_record: gestione.data('id_record'),
id_allegato: allegato.id,
filename: allegato.filename,
}).toString();
// Richiesta AJAX
$.ajax(globals.rootdir + "/actions.php?" + params)
.then(function () {
ricaricaAllegati(gestione);
});
}).catch(swal.noop);
}
function impostaCategorieAllegatiDisponibili(gestione, categorie) {
// Disabilitazione per rimozione input in aggiunta
return;
const id = "#" + gestione.attr('id');
const input = $("#modifica-allegato #categoria_allegato")[0];
autocomplete({
minLength: 0,
input: input,
emptyMsg: globals.translations.noResults,
fetch: function (text, update) {
text = text.toLowerCase();
const suggestions = categorie.filter(n => n.toLowerCase().startsWith(text));
// Trasformazione risultati in formato leggibile
const results = suggestions.map(function (result) {
return {
label: result,
value: result
}
});
update(results);
},
onSelect: function (item) {
input.value = item.label;
},
});
}

View File

@ -158,6 +158,7 @@ function salvaForm(form, data = {}, button = null) {
buttonRestore(button, restore);
reject();
return;
}
// Gestione grafica di salvataggio

View File

@ -52,7 +52,11 @@ function openModal(title, href) {
}
});
var content = '<div class="modal-dialog modal-lg">\
// Promise per la gestione degli eventi
const d = $.Deferred();
$(id).one('shown.bs.modal', d.resolve);
const content = '<div class="modal-dialog modal-lg">\
<div class="modal-content">\
<div class="modal-header bg-light-blue">\
<button type="button" class="close" data-dismiss="modal">\
@ -68,7 +72,7 @@ function openModal(title, href) {
// Lettura contenuto div
if (href.substr(0, 1) === '#') {
var data = $(href).html();
const data = $(href).html();
$(id).html(content.replace("|data|", data));
$(id).modal('show');
@ -80,6 +84,8 @@ function openModal(title, href) {
}
});
}
return d.promise();
}
/**

View File

@ -82,6 +82,8 @@ const JS = gulp.parallel(() => {
const vendor = [
'jquery/dist/jquery.js',
'autosize/dist/autosize.js',
'autocompleter/autocomplete.js',
'html5sortable/dist/html5sortable.js',
'bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js',
'moment/moment.js',
'components-jqueryui/jquery-ui.js',

View File

@ -30,7 +30,7 @@ $fields = $dbo->fetchArray('SELECT *, (SELECT GROUP_CONCAT(zz_groups.nome) FROM
foreach ($fields as $field) {
echo '
<div class="panel panel-default clickable col-md-4" data-id="'.$field['id'].'">
<div class="panel-body">
<div class="panel-body no-selection">
<input type="checkbox" name="visibile" '.($field['visible'] ? 'checked' : '').'>
<span class="text-'.($field['visible'] ? 'success' : 'danger').'">'.$field['name'].'<br><small>( '.$field['gruppi_con_accesso'].')</small></span>
@ -76,22 +76,19 @@ echo '
// Ordinamento dinamico delle colonne
$(document).ready(function() {
$(".sortable").disableSelection();
$(".sortable").each(function() {
$(this).sortable({
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
let order = $(".panel[data-id]").toArray().map(a => $(a).data("id"))
sortable(".sortable", {
axis: "y",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".panel[data-id]").toArray().map(a => $(a).data("id"))
console.log(order);
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: "'.$id_module.'",
op: "ordina_colonne",
order: order.join(","),
});
}
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
op: "ordina_colonne",
order: order.join(","),
});
});
});

View File

@ -56,12 +56,34 @@ $source = array_clean(array_column($categories, 'category'));
echo '
<script>
var categorie = '.json_encode($source).';
// Auto-completamento categoria
$("#modifica-allegato #categoria_allegato").autocomplete({
source: '.json_encode($source).',
minLength: 0
}).focus(function() {
$(this).autocomplete("search", $(this).val())
$(document).ready(function () {
const input = $("#modifica-allegato #categoria_allegato")[0];
autocomplete({
minLength: 0,
input: input,
emptyMsg: globals.translations.noResults,
fetch: function (text, update) {
text = text.toLowerCase();
const suggestions = categorie.filter(n => n.toLowerCase().startsWith(text));
// Trasformazione risultati in formato leggibile
const results = suggestions.map(function (result) {
return {
label: result,
value: result
}
});
update(results);
},
onSelect: function (item) {
input.value = item.label;
},
});
});
</script>
<script>$(document).ready(init)</script>';

View File

@ -108,19 +108,28 @@ if (Auth::check()) {
'details' => tr('Dettagli'),
'loading' => tr('Caricamento'),
'waiting' => tr('Impossibile procedere'),
'waiting_msg' => tr('Prima di proseguire devi selezionare alcuni elementi!'),
'waitingMessage' => tr('Prima di proseguire devi selezionare alcuni elementi!'),
'hooksExecuting' => tr('Hooks in esecuzione'),
'hookExecuting' => tr('Hook "_NAME_" in esecuzione'),
'hookMultiple' => tr('Hai _NUM_ notifiche'),
'hookSingle' => tr('Hai 1 notifica'),
'hookNone' => tr('Nessuna notifica'),
'singleCalendar' => tr("E' presente un solo periodo!"),
'noResults' => tr("Nessun elemento trovato"),
];
foreach ($translations as $key => $value) {
echo '
'.$key.': "'.addslashes($value).'",';
}
echo '
allegati: {
messaggio: "'.tr("Clicca o trascina qui per caricare uno o più file").'",
maxFilesize: "'.tr('Max upload: _SIZE_ MB').'",
errore: "'.tr('Errore').'",
modifica: "'.tr('Modifica allegato').'",
elimina: "'.tr('Vuoi eliminare questo file?').'",
procedi: "'.tr('Procedi').'",
},
ajax: {
"missing": {
"title": "'.tr('Errore').'",
@ -292,7 +301,7 @@ if (Auth::check()) {
hotkeys("f1,f2,f3,f4", function(event, handler) {
switch (handler.key) {
case "f1":
case "f1":
event.preventDefault();
$("button[data-toggle]").first().trigger("click");
break;
@ -453,7 +462,8 @@ if (Auth::check()) {
<div class="input-group">
<input type="text" name="q" class="form-control" id="supersearch" placeholder="'.tr('Cerca').'..."/>
<span class="input-group-btn">
<button class="btn btn-flat" id="search-btn" name="search" type="submit" ><i class="fa fa-search"></i>
<button class="btn btn-flat" id="search-btn" name="search" type="submit">
<i class="fa fa-search"></i>
</button>
</span>

View File

@ -158,58 +158,58 @@ echo '
echo '
<script>
var emails = [];
var id_anagrafica = "'.$id_anagrafica.'";
var pec = "'.$smtp['pec']. '";
$(document).ready(function() {';
$(document).ready(function() {
// Auto-completamento destinatario
if (id_anagrafica) {
$(document).load(globals.rootdir + "/ajax_complete.php?module=Anagrafiche&op=get_email&id_anagrafica=" + id_anagrafica + (pec ? "&type=pec" : ""), function(response) {
emails = JSON.parse(response);
// Autocompletamento destinatario
if (!empty($id_anagrafica)) {
echo '
$(document).load(globals.rootdir + "/ajax_complete.php?module=Anagrafiche&op=get_email&id_anagrafica='.$id_anagrafica.(($smtp['pec']) ? '&type=pec' : '').'", function(response) {
emails = JSON.parse(response);
$(".destinatari").each(function(){
addAutoComplete(this);
});
$(".destinatari").each(function(){
addAutoComplete(this);
aggiungiDestinatario();
});
aggiungiDestinatario();
});';
}
echo '
});
function inviaEmail() {
if($("#email-form").parsley().validate() && confirm("Inviare e-mail?")) {
$("#email-form").submit();
const form = $("#email-form");
if (form.parsley().validate() && confirm("Inviare e-mail?")) {
form.submit();
}
}
function addAutoComplete(input){
$(input).autocomplete({
source: emails,
function addAutoComplete(input) {
autocomplete({
minLength: 0,
close: function() {
input: input,
emptyMsg: globals.translations.noResults,
fetch: function (text, update) {
text = text.toLowerCase();
const suggestions = emails.filter(n => n.value.toLowerCase().startsWith(text));
update(suggestions);
},
onSelect: function (item) {
input.value = item.value;
aggiungiDestinatario();
},
}).focus(function() {
$(this).autocomplete("search", $(this).val());
});
}
function aggiungiDestinatario() {
var last = $("#lista-destinatari input").last();
const last = $("#lista-destinatari input").last();
if (last.val()) {
cleanup_inputs();
const nuovaRiga = aggiungiContenuto("#lista-destinatari", "#template-destinatario", {"-id-": $("#lista-destinatari > div").length});
aggiungiContenuto("#lista-destinatari", "#template-destinatario", {"-id-": $("#lista-destinatari > div").length});
$(".destinatari").each(function(){
nuovaRiga.find(".destinatari").each(function(){
addAutoComplete(this);
});
restart_inputs();
}
}
</script>';

View File

@ -25,6 +25,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Contratti\Contratto;
use Modules\DDT\DDT;
use Modules\Fatture\Fattura;
use Modules\Interventi\Intervento;
use Modules\Ordini\Ordine;
use Modules\Preventivi\Preventivo;
use Modules\TipiIntervento\Tipo as TipoSessione;
@ -327,6 +328,11 @@ class Anagrafica extends Model
return $this->hasMany(Dichiarazione::class, 'id_anagrafica');
}
public function interventi()
{
return $this->hasMany(Intervento::class, 'idanagrafica');
}
// Metodi statici
/**

View File

@ -299,25 +299,21 @@ function rimuoviRiga(button) {
}
$(document).ready(function() {
$(".sortable").each(function() {
$(this).sortable({
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
sortable(".sortable", {
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: '.$id_module.',
id_record: '.$id_record.',
op: "update_position",
order: order.join(","),
});
}
});
});
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_record: globals.id_record,
op: "update_position",
order: order.join(","),
});
});
});
</script>';

View File

@ -126,7 +126,7 @@ switch (filter('op')) {
(
(co_preventivi.data_accettazione >= '.prepare($start).' AND co_preventivi.data_accettazione <= '.prepare($end).')
OR (co_preventivi.data_conclusione >= '.prepare($start).' AND co_preventivi.data_conclusione <= '.prepare($end).')
)
)
AND
co_statipreventivi.is_pianificabile=1';

View File

@ -335,7 +335,7 @@ $modulo_interventi = Modules::get('Interventi');
echo '
<script type="text/javascript">
globals.dashboard = {
load_url: globals.rootdir + "/actions.php?id_module='.$id_module.'",
load_url: "'.$structure->fileurl('ajax.php').'?id_module='.$id_module.'",
style: "'.$def.'",
show_sunday: '.intval(setting('Visualizzare la domenica sul calendario')).',
start_time: "'.setting('Ora inizio sul calendario').'",
@ -559,7 +559,7 @@ echo '
select: function(start, end, allDay) { // info
// let start = info.start;
// let end = info.end;
let is_allDay = !start.hasTime() && !end.hasTime();
if (is_allDay!==true){
@ -580,7 +580,7 @@ echo '
editable: globals.dashboard.write_permission,
eventDrop: function(event, delta, revertFunc ) {// info
// let event = info.event;
if (event.allDay!==true){
$.post(globals.dashboard.load_url, {
op: "modifica_intervento",
@ -599,7 +599,7 @@ echo '
if (data !=="ok"){
revertFunc(); // info.revert();
}
}
});
}else{
@ -617,7 +617,7 @@ echo '
timeEnd: moment(event.end).format("YYYY-MM-DD HH:mm")
}, function (data, response) {
data = $.trim(data);
if (response == "success" && data !== "ok") {
swal("'.tr('Attenzione').'", data, "warning");
}else if (response !== "success"){

View File

@ -373,25 +373,21 @@ function apriRiferimenti(button) {
}
$(document).ready(function() {
$(".sortable").each(function() {
$(this).sortable({
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
sortable(".sortable", {
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: '.$id_module.',
id_record: '.$id_record.',
op: "update_position",
order: order.join(","),
});
}
});
});
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_record: globals.id_record,
op: "update_position",
order: order.join(","),
});
});
});
</script>';

View File

@ -474,25 +474,21 @@ function apriInformazioniFE(button) {
}
$(document).ready(function() {
$(".sortable").each(function() {
$(this).sortable({
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
sortable(".sortable", {
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: '.$id_module.',
id_record: '.$id_record.',
op: "update_position",
order: order.join(","),
});
}
});
});
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_record: globals.id_record,
op: "update_position",
order: order.join(","),
});
});
});
</script>';

View File

@ -402,25 +402,21 @@ function apriRiferimenti(button) {
}
$(document).ready(function() {
$(".sortable").each(function() {
$(this).sortable({
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
sortable(".sortable", {
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: '.$id_module.',
id_record: '.$id_record.',
op: "update_position",
order: order.join(","),
});
}
});
});
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_record: globals.id_record,
op: "update_position",
order: order.join(","),
});
});
});
</script>';

View File

@ -49,8 +49,8 @@ foreach ($rs as $r) {
$result['link'] = base_path().'/editor.php?id_module='.$link_id.'&id_record='.$r['id'];
$result['title'] = 'Preventivo '.$r['numero'];
if ($rs[$r]['data_accettazione'] == '0000-00-00') {
$result['title'] .= ' del '.Translator::dateToLocale($rs[$r]['data_accettazione']);
if ($r['data_accettazione'] == '0000-00-00') {
$result['title'] .= ' del '.Translator::dateToLocale($r['data_accettazione']);
}
$result['category'] = 'Preventivi';

View File

@ -366,25 +366,21 @@ function rimuoviRiga(button) {
}
$(document).ready(function() {
$(".sortable").each(function() {
$(this).sortable({
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
let order = $(".table .sortable tr[data-id]").toArray().map(a => $(a).data("id"))
sortable(".sortable", {
axis: "y",
handle: ".handle",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".table tr[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: '.$id_module.',
id_record: '.$id_record.',
op: "update_position",
order: order.join(","),
});
}
});
});
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_record: globals.id_record,
op: "update_position",
order: order.join(","),
});
});
});
</script>';

View File

@ -121,38 +121,21 @@ switch (filter('op')) {
// Ordinamento moduli di primo livello
case 'sort_modules':
$rs = $dbo->fetchArray('SELECT id FROM zz_modules WHERE enabled = 1 AND parent IS NULL ORDER BY `order` ASC');
$order = explode(',', post('order', true));
if ($_POST['ids'] != implode(',', array_column($rs, 'id'))) {
$ids = explode(',', $_POST['ids']);
for ($i = 0; $i < count($ids); ++$i) {
$dbo->query('UPDATE zz_modules SET `order`='.prepare($i).' WHERE id='.prepare($ids[$i]));
}
flash()->info(tr('Posizione delle voci di menù aggiornata!'));
foreach ($order as $i => $id) {
$dbo->query('UPDATE zz_modules SET `order`='.prepare($i).' WHERE id='.prepare($id));
}
break;
case 'sort_widgets':
$location = post('location');
$id_module_widget = post('id_module_widget');
$order = explode(',', post('order', true));
$location = empty($id_record) ? 'controller_'.$location : 'editor_'.$location;
$rs = $dbo->fetchArray("SELECT CONCAT('widget_', id) AS id FROM zz_widgets WHERE enabled = 1 AND location = ".prepare($location).' AND id_module = '.prepare($id_module_widget).' ORDER BY `order` ASC');
if ($_POST['ids'] != implode(',', array_column($rs, 'id'))) {
$ids = explode(',', $_POST['ids']);
for ($i = 0; $i < count($ids); ++$i) {
$id = explode('_', $ids[$i]);
$dbo->query('UPDATE zz_widgets SET `order`='.prepare($i).' WHERE id='.prepare($id[1]));
}
flash()->info(tr('Posizioni widgets aggiornate!'));
foreach ($order as $i => $id) {
$dbo->query('UPDATE zz_widgets SET `order`='.prepare($i).' WHERE id='.prepare($id));
}
break;
case 'sizes':

View File

@ -144,7 +144,7 @@ echo '
foreach ($fields as $field) {
echo '
<p class="clickable" data-id="'.$field['id'].'">
<p class="clickable no-selection" data-id="'.$field['id'].'">
<i class="fa fa-sort"></i>
';
@ -243,30 +243,19 @@ echo '
$(document).ready(function() {
$("#save-buttons").hide();
$(".sortable").disableSelection();
$(".sortable").each(function() {
$(this).sortable({
axis: "y",
cursor: "move",
dropOnEmpty: true,
scroll: true,
update: function(event, ui) {
sortable(".sortable", {
axis: "y",
cursor: "move",
dropOnEmpty: true,
scroll: true,
})[0].addEventListener("sortupdate", function(e) {
let order = $(".sortable p[data-id]").toArray().map(a => $(a).data("id"))
var order = "";
$("div.panel-body.sortable p[data-id]").each( function() {
order += ","+$(this).data("id");
});
order = order.replace(/^,/, "");
$.post(globals.rootdir + "/actions.php", {
id: ui.item.data("id"),
id_module: '.$id_module.',
id_record: '.$id_record.',
op: "update_position",
order: order,
});
}
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_record: globals.id_record,
op: "update_position",
order: order.join(","),
});
});
});

View File

@ -3,6 +3,7 @@
"main": "gulpfile.js",
"dependencies": {
"admin-lte": "^2.4.0",
"autocompleter": "^6.1.1",
"autonumeric": "^4.6.0",
"autosize": "^3.0.21",
"bootstrap": "^3.3.7",
@ -22,6 +23,7 @@
"fullcalendar": "^3.4.0",
"geocomplete": "^1.7.0",
"hotkeys-js": "^3.8.5",
"html5sortable": "^0.13.2",
"inputmask": "^3.3.9",
"jquery": "^3.5.1",
"jquery-form": "^4.2.1",

View File

@ -84,29 +84,25 @@ $(document).ready(function() {
id_record: "'.$id_record.'",
}, "'.$checks_id.'");
$(".checklist").sortable({
sortable(".checklist", {
placeholder: "sort-highlight",
handle: ".handle",
forcePlaceholderSize: true,
zIndex: 999999,
update: function(event, ui) {
var order = [];
$(".checklist > li").each( function(){
order.push($(this).data("id"));
});
})[0].addEventListener("sortupdate", function(e) {
let order = $(".checklist > li[data-id]").toArray().map(a => $(a).data("id"))
$.post(globals.rootdir + "/actions.php", {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
id_record: "'.$id_record.'",
$.post(globals.rootdir + "/actions.php", {
id_module: globals.id_module,
id_plugin: "'.$id_plugin.'",
id_record: globals.id_record,
op: "ordina-checks",
order: order.join(","),
});
}
order: order.join(","),
});
});
$(".checklist").todoList({
onCheck : function () {
onCheck: function () {
var id = $(this).parent().data("id");
checklists["'.$checks_id.'"].toggleCheck(id);

View File

@ -27,13 +27,13 @@ $id_articolo = $id_record;
echo '
<div class="nav-tabs-custom">
<ul class="nav-tabs-li nav nav-tabs nav-justified">
<li class="active"><a href="#tab_'.$id_plugin.'" onclick="apriTab(this)" data-tab="clienti" id="clienti-tab">'.tr('Clienti').'</a></li>
<li><a href="#tab_'.$id_plugin.'" onclick="apriTab(this)" data-tab="fornitori">'.tr('Fornitori').'</a></li>
<li class="active"><a href="#tab_'.$id_plugin.'" onclick="apriTab(this)" data-tab="fornitori" id="fornitori-tab">'.tr('Fornitori').'</a></li>
<li><a href="#tab_'.$id_plugin.'" onclick="apriTab(this)" data-tab="clienti" id="clienti-tab">'.tr('Clienti').'</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="clienti">
<div class="tab-pane" id="clienti">
<div class="box">
<div class="box-header">
<h3 class="box-title">'.tr('Informazioni specifiche per cliente').'</h3>
@ -140,7 +140,7 @@ if (!$clienti->isEmpty()) {
echo '
</div>
<div class="tab-pane" id="fornitori">
<div class="tab-pane active" id="fornitori">
<div class="box">
<div class="box-header">
<h3 class="box-title">'.tr('Informazioni specifiche per fornitore').'</h3>
@ -330,7 +330,7 @@ echo '
<script>
$(document).ready(function (){
apriTab($("#clienti-tab")[0]);
apriTab($("#fornitori-tab")[0]);
});
function modificaPrezzi(button) {

View File

@ -86,7 +86,7 @@ class Task extends Resource implements RetrieveInterface, CreateInterface
$endpointParts = parse_url($endpoint);
$endpointParts['path'] = $endpointParts['path'] ?: '/';
$endpointParts['port'] = $endpointParts['port'] ?: $endpointParts['scheme'] === 'https' ? 443 : 80;
$endpointParts['port'] = $endpointParts['port'] ?: ($endpointParts['scheme'] === 'https' ? 443 : 80);
$contentLength = strlen($postData);

View File

@ -178,6 +178,7 @@ class Response
$messages = array_column(self::$status, 'message');
$array['message'] = $messages[array_search($array['status'], $codes)];
http_response_code($array['status']);
}
$flags = JSON_FORCE_OBJECT;

View File

@ -21,6 +21,7 @@ namespace HTMLBuilder\Manager;
use Models\Setting;
use Models\Upload;
use Util\FileSystem;
/**
* Gestione allegati.
@ -47,11 +48,14 @@ class FileManager implements ManagerInterface
// ID del form
$attachment_id = 'attachments_'.$options['id_module'].'_'.$options['id_plugin'];
$upload_max_filesize = ini_get('upload_max_filesize');
$upload_max_filesize = substr($upload_max_filesize, 0, -1);
$dbo = database();
// Codice HTML
$result = '
<div id="'.$attachment_id.'" >';
<div class="gestione-allegati" id="'.$attachment_id.'" data-id_module="'.$options['id_module'].'" data-id_plugin="'.$options['id_plugin'].'" data-id_record="'.$options['id_record'].'" data-max_filesize="'.$upload_max_filesize.'">';
if (!empty($options['showpanel'])) {
$result .= '
@ -79,16 +83,20 @@ class FileManager implements ManagerInterface
<div class="box-header with-border">
<h3 class="box-title">'.(!empty($category) ? $category : tr('Generale')).'</h3>
{[ "type": "text", "class": "hide category-name", "value": "'.$category.'" ]}
{[ "type": "text", "class": "hidden category-name", "value": "'.$category.'" ]}
<div class="box-tools pull-right">';
if (!empty($category) && !in_array($category, ['Fattura Elettronica'])) {
$result .= '
<button type="button" class="btn btn-box-tool category-save hide">
<button type="button" class="btn btn-box-tool category-save hidden">
<i class="fa fa-check"></i>
</button>
<button type="button" class="btn btn-box-tool category-cancel hidden">
<i class="fa fa-close"></i>
</button>
<button type="button" class="btn btn-box-tool category-edit">
<i class="fa fa-edit"></i>
</button>';
@ -115,7 +123,7 @@ class FileManager implements ManagerInterface
$file = Upload::find($r['id']);
$result .= '
<tr id="row_'.$r['id'].'" >
<tr id="row_'.$r['id'].'" data-id="'.$r['id'].'" data-filename="'.$r['filename'].'">
<td align="left">';
if ($file->user && $file->user->photo) {
@ -133,38 +141,38 @@ class FileManager implements ManagerInterface
<i class="fa fa-external-link"></i> '.$r['name'].'
</a>
<small> ('.$file->extension.')'.((!empty($file->size)) ? ' ('.\Util\FileSystem::formatBytes($file->size).')' : '').' '.(((setting('Logo stampe') == $r['filename']) || (setting('Filigrana stampe') == $r['filename'])) ? '<i class="fa fa-file-text-o"></i>' : '').'</small>'.'
<small> ('.$file->extension.')'.((!empty($file->size)) ? ' ('. FileSystem::formatBytes($file->size).')' : '').' '.(((setting('Logo stampe') == $r['filename']) || (setting('Filigrana stampe') == $r['filename'])) ? '<i class="fa fa-file-text-o"></i>' : '').'</small>'.'
</td>
<td>'.\Translator::timestampToLocale($r['created_at']).'</td>
<td>'.timestampFormat($r['created_at']).'</td>
<td class="text-center">
<a class="btn btn-xs btn-primary" href="'.base_path().'/actions.php?id_module='.$options['id_module'].'&op=download-allegato&id='.$r['id'].'&filename='.$r['filename'].'" target="_blank">
<button type="button" class="btn btn-xs btn-primary" onclick="saggiungiAllegato(this)">
<i class="fa fa-download"></i>
</a>';
</button>';
// Anteprime supportate dal browser
if ($file->hasPreview()) {
$result .= '
<button class="btn btn-xs btn-info" type="button" data-title="'.prepareToField($r['name']).' <small style=\'color:white\'><i>('.$r['filename'].')</i></small>" data-href="'.base_path().'/view.php?file_id='.$r['id'].'">
<button type="button" class="btn btn-xs btn-info" onclick="visualizzaAllegato(this)">
<i class="fa fa-eye"></i>
</button>';
} else {
$result .= '
<button class="btn btn-xs btn-default disabled" title="'.tr('Anteprima file non disponibile').'" disabled>
<button type="button" class="btn btn-xs btn-default disabled" title="'.tr('Anteprima file non disponibile').'" disabled>
<i class="fa fa-eye"></i>
</button>';
}
if (!$options['readonly']) {
$result .= '
<button type="button" class="btn btn-xs btn-warning" data-href="'.base_path().'/actions.php?op=visualizza-modifica-allegato&id_module='.$options['id_module'].'&id_allegato='.$r['id'].'" data-title="'.tr('Modifica allegato').'">
<button type="button" class="btn btn-xs btn-warning" onclick="modificaAllegato(this)">
<i class="fa fa-edit"></i>
</button>
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="rimuovi-allegato" data-filename="'.$r['filename'].'" data-id_record="'.$r['id_record'].'" data-id_plugin="'.$options['id_plugin'].'" data-before="show_'.$attachment_id.'" data-callback="reload_'.$attachment_id.'">
<button type="button" class="btn btn-xs btn-danger" onclick="rimuoviAllegato(this)">
<i class="fa fa-trash"></i>
</a>';
</button>';
}
$result .= '
@ -214,147 +222,42 @@ class FileManager implements ManagerInterface
$source = array_clean(array_column($categories, 'category'));
$upload_max_filesize = ini_get('upload_max_filesize');
$upload_max_filesize = substr($upload_max_filesize, 0, -1);
$result .= '
<script>$(document).ready(init)</script>
<script>
// Disabling autoDiscover, otherwise Dropzone will try to attach twice.
Dropzone.autoDiscover = false;
$(document).ready(function() {
let dropzone_id = "#'.$attachment_id.' .dropzone";
if ($(dropzone_id).length == 0) {
return;
}
const container = $("#'.$attachment_id.'");
let dragdrop = new Dropzone(dropzone_id, {
dictDefaultMessage: "'.tr('Clicca o trascina qui per caricare uno o più file').'.<br>('.tr('Max upload: _SIZE_', [
'_SIZE_' => $upload_max_filesize.' MB',
]).')",
paramName: "file",
maxFilesize: '.$upload_max_filesize.', // MB
uploadMultiple: false,
parallelUploads: 2,
addRemoveLinks: false,
autoProcessQueue: true,
autoQueue: true,
url: "'.base_path().'/actions.php?op=aggiungi-allegato&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'",
init: function (file, xhr, formData) {
this.on("success", function (file) {
dragdrop.removeFile(file);
});
this.on("complete", function (file) {
// Ricarico solo quando ho finito
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
reload_'.$attachment_id.'();
}
});
}
});
// Modifica categoria
$("#'.$attachment_id.' .category-edit").click(function() {
var nome = $(this).parent().parent().find(".box-title");
var save_button = $(this).parent().find(".category-save");
var input = $(this).parent().parent().find(".category-name");
nome.hide();
$(this).hide();
input.removeClass("hide");
save_button.removeClass("hide");
});
$("#'.$attachment_id.' .category-save").click(function() {
var nome = $(this).parent().parent().find(".box-title");
var input = $(this).parent().parent().find(".category-name");
show_'.$attachment_id.'();
$.ajax({
url: globals.rootdir + "/actions.php",
cache: false,
type: "POST",
data: {
id_module: "'.$options['id_module'].'",
id_plugin: "'.$options['id_plugin'].'",
id_record: "'.$options['id_record'].'",
op: "modifica-categoria-allegato",
category: nome.text(),
name: input.val(),
},
success: function(data) {
reload_'.$attachment_id.'();
},
error: function(data) {
reload_'.$attachment_id.'();
}
});
});
function getFilenameAndExtension(path) {
let filename_extension = path.replace(/^.*[\\\/]/, \'\');
let filename = filename_extension.substring(0, filename_extension.lastIndexOf(\'.\'));
let ext = filename_extension.split(\'.\').pop();
return [filename, ext];
}
// Auto-completamento categoria
$("#'.$attachment_id.' #categoria_allegato").autocomplete({
source: '.json_encode($source).',
minLength: 0
}).focus(function() {
$(this).autocomplete("search", $(this).val())
});
var data = {
op: "aggiungi-allegato",
id_module: "'.$options['id_module'].'",
id_plugin: "'.$options['id_plugin'].'",
id_record: "'.$options['id_record'].'",
};
// Upload
$("#'.$attachment_id.' #upload").click(function(){
$form = $("#'.$attachment_id.' #upload-form");
$form.ajaxSubmit({
url: globals.rootdir + "/actions.php",
data: data,
type: "post",
uploadProgress: function(event, position, total, percentComplete) {
$("#'.$attachment_id.' #upload").prop("disabled", true).html(percentComplete + "%").removeClass("btn-success").addClass("btn-info");
},
success: function(data){
reload_'.$attachment_id.'();
},
error: function(data) {
alert("'.tr('Errore').': " + data);
}
});
});
initGestioneAllegati(container);
impostaCategorieAllegatiDisponibili(container, '.json_encode($source).');
});
function show_'.$attachment_id.'() {
localLoading($("#'.$attachment_id.' .panel-body"), true);
}
// Modifica categoria
$("#'.$attachment_id.' .category-edit").click(function() {
const container = $(this).closest(".gestione-allegati");
function reload_'.$attachment_id.'() {
$("#'.$attachment_id.'").load(globals.rootdir + "/ajax.php?op=list_attachments&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'", function() {
localLoading($("#'.$attachment_id.' .panel-body"), false);
modificaCategoriaAllegati(container, this);
});
var id = $("#'.$attachment_id.' table tr").eq(-1).attr("id");
if (id !== undefined) {
$("#" + id).effect("highlight", {}, 1500);
}
});
}
$("#'.$attachment_id.' .category-save").click(function() {
const container = $(this).closest(".gestione-allegati");
salvaCategoriaAllegati(container, this);
});
$("#'.$attachment_id.' .category-cancel").click(function() {
const container = $(this).closest(".gestione-allegati");
ricaricaAllegati(gestione);
});
// Upload
$("#'.$attachment_id.' #upload").click(function(){
const container = $(this).closest(".gestione-allegati");
aggiungiAllegato(container);
});
</script>';
return $result;

View File

@ -258,7 +258,7 @@ class WidgetManager implements ManagerInterface
// Aggiungo ad uno ad uno tutti i widget
foreach ($widgets as $widget) {
$result .= '
<li class="col-sm-6 col-md-4 col-lg-'.intval(12 / $row_max).' li-widget" id="widget_'.$widget['id'].'">';
<li class="col-sm-6 col-md-4 col-lg-'.intval(12 / $row_max).' li-widget" id="widget_'.$widget['id'].'" data-id="'.$widget['id'].'">';
$info = array_merge($options, [
'id' => $widget['id'],

View File

@ -357,7 +357,7 @@ class Modules
if ($active) {
$result .= ' active actual';
}
$result .= '" id="'.$element['id'].'">
$result .= '" id="'.$element['id'].'" data-id="'.$element['id'].'">
<a href="'.$link.'" target="'.$target.'" >
<i class="'.$element['icon'].'"></i>
<span>'.$title.'</span>';

View File

@ -140,4 +140,5 @@ INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `e
ALTER TABLE `dt_ddt` ADD `id_ddt_trasporto_interno` INT(11) NULL, ADD FOREIGN KEY (`id_ddt_trasporto_interno`) REFERENCES `dt_ddt`(`id`) ON DELETE CASCADE;
-- Aggiunto ragruppamento referenti per sede
UPDATE `zz_plugins` SET `options` = ' { \"main_query\": [ { \"type\": \"table\", \"fields\": \"Nome, Indirizzo, Città, CAP, Provincia, Referente\", \"query\": \"SELECT an_sedi.id, an_sedi.nomesede AS Nome, an_sedi.indirizzo AS Indirizzo, an_sedi.citta AS Città, an_sedi.cap AS CAP, an_sedi.provincia AS Provincia, GROUP_CONCAT(an_referenti.nome SEPARATOR \\\", \\\") AS Referente FROM an_sedi LEFT OUTER JOIN an_referenti ON idsede = an_sedi.id WHERE 1=1 AND an_sedi.idanagrafica=|id_parent| GROUP BY an_sedi.id HAVING 2=2 ORDER BY an_sedi.id DESC\"} ]}' WHERE `zz_plugins`.`name` = 'Sedi';
UPDATE `zz_plugins` SET `options` = ' { \"main_query\": [ { \"type\": \"table\", \"fields\": \"Nome, Indirizzo, Città, CAP, Provincia, Referente\", \"query\": \"SELECT an_sedi.id, an_sedi.nomesede AS Nome, an_sedi.indirizzo AS Indirizzo, an_sedi.citta AS Città, an_sedi.cap AS CAP, an_sedi.provincia AS Provincia, GROUP_CONCAT(an_referenti.nome SEPARATOR \\\", \\\") AS Referente FROM an_sedi LEFT OUTER JOIN an_referenti ON idsede = an_sedi.id WHERE 1=1 AND an_sedi.idanagrafica=|id_parent| GROUP BY an_sedi.id HAVING 2=2 ORDER BY an_sedi.id DESC\"} ]}' WHERE `zz_plugins`.`name` = 'Sedi';
UPDATE `zz_group_module` SET `clause` = 'in_interventi.id IN (SELECT idintervento FROM in_interventi_tecnici WHERE idintervento=in_interventi.id AND idtecnico=|id_anagrafica| UNION SELECT id_intervento FROM in_interventi_tecnici_assegnati WHERE id_intervento=in_interventi.id AND id_tecnico=|id_anagrafica|)' WHERE `zz_group_module`.`name` = 'Mostra interventi ai tecnici coinvolti';