Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
242 righe
11 KiB
242 righe
11 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$id_modulo = "inviti"; |
|
$cmd_info = gara::getInfoModulo($id_modulo); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"],$id_modulo) && $_SESSION["utente"]->permission($cmd_info["modulo_riferimento"])) { |
|
$codice_round = $_GET["codice_round"] ?? NULL; |
|
$gara = gara::init($_GET["codice"],$codice_round); |
|
if (!empty($gara)) { |
|
$record = $gara->info; |
|
$round = $gara->round; |
|
$lotti = $gara->getLotti(); |
|
$partial = false; |
|
$multiLotto = (count($gara->getLotti()) > 1); |
|
if (isset($_GET["codice_lotto"])) { |
|
$setLotto = (is_numeric($_GET["codice_lotto"])) ? $_GET["codice_lotto"] : "0"; |
|
} else if (!$multiLotto) { |
|
$setLotto = $lotti[0]["codice"]; |
|
} |
|
if (!empty($setLotto)) { |
|
$gara->setLotto($setLotto); |
|
$lotto = $gara->lotto; |
|
} |
|
$lock = $gara->checkLock($cmd_info["id"]); |
|
$titolo_modulo = __($cmd_info["titolo"]); |
|
if (!empty($round)) { $titolo_modulo .= " - " . $round["infoFase"]["titolo"]; } |
|
$generalOption = true; |
|
$statiLotti = []; |
|
$checkInviti = $gara->countInvitati("0"); |
|
if (!empty($checkInviti)) { |
|
$setLotto = "0"; |
|
} else { |
|
if (!isset($setLotto)) { |
|
$statiLotti[""] = ["class"=>"btn-danger","label"=>__("Nessun invito")]; |
|
foreach($lotti AS $lt) { |
|
$checkInviti = $gara->countInvitati($lt["codice"]); |
|
if (!empty($checkInviti)) { |
|
$generalOption = false; |
|
$statiLotti[$lt["codice"]] = ["class"=>"btn-success","label"=>__("Invitati") . ": " . $checkInviti]; |
|
} else { |
|
$statiLotti[$lt["codice"]] = ["class"=>"btn-danger","label"=>__("Nessun invito")]; |
|
} |
|
} |
|
} |
|
} |
|
|
|
$breadcrumb = array(); |
|
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb["/".$radice."/panel.php?codice=".$record["codice"]."&codice_round=".$round["codice"]] = __("Pannello"); |
|
if ($multiLotto && isset($_GET["codice_lotto"])) { |
|
$breadcrumb["/".$radice."/inviti/index.php?codice=".$record["codice"]."&codice_round=".$round["codice"]] = __("Scelta lotto"); |
|
} |
|
$breadcrumb[""] = $titolo_modulo; |
|
|
|
include_once ($beRoot."/layout/top.php"); |
|
|
|
?><h1><?= $titolo_modulo ?></h1><? |
|
if (!isset($setLotto)) { |
|
$gara->printSelectLotto("{$_SERVER["PHP_SELF"]}?codice=".$record["codice"]."&codice_round=".$round["codice"],$generalOption,$statiLotti); |
|
} else { |
|
if (!empty($lotto)) { |
|
?><h3><?= __("Lotto") . " " . $lotto["numero"] ?> - <?= $lotto["oggetto"] ?></h3><? |
|
} |
|
try { |
|
$path = $gara->getSorgenteInvitati(); |
|
} catch (\Throwable $th) { |
|
alertManager::printAlertBox(__($th->getMessage())); |
|
unset($path); |
|
} |
|
if (isset($path) && file_exists($path)) { |
|
?> |
|
<script> |
|
callBack = "invitaOperatore"; |
|
function invitaOperatore(codice_operatore) { |
|
invitati = JSON.parse($("#invitati").val()); |
|
if (invitati.indexOf(codice_operatore)==-1) { |
|
invitati.push(codice_operatore); |
|
addClass = "btn-info"; |
|
removeClass = "btn-success"; |
|
aggiungi("/backend/gare/inviti/tr_invitato.php?codice_operatore="+codice_operatore,"#riepilogo-body-esistenti"); |
|
$("#btn-sorteggio").hide(); |
|
} else { |
|
removeClass = "btn-info"; |
|
addClass = "btn-success"; |
|
invitati = invitati.clean(codice_operatore); |
|
$("#tr-invitato-"+codice_operatore).remove(); |
|
} |
|
invitati = JSON.stringify(invitati); |
|
if ($(".riepilogo-body").children().length > 0) { |
|
$(".riepilogo-table").show(); |
|
$("#riepilogo-alert").hide(); |
|
$("#btn-riepilogo").show(); |
|
$("#btn-choose-sorteggio").hide(); |
|
} else { |
|
$(".riepilogo-table").hide(); |
|
$("#btn-riepilogo").hide(); |
|
$("#btn-choose-sorteggio").show(); |
|
$("#btn-sorteggio").show(); |
|
} |
|
$("#invitati").val(invitati); |
|
$("#callback-button-oe-"+codice_operatore).removeClass(removeClass).addClass(addClass); |
|
$(".callback-label-oe-"+codice_operatore).toggle(); |
|
} |
|
</script> |
|
<? |
|
$estrazione = oeManager::getEstrazione("gare",$gara->info["codice"],$setLotto); |
|
$invitati = $gara->getInvitati(); |
|
$invitati = array_column($invitati,"codice_operatore"); |
|
$invitatiManuali = $gara->getInvitatiManuali(); |
|
$countInvitati = count($invitati) + count($invitatiManuali); |
|
if (empty($estrazione)) { |
|
include($path); |
|
if (!$lock) { ?> |
|
<form action="/backend/gare/inviti/save.php" method="POST" rel="validate"> |
|
<input type="hidden" name="invitati" id="invitati" value='<?= json_encode($invitati) ?>'> |
|
<input type="hidden" name="filtriApplicati" id="filtriApplicati"> |
|
<input type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input type="hidden" name="codice_gara" value="<?= $gara->info["codice"] ?>"> |
|
<input type="hidden" name="codice_lotto" value="<?= $gara->lotto["codice"] ?? "0" ?>"> |
|
<? } ?> |
|
<script> |
|
var exportCSVInvitati = function() { |
|
let data = ["#;Codice Fiscale;Ragione Sociale;PEC"]; |
|
let count = 0; |
|
$("tr",".riepilogo-body").each(function(i,el) { |
|
count++; |
|
let columns = $(el).find("td"); |
|
row = [ |
|
count, |
|
columns[0].innerText, |
|
columns[1].innerText, |
|
columns[2].innerText, |
|
] |
|
const values = Object.values(row).join(';') |
|
data.push(values); |
|
}); |
|
data = data.join('\n'); |
|
const blob = new Blob([data], { type: 'text/csv' }); |
|
const url = window.URL.createObjectURL(blob) |
|
const hiddenElement = document.createElement('a'); |
|
hiddenElement.setAttribute('href', url) |
|
hiddenElement.setAttribute('download', 'Export Inviti - Lotto #<?= $lotto["numero"] ?> - <?= $lotto["cig"] ?>.csv'); |
|
hiddenElement.setAttribute('target','_blank'); |
|
hiddenElement.click(); |
|
} |
|
</script> |
|
<div id="riepilogo" class="card <?= (empty($countInvitati)) ? "collapse" : ""; ?>"> |
|
<div class="card-body"> |
|
<h3> |
|
<?= __("Invitati") ?> |
|
<button type="button" class="float-right btn btn-sm btn-primary" onclick="exportCSVInvitati()"> |
|
<span class="fa fa-file-csv"></span> <?= __("Esporta CSV") ?> |
|
</button> |
|
</h3> |
|
<table id="riepilogo-table-esistenti" class="table table-striped table-condensed riepilogo-table"> |
|
<thead> |
|
<tr> |
|
<th><?= __("Codice fiscale") ?></th> |
|
<th><?= __("Ragione sociale") ?></th> |
|
<th><?= __("PEC") ?></th> |
|
<th></th> |
|
</tr> |
|
</thead> |
|
<tbody id="riepilogo-body-esistenti" class="riepilogo-body"> |
|
<? |
|
if (!empty($invitati)) { |
|
foreach($invitati AS $oe) { |
|
include(__DIR__."/tr_invitato.php"); |
|
} |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
<div id="invitiManuali" <?= (empty($invitatiManuali)) ? "class='collapse'" : "" ?>> |
|
<h3><?= __("Invitati non iscritti") ?></h3> |
|
<table id="riepilogo-table-manuali" class="riepilogo-table table table-striped <?= (empty($countInvitati)) ? "collapse" : ""; ?>"> |
|
<thead> |
|
<tr> |
|
<th><?= __("Codice fiscale") ?></th> |
|
<th><?= __("Ragione sociale") ?></th> |
|
<th><?= __("PEC") ?></th> |
|
<th></th> |
|
</tr> |
|
</thead> |
|
<tbody id="riepilogo-body-manuali" class="riepilogo-body"> |
|
<? |
|
foreach($invitatiManuali AS $oe) { |
|
include(__DIR__."/tr_invitato_manuale.php"); |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
<? if (!$lock) { ?> |
|
<div class="card-footer"> |
|
<div class="d-flex"> |
|
<div class="col"> |
|
<button type="button" class="btn btn-block btn-warning" onClick="$('#tabella').slideDown(); $('#riepilogo').slideUp();" > |
|
<span class="fa fa-backward"></span> <?= __("Torna a selezione") ?> |
|
</button> |
|
</div> |
|
<div class="col"> |
|
<button type="submit" class="btn btn-block btn-success" > |
|
<span class="fa fa-check"></span> <?= __("Salva") ?> |
|
</button> |
|
</div> |
|
</div> |
|
</div> |
|
<? } ?> |
|
</div> |
|
<? if (!$lock) { ?> |
|
</form> |
|
<? } ?> |
|
<div id="riepilogo-alert" class="<?= (!empty($countInvitati) || !empty($ignoreAlertInvitati)) ? "collapse": "" ?>"> |
|
<? alertManager::printWarningBox(__("Nessun invito selezionato"),__("Scegliere una modalità di selezione dal menù in alto a destra")) ?> |
|
</div> |
|
<? |
|
} else { |
|
?> |
|
<div class="card card-body"> |
|
<? |
|
$relazioni = oeManager::getRelazioniEstrazione($estrazione["codice"]); |
|
oeManager::printReportEstrazione($estrazione,$relazioni); |
|
?> |
|
</div> |
|
<? |
|
} |
|
} else { |
|
alertManager::printAlertBox(__("Errore nella selezione della sorgente inviti"),__("Si prega di contattare l'Help desk")); |
|
} |
|
} |
|
include_once ($beRoot."/layout/bottom.php"); |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|