1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-11 16:06:20 +01:00
openstamanager/plugins/importFE/edit.php

126 lines
3.7 KiB
PHP
Raw Normal View History

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>
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) {
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-02-21 22:21:30 +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
},
2019-02-01 17:44:31 +01:00
error: function(xhr) {
alert("'.tr('Errore').': " + xhr.responseJSON.error.message);
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
2019-02-12 11:42:48 +01:00
echo '
2018-11-30 15:33:25 +01:00
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">
2019-02-12 11:42:48 +01:00
'.tr('Fatture da importare').'</span>
</h3>';
// Ricerca automatica
if (Interaction::isEnabled()) {
echo '
2018-11-30 15:33:25 +01:00
<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').'
2019-02-12 11:42:48 +01:00
</button>';
}
echo '
2018-11-30 15:33:25 +01:00
</div>
<div class="box-body" id="list">';
2019-03-01 11:51:21 +01:00
if (Interaction::isEnabled()) {
echo '
<p>'.tr('Per vedere le fatture da importare utilizza il pulsante _BUTTON_', [
'_BUTTON_' => '<b>"'.tr('Ricerca fatture di acquisto').'"</b>',
]).'.</p>';
} else {
2018-11-30 15:33:25 +01:00
include $structure->filepath('list.php');
2019-03-01 11:51:21 +01:00
}
2018-11-30 15:33:25 +01:00
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>';