awaiting submissions from storage acc
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
export default function handler(req, res) {
|
||||
const { email, subject, emailcontenttitle, emailcontent } = req.body;
|
||||
console.log(email);
|
||||
//console.log(process.env);
|
||||
|
||||
const client = nodemailer.createTransport({
|
||||
auth: {
|
||||
user: process.env.EMAIL_SERVER_USER,
|
||||
pass: process.env.EMAIL_SERVER_PASSWORD,
|
||||
},
|
||||
host: process.env.EMAIL_SERVER_HOST,
|
||||
port: process.env.EMAIL_SERVER_PORT,
|
||||
secure: true,
|
||||
});
|
||||
|
||||
//console.log(client);
|
||||
|
||||
// Some simple styling options
|
||||
const backgroundColor = "#ffffff";
|
||||
const textColor = "#444444";
|
||||
const mainBackgroundColor = "#ffffff";
|
||||
const buttonBackgroundColor = "#aa1111";
|
||||
const buttonBorderColor = "#aa1111";
|
||||
const buttonTextColor = "#ffffff";
|
||||
const headerBackgroundColor = "#000000";
|
||||
const url = process.env.API_ROOT;
|
||||
|
||||
let emailBodyContent = ` <body style="background: ${backgroundColor};">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="center" style="padding: 10px 0px 20px 0px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: #fff;background-color: ${headerBackgroundColor};border-bottom: 10px solid #ffd530;>
|
||||
|
||||
<strong>PEDW - Planning Casework</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" border="0" cellspacing="20" cellpadding="0" style="background: ${mainBackgroundColor}; max-width: 600px; margin: auto; border-radius: 10px;">
|
||||
<tr>
|
||||
<td align="left" style="padding: 10px 0px 0px 0px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: ${textColor};">
|
||||
${emailcontenttitle}
|
||||
</td>
|
||||
<img src ="${url}/assets/images/planning-casework-en.svg"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="padding: 10px 0px 0px 0px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: ${textColor};">
|
||||
${emailcontent}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="padding: 20px 0;">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="padding: 0px 0px 10px 0px; font-size: 16px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; color: ${textColor};">
|
||||
If you did not request this email you can safely ignore it.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>`;
|
||||
|
||||
const mailData = {
|
||||
from: "no-reply@rdbdigital.com",
|
||||
to: email,
|
||||
subject: subject,
|
||||
text: emailBodyContent,
|
||||
html: emailBodyContent,
|
||||
};
|
||||
|
||||
client.sendMail(mailData, (err, data) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
res.status(400);
|
||||
} else {
|
||||
console.log("mail sent");
|
||||
res.status(200).json(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||
|
||||
import { getCaseBlob } from "../../../actions/azurestorage";
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -25,6 +25,7 @@ export default async function ApiProxy(req, res) {
|
||||
var createCaseBody = req.body;
|
||||
var contactid = req.query.contactid;
|
||||
var appealTypeId = req.query.appealTypeId;
|
||||
var containerName = req.query.containername;
|
||||
var lpaID = req.query.lpaID;
|
||||
var queryUrl = "incidents";
|
||||
var token = await getToken();
|
||||
@@ -42,7 +43,7 @@ export default async function ApiProxy(req, res) {
|
||||
delete newData.lpaTypes;
|
||||
delete newData.appealTypes;
|
||||
|
||||
console.log("/////Create Case:", newData);
|
||||
console.log("/////Create Case:\n", newData, "\n//////////////");
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
@@ -55,18 +56,18 @@ export default async function ApiProxy(req, res) {
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: JSON.stringify(data),
|
||||
data: JSON.stringify(newData),
|
||||
};
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: axios(config)
|
||||
.then(({ data }) => {
|
||||
console.log(data);
|
||||
getCaseBlob(containerName, data.ticketnumber, createCaseBody);
|
||||
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(consoleLogger(err));
|
||||
//console.log(consoleLogger(err));
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { hashAPIPath } from "../../../actions";
|
||||
import { deleteBlob } from "../../../actions/azurestorage";
|
||||
|
||||
import nextConnect from "next-connect";
|
||||
import middleware from "../middleware/middleware";
|
||||
|
||||
const ApiProxy = nextConnect();
|
||||
ApiProxy.use(middleware);
|
||||
|
||||
ApiProxy.get(async (req, res) => {
|
||||
var containerName = req.query.container;
|
||||
var casefolderID = req.query.casefolderID;
|
||||
var blobName = req.query.blobname;
|
||||
var checkHash = req.query.hash;
|
||||
|
||||
var checkquerypath =
|
||||
"/api/file/deleteblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID +
|
||||
"&blobname=" +
|
||||
blobName;
|
||||
|
||||
// console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
await deleteBlob(
|
||||
containerName,
|
||||
casefolderID + "/files/" + blobName
|
||||
).then((data) => {
|
||||
return res.status(200).json({ data: data });
|
||||
});
|
||||
} else {
|
||||
return res.status(400).json();
|
||||
}
|
||||
});
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default ApiProxy;
|
||||
@@ -0,0 +1,44 @@
|
||||
import {
|
||||
downloadAllProgressFiles,
|
||||
getAllProgressBlobs,
|
||||
} from "../../../actions/azurestorage";
|
||||
import _ from "lodash";
|
||||
import nextConnect from "next-connect";
|
||||
import middleware from "../middleware/middleware";
|
||||
import { hashAPIPath } from "../../../actions";
|
||||
|
||||
const ApiProxy = nextConnect();
|
||||
ApiProxy.use(middleware);
|
||||
|
||||
ApiProxy.get(async (req, res) => {
|
||||
var containerName = req.query.container;
|
||||
var checkHash = req.query.hash;
|
||||
|
||||
var checkquerypath =
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" + containerName;
|
||||
|
||||
// console.log(req.url);
|
||||
// console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getAllProgressBlobs(containerName)
|
||||
.then((data) => {
|
||||
//console.log(data);
|
||||
return downloadAllProgressFiles(containerName, data);
|
||||
})
|
||||
.then((data) => {
|
||||
return res.status(200).json(data);
|
||||
});
|
||||
} else {
|
||||
return res.status(400).json();
|
||||
}
|
||||
});
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default ApiProxy;
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
downloadProgressFile,
|
||||
getProgressBlobs,
|
||||
} from "../../../actions/azurestorage";
|
||||
|
||||
import _ from "lodash";
|
||||
import nextConnect from "next-connect";
|
||||
import middleware from "../middleware/middleware";
|
||||
|
||||
@@ -25,9 +25,9 @@ ApiProxy.get(async (req, res) => {
|
||||
|
||||
//if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getProgressBlobs(containerName, casefolderID)
|
||||
.then((data) =>
|
||||
downloadProgressFile(containerName, data.path, casefolderID)
|
||||
)
|
||||
.then((data) => {
|
||||
return downloadProgressFile(containerName, data.path, casefolderID);
|
||||
})
|
||||
.then((data) => {
|
||||
return res.status(200).json(data);
|
||||
});
|
||||
|
||||
@@ -32,11 +32,7 @@ ApiProxy.post(async (req, res) => {
|
||||
// if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
|
||||
//createContainer(containerID).then((containerName) => {
|
||||
|
||||
console.log(
|
||||
"does this et folder name:",
|
||||
appealData.pinswg_name,
|
||||
casefolderID
|
||||
);
|
||||
console.log("does this get folder name:", containerID, casefolderID);
|
||||
createBlob(appealData, containerID, casefolderID).then((data) => {
|
||||
Object.keys(req.files).length > 0 &&
|
||||
uploadFile(req.files, containerID, casefolderID);
|
||||
|
||||
@@ -32,7 +32,7 @@ const SignIn = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds govuk-body">
|
||||
A link has been sent to your email so you can
|
||||
continue
|
||||
continue. Please close this window.
|
||||
</div>
|
||||
</div>
|
||||
<div className="govuk-grid-row">
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ const Home = (props) => {
|
||||
<CookieBanner />
|
||||
<Header courseName="Appeals Casework Portal" />
|
||||
<div className="govuk-width-container">
|
||||
{hasGGCode ? (
|
||||
{hasLoginCode ? (
|
||||
<>
|
||||
<h1>
|
||||
{ggLocale == "cy"
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import xpath from "xpath";
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getAppealsTypesForNewAppeal,
|
||||
getMandatoryFields,
|
||||
getPickLists,
|
||||
getPartSavedAppeal,
|
||||
@@ -26,6 +26,7 @@ import TimeOut from "../../components/timeout";
|
||||
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setLoggedInUserEmail,
|
||||
setContainerID,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
@@ -217,32 +218,32 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const { query, req, res } = ctx;
|
||||
const { cookies } = req;
|
||||
|
||||
console.log(cookies);
|
||||
console.log("the query", query.appealtypes);
|
||||
//console.log(cookies);
|
||||
//console.log("the query", query.appealtypes);
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
console.log("nextAuth Session:", thisSession);
|
||||
//console.log("nextAuth Session:", thisSession);
|
||||
|
||||
let loggedInUserIdent = thisSession.user.id;
|
||||
let loggedInUserEmail = thisSession.user.email;
|
||||
|
||||
console.log("logged ident:", loggedInUserIdent);
|
||||
//console.log("logged ident:", loggedInUserIdent);
|
||||
|
||||
const [
|
||||
appealTypeData,
|
||||
mandatoryFieldsData,
|
||||
pickListData,
|
||||
blobList,
|
||||
blobProgress,
|
||||
] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFilesFromBlob(loggedInUserIdent, query.casereference),
|
||||
await getProgressFromBlob(loggedInUserIdent, query.casereference),
|
||||
]);
|
||||
const [appealTypeData, mandatoryFieldsData, pickListData, blobList] =
|
||||
await Promise.all([
|
||||
await getAppealsTypesForNewAppeal(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFilesFromBlob(loggedInUserIdent, query.casereference),
|
||||
]);
|
||||
|
||||
console.log("has blobprogess:", loggedInUserIdent, query.casereference);
|
||||
const blobProgress = await getProgressFromBlob(
|
||||
loggedInUserIdent,
|
||||
query.casereference
|
||||
);
|
||||
|
||||
console.log("/////////\nappela tupe data:", appealTypeData);
|
||||
|
||||
//
|
||||
// Removed to make progress from Blob not CRM
|
||||
@@ -288,6 +289,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
||||
store.dispatch(setAppealLPA(query.lpa));
|
||||
store.dispatch(setAppealTypeID(query.apt));
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
@@ -295,6 +297,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setFilesForAppeal(blobList));
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
|
||||
return {
|
||||
props: { url: process.env.API_ROOT },
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getAwaitingSubmissionFromBlob,
|
||||
getAwaitingSubmission,
|
||||
getMyCases,
|
||||
getMyRepresentations,
|
||||
@@ -27,6 +28,7 @@ import {
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionFromBlob,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
@@ -185,12 +187,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
awaitingSubmissionFromBlob,
|
||||
] = await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getMyCases(loggedInUser),
|
||||
await getMyRepresentations(loggedInUser),
|
||||
await getWatchedCases(loggedInUser),
|
||||
await getAwaitingSubmission(loggedInUser),
|
||||
await getAwaitingSubmissionFromBlob(thisSession.user.id),
|
||||
]);
|
||||
|
||||
if (_.has(accountDetails, "errorCode") != false) {
|
||||
@@ -224,6 +228,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
store.dispatch(
|
||||
setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob)
|
||||
);
|
||||
|
||||
store.dispatch(
|
||||
setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
);
|
||||
|
||||
@@ -26,6 +26,7 @@ import TimeOut from "../../components/timeout";
|
||||
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setLoggedInUserEmail,
|
||||
setContainerID,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
@@ -226,8 +227,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("nextAuth Session:", thisSession);
|
||||
|
||||
let loggedInUserIdent = thisSession.user.id;
|
||||
let loggedInUserEmail = thisSession.user.email;
|
||||
|
||||
console.log("logged ident:", loggedInUserIdent);
|
||||
console.log("logged ident:", loggedInUserIdent, loggedInUserEmail);
|
||||
|
||||
const [
|
||||
caseReferenceData,
|
||||
@@ -235,17 +237,20 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
mandatoryFieldsData,
|
||||
pickListData,
|
||||
//blobList,
|
||||
blobProgress,
|
||||
] = await Promise.all([
|
||||
await getCase(query.id),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getProgressFromBlob(loggedInUserIdent, query.casereference),
|
||||
|
||||
//await getFilesFromBlob(query.casereference),
|
||||
]);
|
||||
|
||||
const blobProgress = await getProgressFromBlob(
|
||||
loggedInUserIdent,
|
||||
caseReferenceData.ticketnumber
|
||||
);
|
||||
|
||||
console.log("anything here", loggedInUser, query.id, caseReferenceData);
|
||||
|
||||
let caseReference = caseReferenceData; //caseReferenceData.ticketnumber;
|
||||
@@ -265,6 +270,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
||||
store.dispatch(setAppealLPA(query.lpa));
|
||||
store.dispatch(setAppealTypeID(query.apt));
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
@@ -273,6 +279,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
|
||||
//store.dispatch(setFilesForAppeal(blobList));
|
||||
|
||||
return {
|
||||
props: { url: process.env.API_ROOT },
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user