<%inherit file="home.phtml"/>
<%block name="content">
<div align="center" style="padding-top:40px;min-height:90vh;">
    <h1>${lang('cuchulublog', 'contact', 'Contact')}</h1>
    <div id="error_id" class="error" style="display:none;">${lang('cuchulublog', 'error_cannot_send_email', 'Error: no puedo enviar el email')}</div>
    <div class="cont">
        <form method="post" id="sendmail_form">
            <p>${lang('cuchulublog', 'fill_this_form_for_contact', 'Rellene este formulario para contactar')}.</p>
            <div class="form">
                <p><label>${lang('cuchulublog', 'name', 'Nombre')}*: </label><input type="text" id="nombre_field_form" class="" name="nombre" value=""> <span class="error" id="nombre_error"></span></p>
                <p><label>${lang('cuchulublog', 'email', 'Email')}*: </label><input type="text" id="email_field_form" class="" name="email" value=""> <span class="error" id="email_error"></span></p>
                <p><label>${lang('cuchulublog', 'subject', 'Subject')}*: </label><input type="text" id="asunto_field_form" class="" name="asunto" value=""> <span class="error" id="asunto_error"></span></p>
                <p><label>${lang('cuchulublog', 'text', 'Text')}*: </label>        <p><textarea class="tinymce_editor" name="texto"></textarea></p>
                <span class="error" id="text_error"></span></p>
            </div>
            <p><div class="g-recaptcha" data-sitekey="6LfrCygUAAAAAE0U7Hab8o6LhfrZmeAe1aV4Xy98" id="captcha_field_form"></div>
            <span class="error" id="captcha_error"></span></p>
            ${csrf_token()|n}
            <p><button type="submit">${lang('cuchulublog', 'send_form', 'Send form')}</button></p>
        </form>
        <script src="https://www.google.com/recaptcha/api.js" async></script>
    </div>
    <div id="success_sendmail" style="display:none;"><p>${lang('cuchulublog', 'email_sended_successfully', 'Se envió el email correctamente. Pronto nos pondremos en contacto')}.</p></div>
</div>
</%block>
<%block name="js_footer">
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'cuchulublog')}"></script>
<script language="javascript">

//var options={'url': "${url_for('.send_contact')}", 
var options={url: "${url_for('.send_contact')}", success: function(data) { 
    
    $('#sendmail_form').hide();
    $('#success_sendmail').show();

}, pre_callback: function () {}, loading: '#loading', upload: {}};

$('#sendmail_form').sendPost(options);

</script>
</%block>
