{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}

{% import "macro_functions.phtml" as mf %}

{% block meta_title %}{{ 'Contact us'|trans }}{% endblock %}
{% block breadcrumb %}{{ 'Contact us'|trans }}{% endblock %}

{% block content %}
{% set company = guest.system_company %}
<div class="content-block" role="main">
    <div class="row">
        <article class=" span12 data-block">
            <div class="data-container">
                <header>
                    <h2>{{ 'Contact us'|trans }}</h2>
                    <p>{{ company.signature }}</p>
                </header>
                <section>
                    <form method="post" action="" id="public-ticket-create" class="form form-horizontal span6">
                        <fieldset>
                            <div class="control-group">
                                <label for="name">{{ 'Name'|trans }}: </label>
                                <div class="controls">
                                    <input type="text" name="name" value="{{request.name}}" required="required" id="name">
                                </div>
                            </div>

                            <div class="control-group">
                                <label for="email">{{ 'Email'|trans }}: </label>
                                <div class="controls">
                                    <input type="email" name="email" value="{{request.email}}" required="required" id="email">
                                </div>
                            </div>

                            <div class="control-group">
                                <label for="subject">{{ 'Subject'|trans }}: </label>
                                <div class="controls">
                                    <input type="text" name="subject" value="{{request.subject}}" required="required" id="subject">
                                </div>
                            </div>

                            <div class="control-group">
                                <label for="message">{{ 'Message'|trans }}: </label>
                                <div class="controls">
                                    <textarea name="message" cols="5" rows="5" required="required" id="message">{{request.message}}</textarea>
                                </div>
                            </div>


                            {{ mf.recaptcha }}
                            <div class="control-group">
                                <div class="controls">
                                    <button class="btn btn-primary btn-large pull-right" type="submit" value="{{ 'Send'|trans }}" data-loading-text="Loading...">{{ 'Send'|trans }}</button>
                                </div>
                            </div>


                        </fieldset>

                        <input type="hidden" name="anti-spam" value="1" id="anti-spam" required="required"/>
                    </form>

                    <strong>
                        <dl class="span3 offset1">
                            <dd>
                                {{ company.name }}
                            </dd>
                            <dd>
                                {{ company.address_1 }}
                            </dd>
                            <dd>
                                {{ company.address_2 }}
                            </dd>
                            <dd>
                                {{ company.address_3 }}
                            </dd>
                            <dd>
                                {{ company.tel }}
                            </dd>
                            <dd>
                                {{ company.www }}
                            </dd>
                            <dd>
                                {{ company.email }}
                            </dd>
                        </dl>
                    </strong>
                </section>

            </div>
        </article>
    </div>
</div>
{% endblock %}

{% block js %}
<script>
$(function() {
    $('#anti-spam').remove();

    $('#public-ticket-create').bind('submit', function(event) {
        $('.wait').show();
        bb.post(
            'guest/support/ticket_create',
            $(this).serialize(),
            function(result) {
                bb.redirect("{{ 'support/contact-us/conversation'|link }}" + '/' + result);
            }
        );

        return false;
    });
});
</script>
{% endblock %}
