Skip to content

Commit

Permalink
Merge pull request #5355 from bcgov/origin/dev-marshal-SS-3968
Browse files Browse the repository at this point in the history
[FOIMOD-3389] add generic cover email template
  • Loading branch information
JieunSon96 authored Aug 13, 2024
2 parents 7a9fa63 + 7d6c995 commit bebe45f
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const fetchDocumentPage = (ministryId, done) => {
if (!ministryId) {
return (dispatch) => {};
}
console.log("ministrY id : ",ministryId)

let apiUrl = replaceUrl(
API.DOC_REVIEWER_REDACTED_DOCUMENT_RECORDS,
"<ministryrequestid>",
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ const FOIRequest = React.memo(({ userDetail, openApplicantProfileModal }) => {
return (
requestState !== StateEnum.intakeinprogress.name &&
requestState !== StateEnum.unopened.name &&
requestState !== StateEnum.open.name &&
//requestState !== StateEnum.open.name &&
requestState !== StateEnum.appfeeowing.name &&
requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,18 @@ export const ContactApplicant = ({
if (['PAYONLINE', 'PAYOUTSTANDING'].includes(item.name)) {
return !isFeeTemplateDisabled(currentCFRForm, item);
} else if (['EXTENSIONS-PB'].includes(item.name)) {
return getExtensionType(requestExtensions) === "PB";
return getExtensionType(requestDetails, requestExtensions) === "PB";
} else if (['OIPCAPPLICANTCONSENTEXTENSION'].includes(item.name)) {
const check=getExtensionType(requestExtensions) === "OIPCAPPLICANTCONSENTEXTENSION"
return check;
const isApplicantConsent = getExtensionType(requestDetails, requestExtensions) === "OIPCAPPLICANTCONSENTEXTENSION"
return isApplicantConsent;
} else if(['OIPCFIRSTTIMEEXTENSION'].includes(item.name)){
const check2 = getExtensionType(requestExtensions) === "OIPCFIRSTTIMEEXTENSION"
return check2;
const isFirstTimeExtension = getExtensionType(requestDetails, requestExtensions) === "OIPCFIRSTTIMEEXTENSION"
return isFirstTimeExtension;
} else if(['OIPCSUBSEQUENTTIMEEXTENSION'].includes(item.name)){
const check3 = getExtensionType(requestExtensions) === "OIPCSUBSEQUENTTIMEEXTENSION"
return check3;
const isSubsequentTimeExtension = getExtensionType(requestDetails, requestExtensions) === "OIPCSUBSEQUENTTIMEEXTENSION"
return isSubsequentTimeExtension;
} else if(['GENERICCOVEREMAILTEMPLATE'].includes(item.name)){
return true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { fetchDocumentPage, fetchDocumentPageFlags } from "../../../../apiManage

export const renderTemplate = (template: string, content: string, params: Array<any>) => {
let newTemplate = template.replace("{{content}}", content);
console.log("renderTemplate안에 newTemplate : ",newTemplate)
return applyVariables(newTemplate, params);
}

Expand All @@ -31,7 +30,12 @@ export const getExtensiondetails = (requestExtensions:any, type: string) => {
return ["","","","","","",""]
}

export const getExtensionType = (requestExtensions: any) => {
export const getExtensionType = (requestDetails:any, requestExtensions: any) => {

if (requestDetails.currentState === "Open") {
return "NA";
}

if (!requestExtensions || requestExtensions.length === 0) {
return "NA";
}
Expand All @@ -45,7 +49,6 @@ export const getExtensionType = (requestExtensions: any) => {
if (latestExtension.extensionstatus === "Approved" && latestExtension.extensiontype === "OIPC") {
return "OIPCAPPLICANTCONSENTEXTENSION";
} else if (latestExtension.extensionstatus === "Pending" && latestExtension.extensiontype === "OIPC") {
console.log("approvedOIPCExists : ",approvedOIPCExists)
return approvedOIPCExists ? "OIPCSUBSEQUENTTIMEEXTENSION" : "OIPCFIRSTTIMEEXTENSION";
} else if (latestExtension.extensionstatus === "Approved" && latestExtension.extensiontype === "Public Body") {
return "PB";
Expand Down Expand Up @@ -159,7 +162,6 @@ const getMappedValue = (property: string, propertykey: string) => {

// Function to map extension reason id to its textual representation (PB and OIPC combined)
const mapSectionWithExtensionReasonId = (extensionReasonId: number) => {
console.log("extensionReasonId : ",extensionReasonId)
switch (extensionReasonId) {
case 1:
case 6:
Expand Down Expand Up @@ -219,7 +221,6 @@ const displayFeeEstimateInfo = (data: any[]): string => {
const dateSent = result.created_at || "";
const datePaid = getFullFeePaidDate(data) || "";
const dateWaiverDecision = getFeeWaiverDecisionDate(data) || "";
console.log("Fee dateSent: "+dateSent, "/ Fee datePaid:",datePaid," / Fee dateWaiverDecision:",dateWaiverDecision)

htmlString = `
<p><strong><span style="font-size: 13px;">Fee Estimate:&nbsp;</span></strong><span style="font-size: 13px;">Yes</span></p>
Expand Down Expand Up @@ -291,8 +292,7 @@ const displayPBExtension = (requestExtensions:any): string => {
// Check if there are any PB Extensions
if (pbExtensions.length > 0) {
const recentPBExtension = pbExtensions[0]; // Assuming the list is sorted by date with the most recent first
console.log("Most recent PB Extension:", recentPBExtension);


// Extract variables for the HTML template
const {
extendedduedate,
Expand Down Expand Up @@ -337,7 +337,6 @@ const displayOIPCExtension = (requestExtensions:any): string => {
);
// Join the mapped reasons into a comma-separated string
const reasonsString = mappedReasons.join(", ");
console.log("displayOIPCExtension : ",reasonsString)
return reasonsString;
}
}
Expand All @@ -355,7 +354,6 @@ const displayApplicantConsentSection = (requestExtensions:any, requestDetails:an
// Check if there are any OIPC Extensions
if (oipcExtensions.length > 0) {
const recentOIPCExtension = oipcExtensions[0]; // Assuming the list is sorted by date with the most recent first
console.log("Most recent OIPC Extension:", recentOIPCExtension);

// Extract variables for the HTML template
const { extensionreson } = recentOIPCExtension;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""empty message
Revision ID: 5b9b19213803
Revises: 3e8203b24730
Create Date: 2024-08-09 15:35:11.747935
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '5b9b19213803'
down_revision = '3e8203b24730'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by FAlembic - please adjust! ###
op.execute("""
INSERT INTO public."ApplicantCorrespondenceTemplates"( documenturipath, "name", description, active, "version", created_at, createdby, display)
VALUES
('/TEMPLATES/EMAILS/generic_cover_email_template.html', 'GENERICCOVEREMAILTEMPLATE', 'Generic Cover Email Template', true, 1, now(), 'system', true);
commit;""")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute("""delete from public."ApplicantCorrespondenceTemplates" act where name = 'GENERICCOVEREMAILTEMPLATE'; commit;""")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p><span style="font-size: 13px;">Subject: FOI Request {{axisRequestId}}</span></p>
<p style="text-align: center;"><span style="font-size: 13px; ">&nbsp;</span></p>
<p><span style='font-size:13px;font-family:"BC Sans";'>Please see the attached regarding your FOI request/consultation.&nbsp;</span>
<p style="text-align: center;"><span style="font-size: 13px; ">&nbsp;</span></p>
<p><span style="font-size: 13px;">Thank you,</span></p>
<p><strong><span style="font-size: 13px;">Information Access Operations | Ministry of Citizens' Services</span></strong><span style="font-size: 13px;"></span></p>
<p><strong><span style="font-size: 13px;"><a href="https://www.gov.bc.ca/freedomofinformation"><span style="font-size: 13px; ">www.gov.bc.ca/freedomofinformation</span></a></span></strong><span style="font-size: 13px;"></span></p>

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def gettemplatename(self, key):
return "oipc_first_time_extension.html"
elif key == "OIPCSUBSEQUENTTIMEEXTENSION":
return "oipc_subsequent_time_extension.html"
elif key == "GENERICCOVEREMAILTEMPLATE":
return "generic_cover_email_template.html"
else:
logging.info("Unknown key")
return None
Expand Down

0 comments on commit bebe45f

Please sign in to comment.