Commit a4fb64a0 authored by Alex Felippe Chiozo's avatar Alex Felippe Chiozo
Browse files

adiciona impressão do formulário de inscrição

parent 6cdec223
......@@ -66,6 +66,33 @@ class Theme extends BaseV1\Theme{
}
return;
});
// insere botão de imprimir na visualização do formulário de inscrição
$app->hook("template(registration.view.form):begin", function () use ($app) {
/** @var \MapasCulturais\Theme $this */
if (!$this->controller->requestedEntity->canUser("admin")) {
return;
}
$this->part("button-print-registration", [
"registration" => $this->controller->requestedEntity
]);
return;
});
// implementa o endpoint para o botão de imprimir
$app->hook("GET(registration.print)", function () use ($app) {
/** @var \MapasCulturais\Controller $this */
$this->requireAuthentication();
if (!$this->requestedEntity->canUser("admin")) {
$this->errorJson("Unauthorised.", 401);
return;
}
$app->view->enqueueScript("app", "print-registration", "js/print-registration.js");
$app->view->enqueueStyle("app", "print-registration", "css/print-registration.css", ["main"]);
$this->render("single", [
"entity" => $this->requestedEntity
]);
return;
});
return;
}
function includeVendorAssets()
......
$(function () {
// initialisation
const $footer = $("footer");
console.log($footer.height());
$footer.before("<div id=\"empty-footer\">.</div>");
$("#main-header").removeClass("sombra");
// trigger the print window
setTimeout(function () {
$(window).resize();
window.print();
return;
}, 500);
// adjust height of empty-footer
$(window).resize(function () {
$("#empty-footer").height($footer.height());
return;
});
// adjust header on scroll
$(window).scroll(function () {
$("#main-header")[0].style.top = 0;
return;
});
});
\ No newline at end of file
<?php
use MapasCulturais\i;
$url = $app->createUrl("registration", "print", ["id" => $registration->id]);
?>
<div class="clearfix clear" style="margin-bottom: 1rem;">
<a href="<?=$url?>" class="alignright btn btn-default hltip print-registration" title="" hltitle="Acessar versão para impressão" target="_blank">
<?php i::_e("Imprimir"); ?>
</a>
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment