Skip to content

Commit

Permalink
hide related licences
Browse files Browse the repository at this point in the history
closes #96
  • Loading branch information
dangowans committed Jun 8, 2022
1 parent cb25dd5 commit f242a3c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions helpers/functions.config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export declare function getProperty(propertyName: "settings.licenceAliasPlural")
export declare function getProperty(propertyName: "settings.licenseeAlias"): string;
export declare function getProperty(propertyName: "settings.licenseeAliasPlural"): string;
export declare function getProperty(propertyName: "settings.renewalAlias"): string;
export declare function getProperty(propertyName: "settings.includeRelated"): boolean;
export declare function getProperty(propertyName: "settings.includeBatches"): boolean;
export declare function getProperty(propertyName: "settings.includeReplacementFee"): boolean;
export declare function getProperty(propertyName: "exports.batches"): configTypes.ConfigBatchExport;
Expand Down
1 change: 1 addition & 0 deletions helpers/functions.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ configFallbackValues.set("settings.licenceAliasPlural", "Licences");
configFallbackValues.set("settings.licenseeAlias", "Licensee");
configFallbackValues.set("settings.licenseeAliasPlural", "Licensees");
configFallbackValues.set("settings.renewalAlias", "Renewal");
configFallbackValues.set("settings.includeRelated", true);
configFallbackValues.set("settings.includeBatches", false);
configFallbackValues.set("settings.includeReplacementFee", true);
configFallbackValues.set("licenceLengthFunctions", {});
Expand Down
2 changes: 2 additions & 0 deletions helpers/functions.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ configFallbackValues.set("settings.licenceAliasPlural", "Licences");
configFallbackValues.set("settings.licenseeAlias", "Licensee");
configFallbackValues.set("settings.licenseeAliasPlural", "Licensees");
configFallbackValues.set("settings.renewalAlias", "Renewal");
configFallbackValues.set("settings.includeRelated", true);
configFallbackValues.set("settings.includeBatches", false);
configFallbackValues.set("settings.includeReplacementFee", true);

Expand Down Expand Up @@ -71,6 +72,7 @@ export function getProperty(propertyName: "settings.licenceAliasPlural"): string
export function getProperty(propertyName: "settings.licenseeAlias"): string;
export function getProperty(propertyName: "settings.licenseeAliasPlural"): string;
export function getProperty(propertyName: "settings.renewalAlias"): string;
export function getProperty(propertyName: "settings.includeRelated"): boolean;
export function getProperty(propertyName: "settings.includeBatches"): boolean;
export function getProperty(propertyName: "settings.includeReplacementFee"): boolean;

Expand Down
2 changes: 1 addition & 1 deletion public-typescript/licence-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
clickEvent.currentTarget.closest(".message").remove();
});
}
if (!isCreate) {
if (!isCreate && document.querySelector("#panel--relatedLicences")) {
const currentDateString = cityssm.dateToString(new Date());
const getRelatedLicenceHTML = (relatedLicence) => {
const licenceURL = urlPrefix + "/licences/" + relatedLicence.licenceId +
Expand Down
4 changes: 2 additions & 2 deletions public-typescript/licence-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ declare const bulmaJS: BulmaJS;
* Related Licences
*/

if (!isCreate) {
if (!isCreate && document.querySelector("#panel--relatedLicences")) {

const currentDateString = cityssm.dateToString(new Date());

Expand Down Expand Up @@ -1204,7 +1204,7 @@ declare const bulmaJS: BulmaJS;
url.searchParams.append("bankTransitNumber", bankTransitNumberElement.value);
url.searchParams.append("bankAccountNumber", (document.querySelector("#licenceEdit--bankAccountNumber") as HTMLInputElement).value);
}

let newStartDate = endDateStringElement.valueAsDate;
newStartDate.setDate(newStartDate.getDate() + 1);

Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/licence-edit.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions types/configTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Config {
licenseeAlias?: string;
licenseeAliasPlural?: string;
renewalAlias?: string;
includeRelated?: boolean;
includeBatches?: boolean;
includeReplacementFee?: boolean;
};
Expand Down
1 change: 1 addition & 0 deletions types/configTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Config {
licenseeAlias?: string;
licenseeAliasPlural?: string;
renewalAlias?: string;
includeRelated?: boolean;
includeBatches?: boolean;
includeReplacementFee?: boolean;
};
Expand Down
2 changes: 1 addition & 1 deletion views/licence-edit.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
</div>
</div>
</div>
<% if (!isCreate || relatedLicence) { %>
<% if ((!isCreate && (configFunctions.getProperty("settings.includeRelated") || licence.relatedLicences.length > 0)) || (isCreate && relatedLicence)) { %>
<div class="column">
<% if (isCreate && relatedLicence) { %>
<div class="message is-info">
Expand Down

0 comments on commit f242a3c

Please sign in to comment.