billing: Add sponsorship request form to the billing page.

Previously this was only available on the upgrade page - meaning an
organization that already bought a plan wouldn't be able to request a
sponsorship to get a discount or such, even if qualified.
This commit is contained in:
Mateusz Mandera
2023-02-13 20:40:51 +01:00
committed by Tim Abbott
parent cf55e66c74
commit 684430faa2
10 changed files with 140 additions and 72 deletions

View File

@@ -136,6 +136,18 @@ export function set_tab(page) {
window.addEventListener("hashchange", handle_hashchange);
}
export function set_sponsorship_form() {
$("#sponsorship-button").on("click", (e) => {
if (!is_valid_input($("#sponsorship-form"))) {
return;
}
e.preventDefault();
create_ajax_request("/json/billing/sponsorship", "sponsorship", [], "POST", () =>
window.location.replace("/"),
);
});
}
export function is_valid_input(elem) {
return elem[0].checkValidity();
}