<?php 
include 'views/_header.tpl.php'; ?>

<style type="text/css">
div.form.login-form .box-white {
    height: auto !important;
}
</style>
        <div class="container_12">
            <div class="grid_12">
            <div class="form login-form" style="margin-top:15px;">
                <form method="post" action="/auth/register">
                    <div class="box-white">
                        <h3 class="rs">Register as a Business !</h3>
                        <!--<h4 class="rs title-box">New to YourBrand?</h4>-->
                        <!--<p class="rs">Sign up with email or Facebook</p>-->
                        <div class="form-action">
                            <label for="txt_name">
                                <input name="name" id="txt_name" class="txt fill-width" type="text" placeholder="Enter business name"/>
                            </label>
                            <label for="txt_email">
                                <input name="email" id="txt_email" class="txt fill-width" type="email" placeholder="Enter your e-mail address (Username)"/>
                            </label>
                            <label for="txt_password">
                                <input name="password" id="txt_password" class="txt fill-width" type="password" placeholder="Enter password"/>
                            </label>
                            
                            <?php 
                            $usertypeModel = new usertypeModel();
                            $user_types = $usertypeModel->getList();
                            ?>
                            <label for="usertype">
                                <p class="rs description-input">Select a Building</p>
                                <select name="type_id" class="txt fill-width">
                                    <option value="">Please select a Building</option>
                                    <?php 
                                    foreach ($user_types as $usertype) : ?>
                                    <option value="<?= $usertype['id'] ?>"><?= $usertype['title'] ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </label>                             

                            <?php 
                            $categoryModel = new categoryModel();
                            $categories = $categoryModel->getList();
                            ?>
                            <label for="category">
                                <p class="rs description-input">Select a business category</p>
                                <select name="category_id" class="txt fill-width">
                                    <option value="">Please select a category</option>
                                    <?php 
                                    foreach ($categories as $category) : ?>
                                    <option value="<?= $category['id'] ?>"><?= $category['title'] ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </label>

                            <label for="txt_address">
                                <input name="location" onblur="geocodeAddress();" id="txt_address" class="txt fill-width" type="text" placeholder="Enter physical address"/>
                                <input type='hidden' name='location_lat' value=""/>
                                <input type='hidden' name='location_lng' value="" />
                            </label>
                            <script src='/static/js/googlemaps/GoogleMapsBusinessReg.js'></script>

                            <label><input type="checkbox" id="add_mailing_addr" />&nbsp;Add a different mailing address</label>
                            <label for="txt_address2">
                                <input disabled name="mailing_address" id="txt_address2" class="txt fill-width" type="text" placeholder="Enter mailing address"/>
                            </label>

                            <label for="txt_phone">
                                <input name="phone" id="txt_phone" class="txt fill-width" type="text" placeholder="Enter business phone number"/>
                            </label>

                            <label for="txt_contactname">
                                <input name="contact_name" id="txt_contactname" class="txt fill-width" type="text" placeholder="Enter contact name"/>
                            </label>

                            <label for="txt_contactmail">
                                <input name="contact_email" id="txt_contactmail" class="txt fill-width" type="text" placeholder="Enter contact e-mail address"/>
                            </label>

                            <label for="txt_contactphone">
                                <input name="contact_phone" id="txt_contactphone" class="txt fill-width" type="text" placeholder="Enter contact phone number"/>
                            </label>

                            <label for="txt_besttime">
                                <input name="contact_best_time" id="txt_besttime" class="txt fill-width" type="text" placeholder="Best time to be reached (8am-6pm)"/>
                            </label> 

                            <input type="hidden" name="account_type" value="Company" />

                            <span style="text-align:left;">
                                <br />
                                <input name="check_terms" id="check_terms" class="txt" type="checkbox" style="width:25px; margin-bottom:1px" /> 
                                I Agree to the <a href="/terms" class="fc-orange">Terms</a>.
                            </span>
                            <br /><br />
                            <p class="rs ta-c" style="margin-bottom:0px;">
                                <button class="btn btn-fb register-trigger" type="submit"  style="margin-bottom:2px;">Register</button>
                                <a href="/auth/loginFacebook" class="btn btn-fb connect-fb" style=""><i class="fa fa-facebook"></i> Connect</a>
                            </p>
                        </div>
                    </div>
                </form>
            </div>
            </div><!-- CLOSE GRID 8 -->
        </div><!-- CLOSE OF CONTAINER -->

<script type="text/javascript">
$(document).ready(function()
{
    $("#add_mailing_addr").change(function()
    {
        if ($(this).is(":checked")) {
            $("input[name='mailing_address']").removeProp("disabled");
            $("input[name='mailing_address']").focus();
        }
        else 
            $("input[name='mailing_address']").prop("disabled", true);
    });
});
</script>

<?php
include 'views/_footer.tpl.php'; ?>