Skip to content

Commit

Permalink
prevent issuing licences for inactive categories
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jun 16, 2022
1 parent cecda4b commit 8f55edc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
7 changes: 4 additions & 3 deletions public-typescript/licence-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
});
}
if (!isCreate && !issueLicenceButtonElement) {
const renewLicenceButtonElement = document.querySelector("#is-renew-licence-button");
if (!isCreate && renewLicenceButtonElement) {
const doRenew = () => {
const url = new URL(window.location.protocol + "//" +
window.location.host +
Expand All @@ -849,11 +850,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
url.searchParams.append("startDateString", cityssm.dateToString(newStartDate));
window.location.href = url.toString();
};
document.querySelector("#is-renew-licence-button").addEventListener("click", (clickEvent) => {
renewLicenceButtonElement.addEventListener("click", (clickEvent) => {
clickEvent.preventDefault();
bulmaJS.confirm({
title: "Renew " + licenceAlias,
message: "Are you sure you want to renew this " + licenceAlias.toLowerCase() + "?",
message: "Are you sure you want to copy the information from this " + licenceAlias.toLowerCase() + " to a new one?",
okButton: {
text: "Yes, Renew this " + licenceAlias,
callbackFunction: doRenew
Expand Down
7 changes: 4 additions & 3 deletions public-typescript/licence-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1191,8 +1191,9 @@ declare const bulmaJS: BulmaJS;
* Renew Licence
*/

if (!isCreate && !issueLicenceButtonElement) {
const renewLicenceButtonElement = document.querySelector("#is-renew-licence-button");

if (!isCreate && renewLicenceButtonElement) {

const doRenew = () => {

Expand Down Expand Up @@ -1228,13 +1229,13 @@ declare const bulmaJS: BulmaJS;
window.location.href = url.toString();
};

document.querySelector("#is-renew-licence-button").addEventListener("click", (clickEvent) => {
renewLicenceButtonElement.addEventListener("click", (clickEvent) => {

clickEvent.preventDefault();

bulmaJS.confirm({
title: "Renew " + licenceAlias,
message: "Are you sure you want to renew this " + licenceAlias.toLowerCase() + "?",
message: "Are you sure you want to copy the information from this " + licenceAlias.toLowerCase() + " to a new one?",
okButton: {
text: "Yes, Renew this " + licenceAlias,
callbackFunction: doRenew
Expand Down
Loading

0 comments on commit 8f55edc

Please sign in to comment.