Finish Carelli_RilevazioniSteup_StampaIspezione
This commit is contained in:
@@ -1209,4 +1209,28 @@ class RilevazioniSteup {
|
||||
}
|
||||
return "<span class = 'badge {$class}' title='priorita {$priorityLevel}'>{$text}</span>";
|
||||
}
|
||||
|
||||
private static function getSetupReportName() {
|
||||
$gestSetup = new GestSetup;
|
||||
$reportName = $gestSetup->keySection("REPORT_NAME")->get();
|
||||
|
||||
return $reportName;
|
||||
}
|
||||
|
||||
public static function stampaIspezione($data) {
|
||||
$JP = new JasperProcessor;
|
||||
|
||||
$gestSetup = self::getSetupReportName();
|
||||
$ret = $JP->load($gestSetup);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$JP = $ret->get("JP");
|
||||
$JP->cacheAs("Stampa Ispezione")
|
||||
->param("activityId", array_get($data, "activityId"));
|
||||
|
||||
$ret = $JP->run();
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,9 @@ if (isset($_POST["delete_activity"])) {
|
||||
} else if (isset($_GET["articoliAttivita"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["articoliAttivita"]);
|
||||
RilevazioniSteup::getArticoliAttivita($data)->display();
|
||||
} else if (isset($_GET["stampaIspezione"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["stampaIspezione"]);
|
||||
RilevazioniSteup::stampaIspezione($data)->display();
|
||||
} else if (Controller::is_ajaxRequest()) {
|
||||
$Ret = new Ret;
|
||||
$Ret->set_errorCode(ErrorHandler::UNEXPECTED_AJAX_METHOD)->display();
|
||||
|
||||
@@ -143,19 +143,30 @@ if ($Ret->is_OK()) {
|
||||
<?php if (!(User::is_puntoVendita() && !$isCompleted)) { ?>
|
||||
<a href="?ispezione=<?= Utility::B64JSON_stringify(is_array($item["activity_id"]) ? $item["activity_id"] : array($item["activity_id"])) ?>"
|
||||
class="btn btn-default">
|
||||
<span class="text-info xfont-weight-bold"><i class="fas fa-search"></i> Consulta</span>
|
||||
<span class="text-info xfont-weight-bold">
|
||||
<i class="fas fa-search"></i> Consulta
|
||||
</span>
|
||||
</a>
|
||||
<?php }
|
||||
if (RilevazioniSteup::is_editorUserGroup()) { ?>
|
||||
<button class="btn btn-default bt_deleteIspezione">
|
||||
<span class="text-danger"><i class="fas fa-trash"></i> Rimuovi</span>
|
||||
<span class="text-danger">
|
||||
<i class="fas fa-trash"></i> Rimuovi
|
||||
</span>
|
||||
</button>
|
||||
<?php }
|
||||
if (RilevazioniSteup::canUserReopenInspections() && $isCompleted) { ?>
|
||||
<button class="btn btn-default bt_reopenIspezione">
|
||||
<span class="text-warning"><i class="fas fa-lock-open"></i> Riapri</span>
|
||||
<span class="text-warning">
|
||||
<i class="fas fa-lock-open"></i> Riapri
|
||||
</span>
|
||||
</button>
|
||||
<?php } ?>
|
||||
<button class="btn btn-default bt_stampaIspezione">
|
||||
<span class="text-primary">
|
||||
<i class="fas fa-print"></i> Stampa
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
$(function () {
|
||||
$(document).on("click", ".bt_deleteIspezione, .bt_deleteEntry", function () {
|
||||
var $tr = $(this).closest("tr");
|
||||
var activityId = $tr.getDataAttr("activity_id");
|
||||
var type = $(this).hasClass("bt_deleteIspezione") ? "ispezione" : "entry";
|
||||
const $tr = $(this).closest("tr");
|
||||
const activityId = $tr.getDataAttr("activity_id");
|
||||
const type = $(this).hasClass("bt_deleteIspezione") ? "ispezione" : "entry";
|
||||
|
||||
_rilevazioniSteup.deleteIspezione(activityId, type).then(function () {
|
||||
$tr.remove();
|
||||
});
|
||||
@@ -18,22 +19,32 @@ $(function () {
|
||||
});
|
||||
|
||||
$(document).on("click", ".bt_editEntry", function () {
|
||||
var $tr = $(this).closest("tr");
|
||||
var activityId = $tr.getDataAttr("activity_id");
|
||||
const $tr = $(this).closest("tr");
|
||||
const activityId = $tr.getDataAttr("activity_id");
|
||||
|
||||
_rilevazioniSteup.editEntry(activityId);
|
||||
});
|
||||
|
||||
$(document).on("click", ".bt_viewProducts", function () {
|
||||
var $tr = $(this).closest("tr");
|
||||
var activityId = $tr.getDataAttr("activity_id");
|
||||
const $tr = $(this).closest("tr");
|
||||
const activityId = $tr.getDataAttr("activity_id");
|
||||
|
||||
_rilevazioniSteup.viewProducts(activityId);
|
||||
});
|
||||
|
||||
$(document).on("click", ".bt_stampaIspezione", function () {
|
||||
const $tr = $(this).closest("tr");
|
||||
const activityId = $tr.attr("data-activity_id");
|
||||
|
||||
_rilevazioniSteup.stampaIspezione(activityId);
|
||||
});
|
||||
|
||||
$(".indiceGradimento").on("change", function () {
|
||||
var $indiceGradimento = $(this);
|
||||
var $i = $indiceGradimento.closest(".input-group").find("i");
|
||||
var value = $indiceGradimento.getValue();
|
||||
var codJfas = $indiceGradimento.closest("[data-cod_jfas]").getDataAttr("cod_jfas");
|
||||
const $indiceGradimento = $(this);
|
||||
const $i = $indiceGradimento.closest(".input-group").find("i");
|
||||
const value = $indiceGradimento.getValue();
|
||||
const codJfas = $indiceGradimento.closest("[data-cod_jfas]").getDataAttr("cod_jfas");
|
||||
|
||||
$indiceGradimento.blur();
|
||||
_rilevazioniSteup.set_punteggio(value, codJfas).then(function (ret) {
|
||||
$i.toggleClass("text-success", ret).toggleClass("text-muted", !ret);
|
||||
@@ -46,21 +57,20 @@ $(function () {
|
||||
});
|
||||
|
||||
$(document).on("click", ".img-thumbnail", function () {
|
||||
var $this = $(this);
|
||||
var $box = $this.parent();
|
||||
var $tr = $this.closest("tr");
|
||||
var $panelRepo = $this.closest("div[data-cod_jfas]");
|
||||
const $this = $(this);
|
||||
const $box = $this.parent();
|
||||
const $tr = $this.closest("tr");
|
||||
const $panelRepo = $this.closest("div[data-cod_jfas]");
|
||||
const reas = $tr.find("td:nth-child(2)").text();
|
||||
const title = reas + " - " + $panelRepo.find(".panel-heading h4").html();
|
||||
const note = nullIfBlank($tr.find(".note-entry").text());
|
||||
const startFrom = $this.index() + 1;
|
||||
const carousel = new Carousel();
|
||||
|
||||
var reas = $tr.find("td:nth-child(2)").text();
|
||||
var title = reas + " - " + $panelRepo.find(".panel-heading h4").html();
|
||||
var note = nullIfBlank($tr.find(".note-entry").text());
|
||||
|
||||
var carousel = new Carousel();
|
||||
carousel.title(title);
|
||||
|
||||
var startFrom = $this.index() + 1;
|
||||
$box.find("img").each(function () {
|
||||
var src = $(this).attr("data-uri");
|
||||
const src = $(this).attr("data-uri");
|
||||
carousel.append(src, note);
|
||||
});
|
||||
|
||||
@@ -281,6 +291,17 @@ var _rilevazioniSteup = {
|
||||
}
|
||||
},
|
||||
|
||||
stampaIspezione: function (activityId) {
|
||||
new Ajax()
|
||||
.get("stampaIspezione")
|
||||
.$button($(this))
|
||||
.waitToast("Preparazione stampa...")
|
||||
.noticeAsToast()
|
||||
.onSuccess({modalBox: {IFrame: true}})
|
||||
.data({activityId})
|
||||
.execute();
|
||||
},
|
||||
|
||||
editEntry: function (activityId) {
|
||||
var ajax = new Ajax();
|
||||
var self = this;
|
||||
|
||||
Reference in New Issue
Block a user