<div class="col-md-3"></div>
<form class="form-horizontal user-setting-panel pt_forms col-md-6 pt_shadow" id="general-settings" method="POST">
	<div class="setting-general-alert"></div>
	<div class="row">
        <!-- Text input-->
        <div class="form-group col-lg-6">
            <label class="col-md-12" for="username">{{LANG username}}</label>
            <div class="col-md-12">
                <input id="username" name="username" type="text" placeholder="" class="form-control input-md" value="{{USER username}}">
            </div>
        </div>
        <!-- Text input-->
        <div class="form-group col-lg-6">
            <label class="col-md-12" for="email">{{LANG email_address}}</label>
            <div class="col-md-12">
                <input id="email" name="email" type="text" placeholder="" class="form-control input-md" value="{{USER email}}">
            </div>
        </div>
        <!-- Select Basic -->
        <div class="form-group col-lg-6">
            <label class="col-md-12" for="gender">{{LANG gender}}</label>
            <div class="col-md-12">
                <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 col-lg-6">
            <label class="col-md-12" for="country">{{LANG country}}</label>
            <div class="col-md-12">
                <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}}
	</div>
	<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="last-sett-btn modal-footer" style="margin: 0px -30px -10px -30px;">
		<button id="submit" name="submit" class="btn btn-main setting-panel-mdbtn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG save}}</button>
	</div>
</form>
<div class="col-md-3"></div>
<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('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG save}}');
                // FL_progressIconLoader(form.find('button'));
            }
        });
    });
</script>