feat: gestione mailto campi input

This commit is contained in:
MatteoPistorello 2024-10-30 12:16:43 +01:00
parent 263d79e0ed
commit 4725d27527
14 changed files with 19 additions and 18 deletions

View File

@ -118,14 +118,14 @@ $idx = 0;
foreach ($emails as $email) {
echo '
<div class="col-md-12">
{[ "type": "email", "name": "destinatari['.$idx++.']", "value": "'.$email.'", "icon-before": "choice|email|'.$template['type'].'", "extra": "onkeyup=\'aggiungiDestinatario();\'", "class": "destinatari", "required": 0 ]}
{[ "type": "text", "name": "destinatari['.$idx++.']", "value": "'.$email.'", "icon-before": "choice|email|'.$template['type'].'", "extra": "onkeyup=\'aggiungiDestinatario();\'", "class": "destinatari email-mask", "required": 0 ]}
</div>';
}
if (empty($emails)) {
echo '
<div class="col-md-12">
{[ "type": "email", "name": "destinatari['.$idx++.']", "value": "", "icon-before": "choice|email|'.$template['type'].'", "extra": "onkeyup=\'aggiungiDestinatario();\'", "class": "destinatari", "required": 0 ]}
{[ "type": "text", "name": "destinatari['.$idx++.']", "value": "", "icon-before": "choice|email|'.$template['type'].'", "extra": "onkeyup=\'aggiungiDestinatario();\'", "class": "destinatari email-mask", "required": 0 ]}
</div>';
}
echo '
@ -197,7 +197,7 @@ echo '
echo '
<div class="hidden" id="template-destinatario">
<div class="col-md-12">
{[ "type": "email", "name": "destinatari[-id-]", "icon-before": "choice|email|'.$template['type'].'", "extra": "onkeyup=\'aggiungiDestinatario();\'", "class": "destinatari" ]}
{[ "type": "text", "name": "destinatari[-id-]", "icon-before": "choice|email|'.$template['type'].'", "extra": "onkeyup=\'aggiungiDestinatario();\'", "class": "destinatari email-mask" ]}
</div>
</div>';

View File

@ -119,11 +119,11 @@ echo '
<div class="row">
<div class="col-md-4">
{[ "type": "text", "label": "'.tr('Email').'", "name": "email", "class": "email-mask", "placeholder":"casella@dominio.ext", "icon-before": "<i class=\"fa fa-envelope\"></i>", "validation": "email" ]}
{[ "type": "email", "label": "'.tr('Email').'", "name": "email", "placeholder":"casella@dominio.ext", "validation": "email" ]}
</div>
<div class="col-md-4">
{[ "type": "text", "label": "'.tr('PEC').'", "name": "pec", "class": "email-mask", "placeholder":"pec@dominio.ext", "icon-before": "<i class=\'fa fa-envelope-o\'></i>" ]}
{[ "type": "email", "label": "'.tr('PEC').'", "name": "pec", "placeholder":"pec@dominio.ext" ]}
</div>';
$help_codice_destinatario = tr("Per impostare il codice specificare prima '<b>Tipologia</b>' e '<b>Nazione</b>' dell'anagrafica").':<br><br><ul><li>'.tr('Azienda (B2B) - Codice Destinatario, 7 caratteri').'</li><li>'.tr('Ente pubblico (B2G/PA) - Codice Univoco Ufficio (www.indicepa.gov.it), 6 caratteri').'</li><li>'.tr('Privato (B2C) - viene utilizzato il Codice Fiscale').'</li></ul>Se non si conosce il codice destinatario lasciare vuoto il campo. Verrà applicato in automatico quello previsto di default dal sistema (\'0000000\', \'999999\', \'XXXXXXX\').';

View File

@ -162,7 +162,7 @@ if (in_array($id_azienda, $tipi_anagrafica)) {
</div>
<div class="col-md-4">
{[ "type": "text", "label": "<?php echo tr('PEC'); ?>", "name": "pec", "class": "email-mask", "placeholder":"pec@dominio.ext", "value": "$pec$", "icon-before": "<i class='fa fa-envelope-o'></i>", "validation": "email" ]}
{[ "type": "email", "label": "<?php echo tr('PEC'); ?>", "name": "pec", "placeholder":"pec@dominio.ext", "value": "$pec$", "validation": "email" ]}
</div>
<div class="col-md-4">
@ -218,7 +218,7 @@ if (in_array($id_azienda, $tipi_anagrafica)) {
</div>
<div class="col-md-4">
{[ "type": "text", "label": "<?php echo tr('Email'); ?>", "name": "email", "class": "email-mask", "placeholder": "casella@dominio.ext", "value": "$email$", "icon-before": "<i class='fa fa-envelope'></i>", "validation": "email" ]}
{[ "type": "email", "label": "<?php echo tr('Email'); ?>", "name": "email", "placeholder": "casella@dominio.ext", "value": "$email$", "validation": "email" ]}
</div>
</div>

View File

@ -96,7 +96,7 @@ if (!$record['predefined']) {
</div>
<div class="col-md-6">
{[ "type": "email", "label": "<?php echo tr('Destinatario fisso'); ?>", "name": "reply_to", "value": "$reply_to$", "help": "<?php echo 'Rispondi a questo indirizzo e-mail.'; ?>" ]}
{[ "type": "text", "class": "email-mask", "label": "<?php echo tr('Destinatario fisso'); ?>", "name": "reply_to", "value": "$reply_to$", "help": "<?php echo 'Rispondi a questo indirizzo e-mail.'; ?>" ]}
</div>
</div>

View File

@ -80,11 +80,10 @@ foreach ($destinatari_filtrati as $destinatario) {
'<div class="text-center">'.
(!empty($origine->email) ?
input([
'type' => 'text',
'type' => 'email',
'name' => 'email',
'id' => 'email_'.random_int(0, 99999),
'readonly' => '1',
'class' => 'email-mask',
'value' => $origine->email,
'validation' => 'email|'.$id_modulo_anagrafiche.'|'.$destinatario->record_id,
]) :

View File

@ -35,7 +35,7 @@ include_once __DIR__.'/../../core.php';
</div>
<div class="col-md-6">
{[ "type": "email", "label": "<?php echo tr('Email mittente'); ?>", "name": "from_address", "required": 1 ]}
{[ "type": "text", "class": "email-mask", "label": "<?php echo tr('Email mittente'); ?>", "name": "from_address", "required": 1 ]}
</div>
</div>

View File

@ -53,7 +53,7 @@ echo '
</div>
<div class="col-md-3">
{[ "type": "email", "label": "'.tr('Email mittente').'", "name": "from_address", "value": "$from_address$", "required": 1 ]}
{[ "type": "text", "class": "email-mask", "label": "'.tr('Email mittente').'", "name": "from_address", "value": "$from_address$", "required": 1 ]}
</div>
<div class="col-md-3">

View File

@ -46,7 +46,7 @@ echo '
<div class="row">
<div class="col-md-12">
{[ "type": "email", "label": "'.tr('Email').'", "name": "email", "required": 0, "value": "'.$utente['email'].'", "validation": "email" ]}
{[ "type": "text", "class": "email-mask", "label": "'.tr('Email').'", "name": "email", "required": 0, "value": "'.$utente['email'].'", "validation": "email" ]}
</div>
</div>';

View File

@ -45,7 +45,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Indirizzo email').'", "name": "email", "class": "email-mask", "validation": "email"]}
{[ "type": "email", "label": "'.tr('Indirizzo email').'", "name": "email", "validation": "email"]}
</div>
</div>

View File

@ -44,7 +44,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Indirizzo email').'", "name": "email", "class": "email-mask", "value" : "$email$", "validation": "email" ]}
{[ "type": "email", "label": "'.tr('Indirizzo email').'", "name": "email", "value" : "$email$", "validation": "email" ]}
</div>
</div>

View File

@ -78,7 +78,7 @@ echo '
</div>
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Indirizzo email').'", "name": "email", "class": "email-mask", "validation": "email" ]}
{[ "type": "email", "label": "'.tr('Indirizzo email').'", "name": "email", "validation": "email" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "'.tr('Opt-out per newsletter').'", "name": "disable_newsletter_add", "id": "disable_newsletter_m", "value": "0", "help": "'.tr("Blocco per l'invio delle email.").'" ]}

View File

@ -78,7 +78,7 @@ echo '
{[ "type": "telefono", "label": "'.tr('Cellulare').'", "name": "cellulare", "value": "$cellulare$" ]}
</div>
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Indirizzo email').'", "name": "email", "value": "$email$", "class": "email-mask", "validation": "email" ]}
{[ "type": "email", "label": "'.tr('Indirizzo email').'", "name": "email", "value": "$email$", "validation": "email" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "'.tr('Opt-out per newsletter').'", "name": "disable_newsletter", "id": "disable_newsletter_m", "value": "'.empty($record['enable_newsletter']).'", "help": "'.tr("Blocco per l'invio delle email.").'" ]}

View File

@ -134,7 +134,7 @@ if (empty($token)) {
{[ "type": "text", "label": "'.tr('Username').'", "placeholder": "'.tr('Username').'", "name": "username", "icon-before": "<i class=\"fa fa-user\"></i>", "required": 1 ]}
{[ "type": "email", "label": "'.tr('Email').'", "placeholder": "'.tr('Email').'", "name": "email", "icon-before": "<i class=\"fa fa-envelope\"></i>", "required": 1 ]}';
{[ "type": "text", "class": "email-mask", "label": "'.tr('Email').'", "placeholder": "'.tr('Email').'", "name": "email", "icon-before": "<i class=\"fa fa-envelope\"></i>", "required": 1 ]}';
} else {
echo '
<input type="hidden" name="op" value="update">

View File

@ -261,6 +261,8 @@ class DefaultHandler implements HandlerInterface
$values['type'] = 'text';
$values['icon-before'] = $values['value'] ? '<a href="mailto:'.$values['value'].'" target="_blank"><i class="fa fa-envelope"></i></a>' : '<i class="fa fa-envelope"></i>';
// Delega al metodo "text", per la generazione del codice HTML
return $this->text($values, $extras);
}