<div class="settings-header">
    <h3><i class="fa fa-cog fa-fw "></i> {{LANG general_settings}}</h3>
</div>
<form class="form-horizontal user-setting-panel " id="general-settings" method="POST">
    <div class="setting-general-alert"></div>
    <fieldset>
        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-2" for="username">{{LANG username}}</label>
            <div class="col-md-6">
                <input id="username" name="username" type="text" placeholder="" class="form-control input-md" value="{{USER username}}">
            </div>
        </div>
        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-2" for="email">{{LANG email_address}}</label>
            <div class="col-md-6">
                <input id="email" name="email" type="text" placeholder="" class="form-control input-md" value="{{USER email}}">
            </div>
        </div>
        <!-- Select Basic -->
        <div class="form-group">
            <label class="col-md-2" for="gender">{{LANG gender}}</label>
            <div class="col-md-6">
                <select id="gender" name="gender" class="form-control">
                    <option value="male" <?php echo ($pt->settings->gender == 'male') ? 'selected': '';?>>{{LANG male}}</option>
                    <option value="female" <?php echo ($pt->settings->gender == 'female') ? 'selected': '';?>>{{LANG female}}</option>
                </select>
            </div>
        </div>
        <!-- Select Basic -->
        <div class="form-group">
            <label class="col-md-2" for="country">{{LANG country}}</label>
            <div class="col-md-6">
                <select id="country" name="country" class="form-control">
                    {{COUNTRIES_LAYOUT}}
                </select>
            </div>
        </div>
        <?php if ($pt->is_admin == true) { ?>
            {{ADMIN_LAYOUT}}
        <?php } ?>
        <hr>
        {{CUSTOM_FIELDS}}
        <input type="hidden" name="hash_id" value="<?php echo PT_CreateSession()?>">
        <input type="hidden" name="user_id" value="{{USER id}}">
        <input type="hidden" name="cf" value="{{CUSTOM_DATA}}">
        <!-- Button (Double) -->
        <div class="form-group">
            <label class="col-md-2" for="button1id"></label>
            <div class="col-md-8">
                <button id="submit" name="submit" class="btn btn-main"><i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i> {{LANG save}}</button>
            </div>
        </div>
    </fieldset>
</form>
<script>
    $(function() {
        var form = $('form#general-settings');

        form.ajaxForm({
            url: '{{LINK aj/user/general}}?hash=' + $('.main_session').val(),
            beforeSend: function() {
                form.find('button').text('{{LANG please_wait}}');
                // FL_progressIconLoader(form.find('button'));
            },
            success: function(data) {
                scrollToTop();
                if (data.status == 200) {
                    $('.setting-general-alert').html('<div class="alert alert-success">' + data.message + '</div>');
                    $('.alert-success').fadeIn('fast', function() {
                        $(this).delay(2500).slideUp(500, function() {
                            $(this).remove();
                        });
                    });
                } else if (data.errors) {
                    var errors = data.errors.join("<br>");
                    $('.setting-general-alert').html('<div class="alert alert-danger">' + errors + '</div>');
                    $('.alert-danger').fadeIn(300);
                }
                form.find('button').html('<i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i> {{LANG save}}');
                // FL_progressIconLoader(form.find('button'));
            }
        });
    });
</script>