openstamanager/modules/dashboard/widgets/stampa_calendario.dashboard...

71 lines
1.9 KiB
PHP
Raw Normal View History

2018-05-08 15:55:46 +02:00
<?php
include_once __DIR__.'/../../../core.php';
2019-11-22 17:33:30 +01:00
use Carbon\Carbon;
// Trovo id_print della stampa
$id_print = Prints::getModulePredefinedPrint('Dashboard')['id'];
$date = new Carbon($_SESSION['dashboard']['date']);
2018-05-08 15:55:46 +02:00
echo '
<form action="" method="post" onsubmit="if($(this).parsley().validate()) { return stampa_calendario(); }" >
2018-07-03 12:28:38 +02:00
2018-05-08 15:55:46 +02:00
<div class="row">
2019-02-03 10:59:33 +01:00
<div class="col-md-4">
2019-11-22 17:33:30 +01:00
{[ "type": "text", "label": "'.tr('Mese e anno').'", "name": "date", "required": "1" ]}
2018-05-08 15:55:46 +02:00
</div>
2019-11-22 16:28:03 +01:00
2018-05-08 15:55:46 +02:00
<div class="col-md-2">
2019-11-22 16:28:03 +01:00
{[ "type": "select", "label": "'.tr('Formato').'", "name": "format", "required": "1", "values": "list=\"A4\": \"'.tr('A4').'\", \"A3\": \"'.tr('A3').'\"", "value": "'.$_SESSION['dashboard']['format'].'" ]}
2018-05-08 15:55:46 +02:00
</div>
2018-07-03 12:28:38 +02:00
2019-02-03 10:59:33 +01:00
<div class="col-md-4">
2019-11-22 16:28:03 +01:00
{[ "type": "select", "label": "'.tr('Orientamento').'", "name": "orientation", "required": "1", "values": "list=\"L\": \"'.tr('Orizzontale').'\", \"P\": \"'.tr('Verticale').'\"", "value": "'.$_SESSION['dashboard']['orientation'].'" ]}
2018-05-08 15:55:46 +02:00
</div>
2018-07-03 12:28:38 +02:00
2018-05-08 15:55:46 +02:00
<div class="col-md-2">
<p style="line-height:14px;">&nbsp;</p>
2019-11-22 16:28:03 +01:00
<button type="submit" class="btn btn-primary btn-block">
<i class="fa fa-print"></i> '.tr('Stampa').'
</button>
2018-05-08 15:55:46 +02:00
</div>
2018-07-03 12:28:38 +02:00
2018-05-08 15:55:46 +02:00
</div>
2018-07-03 12:28:38 +02:00
2019-11-22 16:28:03 +01:00
</form>
2018-06-26 14:30:26 +02:00
2019-11-22 16:28:03 +01:00
<script>$(document).ready(init)</script>';
2018-05-08 15:55:46 +02:00
2019-11-22 17:33:30 +01:00
echo '
2018-05-08 15:55:46 +02:00
<script>
function stampa_calendario (){
2019-11-22 17:33:30 +01:00
window.open(globals.rootdir + "/pdfgen.php?id_print='.$id_print.'");
2019-11-22 16:28:03 +01:00
2018-05-08 15:55:46 +02:00
return false;
}
2019-11-22 17:33:30 +01:00
$("#format").change(function() {
session_set("dashboard,format", $(this).val(), 0, 0);
2018-05-08 15:55:46 +02:00
});
2019-11-22 17:33:30 +01:00
$("#orientation").change(function() {
session_set("dashboard,orientation", $(this).val(), 0, 0);
2018-05-08 15:55:46 +02:00
});
$(function() {
2019-11-22 17:33:30 +01:00
$("#date").datetimepicker({
format: "MMMM YYYY",
2019-11-22 16:28:03 +01:00
locale: globals.locale,
useCurrent: false,
2019-11-22 18:25:33 +01:00
defaultDate: moment("'.$date->format('Y-m-d H:i:s').'")
2019-11-22 16:28:03 +01:00
});
2018-07-03 12:28:38 +02:00
2019-11-22 17:33:30 +01:00
$("#date").on("dp.change", function(e) {
session_set("dashboard,date", e.date.format("YYYY-MM-DD"), 0, 0);
2018-05-08 15:55:46 +02:00
});
});
2019-11-22 17:33:30 +01:00
</script>';