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.
172 righe
7.3 KiB
172 righe
7.3 KiB
<? |
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "public_html")) . "/config.php"; |
|
include_once($configPath); |
|
$id_modulo = "lotti"; |
|
$cmd_info = concorso::getInfoModulo($id_modulo); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($cmd_info["modulo_riferimento"], $_GET["codice"], $id_modulo)) { |
|
$codice_round = $_GET["codice_round"] ?? NULL; |
|
$concorso = concorso::init($_GET["codice"], $codice_round); |
|
if (!empty($concorso)) { |
|
$record = $concorso->info; |
|
$round = $concorso->round; |
|
$lock = $concorso->checkLock($cmd_info["id"]); |
|
$canAddOrRemoveLotti = $concorso->canAddOrRemoveLotti(); |
|
$titolo_modulo = __($cmd_info["titolo"]); |
|
$lotti = $concorso->getLotti(); |
|
|
|
$breadcrumb = array(); |
|
$breadcrumb["/" . $radice . "/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb["/" . $radice . "/panel.php?codice=" . $record["codice"] . "&codice_round=" . $round["codice"]] = __("Pannello"); |
|
$breadcrumb[""] = $titolo_modulo; |
|
|
|
include_once($beRoot . "/layout/top.php"); |
|
?><h1><?= $titolo_modulo ?></h1> |
|
|
|
<div id="commands" class="mb-5"> |
|
<div class="commands container-fluid"> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<?php if($canAddOrRemoveLotti) : ?> |
|
<? if (!$lock) { ?> |
|
<button onClick="showModalWithURL('massive/form.php?codice_concorso=<?= $record["codice"] ?>')" class="btn btn-warning" title="<?= __('Importazione massiva') ?>"><span class="fa fa-upload"></span> <?= __('Importazione massiva') ?></button> |
|
<? if (!empty($lotti)) { ?> |
|
<button id="createLotto" onClick="showModalWithURL('edit.php?codice_concorso=<?= $record["codice"] ?>&codice=0')" class="btn btn-success" title="<?= __('Aggiungi nuovo') ?>"><span class="fa fa-plus-circle"></span> <?= __('Aggiungi nuovo') ?></button> |
|
<? } ?> |
|
<? } ?> |
|
<?php endif; ?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
if (!empty($lotti)) { |
|
if (count($lotti) > 1) { |
|
$totaleLotti = 0; |
|
?> |
|
<div class="card mb-2"> |
|
<div class="card-body"> |
|
<div class="table-responsive"> |
|
<table class="table table-striped table-hover m-0"> |
|
<thead> |
|
<tr> |
|
<th width="10"></th> |
|
<th width="10">#</th> |
|
<th width="10"><?= __("CIG") ?></th> |
|
<th><?= __("descrizione") ?></th> |
|
<th width="200"><?= __("Premio") ?></th> |
|
<th width="10"></th> |
|
<th width="10"></th> |
|
</tr> |
|
</thead> |
|
<tbody id="listlotti"> |
|
<? |
|
foreach ($lotti as $lotto) { |
|
$status = "bg-danger"; |
|
?> |
|
<tr class="rowlotti"> |
|
<td width="10" class="handle"><span class="text-disabled fa fa-bars"></span></td> |
|
<td width="10" class="numeroLotto"><?= $lotto["numero"] ?></td> |
|
<td width="10"><?= $lotto["cig"] ?></td> |
|
<td> |
|
<input class="ordinamento" type="hidden" name="ordinamento-lotti[<?= $lotto["codice"] ?>]" value="<?= $lotto["ordinamento"] ?>"> |
|
<strong><?= $lotto["oggetto"] ?></strong> |
|
</td> |
|
<td class="text-right">€ <?= number_format($lotto["importoBase"],2,",",".") ?></td> |
|
<td width="10"> |
|
<button onClick="showModalWithURL('edit.php?codice_concorso=<?= $record["codice"] ?>&codice=<?= $lotto["codice"] ?>')" class="btn btn-block btn-sm btn-info" title="<?= __('modifica') ?>"><span class="fa fa-edit"></span></button> |
|
</td> |
|
<td width="10"> |
|
<?php if($canAddOrRemoveLotti) : ?> |
|
<? if (!$lock) { ?><button title="<?= __("elimina") ?>" class="btn btn-sm btn-danger" onclick="elimina('<?= $lotto["codice"] ?>','concorsi/lotti','codice_concorso=<?= $lotto["codice_concorso"] ?>');"><span class='fa fa-times'></span></button><? } ?> |
|
<?php endif; ?> |
|
</td> |
|
</tr> |
|
<? |
|
$totaleLotti += $lotto["importoBase"]; |
|
} |
|
$differenza = $record["prezzoRiferimento"] - $totaleLotti; |
|
?> |
|
</tbody> |
|
<tfoot> |
|
<tr> |
|
<td colspan="4" class="text-right"><?= __("Totali") ?></td> |
|
<td class="text-right">€ <?= number_format($totaleLotti,2,",",".") ?></td> |
|
<td></td> |
|
<td></td> |
|
</tr> |
|
</tfoot> |
|
</table> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card mb-2"> |
|
<div class="card-body"> |
|
<table class="table"> |
|
<thead> |
|
<tr> |
|
<th class="text-center"><?= __("Totale lotti") ?></th> |
|
<th class="text-center"><?= __("Totale concorso") ?></th> |
|
<th class="text-center"><?= __("Differenza") ?></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<tr> |
|
<td class="text-center">€ <?= number_format($totaleLotti,2,",",".") ?></td> |
|
<td class="text-center">€ <?= number_format($record["prezzoRiferimento"],2,",",".") ?></td> |
|
<td class="text-center <?= ($differenza != 0) ? "text-danger" : "text-success" ?>">€ <?= number_format($differenza,2,",",".") ?></td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
<? |
|
if (!$lock && $canAddOrRemoveLotti) { |
|
?> |
|
<script> |
|
$("#listlotti").sortable({ |
|
handle: ".handle", |
|
update: function(event, ui) { |
|
$(".rowlotti", "#listlotti").each(function(index, el) { |
|
$(this).find('.ordinamento').val(index); |
|
$(this).find('.numeroLotto').html(index + 1); |
|
}); |
|
let data = $('.ordinamento').serialize(); |
|
data += "&codice=<?= $concorso->info["codice"] ?>"; |
|
|
|
$.ajax({ |
|
type: "POST", |
|
url: '/backend/concorsi/lotti/save-order.php', |
|
data: data, |
|
async: true |
|
}); |
|
} |
|
}); |
|
</script> |
|
<? |
|
} |
|
} else { |
|
$lotto = reset($lotti); |
|
include(__DIR__."/edit.php"); |
|
} |
|
if (!$lock && !empty($_GET["createLotto"])) { ?> |
|
<script>$("#createLotto").trigger('click');</script> |
|
<? } |
|
} else { |
|
if (!$lock) { |
|
$lotto = get_campi("b_concorsi_lotti"); |
|
$lotto["oggetto"] = strip_tags($concorso->info["oggetto"]); |
|
include(__DIR__."/edit.php"); |
|
} else { |
|
alertManager::printWarningBox(__("Nessun risultato")); |
|
} |
|
} |
|
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(); |
|
} |
|
?>
|