2019-09-24 10:09:29 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-09-24 10:09:29 +02:00
|
|
|
|
2021-08-02 18:27:28 +02:00
|
|
|
use Modules\Anagrafiche\Anagrafica;
|
|
|
|
use Modules\Anagrafiche\Referente;
|
|
|
|
use Modules\Anagrafiche\Sede;
|
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<form action="" method="post" id="edit-form">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
<input type="hidden" name="op" value="update">
|
|
|
|
|
|
|
|
<!-- DATI -->
|
|
|
|
<div class="panel panel-primary">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">'.tr('Dati campagna').'</h3>
|
|
|
|
</div>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<div class="panel-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "required": 1, "value": "$name$" ]}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
{[ "type": "textarea", "label": "'.tr('Descrizione').'", "name": "description", "required": 0, "value": "$description$" ]}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
{[ "type": "textarea", "label": "'.tr('Query dinamica').'", "name": "query", "required": 0, "value": "$query$", "help": "'.tr("La query SQL deve restituire gli identificativi delle anagrafiche da inserire nella lista, sotto un campo di nome ''id''").'. '.tr('Per esempio: _SQL_', [
|
2021-08-02 18:27:28 +02:00
|
|
|
'_SQL_' => 'SELECT idanagrafica AS id, \'anagrafica\' AS tipo FROM an_anagrafiche',
|
2019-09-24 10:09:29 +02:00
|
|
|
]).'" ]}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<form action="" method="post" id="receivers-form">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
<input type="hidden" name="op" value="add_receivers">
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<!-- Destinatari -->
|
|
|
|
<div class="box box-primary">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">'.tr('Aggiunta destinatari').'</h3>
|
|
|
|
</div>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<div class="box-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2021-08-02 18:27:28 +02:00
|
|
|
{[ "type": "select", "label": "'.tr('Destinatari').'", "name": "receivers[]", "ajax-source": "destinatari_newsletter", "multiple": 1, "disabled": '.intval(!empty($lista->query)).' ]}
|
2019-09-24 10:09:29 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<div class="row pull-right">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
|
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>';
|
|
|
|
|
2021-08-02 18:27:28 +02:00
|
|
|
$destinatari = $lista->getDestinatari();
|
2019-09-24 10:09:29 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
<!-- Destinatari -->
|
|
|
|
<div class="panel panel-primary">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">
|
|
|
|
'.tr('Destinatari').'
|
2021-08-02 18:27:28 +02:00
|
|
|
<span class="badge">'.$destinatari->count().'</span>
|
2019-09-24 10:09:29 +02:00
|
|
|
</h3>
|
|
|
|
</div>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<div class="panel-body">';
|
|
|
|
|
2021-08-02 18:27:28 +02:00
|
|
|
if (!$destinatari->isEmpty()) {
|
2019-09-24 10:09:29 +02:00
|
|
|
echo '
|
|
|
|
<table class="table table-hover table-condensed table-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Nome').'</th>
|
|
|
|
<th class="text-center">'.tr('Indirizzo').'</th>
|
|
|
|
<th class="text-center" width="60">#</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2020-09-07 15:04:06 +02:00
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
<tbody>';
|
|
|
|
|
2021-08-02 18:27:28 +02:00
|
|
|
foreach ($destinatari as $destinatario) {
|
|
|
|
$anagrafica = $destinatario instanceof Anagrafica ? $destinatario : $destinatario->anagrafica;
|
|
|
|
$descrizione = $anagrafica->ragione_sociale;
|
|
|
|
|
|
|
|
if ($destinatario instanceof Sede) {
|
|
|
|
$descrizione .= ' ['.$destinatario->nomesede.']';
|
|
|
|
} elseif ($destinatario instanceof Referente) {
|
|
|
|
$descrizione .= ' ['.$destinatario->nome.']';
|
|
|
|
}
|
|
|
|
|
2019-09-24 10:09:29 +02:00
|
|
|
echo '
|
2021-08-02 18:27:28 +02:00
|
|
|
<tr '.(empty($destinatario->email) ? 'class="bg-danger"' : '').'>
|
|
|
|
<td>'.Modules::link('Anagrafiche', $anagrafica->id, $descrizione).'</td>
|
|
|
|
<td class="text-center">'.$destinatario->email.'</td>
|
2019-09-24 10:09:29 +02:00
|
|
|
<td class="text-center">
|
2021-08-02 18:27:28 +02:00
|
|
|
<a class="btn btn-danger ask btn-sm '.(!empty($lista->query) ? 'disabled' : '').'" data-backto="record-edit" data-op="remove_receiver" data-type="'.get_class($destinatario).'" data-id="'.$destinatario->id.'" '.(!empty($lista->query) ? 'disabled' : '').'>
|
2019-09-24 10:09:29 +02:00
|
|
|
<i class="fa fa-trash"></i>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
} else {
|
|
|
|
echo '
|
2021-08-02 18:27:28 +02:00
|
|
|
<p>'.tr('Nessun destinatario collegato alla lista').'.</p>';
|
2019-09-24 10:09:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<a class="btn btn-danger ask" data-backto="record-list">
|
|
|
|
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
|
|
|
</a>';
|