Suggest account number option

This commit is contained in:
slawkens
2021-06-09 01:01:18 +02:00
parent 6f3ba9c34b
commit e47bb11883
3 changed files with 79 additions and 0 deletions

View File

@@ -34,6 +34,9 @@
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.account is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
{% if not constant('USE_ACCOUNT_NAME') %}
<div id="SuggestAccountNumber">[<a href="#">suggest number</a>]</div>
{% endif %}
</td>
<td>
<input type="text" name="account" id="account_input" size="30" maxlength="{% if constant('USE_ACCOUNT_NAME') %}30{% else %}10{% endif %}" value="{{ account }}" autofocus/>
@@ -336,3 +339,8 @@
</form>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_FORM') }}
<script type="text/javascript" src="tools/check_name.js"></script>
<style>
#SuggestAccountNumber {
font-size: 7pt;
}
</style>

View File

@@ -20,6 +20,9 @@
$('#password2').blur(function() {
checkPassword();
});
$('#SuggestAccountNumber a').click(function (event) {
generateAccountNumber(event);
});
});
function updateFlag()
@@ -192,4 +195,18 @@
lastSend = timeNow;
}
function generateAccountNumber(event)
{
event.preventDefault();
$.getJSON("tools/generate_account_number.php", { uid: Math.random() },
function(data){
if(data.hasOwnProperty('success')) {
$('#account_input').val(data.success);
}
}
);
setTimeout(checkAccount, 1000);
}
</script>