openstamanager/modules/stato_email/edit.php

175 lines
4.7 KiB
PHP
Raw Normal View History

2019-08-29 10:25:14 +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-08-29 10:25:14 +02:00
include_once __DIR__.'/../../core.php';
echo '
<!-- DATI -->
2024-05-16 18:02:50 +02:00
<div class="card card-primary">
<div class="card-heading">
<h3 class="card-title">'.tr('Informazioni').'</h3>
2019-08-29 10:25:14 +02:00
</div>
2020-09-07 15:04:06 +02:00
2024-05-16 18:02:50 +02:00
<div class="card-body">
2020-09-07 15:04:06 +02:00
2019-08-29 10:25:14 +02:00
<div class="row">
2019-09-19 18:22:20 +02:00
<div class="col-md-3">
<h4>'.tr('Template').'</h4>
2024-04-18 17:44:05 +02:00
'.Modules::link('Template email', $mail->template->id, $mail->template->getTranslation('title')).'
2019-09-19 18:22:20 +02:00
</div>
2020-09-07 15:04:06 +02:00
2019-09-19 18:22:20 +02:00
<div class="col-md-3">
<h4>'.tr('Utente').'</h4>
'.Modules::link('Anagrafiche', $mail->user->anagrafica->id, $mail->user->nome_completo).'
2019-08-29 10:25:14 +02:00
</div>
2019-09-19 18:22:20 +02:00
<div class="col-md-3">
<h4>'.tr('Data di invio').'</h4>
2019-09-19 18:22:20 +02:00
'.($mail->sent_at ? timestampFormat($mail->sent_at) : '-').'
2019-08-29 10:25:14 +02:00
</div>
2020-09-07 15:04:06 +02:00
2019-09-19 18:22:20 +02:00
<div class="col-md-3">
<h4>'.tr('Ultimo tentativo').'</h4>
2019-10-29 16:29:59 +01:00
'.($mail->processing_at ? timestampFormat($mail->processing_at) : '-').' ('.tr('totale: _TOT_', [
2024-03-22 15:52:24 +01:00
'_TOT_' => $mail->attempt,
]).')
2019-08-29 10:25:14 +02:00
</div>
</div>
</div>
2019-09-19 18:22:20 +02:00
</div>';
2019-08-29 10:25:14 +02:00
echo '
<h4>'.tr('Account mittente').'</h4>
<div class="well">
2024-04-18 17:44:05 +02:00
'.$mail->template->account->from_name.' &lt;'.$mail->template->account->from_address.'&gt; - '.Modules::link('Account email', $mail->template->account->id, $mail->template->account->getTranslation('title')).'
</div>';
2019-09-19 18:22:20 +02:00
echo '
2019-08-29 10:25:14 +02:00
<h4>'.tr('Oggetto').'</h4>
<div class="well">
'.$mail->subject.'
2019-09-19 18:22:20 +02:00
</div>';
// Destinatari
$receivers = $mail->receivers;
echo '
<div class="row">
<div class="col-md-4">
<h4>'.tr('Destinatari').'</h4>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>'.tr('Tipo').'</th>
<th>'.tr('Indirizzo').'</th>
</tr>
</thead>
2020-09-07 15:04:06 +02:00
2019-09-19 18:22:20 +02:00
<tbody>';
foreach ($receivers as $receiver) {
echo '
<tr>
<td>'.$receiver->type.'</td>
<td>'.$receiver->address.'</td>
</tr>';
}
echo '
</tbody>
</table>
</div>';
// Stampe
$prints = $mail->prints;
echo '
<div class="col-md-4">
<h4>'.tr('Stampe').'</h4>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>'.tr('Stampa').'</th>
<th>'.tr('Nome').'</th>
</tr>
</thead>
2020-09-07 15:04:06 +02:00
2019-09-19 18:22:20 +02:00
<tbody>';
foreach ($prints as $print) {
echo '
<tr>
<td>
2024-04-18 17:44:05 +02:00
<a href="'.Prints::getHref($print->getTranslation('title'), $mail->id_record).'" target="_blank">'.$print->getTranslation('title').'</a>
2019-09-19 18:22:20 +02:00
</td>
2024-04-18 17:44:05 +02:00
<td>'.$print->pivot->getTranslation('title').'</td>
2019-09-19 18:22:20 +02:00
</tr>';
}
echo '
</tbody>
</table>
</div>';
// Stampe
$uploads = $mail->uploads;
echo '
<div class="col-md-4">
<h4>'.tr('Allegati').'</h4>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>'.tr('Allegato').'</th>
<th>'.tr('Nome').'</th>
</tr>
</thead>
2020-09-07 15:04:06 +02:00
2019-09-19 18:22:20 +02:00
<tbody>';
foreach ($uploads as $upload) {
echo '
<tr>
<td>
2024-04-18 17:44:05 +02:00
<a href="'.base_path().'/view.php?file_id='.$upload->id.'" target="_blank">'.$upload->getTranslation('title').'</a>
2019-09-19 18:22:20 +02:00
</td>
2024-04-18 17:44:05 +02:00
<td>'.$upload->pivot->getTranslation('title').'</td>
2019-09-19 18:22:20 +02:00
</tr>';
}
echo '
</tbody>
</table>
</div>';
echo '
</div>';
echo '
2019-08-29 10:25:14 +02:00
<h4>'.tr('Contenuto').'</h4>
<div class="well">
2019-09-19 18:22:20 +02:00
'.$mail->content.'
2019-08-29 10:25:14 +02:00
</div>';
2019-10-29 16:29:59 +01:00
2024-01-15 15:30:45 +01:00
// Posso eliminare l'email solo se questa non è già stata inviata
2019-10-29 16:29:59 +01:00
if (empty($mail->sent_at)) {
echo '
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> '.tr('Elimina').'
</a>';
}