2018-09-24 18:10:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2018-11-30 15:33:25 +01:00
|
|
|
use Plugins\ImportFE\Interaction;
|
|
|
|
|
2018-09-24 18:10:16 +02:00
|
|
|
echo '
|
|
|
|
<script>
|
2018-12-12 17:54:31 +01:00
|
|
|
function upload(btn) {
|
2018-09-24 18:10:16 +02:00
|
|
|
if ($("#blob").val()) {
|
|
|
|
swal({
|
|
|
|
title: "'.tr('Avviare la procedura?').'",
|
|
|
|
type: "warning",
|
|
|
|
showCancelButton: true,
|
|
|
|
confirmButtonText: "'.tr('Sì').'"
|
|
|
|
}).then(function (result) {
|
2018-12-12 17:54:31 +01:00
|
|
|
var restore = buttonLoading(btn);
|
|
|
|
|
2018-09-24 18:10:16 +02:00
|
|
|
$("#upload").ajaxSubmit({
|
|
|
|
url: globals.rootdir + "/actions.php",
|
|
|
|
data: {
|
|
|
|
op: "save",
|
|
|
|
id_module: "'.$id_module.'",
|
|
|
|
id_plugin: "'.$id_plugin.'",
|
|
|
|
},
|
|
|
|
type: "post",
|
|
|
|
success: function(data){
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
2018-09-25 11:55:52 +02:00
|
|
|
if (!data.already) {
|
2018-11-30 15:33:25 +01:00
|
|
|
launch_modal("'.tr('Righe fattura').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_plugin=" + '.$id_plugin.' + "&op=list&filename=" + data.filename);
|
2018-09-25 11:55:52 +02:00
|
|
|
} else {
|
|
|
|
swal({
|
2019-01-03 12:57:17 +01:00
|
|
|
title: "'.tr('Fattura già importata.').'",
|
2018-09-25 11:55:52 +02:00
|
|
|
type: "info",
|
2019-01-03 12:57:17 +01:00
|
|
|
});
|
2019-01-03 13:01:06 +01:00
|
|
|
|
|
|
|
$("#blob").val("");
|
2018-09-25 11:55:52 +02:00
|
|
|
}
|
2019-01-03 13:01:06 +01:00
|
|
|
buttonRestore(btn, restore);
|
2018-09-24 18:10:16 +02:00
|
|
|
},
|
|
|
|
error: function(data) {
|
|
|
|
alert("'.tr('Errore').': " + data);
|
2018-12-12 17:54:31 +01:00
|
|
|
|
|
|
|
buttonRestore(btn, restore);
|
2018-09-24 18:10:16 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
swal({
|
|
|
|
title: "'.tr('Selezionare un file!').'",
|
|
|
|
type: "error",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="box box-success">
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title">
|
2018-12-19 23:53:02 +01:00
|
|
|
'.tr('Carica un XML').'
|
|
|
|
|
2018-12-23 14:01:59 +01:00
|
|
|
<span class="tip" title="'.tr('Formati supportati: XML e P7M').'.">
|
2018-12-19 23:53:02 +01:00
|
|
|
<i class="fa fa-question-circle-o"></i>
|
|
|
|
</span>
|
|
|
|
|
2018-09-24 18:10:16 +02:00
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body" id="upload">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-9">
|
|
|
|
<label><input type="file" name="blob" id="blob"></label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-3">
|
2018-12-19 23:53:02 +01:00
|
|
|
<button type="button" class="btn btn-primary pull-right" onclick="upload(this)">
|
2019-01-10 18:41:25 +01:00
|
|
|
<i class="fa fa-upload"></i> '.tr('Carica documento fornitore').'
|
2018-09-24 18:10:16 +02:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
2018-11-30 15:33:25 +01:00
|
|
|
|
|
|
|
if (Interaction::isEnabled()) {
|
|
|
|
echo '
|
|
|
|
<div class="box box-info">
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title">
|
|
|
|
'.tr('Importazione automatica').'</span>
|
|
|
|
</h3>
|
|
|
|
<button type="button" class="btn btn-primary pull-right" onclick="search(this)">
|
2018-12-19 23:53:02 +01:00
|
|
|
<i class="fa fa-refresh"></i> '.tr('Ricerca fatture di acquisto').'
|
2018-11-30 15:33:25 +01:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="box-body" id="list">';
|
|
|
|
|
|
|
|
include $structure->filepath('list.php');
|
|
|
|
|
|
|
|
echo '
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function search(button) {
|
|
|
|
var restore = buttonLoading(button);
|
|
|
|
|
|
|
|
$("#list").load("'.$structure->fileurl('list.php').'?id_module='.$id_module.'&id_plugin='.$id_plugin.'", function() {
|
|
|
|
buttonRestore(button, restore);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>';
|
|
|
|
}
|