Skip to content

Commit

Permalink
add folio to search results & nil report
Browse files Browse the repository at this point in the history
  • Loading branch information
mgtennant committed Jun 23, 2023
1 parent 9eb4209 commit 343dfdb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
5 changes: 4 additions & 1 deletion frontend/public/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ async function emailSearchResults() {
$(':button').prop('disabled', true);
displayReportEmailSpinner();
const searchData = JSON.parse(localStorage.getItem('searchResults'));
const folio = $('#folioInput').val();
let email = $('#selectSearchResultsEmailRadio').is(':checked')
? $('#searchResultsEmailSelect').val()
: $('#searchResultsEmailInput').val();
Expand All @@ -381,6 +382,7 @@ async function emailSearchResults() {
email: email,
searchData: searchData,
searchInfo: getSearchInfo(),
folio: folio,
};
fetch(`/bc-registry/email-search-results`, {
method: 'POST',
Expand Down Expand Up @@ -477,6 +479,7 @@ async function getNilPdf() {
let searchCriteria1;
let searchCriteria2;
let searchCriteria3;
const folio = $('#folioInput').val();
switch (searchType) {
case 'pid': {
searchCriteria1 = localStorage.getItem('searchCriteria');
Expand Down Expand Up @@ -528,7 +531,7 @@ async function getNilPdf() {
fetch(
`/bc-registry/nil-pdf/${searchType}/${encodeURI(searchCriteria1)}/${encodeURI(searchCriteria2)}/${encodeURI(
searchCriteria3
)}`,
)}/${folio}`,
{
method: 'GET',
}
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/bc-registry/bc-registry.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ export class BCRegistryController {
};
}

@Get('nil-pdf/:searchType/:searchCriteria1/:searchCriteria2/:searchCriteria3')
@Get('nil-pdf/:searchType/:searchCriteria1/:searchCriteria2/:searchCriteria3/:folio')
@Header('Content-Type', 'application/pdf')
@Header('Content-Disposition', 'attachment; filename=report.pdf')
async getNilPdf(
@Param('searchType') searchType: string,
@Param('searchCriteria1') searchCriteria1: string,
@Param('searchCriteria2') searchCriteria2: string,
@Param('searchCriteria3') searchCriteria3: string,
@Param('folio') folio: string,
@Session() session: { data?: SessionData }
): Promise<StreamableFile> {
return new StreamableFile(
Expand All @@ -203,7 +204,8 @@ export class BCRegistryController {
decodeURI(searchCriteria1),
decodeURI(searchCriteria2),
decodeURI(searchCriteria3),
session.data.name
session.data.name,
folio
)
);
}
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/bc-registry/bc-registry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ export class BCRegistryService {
searchCriteria1: string,
searchCriteria2: string,
searchCriteria3: string,
name: string
name: string,
folio: string
) {
const authorizationToken = await this.getCdogsToken();
const documentTemplate = nilTemplate;
Expand All @@ -275,6 +276,7 @@ export class BCRegistryService {
this.httpService.get(requestUrl, requestConfig).pipe(map((response) => response.data))
);
data['account'] = name;
data['folio'] = folio;

switch (searchType) {
case 'pid': {
Expand Down Expand Up @@ -368,7 +370,7 @@ export class BCRegistryService {
});
}

async requestNilSiteIdPdf(siteId: string, name: string) {
async requestNilSiteIdPdf(siteId: string, name: string, folio: string) {
const authorizationToken = await this.getCdogsToken();
const documentTemplate = nilTemplate2;
const requestUrl = `${hostname}:${port}/srsites/getNilReportData/1`;
Expand All @@ -382,6 +384,7 @@ export class BCRegistryService {
this.httpService.get(requestUrl, requestConfig).pipe(map((response) => response.data))
);
data['account'] = name;
data['folio'] = folio;
data['searchType'] = 'Site Identification Number';
data['siteId'] = 'Site ID: ' + siteId; // siteid

Expand Down Expand Up @@ -559,7 +562,7 @@ export class BCRegistryService {
);
} catch (err) {
console.log('caught error');
return this.requestNilSiteIdPdf(parseInt(siteId).toString(), name);
return this.requestNilSiteIdPdf(parseInt(siteId).toString(), name, folio);
}
console.log('Received db data, starting pdf generation');
const startTime = new Date().getTime();
Expand Down Expand Up @@ -845,6 +848,7 @@ export class BCRegistryService {
this.httpService.get(requestUrl, requestConfig).pipe(map((response) => response.data))
);
data['account'] = name;
data['folio'] = searchResultsJson.folio;
switch (searchResultsJson.searchInfo.searchType) {
case 'pid': {
data['searchType'] = 'Land Title Parcel Identifier (PID)';
Expand Down
7 changes: 7 additions & 0 deletions frontend/utils/templates/nilTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ <h3 style="text-align: center; margin: 0.5rem">BC Registries and Online Services
No records from the Site Registry that match the search criteria provided:
</div>
<br />
<div class="col-sm-4 text-left">
<table>
<tr>
<td class="bigserif">Folio: {d.folio}</td>
</tr>
</table>
</div>
<div class="col-sm-4 text-left">
<table>
<tr>
Expand Down
7 changes: 7 additions & 0 deletions frontend/utils/templates/searchResultsPartialTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ <h3 style="text-align: center; margin: 0.5rem">BC Registries and Online Services
<div class="bigserif">
These are the records from the Site Registry that match the search criteria provided:
</div>
<div class="col-sm-4 text-left">
<table>
<tr>
<td class="bigserif">Folio: {d.folio}</td>
</tr>
</table>
</div>
<div class="col-sm-4 text-left">
<table>
<tr>
Expand Down
1 change: 1 addition & 0 deletions frontend/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export type SearchResultsJson = {
searchCriteria3: string;
};
searchData: [SearchResultsJsonObject];
folio: string;
};

export type SearchResultsJsonObject = {
Expand Down

0 comments on commit 343dfdb

Please sign in to comment.