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.
253 righe
13 KiB
253 righe
13 KiB
<?php |
|
|
|
$error = true; |
|
if (!empty($npa) && !empty($npa->schede) && !empty($object)) { |
|
|
|
$error = false; |
|
|
|
// Schede esistenti |
|
$schede_da_stampare = $schede_esistenti = $npa->getCardsByType(true, true); |
|
// Schede disponibili alla creazione |
|
$schede_disponibili = $npa->oggetto->getDescendantCards(false); |
|
// Schede disponibili e rilevanti |
|
$schede_disponibili_rilevanti = $npa->filterCardsByType($schede_disponibili, false); |
|
// Mix |
|
foreach($schede_disponibili_rilevanti as $id => $scheda) { |
|
if(!isset($schede_da_stampare[$id]) || $scheda["multipla"]) { |
|
$schede_da_stampare[$id][] = $scheda; |
|
} |
|
} |
|
|
|
$operazioni = $pdo->prepare("SELECT * FROM b_npa_operazioni_schede WHERE b_npa_operazioni_schede.codice IN ( SELECT MAX(b_npa_operazioni_schede.codice) FROM b_npa_operazioni_schede WHERE codice_scheda = :codice_scheda AND esito IS NULL GROUP BY operazione )"); |
|
|
|
$_require_missing_cig = false; |
|
$alertManager = new alertManager("npa-{$npa->fascicolo["codice"]}"); |
|
if (!empty($npa->oggetto) && !empty($npa->fascicolo["data"] ?? false)) { |
|
if (!$npa->canDoRequest($errore)) { |
|
$alertManager->addDangerAlert($errore["msg"]); |
|
} |
|
} |
|
$stati = $npa->listAvailableStatusList(); |
|
|
|
|
|
$hasSchedePubblicate = false; |
|
$filterSchede = [ |
|
"stato" => [">=", 110], |
|
"codice_npa" => $npa->fascicolo["codice"], |
|
]; |
|
|
|
$hasSchedePubblicate = !empty(NuovaPiattaformaAppalti::fetchSchede(["id_scheda"], $filterSchede)); |
|
?> |
|
<div class="row mb-3"> |
|
<div class="col-12 text-right"> |
|
<?php if ($_SESSION["utente"]->isSupportoOrRoot()) : ?> |
|
<button class="btn btn-warning shadow-none" disabled> |
|
NPA <?= $npa->version ?> |
|
</button> |
|
<?php endif; ?> |
|
<?php if ($npa->canClearDossier()) : ?> |
|
<?php if (isset($errore["code"]) && $errore["code"] === "RUP_RP_MISMATCH") : ?> |
|
<button class="btn btn-danger" onclick='clearDossier(event, <?= $npa->fascicolo["codice"] ?>, "rp")'> |
|
<span class="fa fa-sync mr-2"></span> |
|
Aggiorna RP |
|
</button> |
|
<?php endif; ?> |
|
<?php endif; ?> |
|
<?php if ($_SESSION["utente"]->isSupportoOrRoot() && !$hasSchedePubblicate) : ?> |
|
<button class="btn btn-danger" onclick='clearDossier(event, <?= $npa->fascicolo["codice"] ?>, "nuclear")'> |
|
<span class="fa fa-biohazard mr-2"></span> |
|
Reset Fascicolo (!RISCHIOSO!) |
|
</button> |
|
<?php endif; ?> |
|
<?= $alertManager->printAlertModalButton() ?> |
|
<?php if (!empty($npa->fascicolo) && !empty($npa->fascicolo["id_appalto"])) : ?> |
|
<button class="btn btn-danger" onclick="showModalWithURL(`/backend/npa/ajax/deleghe_panel.php?codice=<?= $npa->fascicolo['codice'] ?>`)"> |
|
<span class="fa fa-lock mr-2"></span> <?= __("Permessi ANAC") ?> |
|
</button> |
|
|
|
<?php endif; ?> |
|
</div> |
|
</div> |
|
<div class="row"> |
|
<div class="col-md-4 col-12"> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<h4 class="mb-0"><?= __("Schede generali") ?></h4> |
|
</div> |
|
<div class="card-body"> |
|
<?php foreach ($schede_da_stampare as $id => $schede) : ?> |
|
<?php foreach ($schede as $scheda) : ?> |
|
<?php |
|
$stato = ["title" => __("Da creare"), "class" => "secondary", "icon" => "fa fa-plus-circle"]; |
|
$query = [ |
|
"scheda" => $id, |
|
"modulo_riferimento" => $npa->fascicolo["modulo_riferimento"] ?? null, |
|
"id_riferimento" => $npa->fascicolo["id_riferimento"] ?? null |
|
]; |
|
if(isset($scheda["stato"])) { |
|
$query["codice"] = $scheda["codice"] ?? 0; |
|
$stato = $stati[$scheda["stato"]] ?? $stati[-999]; |
|
|
|
if ($scheda["errore"] == "SI") { |
|
$stato["title"] = __("Errore nello stato:") . " \"{$stato["title"]}\""; |
|
$stato["icon"] = "fa fa-times-circle"; |
|
$stato["class"] = "danger"; |
|
$alertManager->addDangerAlert("La scheda " . str_replace("_", ".", $id) . " presenta errori."); |
|
} |
|
if ($scheda["stato"] >= 20 && $scheda["stato"] < 40) { |
|
$alertManager->addWarningAlert("La scheda " . str_replace("_", ".", $id) . " non è ancora stata confermata."); |
|
} |
|
if ($scheda["stato"] >= 50) { |
|
if ($scheda["categoria"] != "pianificazione") { |
|
$cig = $pdo->go("SELECT COUNT(codice) FROM b_npa_lotti WHERE codice_npa = :codice_npa AND (cig IS NULL OR cig = '')", [":codice_npa" => $npa->fascicolo["codice"]])->fetch(PDO::FETCH_COLUMN, 0); |
|
if ($cig > 0) { |
|
$_require_missing_cig = true; |
|
$alertManager->addWarningAlert("Attenzione, è necessario richiedere {$cig} CIG."); |
|
} |
|
} |
|
} |
|
if (NuovaPiattaformaAppalti::hasToBePublished($scheda) ?? false) { |
|
if ($scheda["stato"] >= 50 && $scheda["stato"] < 90) { |
|
$alertManager->addWarningAlert("La scheda " . str_replace("_", ".", $id) . " non ancora è stata pubblicata."); |
|
} |
|
} |
|
} |
|
?> |
|
<a href="/backend/npa/edit.php?<?= http_build_query($query) ?>" class="btn my-1 status-border-<?= $stato["class"] ?> btn-block btn-<?= isset($scheda["stato"]) ? "info" : "secondary" ?> text-left"> |
|
<?= str_replace('_', '.', $id) ?>) <strong><?= $scheda["titolo"] ?></strong> |
|
|
|
<?php if (isset($query["codice"])) : ?> |
|
<span>n°<?= $scheda["codice"] ?></span> |
|
- <i><?= mysql2datetime($scheda["timestamp_creazione"]) ?></i> |
|
<?php endif; ?> |
|
<br> |
|
<i class="<?= $stato["icon"] ?> mr-2"></i><?= $stato["title"] ?> |
|
<?php if (!empty($scheda["codice_rettifica"])) : ?> |
|
<div class="badge badge-warning ml-2"> |
|
Rettifica di n°<?= $scheda["codice_rettifica"] ?> |
|
</div> |
|
<?php endif; ?> |
|
<?php if (!empty($scheda["codice_modifica"])) : ?> |
|
<div class="badge badge-light ml-2"> |
|
Modifica di n°<?= $scheda["codice_modifica"] ?> |
|
</div> |
|
<?php endif; ?> |
|
</a> |
|
<?php endforeach; ?> |
|
<?php endforeach; ?> |
|
|
|
</div> |
|
</div> |
|
</div> |
|
<?php if ($npa->fascicolo["modulo_riferimento"] != "albo_fornitori") : ?> |
|
<div class="col-md-8 col-12 mt-md-0 mt-4"> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<h4 class="mb-0"><?= __("Schede relative ai lotti") ?></h4> |
|
</div> |
|
<div class="card-header text-right"> |
|
<form action="#" class="w-100" onsubmit="table.ajax.reload();"> |
|
<div class="row"> |
|
<? |
|
if ($_require_missing_cig) { |
|
?> |
|
<div class="col text-left pl-1"> |
|
<button class="btn btn-sm btn-primary text-uppercase mt-0 mb-0" onclick="getCIG('<?= $npa->fascicolo['codice'] ?>')" role="button"><i class="fas fa-download mr-3"></i><?= __("Ottieni CIG mancanti") ?></button> |
|
</div> |
|
<? |
|
} |
|
?> |
|
<div class="ml-auto col-sm-4 pr-1"> |
|
<div class="input-group input-group-sm"> |
|
<input type="text" id="cerca-lotti" class="form-control" placeholder="<?= __("Ricerca") ?>..." aria-label="<?= __("Ricerca") ?>..." aria-describedby="button-addon2"> |
|
<div class="input-group-append"> |
|
<button class="btn btn-primary" onclick="table.ajax.reload();" type="button" id="button-addon2"><i class="fas fa-search"></i></button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</form> |
|
</div> |
|
<style> |
|
.dataTables_info { |
|
margin-left: 5px; |
|
padding-bottom: 5px; |
|
} |
|
</style> |
|
<table class="table table-striped table-hover" id="tab-lotti" width="100%" style="margin: 0px !important"> |
|
<thead> |
|
<tr> |
|
<th width="10"></th> |
|
<th width="100"><?= __("CIG") ?></th> |
|
<th><?= __("Oggetto") ?></th> |
|
<th width="210"></th> |
|
</tr> |
|
</thead> |
|
<tbody id="sortable"> |
|
</tbody> |
|
</table> |
|
<script> |
|
var table = $("#tab-lotti").DataTable({ |
|
"processing": true, |
|
"serverSide": true, |
|
"searching": false, |
|
"lengthChange": false, |
|
"bPaginate": false, |
|
"language": { |
|
"url": "/dictionary/datatables/<?= $_SESSION["language"] ?>.lang" |
|
}, |
|
"ajax": { |
|
"url": "/backend/npa/lotti/table.php", |
|
"data": function(d) { |
|
d.fascicolo = "<?= $npa->fascicolo["codice"] ?>", |
|
d.cerca = $('#cerca-lotti').val() |
|
} |
|
}, |
|
"order": [ |
|
[1, 'asc'] |
|
], |
|
"drawCallback": function(settings) { |
|
$('[data-toggle="tooltip"]').tooltip(); |
|
}, |
|
"columns": [{ |
|
"class": "align-middle", |
|
"orderable": false |
|
}, |
|
{ |
|
"class": "text-center align-middle" |
|
}, |
|
{ |
|
"class": "align-middle", |
|
"orderable": false |
|
}, |
|
{ |
|
"class": "align-middle", |
|
"orderable": false |
|
} |
|
] |
|
}); |
|
</script> |
|
|
|
</div> |
|
</div> |
|
<?php endif; ?> |
|
<?= $npa->printJavascriptBoilerplate() ?> |
|
</div> |
|
<? |
|
|
|
if (!empty($alertManager->alerts)) { |
|
$alertManager->printModal(); |
|
} |
|
} |
|
|
|
if ($error) { |
|
|
|
?> |
|
<div class="card"> |
|
<div class="card-body"> |
|
<? alertManager::printWarningBox(__("Attenzione, il fascicolo dell'appalto non è stato inizializzato correttamente."), __("Si prega di riprovare o di contattare il servizio di HelpDesk.")); ?> |
|
</div> |
|
</div> |
|
<? |
|
|
|
}
|
|
|