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.
165 righe
7.5 KiB
165 righe
7.5 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$id_modulo = "sorteggio"; |
|
$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"]) && !empty($_GET["codice_lotto"])) { |
|
$codice_round = $_GET["codice_round"] ?? NULL; |
|
$gara = gara::init($_GET["codice"],$codice_round); |
|
if (!empty($gara) && $gara->setLotto($_GET["codice_lotto"])) { |
|
$record = $gara->info; |
|
$round = $gara->round; |
|
$lotto = $gara->lotto; |
|
$partecipanti = []; |
|
$agg = $gara->getAggiudicatari(); |
|
$aggiudicatari = 0; |
|
if (count($agg) > 1) { |
|
$partecipanti = $agg; |
|
$aggiudicatari = count($agg); |
|
} else { |
|
$punteggioAggiudicazione = $agg[0]["totale"] ?? ""; |
|
$tmp = $gara->getPartecipanti(); |
|
if (!empty($tmp)) { |
|
foreach($tmp AS $partecipante) { |
|
if ($partecipante["aggiudicatario"] == "S" || $partecipante["totale"] == $punteggioAggiudicazione) { |
|
$punteggioAggiudicazione = $partecipante["totale"]; |
|
$partecipanti[] = $partecipante; |
|
if ($partecipante["aggiudicatario"]=="S") { |
|
$aggiudicatari++; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (count($partecipanti) > 1) { |
|
$lock = $gara->checkLock($cmd_info["id"]); |
|
if ($aggiudicatari === 1) { |
|
$lock = true; |
|
} else { |
|
$operatori = array_column($partecipanti,"codice_operatore"); |
|
$operatori = array_filter($operatori); |
|
if (!empty($operatori)) { |
|
$sorteggio = true; |
|
} |
|
} |
|
$titolo_modulo = __($cmd_info["titolo"]); |
|
|
|
$breadcrumb = array(); |
|
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb["/".$radice."/panel.php?codice=".$record["codice"]."&codice_round=".$round["codice"]] = __("Pannello"); |
|
if (!empty($_GET["codice_lotto"]) && count($gara->getLotti()) > 1) { |
|
$breadcrumb["/".$radice."/sorteggio/index.php?codice=".$record["codice"]."&codice_round=".$round["codice"]] = __("Scelta lotto"); |
|
} |
|
$breadcrumb[""] = $titolo_modulo; |
|
$extraInfo = $gara->getExtraInfo(); |
|
include_once ($beRoot."/layout/top.php"); |
|
?><h1><?= $titolo_modulo ?></h1> |
|
<form rel="validate" method="post" action="save.php" id="edit-form"> |
|
<input id="token" type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input id="codice" type="hidden" name="codice_lotto" value="<?= $lotto["codice"] ?>"> |
|
<input id="codice_gara" type="hidden" name="codice_gara" value="<?= $record["codice"] ?>"> |
|
<div class="card mb-2"> |
|
<div class="card-header"> |
|
<span class="card-title"><?= __("Estremi atto") ?>*</span> |
|
</div> |
|
<div class="card-body"> |
|
<div class="form-group"> |
|
<input id="estremi_sorteggio" class="form-control" name="estremi_sorteggio" title="<?= __("Estremi") ?>" rel="S;1;0;A" value="<?= $extraInfo["lotto"]["estremi_sorteggio"] ?? "" ?>"> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card"> |
|
<div class="card-body m-0 p-0"> |
|
<table class="table table-hover table-striped m-0"> |
|
<thead> |
|
<tr> |
|
<th><?= __("Codice fiscale") ?></th> |
|
<th><?= __("Denominazione") ?></th> |
|
<th><?= __("Punteggio") ?></th> |
|
<th><?= __("Aggiudicatario") ?></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? foreach($partecipanti AS $partecipante) { ?> |
|
<tr> |
|
<td width="5%"> |
|
<?= $partecipante["codice_fiscale"] ?> |
|
</td> |
|
<td> |
|
<?= $partecipante["ragione_sociale"] ?> |
|
</td> |
|
<td class="text-center" width="10"> |
|
<?= $partecipante["totale"] ?> |
|
</td> |
|
<td width="10" class="text-center"> |
|
<? if (!$lock) { ?> |
|
<div class="form-group"> |
|
<input type="radio" name="aggiudicatario" value="<?= $partecipante["codice"] ?>"> |
|
</div> |
|
<? } else { |
|
if ($partecipante["aggiudicatario"] == "S") { |
|
?> |
|
<span class="fa fa-trophy"></span> |
|
<? |
|
} |
|
} ?> |
|
</td> |
|
</tr> |
|
<? } ?> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
<button class="btn btn-success btn-block mt-2"><span class="fa fa-save"></span> <?= __("Salva") ?></button> |
|
</form> |
|
<? if ($lock) { |
|
$oeManager = new oeManager; |
|
$estrazione = oeManager::getEstrazione("gareSorteggio",$round["codice"],$gara->lotto["codice"]); |
|
$relazioni = $oeManager->getRelazioniEstrazione($estrazione["codice"]); |
|
if (!empty($estrazione) && !empty($relazioni)) { |
|
?> |
|
<button type="button" onclick='$("#reportSorteggio").slideToggle();' class="btn btn-info btn-block mt-2"><span class="fa fa-random"></span> <?= __("Verbale sorteggio") ?></button> |
|
<div id="reportSorteggio" class="my-3 collapse"> |
|
<div class="card card-body"> |
|
<? oeManager::printReportEstrazione($estrazione,$relazioni); ?> |
|
</div> |
|
</div> |
|
<? |
|
} |
|
} |
|
if (!$lock && !empty($sorteggio)) { ?> |
|
<div id="modal-sorteggio" class="modal fade" role="dialog" tabindex="-1"> |
|
<div class="modal-dialog" role="document"> |
|
<div class="modal-content"> |
|
<div class="modal-header text-right"> |
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
|
</div> |
|
<div class="modal-body"> |
|
<form rel="validate" method="post" action="sorteggio.php"> |
|
<input type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input type="hidden" name="codice_lotto" value="<?= $lotto["codice"] ?>"> |
|
<input type="hidden" name="codice_gara" value="<?= $record["codice"] ?>"> |
|
<? alertManager::printWarningBox(__("Vuoi continuare?"),__("Procedendo non sarà possibile effettuare modifiche")); ?> |
|
<button class="btn btn-lg btn-info btn-block"><?= __("Salva") ?></button> |
|
</form> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<button type="button" onclick='$("#modal-sorteggio").modal();' class="btn btn-info btn-block mt-2"><span class="fa fa-random"></span> <?= __("Effettua sorteggio") ?></button> |
|
<? } ?> |
|
<? |
|
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(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|