{extends "../@layout.xml"}
{block title}{_"registration"}{/block}

{block header}
    {_"registration"}
{/block}

{block headIncludes}
    {if !$referer}
        <meta name="description" content="{tr('register_meta_desc', OPENVK_ROOT_CONF['openvk']['appearance']['name'])}" />
    {else}
        <meta property="og:title" content="{tr('register_referer_meta_title', $referer->getFullName(), OPENVK_ROOT_CONF['openvk']['appearance']['name'])}" />
        <meta property="og:image" content="{$referer->getAvatarUrl()}" />
        
        <meta name="description"
              content="{tr('register_referer_meta_desc', $referer->getFullName(), OPENVK_ROOT_CONF['openvk']['appearance']['name'])}" />
    {/if}
{/block}

{block content}
    {if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['enable'] || $referer}
        <p n:if="!is_null($referer)" align="center">
            {tr("invites_you_to", $referer->getFullName(), OPENVK_ROOT_CONF['openvk']['appearance']['name'])|noescape}
        </p>
        
        <form method="POST" enctype="multipart/form-data">
            <table cellspacing="7" cellpadding="0" width="52%" border="0" align="center">
                <tbody>
                    <tr>
                        <td>
                            <span>{_"name"}: </span>
                        </td>
                        <td>
                            <input type="text" name="first_name" required />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>{_"surname"}: </span>
                        </td>
                        <td>
                            <input type="text" name="last_name" required />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>{_"gender"}: </span>
                        </td>
                        <td>
                            {var femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]}
                            <select name="sex" required>
                                <option n:attr="selected => !$femalePreferred" value="male">{_"male"}</option>
                                <option n:attr="selected => $femalePreferred" value="female">{_"female"}</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>{_"birth_date"}: </span>
                        </td>
                        <td>
                            <input max={date('Y-m-d')} name="birthday" type="date"/>
                        </td>
                    </tr>
                    <tr></tr>
                    <tr>
                        <td>
                            <span>{_"email"}: </span>
                        </td>
                        <td>
                            <input type="email" name="email" required />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>{_"password"}: </span>
                        </td>
                        <td>
                            <input type="password" name="password" required />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>CAPTCHA: </span>
                        </td>
                        <td>
                            {captcha_template()|noescape}
                        </td>
                    </tr>
                    <tr>
                        <td>
                            
                        </td>
                        <td>
                            <input type="hidden" name="hash" value="{$csrfToken}" />
                            <input type="submit" value="{_'registration'}" class="button" />
                            <a href="/login">{_"log_in"}</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    {else}
        <center>
            <img src="/assets/packages/static/openvk/img/oof.apng" alt="{_'registration_closed'}" style="width: 20%;" />
            <p>
                {_"registration_disabled_info"}
                {if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}
                    <br/><br/><b>{php echo OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}</b>
                {/if}
            </p>
        </center>
    {/if}
{/block}
