2017-03-02 12:23:23 +02:00
|
|
|
$(document).ready(function() {
|
2017-05-26 23:02:04 +02:00
|
|
|
// Auto-fill domain quota when adding new domain
|
2017-05-13 09:42:17 +02:00
|
|
|
auto_fill_quota = function(domain) {
|
|
|
|
$.get("/api/v1/get/domain/" + domain, function(data){
|
2017-04-29 22:19:35 +02:00
|
|
|
var result = $.parseJSON(JSON.stringify(data));
|
2017-03-02 12:23:23 +02:00
|
|
|
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});
|
2017-05-13 09:42:17 +02:00
|
|
|
$('#addInputQuota').val(max_new_mailbox_quota);
|
2017-03-02 12:23:23 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
|
|
|
$('#addInputQuota').attr({"disabled": true, "value": "", "type": "text", "value": "n/a"});
|
2017-05-13 09:42:17 +02:00
|
|
|
$('#addInputQuota').val(max_new_mailbox_quota);
|
2017-03-02 12:23:23 +02:00
|
|
|
}
|
|
|
|
});
|
2017-05-13 09:42:17 +02:00
|
|
|
}
|
|
|
|
$('#addSelectDomain').on('change', function() {
|
|
|
|
auto_fill_quota($('#addSelectDomain').val());
|
2017-03-02 12:23:23 +02:00
|
|
|
});
|
2017-05-13 09:42:17 +02:00
|
|
|
auto_fill_quota($('#addSelectDomain').val());
|
2017-03-02 12:23:23 +02:00
|
|
|
});
|