mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 23:07:46 +01:00
Correzioni JS per inizializzazione select automatica
Rimozione debugbar e correzione su formattazione numerica per compatibilità con PHP8.
This commit is contained in:
parent
f3d16f46c1
commit
d1c18fecad
@ -1041,7 +1041,7 @@ div.tip {
|
|||||||
background: #222222;
|
background: #222222;
|
||||||
}
|
}
|
||||||
|
|
||||||
.decimal-number {
|
.number-input {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ function initDateInput(input) {
|
|||||||
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
|
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
|
||||||
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
|
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initTimestampInput(input) {
|
function initTimestampInput(input) {
|
||||||
@ -72,7 +74,9 @@ function initTimestampInput(input) {
|
|||||||
|
|
||||||
$this.on("dp.hide", function (e) {
|
$this.on("dp.hide", function (e) {
|
||||||
$('#tecnici > div').addClass('table-responsive');
|
$('#tecnici > div').addClass('table-responsive');
|
||||||
})
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initTimeInput(input) {
|
function initTimeInput(input) {
|
||||||
@ -88,6 +92,8 @@ function initTimeInput(input) {
|
|||||||
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
|
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
|
||||||
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
|
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +42,13 @@ function input(name) {
|
|||||||
if (!element.data("input-controller")) {
|
if (!element.data("input-controller")) {
|
||||||
return new Input(element);
|
return new Input(element);
|
||||||
} else {
|
} else {
|
||||||
return element.data("input-controller");
|
const controller = element.data("input-controller");
|
||||||
|
|
||||||
|
if (!element.data("input-init")) {
|
||||||
|
controller.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
return controller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,49 +60,53 @@ function input(name) {
|
|||||||
function Input(element) {
|
function Input(element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
|
|
||||||
// Controllo sulla gestione precedente
|
|
||||||
if (this.element.data("input-controller")) {
|
|
||||||
return this.element.data("input-controller");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.element.data("input-controller", this);
|
this.element.data("input-controller", this);
|
||||||
this.element.data("required", this.element.attr("required"));
|
this.element.data("required", this.element.attr("required"));
|
||||||
|
|
||||||
let htmlElement = element[0];
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Input.prototype.init = function () {
|
||||||
|
let initCompleted = false;
|
||||||
|
let htmlElement = this.element[0];
|
||||||
|
|
||||||
// Operazioni di inizializzazione per input specifici
|
// Operazioni di inizializzazione per input specifici
|
||||||
// Inizializzazione per date
|
// Inizializzazione per date
|
||||||
if (this.element.hasClass('timestamp-picker')) {
|
if (this.element.hasClass('timestamp-picker')) {
|
||||||
initTimestampInput(htmlElement);
|
initCompleted = initTimestampInput(htmlElement);
|
||||||
} else if (this.element.hasClass('datepicker')) {
|
} else if (this.element.hasClass('datepicker')) {
|
||||||
initDateInput(htmlElement);
|
initCompleted = initDateInput(htmlElement);
|
||||||
} else if (this.element.hasClass('timepicker')) {
|
} else if (this.element.hasClass('timepicker')) {
|
||||||
initTimeInput(htmlElement);
|
initCompleted = initTimeInput(htmlElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inizializzazione per campi numerici
|
// Inizializzazione per campi numerici
|
||||||
else if (this.element.hasClass('decimal-number')) {
|
else if (this.element.hasClass('number-input')) {
|
||||||
initNumberInput(htmlElement);
|
initCompleted = initNumberInput(htmlElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inizializzazione per textarea
|
// Inizializzazione per textarea
|
||||||
else if (this.element.hasClass('editor-input')) {
|
else if (this.element.hasClass('editor-input')) {
|
||||||
initEditorInput(htmlElement);
|
initCompleted = initEditorInput(htmlElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inizializzazione per textarea
|
// Inizializzazione per textarea
|
||||||
else if (this.element.hasClass('autosize')) {
|
else if (this.element.hasClass('autosize')) {
|
||||||
initTextareaInput(htmlElement);
|
initCompleted = initTextareaInput(htmlElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inizializzazione per select
|
// Inizializzazione per select
|
||||||
else if (this.element.hasClass('superselect') || this.element.hasClass('superselectajax')) {
|
else if (this.element.hasClass('select-input')) {
|
||||||
initSelectInput(htmlElement);
|
initCompleted = initSelectInput(htmlElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inizializzazione alternativa per maschere
|
// Inizializzazione alternativa per maschere
|
||||||
else {
|
else {
|
||||||
initMaskInput(htmlElement);
|
initCompleted = initMaskInput(htmlElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.element.data("input-init", initCompleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
Input.prototype.getElement = function () {
|
Input.prototype.getElement = function () {
|
||||||
@ -200,7 +210,7 @@ Input.prototype.get = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gestione dei valori numerici
|
// Gestione dei valori numerici
|
||||||
if (this.element.hasClass("decimal-number")) {
|
if (this.element.hasClass("number-input")) {
|
||||||
const autonumeric = this.element.data("autonumeric");
|
const autonumeric = this.element.data("autonumeric");
|
||||||
|
|
||||||
if (autonumeric) {
|
if (autonumeric) {
|
||||||
|
@ -42,6 +42,8 @@ function initMaskInput(input) {
|
|||||||
regex: "[0-9,.+\-]*",
|
regex: "[0-9,.+\-]*",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function initNumbers() {
|
function initNumbers() {
|
||||||
$('.decimal-number').each(function () {
|
$('.number-input').each(function () {
|
||||||
input(this);
|
input(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ function initNumbers() {
|
|||||||
function initNumberInput(input) {
|
function initNumberInput(input) {
|
||||||
let $input = $(input);
|
let $input = $(input);
|
||||||
if (AutoNumeric.isManagedByAutoNumeric(input)) {
|
if (AutoNumeric.isManagedByAutoNumeric(input)) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let min = $input.attr('min-value') && $input.attr('min-value') !== "undefined" ? $input.attr('min-value') : null;
|
let min = $input.attr('min-value') && $input.attr('min-value') !== "undefined" ? $input.attr('min-value') : null;
|
||||||
@ -58,4 +58,6 @@ function initNumberInput(input) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$input.data("autonumeric", autonumeric);
|
$input.data("autonumeric", autonumeric);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -170,12 +170,19 @@ function updateSelectOption(name, value) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param input
|
||||||
|
*/
|
||||||
function initSelectInput(input) {
|
function initSelectInput(input) {
|
||||||
if ($(input).hasClass('superselect')){
|
let $input = $(input);
|
||||||
|
|
||||||
|
if ($input.hasClass('superselect')) {
|
||||||
initStaticSelectInput(input);
|
initStaticSelectInput(input);
|
||||||
} else {
|
} else {
|
||||||
initDynamicSelectInput(input);
|
initDynamicSelectInput(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $input.data('select');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
function initTextareaInput(input) {
|
function initTextareaInput(input) {
|
||||||
autosize($(input));
|
autosize($(input));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditorInput(input) {
|
function initEditorInput(input) {
|
||||||
@ -45,4 +47,6 @@ function initEditorInput(input) {
|
|||||||
$input.trigger("change", event);
|
$input.trigger("change", event);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
17
core.php
17
core.php
@ -148,23 +148,6 @@ Monolog\ErrorHandler::register($logger, [], Monolog\Logger::ERROR, Monolog\Logge
|
|||||||
// Database
|
// Database
|
||||||
$dbo = $database = database();
|
$dbo = $database = database();
|
||||||
|
|
||||||
/* SESSIONE */
|
|
||||||
if (!API\Response::isAPIRequest()) {
|
|
||||||
// Barra di debug (necessario per loggare tutte le query)
|
|
||||||
if (App::debug()) {
|
|
||||||
$debugbar = new DebugBar\DebugBar();
|
|
||||||
|
|
||||||
$debugbar->addCollector(new DebugBar\DataCollector\MemoryCollector());
|
|
||||||
$debugbar->addCollector(new DebugBar\DataCollector\PhpInfoCollector());
|
|
||||||
|
|
||||||
$debugbar->addCollector(new DebugBar\DataCollector\RequestDataCollector());
|
|
||||||
$debugbar->addCollector(new DebugBar\DataCollector\TimeDataCollector());
|
|
||||||
|
|
||||||
$debugbar->addCollector(new DebugBar\Bridge\MonologCollector($logger));
|
|
||||||
$debugbar->addCollector(new Extensions\EloquentCollector($dbo->getCapsule()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* INTERNAZIONALIZZAZIONE */
|
/* INTERNAZIONALIZZAZIONE */
|
||||||
// Istanziamento del gestore delle traduzioni del progetto
|
// Istanziamento del gestore delle traduzioni del progetto
|
||||||
$lang = !empty($config['lang']) ? $config['lang'] : (isset($_GET['lang']) ? $_GET['lang'] : null);
|
$lang = !empty($config['lang']) ? $config['lang'] : (isset($_GET['lang']) ? $_GET['lang'] : null);
|
||||||
|
@ -58,7 +58,6 @@ if (Auth::check()) {
|
|||||||
window.onbeforeunload = null;
|
window.onbeforeunload = null;
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
echo $debugbarRenderer->render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$custom_css = setting('CSS Personalizzato');
|
$custom_css = setting('CSS Personalizzato');
|
||||||
|
@ -260,15 +260,6 @@ echo '
|
|||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
// Barra di debug
|
|
||||||
if (App::debug()) {
|
|
||||||
$debugbarRenderer = $debugbar->getJavascriptRenderer();
|
|
||||||
$debugbarRenderer->setIncludeVendors(false);
|
|
||||||
$debugbarRenderer->setBaseUrl($paths['assets'].'/php-debugbar');
|
|
||||||
|
|
||||||
echo $debugbarRenderer->renderHead();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setting('Abilita esportazione Excel e PDF')) {
|
if (setting('Abilita esportazione Excel e PDF')) {
|
||||||
echo '
|
echo '
|
||||||
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||||
|
@ -253,7 +253,7 @@ WHERE (SELECT COUNT(*) FROM in_interventi_tecnici WHERE in_interventi_tecnici.id
|
|||||||
->sortBy('data');
|
->sortBy('data');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<select class="superselect openstamanager-input" id="mese-promemoria">';
|
<select class="superselect openstamanager-input select-input" id="mese-promemoria">';
|
||||||
|
|
||||||
foreach ($mesi as $mese) {
|
foreach ($mesi as $mese) {
|
||||||
$data = new Carbon\Carbon($mese['data']);
|
$data = new Carbon\Carbon($mese['data']);
|
||||||
|
@ -237,7 +237,7 @@ class DefaultHandler implements HandlerInterface
|
|||||||
*/
|
*/
|
||||||
protected function number(&$values, &$extras)
|
protected function number(&$values, &$extras)
|
||||||
{
|
{
|
||||||
$values['class'][] = 'decimal-number';
|
$values['class'][] = 'number-input';
|
||||||
|
|
||||||
$values['value'] = !empty($values['value']) ? $values['value'] : 0;
|
$values['value'] = !empty($values['value']) ? $values['value'] : 0;
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class SelectHandler implements HandlerInterface
|
|||||||
public function handle(&$values, &$extras)
|
public function handle(&$values, &$extras)
|
||||||
{
|
{
|
||||||
$values['class'][] = 'openstamanager-input';
|
$values['class'][] = 'openstamanager-input';
|
||||||
|
$values['class'][] = 'select-input';
|
||||||
|
|
||||||
$source = isset($values['ajax-source']) ? $values['ajax-source'] : (isset($values['select-source']) ? $values['select-source'] : null);
|
$source = isset($values['ajax-source']) ? $values['ajax-source'] : (isset($values['select-source']) ? $values['select-source'] : null);
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class Formatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($this->numberFormatter)) {
|
if (is_object($this->numberFormatter)) {
|
||||||
$result = $this->numberFormatter->format($value);
|
$result = $this->numberFormatter->format(floatval($value));
|
||||||
} else {
|
} else {
|
||||||
$number = number_format($value, $this->getPrecision(), self::getStandardFormats()['number']['decimals'], self::getStandardFormats()['number']['thousands']);
|
$number = number_format($value, $this->getPrecision(), self::getStandardFormats()['number']['decimals'], self::getStandardFormats()['number']['thousands']);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user