Desacople e implementacion de email
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user