add.js 771 B

123456789101112131415161718
  1. $(document).ready(function() {
  2. // add.php
  3. // Get max. possible quota for a domain when domain field changes
  4. $('#addSelectDomain').on('change', function() {
  5. $.get("/api/v1/domain/" + this.value, function(data){
  6. var result = jQuery.parseJSON( data );
  7. max_new_mailbox_quota = ( result.max_new_mailbox_quota / 1048576);
  8. if (max_new_mailbox_quota != '0') {
  9. $("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
  10. $('#addInputQuota').attr({"disabled": false, "value": "", "type": "number", "max": max_new_mailbox_quota});
  11. }
  12. else {
  13. $("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
  14. $('#addInputQuota').attr({"disabled": true, "value": "", "type": "text", "value": "n/a"});
  15. }
  16. });
  17. });
  18. });