Desacople e implementacion de email

This commit is contained in:
2020-06-09 18:06:36 -04:00
parent 450819f6b4
commit e378054972
22 changed files with 419 additions and 25 deletions

View File

@ -2,3 +2,4 @@
use ProVM\KI\Common\Controller\Web\Contacto;
$app->get('/contacto', Contacto::class);
$app->post('/contacto', [Contacto::class, 'enviar']);

View File

@ -0,0 +1,39 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Contacto Web - {{$nombre}}</title>
<!--[if !mso]><!-- -->
<link href='http://fonts.googleapis.com/css2?family=Roboto' rel='stylesheet' type='text/css' />
<!--<![endif]-->
</head>
<body>
<table style="font-family: Roboto, sans-serif; font-size: 12pt; color: rgb(109, 110, 112);">
<tr>
<td style="font-weight: 700; text-align: right;">
Nombre
</td>
<td colspan="6">
{{$nombre}}
</td>
</tr>
<tr>
<td style="font-weight: 700; text-align: right;">
Email
</td>
<td colspan="6">
{{$mail}}
</td>
</tr>
<tr>
<td style="font-weight: 700; text-align: right; vertical-align: top;">
Mensaje
</td>
<td colspan="6">
{{$mensaje}}
</td>
</tr>
</table>
</body>
</html>

View File

@ -27,6 +27,10 @@
Enviar
</button>
</div>
<div class="ui message transition hidden" id="mensaje_contacto">
<i class="close icon"></i>
<span id="msg"></span>
</div>
</div>
</form>
</div>
@ -65,3 +69,59 @@
</div>
</div>
</div>
@push('scripts')
<script type="text/javascript">
var contacto = {
id: "contacto_form",
data: {
nombre: '',
mail: '',
mensaje: ''
},
output: {
id: 'mensaje_contacto',
success: 'Mensaje enviado.',
},
url: '{{$urls->base}}/contacto',
getData: () => {
var form = $(contacto.id)
contacto.data.nombre = form.find("[name='nombre']").val()
contacto.data.mail = form.find("[name='mail']").val()
contacto.data.mensaje = form.find("[name='mensaje']").val()
},
send: () => {
$.post(contacto.url, contacto.data, (data) => {
$(contacto.output.id).find('#msg').html(contacto.output.success)
$(contacto.output.id).addClass('success').removeClass('hidden').show()
$(contacto.output.id).find('.close').click(function() {
$(contacto.output.id).find('#msg').html('')
$(contacto.output.id).addClass('hidden').removeClass('success error')
})
}, 'json')
},
checkIds: () => {
if (contacto.id.indexOf('#') < 0) {
contacto.id = '#' + contacto.id
}
if (contacto.output.id.indexOf('#') < 0) {
contacto.output.id = '#' + contacto.output.id
}
},
setup: () => {
contacto.checkIds()
$(contacto.id).submit((e) => {
e.preventDefault()
contacto.getData()
contacto.send()
return false
})
}
}
$(document).ready(() => {
contacto.setup()
})
</script>
@endpush

View File

@ -26,14 +26,6 @@
&thinsp;
{{$header->hora}}
</div>
<div class="right menu">
<div class="item">
<div class="ui icon input">
<input type="text" placeholder="Buscar" name="search" id="search" />
<i class="search link icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>