Pulsante per processare FE da remoto

This commit is contained in:
Thomas Zilio 2019-04-19 09:50:16 -07:00
parent 9d230c2bab
commit 0ca8ba237f
2 changed files with 71 additions and 16 deletions

View File

@ -90,4 +90,18 @@ switch (filter('op')) {
include __DIR__.'/rows.php';
break;
case 'process':
$name = get('name');
// Processo il file ricevuto
if (Interaction::isEnabled()) {
$process_result = Interaction::processXML($name);
if (!empty($process_resul)) {
flash()->error($process_result);
}
}
break;
}

View File

@ -13,7 +13,7 @@ if (!empty($list)) {
<thead>
<tr>
<th>'.tr('Nome').'</th>
<th width="10%" class="text-center">#</th>
<th width="20%" class="text-center">#</th>
</tr>
</thead>
<tbody>';
@ -29,6 +29,11 @@ if (!empty($list)) {
<button type="button" class="btn btn-danger" onclick="delete_fe(this, \''.$element.'\')">
<i class="fa fa-trash"></i>
</button>';
}else{
echo '
<button type="button" class="btn btn-info" onclick="process_fe(this, \''.$element.'\')">
<i class="fa fa-upload"></i>
</button>';
}
echo '
@ -81,22 +86,58 @@ function download(button, file) {
}
function delete_fe(button, file) {
var restore = buttonLoading(button);
swal({
title: "'.tr("Rimuovere la fattura salvata localmente?").'",
html: "'.tr("Sarà possibile inserirla nuovamente nel gestionale attraverso il caricamento").'",
type: "error",
showCancelButton: true,
confirmButtonText: "'.tr('Sì').'"
}).then(function (result) {
var restore = buttonLoading(button);
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
data: {
id_module: globals.id_module,
id_plugin: ' . $id_plugin . ',
op: "delete",
name: file,
},
success: function(data) {
$("#list").load("' . $structure->fileurl('list.php') . '?id_module=' . $id_module . '&id_plugin=' . $id_plugin . '", function() {
buttonRestore(button, restore);
});
}
});
});
}
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',
op: "delete",
name: file,
},
success: function(data) {
$("#list").load("'.$structure->fileurl('list.php').'?id_module='.$id_module.'&id_plugin='.$id_plugin.'", function() {
buttonRestore(button, restore);
});
}
function process_fe(button, file) {
swal({
title: "'.tr("Segnare la fattura come processata?").'",
html: "'.tr("Non sarà possibile individuarla nuovamente in modo automatico: l'unico modo per recuperarla sarà contattare l'assistenza").'",
type: "info",
showCancelButton: true,
confirmButtonText: "'.tr('Sì').'"
}).then(function (result) {
var restore = buttonLoading(button);
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',
op: "process",
name: file,
},
success: function(data) {
$("#list").load("'.$structure->fileurl('list.php').'?id_module='.$id_module.'&id_plugin='.$id_plugin.'", function() {
buttonRestore(button, restore);
});
}
});
});
}