mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-18 12:30:35 +01:00
Miglioramento selezione riferimento
This commit is contained in:
parent
8952ad0c0a
commit
d07adca48f
@ -3,7 +3,7 @@ function input(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Input(name) {
|
function Input(name) {
|
||||||
this.element = $("[name=" + name + "]").last();
|
this.element = $("[name='" + name + "']").last();
|
||||||
|
|
||||||
// Fix per select multipli
|
// Fix per select multipli
|
||||||
if (this.element.length === 0) {
|
if (this.element.length === 0) {
|
||||||
|
@ -353,7 +353,7 @@ if (!empty($righe)) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{[ "type": "select", "name": "selezione_riferimento['.$key.']", "ajax-source": "riferimenti-fe", "select-options": '.json_encode(['id_anagrafica' => $anagrafica ? $anagrafica->id : '']).', "required": 1, "label": "'.tr('Riferimento').'" ]}
|
{[ "type": "select", "name": "selezione_riferimento['.$key.']", "ajax-source": "riferimenti-fe", "select-options": '.json_encode(['id_anagrafica' => $anagrafica ? $anagrafica->id : '']).', "required": 1, "label": "'.tr('Riferimento').'", "icon-after": '.json_encode('<button type="button" onclick="rimuoviRiferimento(this)" class="btn btn-primary disabled" id="rimuovi_riferimento_'.$key.'"><i class="fa fa-close"></i></button>').' ]}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
@ -429,6 +429,17 @@ echo '
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function rimuoviRiferimento(button) {
|
||||||
|
let riga = $(button).closest("tr").prev();
|
||||||
|
let id_riga = riga.data("id");
|
||||||
|
|
||||||
|
impostaRiferimento(id_riga, {}, {});
|
||||||
|
|
||||||
|
input("selezione_riferimento[" + id_riga + "]").enable()
|
||||||
|
.getElement().selectReset();
|
||||||
|
$(button).addClass("disabled");
|
||||||
|
}
|
||||||
|
|
||||||
function selezionaRiferimento(riga, tipo_documento, id_documento) {
|
function selezionaRiferimento(riga, tipo_documento, id_documento) {
|
||||||
let id_riga = riga.data("id");
|
let id_riga = riga.data("id");
|
||||||
let qta = riga.data("qta");
|
let qta = riga.data("qta");
|
||||||
@ -484,13 +495,15 @@ function getRiferimenti() {
|
|||||||
* @param riga = {tipo, id, descrizione, qta, prezzo_unitario}
|
* @param riga = {tipo, id, descrizione, qta, prezzo_unitario}
|
||||||
*/
|
*/
|
||||||
function impostaRiferimento(id_riga, documento, riga) {
|
function impostaRiferimento(id_riga, documento, riga) {
|
||||||
console.log(id_riga);
|
|
||||||
$("#tipo_riferimento_" + id_riga).val(documento.tipo);
|
$("#tipo_riferimento_" + id_riga).val(documento.tipo);
|
||||||
$("#id_riferimento_" + id_riga).val(documento.id);
|
$("#id_riferimento_" + id_riga).val(documento.id);
|
||||||
|
|
||||||
$("#tipo_riga_riferimento_" + id_riga).val(riga.tipo);
|
$("#tipo_riga_riferimento_" + id_riga).val(riga.tipo);
|
||||||
$("#id_riga_riferimento_" + id_riga).val(riga.id);
|
$("#id_riga_riferimento_" + id_riga).val(riga.id);
|
||||||
|
|
||||||
$("#riferimento_" + id_riga).html(documento.descrizione);
|
$("#riferimento_" + id_riga).html(documento.descrizione ? documento.descrizione : "");
|
||||||
|
|
||||||
|
input("selezione_riferimento[" + id_riga + "]").disable();
|
||||||
|
$("#rimuovi_riferimento_" + id_riga).removeClass("disabled");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
@ -168,6 +168,10 @@ class HTMLWrapper implements WrapperInterface
|
|||||||
$values['icon-custom'] = 'no-padding';
|
$values['icon-custom'] = 'no-padding';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (str_contains($string, '<button')) {
|
||||||
|
$values['icon-custom'] = 'no-padding';
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user