Add "Licenze" and "Log Licenze" sections to admin panel

Introduced two new sections - "Licenze" and "Log Licenze" - to the admin sidebar and created corresponding controllers, views, modals, and scripts to support their functionality. These sections include filtering, listing, and basic interactions such as editing and deletion support.
This commit is contained in:
2025-04-30 09:29:59 +02:00
parent 86eb77de30
commit 0fdb2e1265
17 changed files with 1350 additions and 0 deletions
@@ -0,0 +1,38 @@
<?php
class Application_ControllerSection_Admin_Index_Licenze extends App_Controller_Sections_AbstractSection
{
public function __construct(App_Controller_Sections_Section $controller)
{
// $this->_moduleName = 'admin';
$this->_resourceName = 'licenze';
//Usato per abilitare la sezione filtri
$this->_enableModalFilter = false;
//Disable new insert of element
$this->_enableNewInsert = false;
parent::__construct($controller);
}
public function lista()
{
parent::lista();
$this->_controller->_MENUITEM = "licenze";
$this->_controller->_EVENTLOADER = $this->_controller->getRequest()->getActionName();
$this->_controller->_PAGETITLE = 'Elenco Licenze';
$this->_controller->_ICONTITLE = 'fa-key';
}
//Personalizzazione della funzione di delete Elemento singolo
/*protected function deleteElement($id){
$this->_model->delete($this->_resourceName,$id);
}*/
}
@@ -0,0 +1,36 @@
<?php
class Application_ControllerSection_Admin_Index_Loglicenze extends App_Controller_Sections_AbstractSection
{
public function __construct(App_Controller_Sections_Section $controller)
{
// $this->_moduleName = 'admin';
$this->_resourceName = 'LogLicenze';
//Usato per abilitare la sezione filtri
$this->_enableModalFilter = false;
//Disable new insert of element
$this->_enableNewInsert = false;
parent::__construct($controller);
}
public function lista()
{
parent::lista();
$this->_controller->_MENUITEM = "loglicenze";
$this->_controller->_EVENTLOADER = $this->_controller->getRequest()->getActionName();
$this->_controller->_PAGETITLE = 'Log Operazioni Licenze';
$this->_controller->_ICONTITLE = 'fa-list';
}
//Personalizzazione della funzione di delete Elemento singolo
/*protected function deleteElement($id){
$this->_model->delete($this->_resourceName,$id);
}*/
}
@@ -23,6 +23,22 @@
</a> </a>
</li> </li>
<li class="nav-item">
<a class="nav-link <?= ($this->menu == 'licenze') ? 'active' : ''; ?>"
href="<?= $this->url(array('action' => 'listlicenze'), 'admin', true); ?>">
<i class="nav-icon fas fa-key "></i>
<p> Licenze</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?= ($this->menu == 'loglicenze') ? 'active' : ''; ?>"
href="<?= $this->url(array('action' => 'listloglicenze'), 'admin', true); ?>">
<i class="nav-icon fas fa-list "></i>
<p> Log Licenze</p>
</a>
</li>
<li class="nav-item has-treeview <?= (in_array($this->menu, array('settings', 'emailtemplate'))) ? 'menu-open' : ''; ?>"> <li class="nav-item has-treeview <?= (in_array($this->menu, array('settings', 'emailtemplate'))) ? 'menu-open' : ''; ?>">
<a href="#" <a href="#"
class="nav-link <?= (in_array($this->menu, array('settings', 'emailtemplate'))) ? 'active' : ''; ?>"> class="nav-link <?= (in_array($this->menu, array('settings', 'emailtemplate'))) ? 'active' : ''; ?>">
@@ -0,0 +1,75 @@
<div class="modal fade" id="modal" data-form="modalForm" tabindex="-1" data-backdrop="false"
role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div id="modal-loader" class="overlay d-none justify-content-center align-items-center">
<i class="fas fa-2x fa-sync fa-spin"></i>
</div>
<div class="modal-header">
<h5 class="modal-title flot-left" id="myModalLabel"><i
class="fa fa-fw <?= ($this->iconTitle) ? $this->iconTitle : 'fa-pencil'; ?> modal_icon"></i>
Email Template</h5>
<button id="close-modal" type="button" class="close float-right" data-dismiss="modal"
aria-hidden="true">&times;
</button>
</div>
<div class="modal-body pdb-0">
<form id="modalForm" name="modalForm" class="compact-form no-border-radius"
action="<?= $this->url(array('controller' => 'index', 'action' => 'salva' . $this->resourceName), $this->moduleName, true); ?>"
data-get="<?= $this->url(array('controller' => 'index', 'action' => 'get' . $this->resourceName), $this->moduleName, true); ?>"
data-delete="<?= $this->url(array('controller' => 'index', 'action' => 'delete' . $this->resourceName, 'id' => $this->id), $this->moduleName, true); ?>"
method="post" role="form">
<input type="hidden" value="" class="form-control" id="id" name="id" form="modalForm" required>
<div class="row">
<div class="col-md-12">
<div id="ErrorDescription" class="alert alert-warning alert-sm d-none"></div>
</div>
<div class="col-12">
<div id="Codice" class="form-group row">
<label for="Codice" class="col-sm-2 col-form-label">Codice</label>
<div class="col-sm-10">
<input type="text" value="" class="form-control" id="Codice" placeholder="" name="Codice">
<!-- Contenitore per la descrizione degli errori -->
<div id="input-error" class="label label-danger hidden"></div>
</div>
</div>
</div>
<div class="col-12">
<div id="Nome" class="form-group row">
<label for="Nome" class="col-sm-2 col-form-label">Nome</label>
<div class="col-sm-10">
<input type="text" value="" class="form-control" id="Nome" placeholder="" name="Nome">
<!-- Contenitore per la descrizione degli errori -->
<div id="input-error" class="label label-danger hidden"></div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" id="undo" class="btn bg-gray pull-left" data-dismiss="modal"><i
class="fa fa-times"></i>
Chiudi
</button>
<button type="button" id="save" op="insert" class="btn btn-brand"><i class="fa fa-save"></i>
Salva
</button>
</div>
</div>
</div>
</div>
@@ -0,0 +1,95 @@
<!-- Post Modal Form -->
<div class="modal fade" id="filterModal" data-form="filterForm" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel"><i class="fa fa-filter float-left modal_icon"></i>
Ricerca <?= ucfirst($this->resourceName); ?></h5>
<button id="close-modal" type="button" class="close float-right" data-dismiss="modal"
aria-hidden="true">&times;
</button>
</div>
<div class="modal-body">
<form id="filterForm" name="filterForm"
action="<?= $this->url(array('module' => $this->moduleName, 'controller' => 'index', 'action' => 'list' . $this->resourceName, 'count' => $this->count, 'order' => $this->order, 'tipoOrder' => $this->tipoOrder), 'default', true); ?>"
method="post" class="form" role="form">
<input type="hidden" value="" class="form-control" id="id" placeholder="" name="id" required>
<div class="row">
<div class="col-6">
<div id="Codice" class="form-group">
<div class="row">
<div class="col-md-4"><label>Codice:</label></div>
<div class="col-md-8">
<input type="text" id="Codice" name="Codice"
value="<?= $this->search_params['Codice']; ?>"
class="form-control"/>
</div>
<div id="input-error"
class="col-md-12 form-error hidden label label-danger text-right"></div>
</div>
</div>
</div>
<div class="col-6">
<div id="Nome" class="form-group">
<div class="row">
<div class="col-md-4 no-padding-right"><label title="">Nome:</label></div>
<div class="col-md-8">
<input type="text" id="Nome" name="Nome"
value="<?= $this->search_params['Nome']; ?>"
class="form-control"/>
</div>
<div id="input-error"
class="col-md-12 form-error hidden label label-danger text-right"></div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div id="Oggetto" class="form-group">
<div class="row">
<div class="col-md-2 no-padding-right"><label title="">Oggetto:</label></div>
<div class="col-md-10">
<input type="text" id="Oggetto" name="Oggetto"
value="<?= $this->search_params['Oggetto']; ?>"
class="form-control"/>
</div>
<div id="input-error"
class="col-md-12 form-error hidden label label-danger text-right"></div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" id="resetFiltri" class="btn btn-warning"><i class="fa fa-eraser"></i>
Reset Filtri
</button>
<button type="button" id="undo" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i>
Annulla
</button>
<button type="submit" id="filtra" form="filterForm" class="btn btn-success"><i class="fa fa-filter"></i>
Cerca
</button>
<input type="submit" form="filterForm" class="d-none">
</div>
</div>
</div>
</div>
@@ -0,0 +1,37 @@
<div class="col-12 col-md-2 no-padding-r-sm">
<input type="text" id="PartitaIva_search" name="PartitaIva"
value="<?= $this->search_params['PartitaIva']; ?>"
class="form-control no-border-right-sm" placeholder="Partita Iva"/>
<input type="hidden" id="PartitaIva_search" name="PartitaIvaOP" value="LIKE">
</div>
<div class="col-12 col-md-2 no-padding-r-l-sm">
<input type="text" id="CodiceFiscale_search" name="CodiceFiscale"
value="<?= $this->search_params['CodiceFiscale']; ?>"
class="form-control no-border-right-sm" placeholder="Codice Fiscale"/>
</div>
<div class="col-12 col-md-4 no-padding-r-l-sm">
<input type="text" id="RagioneSociale_search" name="RagioneSociale" value="<?= $this->search_params['RagioneSociale']; ?>"
class="form-control no-border-right-sm" placeholder="Ragione Sociale"/>
<input type="hidden" id="RagioneSociale_search" name="RagioneSocialeOP" value="LIKE">
</div>
<div class="col-12 col-md-2 no-padding-r-l-sm">
<input type="text" id="Chiave_search" name="Chiave"
value="<?= $this->search_params['Chiave']; ?>"
class="form-control no-border-r-l-sm" placeholder="Chiave"/>
</div>
<div class="col-12 col-md-2 no-padding-l-sm">
<?php $totFilter = count($this->CleanFiltersParam($this->search_params)); ?>
<div class="btn-group">
<button type="submit" title="Cerca" class="btn btn-brand btn-flat"><i
class="fa fa-search fa-fw"></i></button>
<a href="<?= $this->url(array('module' => $this->moduleName, 'action' => 'list' . $this->resourceName, 'reset' => 'true'), 'default', true); ?>"
data-toggle="tooltip" data-container="body" data-placement="right"
title="Reset (Filtri attivi: <?= $totFilter; ?> )"
class="btn btn-brand btn-flat"
type="button"><i class="fa fa-times fa-fw"></i></a>
</div>
</div>
@@ -0,0 +1,170 @@
<div class="box box-no-border box-no-shadow pd10 mb-0">
<div class="box-header">
<div class="col-12">
<!--FORM DI RICERCA-->
<div class="float-left box-title search-left hidden-xs">
<form class="form-horizontal" id="searchForm" name="searchForm" method="post"
action="<?= $this->url(array('controller' => 'index', 'action' => 'list' . $this->resourceName), $this->moduleName, true); ?>">
<div class="row">
<?= $this->render("index/$this->resourceName/_searchBlock.phtml"); ?>
</div>
<input type="hidden" id="order" name="order" class="hidden" value="<?= $this->order; ?>"/>
<input type="hidden" id="tipoOrder" name="tipoOrder" class="hidden" value="<?= $this->tipoOrder; ?>"/>
</form>
</div>
<!--BLOCCO FUNZIONI LATO SINISTRA-->
<div class="float-right box-title search-right">
<div class="btn-group">
<?php if ($this->isActiveNewInsert): ?>
<button data-toggle="tooltip" title="Nuovo" id="new" class="btn btn-brand btn-flat" type="button"
data-target="#Modal" data-toggle="modal"><i class="fa fa-plus"></i></button>
<?php endif; ?>
<?php if ($this->isActiveFilterModal): ?>
<button data-toggle="tooltip" title="Filtra" id="filterData" class="btn btn-brand btn-flat"
type="button" data-target="#filterModal" data-toggle="modal">
<?php if ($totFilter > 0): ?>
<span class="badge bg-red"><?= $totFilter; ?></span>
<?php endif; ?>
<i class="fa fa-filter"></i>
</button>
<?php endif; ?>
<div class="dropdown">
<button class="btn btn-flat btn-brand dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="d-none-xs">Selezionati</span> <span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
<a id="delete_select" class="dropdown-item"
href="<?= $this->url(array('controller' => 'index', 'action' => 'deleteselect' . $this->resourceName), $this->moduleName, true); ?>">
<i class="fa fa-trash fa-fw"></i> Elimina</a>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- INIZIO TABELLA -->
<div class="box-body table-responsive table-wrapper">
<table class="table table-border table-striped flot-header">
<thead>
<?= $this->render("index/$this->resourceName/th.phtml") ?>
</thead>
<tbody id="tablebody">
<?php if (count($this->table) > 0): ?>
<?php foreach ($this->table as $key => $value): ?>
<?= $this->partial("index/$this->resourceName/td.phtml", $value) ?>
<?php endforeach; ?>
<?php else: ?>
<tr>
<?php if ($totFilter <= 0): ?>
<td id="norows" class="no-rows" colspan="10">
<i class="fa fa-exclamation-triangle"></i>
Nessun record presente
</td>
<?php else: ?>
<td id="norows" class="no-rows" colspan="10">
<i class="fa fa-exclamation-triangle"></i>
Nessun risultato trovato in base alla ricerca
</td>
<?php endif; ?>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="box-footer clearfix">
<div class="col-12">
<div class="row">
<!--FUNZIONE MULTIPLE-->
<div class="col-4 col-xs-12">
<div class="btn-group btn-group-sm float-left dropup d-none-xs dropdown-multifunction-down">
<button class="btn btn-default btn-flat" type="button">
Selezionati
</button>
<button class="btn btn-default btn-flat dropdown-toggle" data-toggle="dropdown" type="button">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<a id="delete_select" class="dropdown-item"
href="<?= $this->url(array('controller' => 'index', 'action' => 'deleteselect' . $this->resourceName), $this->moduleName, true); ?>">
<i class="fa fa-trash fa-fw"></i> Elimina</a>
</div>
</div>
</div>
<div class="col-8 col-xs-12">
<!--PAGINATOR FOOTER-->
<?php if ($this->table instanceof Zend_Paginator): ?>
<?= $this->paginationControl($this->table, 'Jumping', 'index/_paginator.phtml', array('action' => $this->action, 'count' => $this->count, 'moduleName'=>$this->moduleName)); ?>
<?php endif; ?>
<div class="pagination-counter float-right">
<form name="paginationCounter"
action="<?= $this->url(array('controller' => 'index', 'action' => 'list' . $this->resourceName, 'page' => $this->page, 'count' => $this->count), $this->moduleName, false); ?>"
class="" method="post" role="form">
<div class="input-group input-group-sm">
<label class="text-right d-none-xs mb-1" for="count">
<?php if ($this->totFiltrati != $this->totElementi): ?>
<span>Filtrati <?= $this->totFiltrati ?> su <?= $this->totElementi; ?> totali </span>
<?php else: ?>
<span>Tot. <?= $this->totElementi; ?></span>
<?php endif; ?>
</label>
<input type="text" class="form-control"
id="count" aria-describedby="inputGroup-sizing-sm"
value="" placeholder="<?= $this->count; ?>" name="count"/>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if ($this->isActiveModalDetail): ?>
<?= $this->render("index/$this->resourceName/_modal.phtml"); ?>
<?php endif; ?>
<?php if ($this->isActiveFilterModal): ?>
<?= $this->render("index/$this->resourceName/_modalFilter.phtml"); ?>
<?php endif; ?>
<?php if ($this->idDetail > 0): ?>
<script type="text/javascript">
$(document).ready(function () {
edit(<?= $this->idDetail; ?>);
});
</script>
<?php endif; ?>
@@ -0,0 +1,52 @@
<tr data-id="<?= $this->id ?>">
<td class="text-center"><input type="checkbox" value="<?= $this->id ?>" name="select-elements[]"
id="select-elements"></td>
<td>
<?= $this->IdentificativoDB; ?>
</td>
<td>
<?= $this->RagioneSociale; ?>
</td>
<td>
<?= $this->PartitaIva; ?>
</td>
<td>
<?= $this->CodiceFiscale; ?>
</td>
<td>
<?= $this->Chiave; ?>
</td>
<td>
<?= $this->IdentificativoPC; ?>
</td>
<td>
<?= $this->Versione; ?>
</td>
<td>
<span class="badge badge-<?= $this->Disattivo == '1' ? 'danger':'primary' ?>"><?= $this->Disattivo == '1' ? 'Si':'No'; ?></span>
</td>
<td>
<div class="text-center">
<!-- <button id="edit" class="btn btn-sm btn-brand btn-flat" type="button" data-toggle="tooltip"
data-container="body" title="Apri Scheda">
<span class="far fa-file fa-fw"></span>
</button>-->
<button id="delete" class="btn btn-sm bg-gray btn-flat" type="button" data-toggle="tooltip"
data-container="body" title="Elimina">
<span class="fa fa-trash fa-fw"></span>
</button>
</div>
</td>
</tr>
@@ -0,0 +1,23 @@
<tr>
<th style="width:60px;" class="text-center">
<div class="dropdown">
<button class="btn btn-default btn-sm dropdown-toggle dropdown-icon" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a id="select_all" class="dropdown-item" href="#"><i class="far fa-check-square fa-fw"></i> Tutti</a>
<a id="deselect_all" class="dropdown-item" href="#"><i class="far fa-square fa-fw"></i> Nessuno</a>
<a id="invert_all" class="dropdown-item" href="#"><i class="fa fa-check-square fa-fw"></i> Inverti</a>
</div>
</div>
</th>
<th data-ord="IdentificativoDB" width="150px">Identificativo DB</th>
<th data-ord="RagioneSociale">Ragione Sociale</th>
<th data-ord="PartitaIva" width="130px">Partita Iva</th>
<th data-ord="CodiceFiscale" width="160px">Codice Fiscale</th>
<th data-ord="Chiave" width="200px">Chiave</th>
<th data-ord="IdentificativoPC" width="300px">Identificativo PC</th>
<th data-ord="Versione" width="100px">Versione</th>
<th data-ord="Disattivo" width="75px">Disattivo</th>
<th width="100px"></th>
</tr>
@@ -0,0 +1,75 @@
<div class="modal fade" id="modal" data-form="modalForm" tabindex="-1" data-backdrop="false"
role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div id="modal-loader" class="overlay d-none justify-content-center align-items-center">
<i class="fas fa-2x fa-sync fa-spin"></i>
</div>
<div class="modal-header">
<h5 class="modal-title flot-left" id="myModalLabel"><i
class="fa fa-fw <?= ($this->iconTitle) ? $this->iconTitle : 'fa-pencil'; ?> modal_icon"></i>
Email Template</h5>
<button id="close-modal" type="button" class="close float-right" data-dismiss="modal"
aria-hidden="true">&times;
</button>
</div>
<div class="modal-body pdb-0">
<form id="modalForm" name="modalForm" class="compact-form no-border-radius"
action="<?= $this->url(array('controller' => 'index', 'action' => 'salva' . $this->resourceName), $this->moduleName, true); ?>"
data-get="<?= $this->url(array('controller' => 'index', 'action' => 'get' . $this->resourceName), $this->moduleName, true); ?>"
data-delete="<?= $this->url(array('controller' => 'index', 'action' => 'delete' . $this->resourceName, 'id' => $this->id), $this->moduleName, true); ?>"
method="post" role="form">
<input type="hidden" value="" class="form-control" id="id" name="id" form="modalForm" required>
<div class="row">
<div class="col-md-12">
<div id="ErrorDescription" class="alert alert-warning alert-sm d-none"></div>
</div>
<div class="col-12">
<div id="Codice" class="form-group row">
<label for="Codice" class="col-sm-2 col-form-label">Codice</label>
<div class="col-sm-10">
<input type="text" value="" class="form-control" id="Codice" placeholder="" name="Codice">
<!-- Contenitore per la descrizione degli errori -->
<div id="input-error" class="label label-danger hidden"></div>
</div>
</div>
</div>
<div class="col-12">
<div id="Nome" class="form-group row">
<label for="Nome" class="col-sm-2 col-form-label">Nome</label>
<div class="col-sm-10">
<input type="text" value="" class="form-control" id="Nome" placeholder="" name="Nome">
<!-- Contenitore per la descrizione degli errori -->
<div id="input-error" class="label label-danger hidden"></div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" id="undo" class="btn bg-gray pull-left" data-dismiss="modal"><i
class="fa fa-times"></i>
Chiudi
</button>
<button type="button" id="save" op="insert" class="btn btn-brand"><i class="fa fa-save"></i>
Salva
</button>
</div>
</div>
</div>
</div>
@@ -0,0 +1,95 @@
<!-- Post Modal Form -->
<div class="modal fade" id="filterModal" data-form="filterForm" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel"><i class="fa fa-filter float-left modal_icon"></i>
Ricerca <?= ucfirst($this->resourceName); ?></h5>
<button id="close-modal" type="button" class="close float-right" data-dismiss="modal"
aria-hidden="true">&times;
</button>
</div>
<div class="modal-body">
<form id="filterForm" name="filterForm"
action="<?= $this->url(array('module' => $this->moduleName, 'controller' => 'index', 'action' => 'list' . $this->resourceName, 'count' => $this->count, 'order' => $this->order, 'tipoOrder' => $this->tipoOrder), 'default', true); ?>"
method="post" class="form" role="form">
<input type="hidden" value="" class="form-control" id="id" placeholder="" name="id" required>
<div class="row">
<div class="col-6">
<div id="Codice" class="form-group">
<div class="row">
<div class="col-md-4"><label>Codice:</label></div>
<div class="col-md-8">
<input type="text" id="Codice" name="Codice"
value="<?= $this->search_params['Codice']; ?>"
class="form-control"/>
</div>
<div id="input-error"
class="col-md-12 form-error hidden label label-danger text-right"></div>
</div>
</div>
</div>
<div class="col-6">
<div id="Nome" class="form-group">
<div class="row">
<div class="col-md-4 no-padding-right"><label title="">Nome:</label></div>
<div class="col-md-8">
<input type="text" id="Nome" name="Nome"
value="<?= $this->search_params['Nome']; ?>"
class="form-control"/>
</div>
<div id="input-error"
class="col-md-12 form-error hidden label label-danger text-right"></div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<div id="Oggetto" class="form-group">
<div class="row">
<div class="col-md-2 no-padding-right"><label title="">Oggetto:</label></div>
<div class="col-md-10">
<input type="text" id="Oggetto" name="Oggetto"
value="<?= $this->search_params['Oggetto']; ?>"
class="form-control"/>
</div>
<div id="input-error"
class="col-md-12 form-error hidden label label-danger text-right"></div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" id="resetFiltri" class="btn btn-warning"><i class="fa fa-eraser"></i>
Reset Filtri
</button>
<button type="button" id="undo" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i>
Annulla
</button>
<button type="submit" id="filtra" form="filterForm" class="btn btn-success"><i class="fa fa-filter"></i>
Cerca
</button>
<input type="submit" form="filterForm" class="d-none">
</div>
</div>
</div>
</div>
@@ -0,0 +1,45 @@
<div class="col-12 col-md-2 no-padding-r-sm">
<input daterangepicker type="text" id="DataInserimento_search" name="DataInserimento"
value="<?= $this->search_params['DataInserimento']; ?>"
class="form-control no-border-right-sm" placeholder="Data Inserimento"/>
<input type="hidden" id="DataInserimento_search" name="DataInserimentoOP" value="DATERANGE">
</div>
<div class="col-12 col-md-2 no-padding-r-l-sm">
<input type="text" id="PartitaIva_search" name="PartitaIva"
value="<?= $this->search_params['PartitaIva']; ?>"
class="form-control no-border-right-sm" placeholder="Partita Iva"/>
<input type="hidden" id="PartitaIva_search" name="PartitaIvaOP" value="LIKE">
</div>
<div class="col-12 col-md-2 no-padding-r-l-sm">
<input type="text" id="CodiceFiscale_search" name="CodiceFiscale"
value="<?= $this->search_params['CodiceFiscale']; ?>"
class="form-control no-border-right-sm" placeholder="Codice Fiscale"/>
<input type="hidden" id="CodiceFiscale_search" name="CodiceFiscaleOP" value="LIKE">
</div>
<div class="col-12 col-md-2 no-padding-r-l-sm">
<input type="text" id="Descrizione_search" name="Descrizione" value="<?= $this->search_params['Descrizione']; ?>"
class="form-control no-border-right-sm" placeholder="Descrizione"/>
<input type="hidden" id="Descrizione_search" name="DescrizioneOP" value="LIKE">
</div>
<div class="col-12 col-md-2 no-padding-r-l-sm">
<input type="text" id="IdentificativoPC_search" name="IdentificativoPC" value="<?= $this->search_params['IdentificativoPC']; ?>"
class="form-control no-border-r-l-sm" placeholder="Identificativo PC"/>
<input type="hidden" id="IdentificativoPC_search" name="IdentificativoPCOP" value="LIKE">
</div>
<div class="col-12 col-md-2 no-padding-l-sm">
<?php $totFilter = count($this->CleanFiltersParam($this->search_params)); ?>
<div class="btn-group">
<button type="submit" title="Cerca" class="btn btn-brand btn-flat"><i
class="fa fa-search fa-fw"></i></button>
<a href="<?= $this->url(array('module' => $this->moduleName, 'action' => 'list' . $this->resourceName, 'reset' => 'true'), 'default', true); ?>"
data-toggle="tooltip" data-container="body" data-placement="right"
title="Reset (Filtri attivi: <?= $totFilter; ?> )"
class="btn btn-brand btn-flat"
type="button"><i class="fa fa-times fa-fw"></i></a>
</div>
</div>
@@ -0,0 +1,170 @@
<div class="box box-no-border box-no-shadow pd10 mb-0">
<div class="box-header">
<div class="col-12">
<!--FORM DI RICERCA-->
<div class="float-left box-title search-left hidden-xs">
<form class="form-horizontal" id="searchForm" name="searchForm" method="post"
action="<?= $this->url(array('controller' => 'index', 'action' => 'list' . $this->resourceName), $this->moduleName, true); ?>">
<div class="row">
<?= $this->render("index/$this->resourceName/_searchBlock.phtml"); ?>
</div>
<input type="hidden" id="order" name="order" class="hidden" value="<?= $this->order; ?>"/>
<input type="hidden" id="tipoOrder" name="tipoOrder" class="hidden" value="<?= $this->tipoOrder; ?>"/>
</form>
</div>
<!--BLOCCO FUNZIONI LATO SINISTRA-->
<div class="float-right box-title search-right">
<div class="btn-group">
<?php if ($this->isActiveNewInsert): ?>
<button data-toggle="tooltip" title="Nuovo" id="new" class="btn btn-brand btn-flat" type="button"
data-target="#Modal" data-toggle="modal"><i class="fa fa-plus"></i></button>
<?php endif; ?>
<?php if ($this->isActiveFilterModal): ?>
<button data-toggle="tooltip" title="Filtra" id="filterData" class="btn btn-brand btn-flat"
type="button" data-target="#filterModal" data-toggle="modal">
<?php if ($totFilter > 0): ?>
<span class="badge bg-red"><?= $totFilter; ?></span>
<?php endif; ?>
<i class="fa fa-filter"></i>
</button>
<?php endif; ?>
<!--<div class="dropdown">
<button class="btn btn-flat btn-brand dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="d-none-xs">Selezionati</span> <span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
<a id="delete_select" class="dropdown-item"
href="<?php /*= $this->url(array('controller' => 'index', 'action' => 'deleteselect' . $this->resourceName), $this->moduleName, true); */?>">
<i class="fa fa-trash fa-fw"></i> Elimina</a>
</div>
</div>-->
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- INIZIO TABELLA -->
<div class="box-body table-responsive table-wrapper">
<table class="table table-border table-striped flot-header">
<thead>
<?= $this->render("index/$this->resourceName/th.phtml") ?>
</thead>
<tbody id="tablebody">
<?php if (count($this->table) > 0): ?>
<?php foreach ($this->table as $key => $value): ?>
<?= $this->partial("index/$this->resourceName/td.phtml", $value) ?>
<?php endforeach; ?>
<?php else: ?>
<tr>
<?php if ($totFilter <= 0): ?>
<td id="norows" class="no-rows" colspan="6">
<i class="fa fa-exclamation-triangle"></i>
Nessun record presente
</td>
<?php else: ?>
<td id="norows" class="no-rows" colspan="6">
<i class="fa fa-exclamation-triangle"></i>
Nessun risultato trovato in base alla ricerca
</td>
<?php endif; ?>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="box-footer clearfix">
<div class="col-12">
<div class="row">
<!--FUNZIONE MULTIPLE-->
<!--<div class="col-4 col-xs-12">
<div class="btn-group btn-group-sm float-left dropup d-none-xs dropdown-multifunction-down">
<button class="btn btn-default btn-flat" type="button">
Selezionati
</button>
<button class="btn btn-default btn-flat dropdown-toggle" data-toggle="dropdown" type="button">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<a id="delete_select" class="dropdown-item"
href="<?php /*= $this->url(array('controller' => 'index', 'action' => 'deleteselect' . $this->resourceName), $this->moduleName, true); */?>">
<i class="fa fa-trash fa-fw"></i> Elimina</a>
</div>
</div>
</div>-->
<div class="col-8 col-xs-12">
<!--PAGINATOR FOOTER-->
<?php if ($this->table instanceof Zend_Paginator): ?>
<?= $this->paginationControl($this->table, 'Jumping', 'index/_paginator.phtml', array('action' => $this->action, 'count' => $this->count, 'moduleName'=>$this->moduleName)); ?>
<?php endif; ?>
<div class="pagination-counter float-right">
<form name="paginationCounter"
action="<?= $this->url(array('controller' => 'index', 'action' => 'list' . $this->resourceName, 'page' => $this->page, 'count' => $this->count), $this->moduleName, false); ?>"
class="" method="post" role="form">
<div class="input-group input-group-sm">
<label class="text-right d-none-xs mb-1" for="count">
<?php if ($this->totFiltrati != $this->totElementi): ?>
<span>Filtrati <?= $this->totFiltrati ?> su <?= $this->totElementi; ?> totali </span>
<?php else: ?>
<span>Tot. <?= $this->totElementi; ?></span>
<?php endif; ?>
</label>
<input type="text" class="form-control"
id="count" aria-describedby="inputGroup-sizing-sm"
value="" placeholder="<?= $this->count; ?>" name="count"/>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if ($this->isActiveModalDetail): ?>
<?= $this->render("index/$this->resourceName/_modal.phtml"); ?>
<?php endif; ?>
<?php if ($this->isActiveFilterModal): ?>
<?= $this->render("index/$this->resourceName/_modalFilter.phtml"); ?>
<?php endif; ?>
<?php if ($this->idDetail > 0): ?>
<script type="text/javascript">
$(document).ready(function () {
edit(<?= $this->idDetail; ?>);
});
</script>
<?php endif; ?>
@@ -0,0 +1,44 @@
<tr data-id="<?= $this->id ?>">
<!--<td class="text-center"><input type="checkbox" value="<?php /*= $this->id */?>" name="select-elements[]"
id="select-elements"></td>-->
<td class="text-center">
<?= $this->id; ?>
</td>
<td>
<?= $this->DataInserimento; ?>
</td>
<td>
<?= $this->Descrizione; ?>
</td>
<td>
<?= $this->PartitaIva; ?>
</td>
<td>
<?= $this->CodiceFiscale; ?>
</td>
<td>
<?= $this->IdentificativoPC; ?>
</td>
<!--<td>
<div class="text-center">
<button id="edit" class="btn btn-sm btn-brand btn-flat" type="button" data-toggle="tooltip"
data-container="body" title="Apri Scheda">
<span class="far fa-file fa-fw"></span>
</button>
<button id="delete" class="btn btn-sm bg-gray btn-flat" type="button" data-toggle="tooltip"
data-container="body" title="Elimina">
<span class="fa fa-trash fa-fw"></span>
</button>
</div>
</td>-->
</tr>
@@ -0,0 +1,21 @@
<tr>
<!--<th style="width:60px;" class="text-center">
<div class="dropdown">
<button class="btn btn-default btn-sm dropdown-toggle dropdown-icon" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a id="select_all" class="dropdown-item" href="#"><i class="far fa-check-square fa-fw"></i> Tutti</a>
<a id="deselect_all" class="dropdown-item" href="#"><i class="far fa-square fa-fw"></i> Nessuno</a>
<a id="invert_all" class="dropdown-item" href="#"><i class="fa fa-check-square fa-fw"></i> Inverti</a>
</div>
</div>
</th>-->
<th data-ord="id" width="60px" class="text-center">#</th>
<th data-ord="DataInserimento" width="150px">Data Inserimento</th>
<th data-ord="Descrizione">Descrizione</th>
<th data-ord="PartitaIva" width="130px">Partita Iva</th>
<th data-ord="CodiceFiscale" width="160px">Codice Fiscale</th>
<th data-ord="IdentificativoPC" width="300px">Identificativo PC</th>
<!--<th width="100px"></th>-->
</tr>
@@ -0,0 +1,179 @@
'use strict';
function beforeSubmit() {
modalLoader.removeClass('d-none').addClass('d-flex');
}
function errorOnSubmit() {
modalLoader.removeClass('d-flex').addClass('d-none');
}
function afterSubmit(resp) {
if (resp.success === 'invalid') {
showErrors(form_id, resp);
} else if (resp.success === true) {
let id;
let mex = '';
if (resp.op === 'insert') {
$('#tablebody').prepend(resp.text);
$('input#id').val(resp.data.id);
mex = 'Inserimento effettuato con successo';
id = resp.data.id;
} else {
$('tr[data-id=' + resp.id + ']').replaceWith(resp.text);
mex = 'Modifca effettuata con successo';
id = resp.id;
}
refreshFormComponents();
$('#norows').remove();
$(modal_id).modal('hide');
$('#save').attr('op', 'insert');
myResetForm('', form_id);
toastr.success(mex);
} else {
toastr.error(resp.shortMessage);
console.error(resp.message);
}
modalLoader.removeClass('d-flex').addClass('d-none');
}
//Specializzo la funzione resetForm nel caso ci sia bisogno di campi TEXTAREA o immagini da resettare
function myResetForm(tipo, formid) {
resetForm(tipo, formid);
$('textarea#Testo').summernote('code', '');
}
function edit(id) {
$('#save').attr('op', 'edit');
var dati = 'id=' + id;
var url = $(form_id).attr('data-get');
myResetForm('all', form_id);
$.getJSON(url, dati, function (resp) {
if (resp.success) {
populateForm(resp, form);
$('textarea#Testo').summernote('code', resp.Testo);
$(modal_id).modal('show');
} else {
toastr.error(resp.message);
}
});
}
$(document).ready(function () {
initFormComponents();
initTableFlotHeader();
}).delegate('#new', 'click', function (link) {
link.preventDefault();
myResetForm('tutto', form_id);
$('#save').attr('op', 'insert');
$(modal_id).modal('show');
})
.delegate('#save', 'click', function (link) {
link.preventDefault();
var operation = $(this).attr('op');
var options = {
target: '#ErrorDescription',
beforeSubmit: beforeSubmit,
success: afterSubmit,
error: errorOnSubmit,
data: {
op: operation
},
dataType: 'json',
resetForm: false
};
$(form_id).ajaxSubmit(options);
})
.delegate('#edit,#editLink', 'click', function (link) {
link.preventDefault();
const id = $(this).parents('tr').attr('data-id');
edit(id);
})
.delegate('#delete', 'click', function (link) {
link.preventDefault();
const url = $(form_id).attr('data-delete');
let tr = $(this).parents('tr');
const cod = tr.attr('data-cod');
let id = tr.attr('data-id');
let message = 'Sei sicuro di voler eliminare definitivamente l\'elemento?';
if (confirm(message)) {
$.ajax({
type: 'POST',
url: url,
data: 'id=' + id + "&cod=" + cod,
dataType: 'json',
complete: function (resp) {
resp = jQuery.parseJSON(resp.responseText);
if (resp.success) {
tr.animate({
'opacity': 'hide'
}, 500, function () {
tr.remove();
});
toastr.success('Eliminazione effettuata con successo');
} else {
toastr.error(resp.message);
}
}
});
}
})
.delegate('#delete_select', 'click', function (link) {
link.preventDefault();
let message = 'Sei sicuro di voler eliminare definitivamente gli elementi selezionati?';
if (confirm(message)) {
let data = [];
$('#tablebody').find(':checkbox').each(function () {
if (this.checked) {
data.push($(this).val());
}
});
let url = $(this).attr('href');
$.ajax({
type: 'POST',
url: url,
data: {
data: data
},
dataType: 'json',
complete: function (resp) {
resp = jQuery.parseJSON(resp.responseText);
if (resp.success) {
var ids = resp.id;
for (var i = 0; i < ids.length; i++) {
var tr = $('#tablebody tr[data-id=' + ids[i] + ']');
tr.animate({
'opacity': 'hide'
}, 500, function () {
tr.remove();
});
}
} else {
toastr.error(resp.message);
}
$('#tablebody').find(':checkbox').iCheck('uncheck');
}
});
}
})
.delegate(modal_id,'hidden.bs.modal',function(link){
link.preventDefault();
myResetForm('tutto', form_id);
$('#save').attr('op', 'insert');
});
@@ -0,0 +1,179 @@
'use strict';
function beforeSubmit() {
modalLoader.removeClass('d-none').addClass('d-flex');
}
function errorOnSubmit() {
modalLoader.removeClass('d-flex').addClass('d-none');
}
function afterSubmit(resp) {
if (resp.success === 'invalid') {
showErrors(form_id, resp);
} else if (resp.success === true) {
let id;
let mex = '';
if (resp.op === 'insert') {
$('#tablebody').prepend(resp.text);
$('input#id').val(resp.data.id);
mex = 'Inserimento effettuato con successo';
id = resp.data.id;
} else {
$('tr[data-id=' + resp.id + ']').replaceWith(resp.text);
mex = 'Modifca effettuata con successo';
id = resp.id;
}
refreshFormComponents();
$('#norows').remove();
$(modal_id).modal('hide');
$('#save').attr('op', 'insert');
myResetForm('', form_id);
toastr.success(mex);
} else {
toastr.error(resp.shortMessage);
console.error(resp.message);
}
modalLoader.removeClass('d-flex').addClass('d-none');
}
//Specializzo la funzione resetForm nel caso ci sia bisogno di campi TEXTAREA o immagini da resettare
function myResetForm(tipo, formid) {
resetForm(tipo, formid);
$('textarea#Testo').summernote('code', '');
}
function edit(id) {
$('#save').attr('op', 'edit');
var dati = 'id=' + id;
var url = $(form_id).attr('data-get');
myResetForm('all', form_id);
$.getJSON(url, dati, function (resp) {
if (resp.success) {
populateForm(resp, form);
$('textarea#Testo').summernote('code', resp.Testo);
$(modal_id).modal('show');
} else {
toastr.error(resp.message);
}
});
}
$(document).ready(function () {
initFormComponents();
initTableFlotHeader();
}).delegate('#new', 'click', function (link) {
link.preventDefault();
myResetForm('tutto', form_id);
$('#save').attr('op', 'insert');
$(modal_id).modal('show');
})
.delegate('#save', 'click', function (link) {
link.preventDefault();
var operation = $(this).attr('op');
var options = {
target: '#ErrorDescription',
beforeSubmit: beforeSubmit,
success: afterSubmit,
error: errorOnSubmit,
data: {
op: operation
},
dataType: 'json',
resetForm: false
};
$(form_id).ajaxSubmit(options);
})
.delegate('#edit,#editLink', 'click', function (link) {
link.preventDefault();
const id = $(this).parents('tr').attr('data-id');
edit(id);
})
.delegate('#delete', 'click', function (link) {
link.preventDefault();
const url = $(form_id).attr('data-delete');
let tr = $(this).parents('tr');
const cod = tr.attr('data-cod');
let id = tr.attr('data-id');
let message = 'Sei sicuro di voler eliminare definitivamente l\'elemento?';
if (confirm(message)) {
$.ajax({
type: 'POST',
url: url,
data: 'id=' + id + "&cod=" + cod,
dataType: 'json',
complete: function (resp) {
resp = jQuery.parseJSON(resp.responseText);
if (resp.success) {
tr.animate({
'opacity': 'hide'
}, 500, function () {
tr.remove();
});
toastr.success('Eliminazione effettuata con successo');
} else {
toastr.error(resp.message);
}
}
});
}
})
.delegate('#delete_select', 'click', function (link) {
link.preventDefault();
let message = 'Sei sicuro di voler eliminare definitivamente gli elementi selezionati?';
if (confirm(message)) {
let data = [];
$('#tablebody').find(':checkbox').each(function () {
if (this.checked) {
data.push($(this).val());
}
});
let url = $(this).attr('href');
$.ajax({
type: 'POST',
url: url,
data: {
data: data
},
dataType: 'json',
complete: function (resp) {
resp = jQuery.parseJSON(resp.responseText);
if (resp.success) {
var ids = resp.id;
for (var i = 0; i < ids.length; i++) {
var tr = $('#tablebody tr[data-id=' + ids[i] + ']');
tr.animate({
'opacity': 'hide'
}, 500, function () {
tr.remove();
});
}
} else {
toastr.error(resp.message);
}
$('#tablebody').find(':checkbox').iCheck('uncheck');
}
});
}
})
.delegate(modal_id,'hidden.bs.modal',function(link){
link.preventDefault();
myResetForm('tutto', form_id);
$('#save').attr('op', 'insert');
});