1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-11 07:05:22 +01:00

Ottimizzazione dimensione widget

This commit is contained in:
loviuz 2023-03-09 19:40:50 +01:00
parent ecd2c1fc08
commit e69a5b3d7f
4 changed files with 33 additions and 36 deletions

View File

@ -56,33 +56,35 @@ function startHooks() {
* @param hook
*/
function startHook(hook, init) {
$.ajax({
url: globals.rootdir + "/ajax.php",
type: "get",
data: {
op: "hook-lock",
id: hook.id,
},
success: function (data) {
var token = JSON.parse(data);
if (document.hasFocus()) {
$.ajax({
url: globals.rootdir + "/ajax.php",
type: "get",
data: {
op: "hook-lock",
id: hook.id,
},
success: function (data) {
var token = JSON.parse(data);
if (init) {
hookCount("#hooks-counter");
if (init) {
hookCount("#hooks-counter");
updateHook(hook);
}
updateHook(hook);
}
if (token) {
executeHook(hook, token);
} else {
var timeout = 10;
if (token) {
executeHook(hook, token);
} else {
var timeout = 10;
setTimeout(function () {
startHook(hook);
}, timeout * 1000);
}
},
});
setTimeout(function () {
startHook(hook);
}, timeout * 1000);
}
},
});
}
}
/**

View File

@ -58,7 +58,7 @@ foreach ($gruppi as $modulo => $widgets) {
<i class="tip fa fa-question-circle-o" title="'.$widget['help'].'"</i>' : '').'
</td>
<td>
{[ "type": "select", "name": "dimensione[]", "class": "widgets", "value": "'.$widget['class'].'", "values": "list=\"0\": \"'.tr('Da impostazioni').'\", \"3\": \"'.tr('Piccolo').'\", \"4\": \"'.tr('Medio').'\", \"6\": \"'.tr('Grande').'\", \"12\": \"'.tr('Molto grande').'\"", "extra": "data-id=\"'.$widget['id'].'\"" ]}
{[ "type": "select", "name": "dimensione[]", "class": "widgets", "value": "'.$widget['class'].'", "values": "list=\"0\": \"'.tr('Da impostazioni').'\", \"col-md-3\": \"'.tr('Piccolo').'\", \"col-md-4\": \"'.tr('Medio').'\", \"col-md-6\": \"'.tr('Grande').'\", \"col-md-12\": \"'.tr('Molto grande').'\"", "extra": "data-id=\"'.$widget['id'].'\"" ]}
</td>
<td><small>'.(
string_starts_with($widget['location'], 'controller') ?

View File

@ -245,25 +245,17 @@ class WidgetManager implements ManagerInterface
// Generazione del codice HTML
if (!empty($widgets)) {
foreach ($widgets as $widget) {
$row_max = empty($widget['class'])? setting('Numero massimo Widget per riga') : $widget['class'];
}
$result = '
<ul class="row widget" id="widget-'.$options['position'].'" data-class="">';
// Aggiungo ad uno ad uno tutti i widget
foreach ($widgets as $widget) {
if ($widgets[0]['id_module'] == $database->fetchOne('SELECT id FROM zz_modules WHERE title = "Stato dei servizi"')['id']) {
if ($widget['id_module'] == $database->fetchOne('SELECT id FROM zz_modules WHERE title = "Stato dei servizi"')['id']) {
$result .= '
<li class="col-sm-6 col-md-4 col-lg-'.$widget['class'].' li-widget" id="widget_'.$widget['id'].'" style="height:100% !important;" data-id="'.$widget['id'].'">';
} else if (empty($widget['class'])) {
$result .= '
<li class="col-sm-6 col-md-4 col-lg-'.intval(12 / $row_max).' li-widget" id="widget_'.$widget['id'].'" data-id="'.$widget['id'].'">';
<li class="col-sm-6 col-md-4 li-widget" id="widget_'.$widget['id'].'" style="height:100% !important;" data-id="'.$widget['id'].'">';
} else {
$result .= '
<li class= "col-sm-6 col-md-4 col-lg-'.$widget['class'].' li-widget" id="widget_'.$widget['id'].'" data-id="'.$widget['id'].'">';
<li class= "col-sm-6 '.($widget['class']?: setting('Dimensione widget predefinita')).' li-widget" id="widget_'.$widget['id'].'" data-id="'.$widget['id'].'">';
}
$info = array_merge($options, [
'id' => $widget['id'],

View File

@ -19,4 +19,7 @@ HAVING
2=2
ORDER BY
`data` DESC,
CAST(`numero_esterno` AS UNSIGNED) DESC" WHERE `name` = 'Ordini fornitore';
CAST(`numero_esterno` AS UNSIGNED) DESC" WHERE `name` = 'Ordini fornitore';
-- Correzione dimensione widget
UPDATE `zz_settings` SET `valore` = 'col-md-6', `tipo` = 'list[col-md-1,col-md-2,col-md-3,col-md-4,col-md-6]', `nome` = 'Dimensione widget predefinita' WHERE `nome` = 'Numero massimo Widget per riga';