aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/functionality/view-khatian
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/functionality/view-khatian')
-rw-r--r--src/scripts/functionality/view-khatian/download-information-pdf-page-content.html8
-rw-r--r--src/scripts/functionality/view-khatian/index.ts128
2 files changed, 68 insertions, 68 deletions
diff --git a/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html b/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html
index 44ced4f..668c36a 100644
--- a/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html
+++ b/src/scripts/functionality/view-khatian/download-information-pdf-page-content.html
@@ -211,7 +211,8 @@
}
</style>
<img class="banner" src="https://banglarbhumi.gov.in/BanglarBhumi/images/bl.png">
- <div class="details" id="$isPlotInformation$">$details$</div>
+ <!--<button id="print-button">Print</button>-->
+ <div class="details">$details$</div>
<footer>
<img class="footer" src="$sanghaFacilitationCentreBannerUrl$">
</footer>
@@ -229,20 +230,21 @@
};
if ($isPlotInformation$) {
+ document.querySelector(".details").setAttribute("id", "plot-information");
const tableElement = document.createElement("table");
tableElement.setAttribute("id", "locater-information");
tableBodyElement = document.createElement("tbody");
tableElement.appendChild(tableBodyElement);
- const detailsElement = document.querySelector("#plot-information > div:nth-child(1)");
+ const detailsElement = document.querySelector(".details > div:nth-child(1)");
detailsElement.insertBefore(tableElement, detailsElement.querySelector("div:nth-child(2)"));
} else {
+ document.querySelector(".details").setAttribute("id", "khatian-information");
tableBodyElement = document.querySelector(".details > table > tbody > tr > td:nth-child(1) > div:nth-child(2) > table > tbody");
}
createTableEntry("\u{99C}\u{9C7}\u{9B2}\u{9BE} (District):", "$district$");
createTableEntry("\u{9AC}\u{9CD}\u{9B2}\u{995} (Block):", "$block$");
createTableEntry("\u{9AE}\u{9CC}\u{99C}\u{9BE} (Mouza):", "$mouza$");
-
Promise.all(
Array.from(document.images)
.filter(img => !img.complete).map(img => new Promise(resolve => {
diff --git a/src/scripts/functionality/view-khatian/index.ts b/src/scripts/functionality/view-khatian/index.ts
index c54ef5a..741a3d0 100644
--- a/src/scripts/functionality/view-khatian/index.ts
+++ b/src/scripts/functionality/view-khatian/index.ts
@@ -4,80 +4,78 @@ import getDownloadInformationPDFPageContent from "@/scripts/functionality/view-k
const sanghaFacilitationCentreBannerUrl = "$l{ /assets/sangha-facilitation-centre-banner.jpg }l$";
-document.addEventListener("DOMContentLoaded", () => {
- const submitButtonElement = $("#khbutton");
- const separatorElement = $("#bodycover > div > form > hr:nth-child(2)");
- const formElement = $("#bodycover > div > form");
- let downloadPDFButton: JQuery<HTMLButtonElement> | null = null;
+const submitButtonElement = $("#khbutton");
+const separatorElement = $("#bodycover > div > form > hr:nth-child(2)");
+const formElement = $("#bodycover > div > form");
+let downloadPDFButton: JQuery<HTMLButtonElement> | null = null;
- const submitButtonElementComputedStyles = window.getComputedStyle(submitButtonElement[0]);
- const styles = Array.from(submitButtonElementComputedStyles)
- .reduce(
- (str, property) => `${str}${property}:${submitButtonElementComputedStyles.getPropertyValue(property)};`,
- ""
- );
+const submitButtonElementComputedStyles = window.getComputedStyle(submitButtonElement[0]);
+const styles = Array.from(submitButtonElementComputedStyles)
+ .reduce(
+ (str, property) => `${str}${property}:${submitButtonElementComputedStyles.getPropertyValue(property)};`,
+ ""
+ );
- const getValueOfSelectElement = (selector: string) => {
- const element = document.querySelector<HTMLSelectElement>(selector)!;
- return element.options[element.selectedIndex].text;
- };
+const getValueOfSelectElement = (selector: string) => {
+ const element = document.querySelector<HTMLSelectElement>(selector)!;
+ return element.options[element.selectedIndex].text;
+};
- let isPlotInformation: boolean | null = null;
+let isPlotInformation: boolean | null = null;
- const downloadInformationPDF = () => {
- generateWebPage(
- getDownloadInformationPDFPageContent({
- sanghaFacilitationCentreBannerUrl,
- isPlotInformation: !!isPlotInformation,
- details: $(isPlotInformation ? "#plotdetails" : "#khdetails").html(),
- district: getValueOfSelectElement("#lstDistrictCode1"),
- block: getValueOfSelectElement("#lstBlockCode1"),
- mouza: getValueOfSelectElement("#lstMouzaList")
- }),
- isPlotInformation
- ? "Plot Details"
- : "Khatian Details"
- );
- };
+const downloadInformationPDF = () => {
+ generateWebPage(
+ getDownloadInformationPDFPageContent({
+ sanghaFacilitationCentreBannerUrl,
+ isPlotInformation: !!isPlotInformation,
+ details: $(isPlotInformation ? "#plotdetails" : "#khdetails").html(),
+ district: getValueOfSelectElement("#lstDistrictCode1"),
+ block: getValueOfSelectElement("#lstBlockCode1"),
+ mouza: getValueOfSelectElement("#lstMouzaList")
+ }),
+ isPlotInformation
+ ? "Plot Details"
+ : "Khatian Details"
+ );
+};
- const showDownloadButton = (args: any) => {
- if (isPlotInformation !== null) {
- const callback = args[2];
- args[2] = (data: any) => {
- callback(data);
- const tableElement = $(isPlotInformation
- ? "#plotdetails > div:nth-child(1) > div:nth-child(4) > table > tbody"
- : "#khdetails > table > tbody > tr > td:nth-child(1) > div:nth-child(5) > table > tbody"
- );
+const showDownloadButton = (args: any) => {
+ if (isPlotInformation !== null) {
+ const callback = args[2];
+ args[2] = (data: any) => {
+ callback(data);
+ const tableElement = $(isPlotInformation
+ ? "#plotdetails > div:nth-child(1) > div:nth-child(4) > table > tbody"
+ : "#khdetails > table > tbody > tr > td:nth-child(1) > div:nth-child(5) > table > tbody"
+ );
- if (tableElement.length > 0) {
- tableElement.css("height", "auto");
- tableElement.css("width", "100%");
+ if (tableElement.length) {
+ tableElement.css("height", "auto");
+ tableElement.css("width", "100%");
- if (!downloadPDFButton) {
- downloadPDFButton = $(document.createElement("button"));
- downloadPDFButton.html("Download PDF");
- downloadPDFButton[0].style.cssText = styles;
- downloadPDFButton.css("width", "auto");
- downloadPDFButton.css("margin-bottom", "1rem");
- downloadPDFButton.click(downloadInformationPDF);
- formElement[0].insertBefore(downloadPDFButton[0], separatorElement[0]);
- }
- } else if (downloadPDFButton) {
- $(downloadPDFButton).remove();
- isPlotInformation = null;
- downloadPDFButton = null;
+ if (!downloadPDFButton) {
+ downloadPDFButton = $(document.createElement("button"));
+ downloadPDFButton.html("Download PDF");
+ downloadPDFButton[0].style.cssText = styles;
+ downloadPDFButton.css("width", "auto");
+ downloadPDFButton.css("margin-bottom", "1rem");
+ downloadPDFButton.click(downloadInformationPDF);
+ formElement[0].insertBefore(downloadPDFButton[0], separatorElement[0]);
}
+ } else if (downloadPDFButton) {
+ ($(downloadPDFButton as any) as any).remove();
+ isPlotInformation = null;
+ downloadPDFButton = null;
}
}
- };
+ }
+};
- interceptPost("plotDetailsAction_LandInfo.action", args => {
- isPlotInformation = true;
- showDownloadButton(args);
- });
- interceptPost("plotDetailsAction_LandInfo.action", args => {
- isPlotInformation = false;
- showDownloadButton(args);
- });
+interceptPost("plotDetailsAction_LandInfo.action", args => {
+ isPlotInformation = true;
+ showDownloadButton(args);
+});
+interceptPost("khDetailsAction_LandInfo.action", args => {
+ isPlotInformation = false;
+ showDownloadButton(args);
});