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

88 lines
2.7 KiB
PHP
Raw Normal View History

2018-05-08 15:55:46 +02:00
<?php
2020-09-07 15:04:06 +02:00
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2018-05-08 15:55:46 +02:00
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>
2020-09-07 15:04:06 +02: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>
2020-09-07 15:04:06 +02:00
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>';