Fixes #264
parent
0950985894
commit
0a90bdc4df
|
@ -175,7 +175,7 @@ if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "adm
|
|||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="domain"><?=$lang['add']['domain'];?>:</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="addSelectDomain" name="domain" id="domain" title="<?=$lang['add']['select'];?>" required>
|
||||
<select id="addSelectDomain" name="domain" id="domain" required>
|
||||
<?php
|
||||
foreach (mailbox_get_domains() as $domain) {
|
||||
echo "<option>".htmlspecialchars($domain)."</option>";
|
||||
|
|
|
@ -1,18 +1,25 @@
|
|||
$(document).ready(function() {
|
||||
// add.php
|
||||
// Get max. possible quota for a domain when domain field changes
|
||||
$('#addSelectDomain').on('change', function() {
|
||||
$.get("/api/v1/get/domain/" + this.value, function(data){
|
||||
|
||||
auto_fill_quota = function(domain) {
|
||||
$.get("/api/v1/get/domain/" + domain, function(data){
|
||||
var result = $.parseJSON(JSON.stringify(data));
|
||||
max_new_mailbox_quota = ( result.max_new_mailbox_quota / 1048576);
|
||||
if (max_new_mailbox_quota != '0') {
|
||||
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
||||
$('#addInputQuota').attr({"disabled": false, "value": "", "type": "number", "max": max_new_mailbox_quota});
|
||||
$('#addInputQuota').val(max_new_mailbox_quota);
|
||||
}
|
||||
else {
|
||||
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
||||
$('#addInputQuota').attr({"disabled": true, "value": "", "type": "text", "value": "n/a"});
|
||||
$('#addInputQuota').val(max_new_mailbox_quota);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#addSelectDomain').on('change', function() {
|
||||
auto_fill_quota($('#addSelectDomain').val());
|
||||
});
|
||||
|
||||
auto_fill_quota($('#addSelectDomain').val());
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue