diff --git a/data/web/add.php b/data/web/add.php index 147619fd..d3c7ca95 100644 --- a/data/web/add.php +++ b/data/web/add.php @@ -175,7 +175,7 @@ if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "adm
- ".htmlspecialchars($domain).""; diff --git a/data/web/js/add.js b/data/web/js/add.js index 05171d10..f8fc3809 100644 --- a/data/web/js/add.js +++ b/data/web/js/add.js @@ -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()); });