Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

billing: Don't show license update buttons until valid change in value.

Aman Agrawal17573cd1fbd9
diff --git a/templates/corporate/billing.html b/templates/corporate/billing.html
index 264eb500efa..d5da039b475 100644
--- a/templates/corporate/billing.html
+++ b/templates/corporate/billing.html
@@ -61,7 +61,7 @@
<input min="{{ licenses }}" type="number" name="licenses" autocomplete="off" id="current-manual-license-count" class="short-width-number-input" data-original-value="{{ licenses }}" value="{{ licenses }}" required/>
</form>
<span class="licence-count-in-use">licenses ({{ seat_count }} in use)</span>
- <button id="current-manual-license-count-update-button" class="license-count-update-button" disabled>
+ <button id="current-manual-license-count-update-button" class="license-count-update-button hide">
<span class="billing-button-text">Update</span>
<object class="loader billing-button-loader" type="image/svg+xml" data="{{ static('images/loading/loader-white.svg') }}"></object>
</button>
@@ -81,7 +81,7 @@
<input type="number" name="licenses_at_next_renewal" autocomplete="off" id="next-manual-license-count" class="short-width-number-input" data-original-value="{{ licenses_at_next_renewal }}" value="{{ licenses_at_next_renewal }}" required/>
</form>
<span class="licence-count-in-use">licenses ({{ seat_count }} in use)</span>
- <button id="next-manual-license-count-update-button" class="license-count-update-button" disabled>
+ <button id="next-manual-license-count-update-button" class="license-count-update-button hide">
<span class="billing-button-text">Update</span>
<object class="loader billing-button-loader" type="image/svg+xml" data="{{ static('images/loading/loader-white.svg') }}"></object>
</button>
diff --git a/web/src/billing/billing.ts b/web/src/billing/billing.ts
index b2cae64ebcf..280df72b7ab 100644
--- a/web/src/billing/billing.ts
+++ b/web/src/billing/billing.ts
@@ -194,15 +194,15 @@ export function initialize(): void {
const {new_current_manual_license_count, old_current_manual_license_count} =
get_old_and_new_license_count_for_current_cycle();
if (new_current_manual_license_count > old_current_manual_license_count) {
- $("#current-manual-license-count-update-button").prop("disabled", false);
+ $("#current-manual-license-count-update-button").toggleClass("hide", false);
$("#current-license-change-error").text("");
} else if (new_current_manual_license_count < old_current_manual_license_count) {
$("#current-license-change-error").text(
"You can only increase the number of licenses for the current billing period.",
);
- $("#current-manual-license-count-update-button").prop("disabled", true);
+ $("#current-manual-license-count-update-button").toggleClass("hide", true);
} else {
- $("#current-manual-license-count-update-button").prop("disabled", true);
+ $("#current-manual-license-count-update-button").toggleClass("hide", true);
$("#current-license-change-error").text("");
}
}, 300); // Wait for 300ms after the user stops typing
@@ -221,9 +221,9 @@ export function initialize(): void {
new_next_manual_license_count < 0 ||
new_next_manual_license_count === old_next_manual_license_count
) {
- $("#next-manual-license-count-update-button").prop("disabled", true);
+ $("#next-manual-license-count-update-button").toggleClass("hide", true);
} else {
- $("#next-manual-license-count-update-button").prop("disabled", false);
+ $("#next-manual-license-count-update-button").toggleClass("hide", false);
}
}, 300); // Wait for 300ms after the user stops typing
});
diff --git a/web/styles/portico/billing.css b/web/styles/portico/billing.css
index 962494f3bb4..11449af5634 100644
--- a/web/styles/portico/billing.css
+++ b/web/styles/portico/billing.css
@@ -457,14 +457,10 @@ input[name="licenses"] {
font-size: 1.1rem;
margin-right: 0;
width: 100px;
+}
- &:disabled {
- color: hsl(0deg 0% 80%);
-
- &:hover {
- cursor: not-allowed;
- }
- }
+#billing-page .license-count-update-button.hide {
+ display: none;
}
#billing-page #current-license-change-form,