2018-11-30 15:33:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
use Plugins\ImportFE\Interaction;
|
|
|
|
|
|
|
|
$list = Interaction::listToImport();
|
2019-02-12 11:42:48 +01:00
|
|
|
$directory = Plugins\ImportFE\FatturaElettronica::getImportDirectory();
|
2018-11-30 15:33:25 +01:00
|
|
|
|
|
|
|
if (!empty($list)) {
|
|
|
|
echo '
|
|
|
|
<table class="table table-striped table-hover table-condensed table-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Nome').'</th>
|
2019-02-12 11:42:48 +01:00
|
|
|
<th width="10%" class="text-center">#</th>
|
2018-11-30 15:33:25 +01:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>';
|
|
|
|
|
|
|
|
foreach ($list as $element) {
|
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<td>'.$element.'</td>
|
2019-02-12 11:42:48 +01:00
|
|
|
<td class="text-center">';
|
|
|
|
|
|
|
|
if (file_exists($directory.'/'.$element)) {
|
|
|
|
echo '
|
|
|
|
<button type="button" class="btn btn-danger" onclick="delete_fe(this, \''.$element.'\')">
|
|
|
|
<i class="fa fa-trash"></i>
|
|
|
|
</button>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
2018-11-30 15:33:25 +01:00
|
|
|
<button type="button" class="btn btn-warning" onclick="download(this, \''.$element.'\')">
|
2019-02-12 11:42:48 +01:00
|
|
|
<i class="fa fa-download"></i> '.tr('Importa').'
|
2018-11-30 15:33:25 +01:00
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
} else {
|
|
|
|
echo '
|
|
|
|
<p>'.tr('Nessuna fattura da importare').'.</p>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<script>
|
|
|
|
function download(button, file) {
|
|
|
|
var restore = buttonLoading(button);
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: globals.rootdir + "/actions.php",
|
|
|
|
type: "get",
|
|
|
|
data: {
|
|
|
|
id_module: globals.id_module,
|
|
|
|
id_plugin: '.$id_plugin.',
|
|
|
|
op: "prepare",
|
|
|
|
name: file,
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
|
|
if (!data.already) {
|
|
|
|
launch_modal("'.tr('Righe fattura').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_plugin=" + '.$id_plugin.' + "&op=list&filename=" + data.filename);
|
2019-01-03 12:57:17 +01:00
|
|
|
buttonRestore(button, restore);
|
2018-11-30 15:33:25 +01:00
|
|
|
} else {
|
|
|
|
swal({
|
2019-01-03 12:57:17 +01:00
|
|
|
title: "'.tr('Fattura già importata.').'",
|
2018-11-30 15:33:25 +01:00
|
|
|
type: "info",
|
2019-01-03 12:57:17 +01:00
|
|
|
});
|
|
|
|
buttonRestore(button, restore);
|
|
|
|
$(button).prop("disabled", true);
|
2018-11-30 15:33:25 +01:00
|
|
|
}
|
|
|
|
|
2019-01-03 12:57:17 +01:00
|
|
|
|
2018-11-30 15:33:25 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-02-12 11:42:48 +01:00
|
|
|
|
|
|
|
function delete_fe(button, file) {
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-11-30 15:33:25 +01:00
|
|
|
</script>';
|