+14
-6
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||||
//ESNR Tenant
|
//ESNR Tenant
|
||||||
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||||
@@ -45,10 +43,10 @@ RELAYPATH = "dev-pedw-hc"
|
|||||||
|
|
||||||
|
|
||||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||||
SHOWLOGIN = "false"
|
SHOWLOGIN = "true"
|
||||||
SHOWREPRESENTATIONS = "false"
|
SHOWREPRESENTATIONS = false
|
||||||
SHOWFILEUPLOAD = "false"
|
SHOWFILEUPLOAD = "true"
|
||||||
SHOWMAPS = "false"
|
SHOWMAPS = "true"
|
||||||
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||||
|
|
||||||
|
|
||||||
@@ -89,3 +87,13 @@ NEXTAUTH_URL=http://localhost:3000
|
|||||||
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
||||||
DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
||||||
SECRET=SuperSecret
|
SECRET=SuperSecret
|
||||||
|
|
||||||
|
|
||||||
|
//Azure Storage Account
|
||||||
|
|
||||||
|
AZURE_CLIENT_ID = $CLIENT_ID
|
||||||
|
AZURE_TENANT_ID = $TENANT
|
||||||
|
AZURE_CLIENT_SECRET = $CLIENT_SECRET
|
||||||
|
|
||||||
|
AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net
|
||||||
|
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
import { BlobServiceClient, ContainerClient } from "@azure/storage-blob";
|
||||||
|
import {
|
||||||
|
DefaultAzureCredential,
|
||||||
|
InteractiveBrowserCredential,
|
||||||
|
EnvironmentCredential,
|
||||||
|
ClientSecretCredential,
|
||||||
|
} from "@azure/identity";
|
||||||
|
import { hashAPIPath } from ".";
|
||||||
|
|
||||||
|
const STORAGE_PATH = process.env.AZURE_PEDW_STORAGE_ENDPOINT;
|
||||||
|
const STORAGE_CONTAINER = process.env.AZURE_PEDW_CONTAINER;
|
||||||
|
|
||||||
|
export const createContainer = async (containerName) => {
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
containerName = containerName.toLowerCase();
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// "container name:",
|
||||||
|
// containerName,
|
||||||
|
// STORAGE_PATH + "/" + containerName
|
||||||
|
// );
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`${STORAGE_PATH}/${containerName}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
const blobServiceClient = new BlobServiceClient(`${STORAGE_PATH}`, creds);
|
||||||
|
|
||||||
|
const createContainerResponse = await containerClient.createIfNotExists();
|
||||||
|
// console.log(
|
||||||
|
// `Created container ${containerName} successfully`,
|
||||||
|
// createContainerResponse.requestId
|
||||||
|
// );
|
||||||
|
|
||||||
|
// console.log("Containers:");
|
||||||
|
// for await (const container of blobServiceClient.listContainers()) {
|
||||||
|
// console.log(`- ${container.name}`);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return containerName;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getContainers = async () => {
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
const blobServiceClient = new BlobServiceClient(`${STORAGE_PATH}`, creds);
|
||||||
|
|
||||||
|
console.log("Containers:");
|
||||||
|
for await (const container of blobServiceClient.listContainers()) {
|
||||||
|
console.log(`- ${container.name}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getBlobs = async (containerName) => {
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`${STORAGE_PATH}/${containerName}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
containerClient.createIfNotExists();
|
||||||
|
|
||||||
|
const blobObj = [];
|
||||||
|
for await (const blob of containerClient.listBlobsFlat({
|
||||||
|
prefix: "files/",
|
||||||
|
})) {
|
||||||
|
let blobDocumentType = blob.name
|
||||||
|
.split("/")[1]
|
||||||
|
.slice(0, blob.name.split("/")[1].indexOf("_"));
|
||||||
|
|
||||||
|
blobObj.push({
|
||||||
|
"name": blob.name.split("/")[1],
|
||||||
|
"path": blob.name,
|
||||||
|
"documentType": blobDocumentType,
|
||||||
|
"versionId": blob.versionId,
|
||||||
|
"isCurrentVersion": blob.isCurrentVersion,
|
||||||
|
"contentLength": blob.properties.contentLength,
|
||||||
|
"contentType": blob.contentType,
|
||||||
|
"hashedfilepath": hashAPIPath(
|
||||||
|
"/api/file/downloadblob?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
"&blobname=" +
|
||||||
|
blob.name.split("/")[1]
|
||||||
|
),
|
||||||
|
"hasheddeletepath": hashAPIPath(
|
||||||
|
"/api/file/deleteblob?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
"&blobname=" +
|
||||||
|
blob.name.split("/")[1]
|
||||||
|
),
|
||||||
|
"hashgetblobs": hashAPIPath(
|
||||||
|
"/api/file/getbloblist?container=" + containerName.toLowerCase()
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return blobObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createBlob = async (formContent, containerName) => {
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`${STORAGE_PATH}/${containerName}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
const content = JSON.stringify(formContent);
|
||||||
|
const blobName =
|
||||||
|
formContent.pinswg_name + "_" + new Date().getTime() + ".json";
|
||||||
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||||
|
|
||||||
|
const uploadBlobResponse = await blockBlobClient.upload(
|
||||||
|
content,
|
||||||
|
Buffer.byteLength(content)
|
||||||
|
);
|
||||||
|
|
||||||
|
// console.log("Blobs:");
|
||||||
|
// for await (const blob of containerClient.listBlobsByHierarchy("/")) {
|
||||||
|
// console.log(`- ${blob.name}`);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return formContent.pinswg_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteBlob = async (containerName, blobName) => {
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
deleteSnapshots: "include", // or 'only'
|
||||||
|
};
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`${STORAGE_PATH}/${containerName.toLowerCase()}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||||
|
|
||||||
|
await blockBlobClient.deleteIfExists(options);
|
||||||
|
|
||||||
|
console.log(`deleted blob ${blobName}`);
|
||||||
|
|
||||||
|
return { "deleted": blobName };
|
||||||
|
};
|
||||||
|
|
||||||
|
export const uploadFile = async (formContent, containerName, foldername) => {
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`${STORAGE_PATH}/${containerName}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
const files = formContent;
|
||||||
|
|
||||||
|
//console.log(...formContent);
|
||||||
|
//console.log("files...", files, files.length);
|
||||||
|
|
||||||
|
for (const prop in files) {
|
||||||
|
//console.log(`files[${prop}] = ${files[prop][0].size}`);
|
||||||
|
const blobName = "files/" + files[prop][0].fieldName;
|
||||||
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||||
|
const uploadBlobResponse = await blockBlobClient.uploadFile(
|
||||||
|
files[prop][0].path,
|
||||||
|
files[prop].size
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
`Uploaded block blob ${files[prop][0].fieldName} successfully`,
|
||||||
|
uploadBlobResponse.requestId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const downloadFile = async (containerName, blobName) => {
|
||||||
|
//console.log.apply(containerName, blobName);
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`${STORAGE_PATH}/${containerName}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
const blobClient = containerClient.getBlobClient("files/" + blobName);
|
||||||
|
const downloadedBlob = await blobClient.download(0);
|
||||||
|
|
||||||
|
const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody);
|
||||||
|
return downloaded;
|
||||||
|
};
|
||||||
|
|
||||||
|
const streamToBuffer = async (readableStream) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const chunks = [];
|
||||||
|
readableStream.on("data", (data) => {
|
||||||
|
chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
||||||
|
});
|
||||||
|
readableStream.on("end", () => {
|
||||||
|
resolve(Buffer.concat(chunks));
|
||||||
|
});
|
||||||
|
readableStream.on("error", reject);
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { hashAPIPath } from "./";
|
import { hashAPIPath, consoleLogger } from "./";
|
||||||
|
|
||||||
const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT;
|
const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT;
|
||||||
const ggClientID = process.env.GG_CLIENT_ID;
|
const ggClientID = process.env.GG_CLIENT_ID;
|
||||||
@@ -87,7 +87,9 @@ export const getPortalLogin = (emailAddress, token) => {
|
|||||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("thiserror", error);
|
console.log(consoleLogger(error));
|
||||||
|
//console.log("thiserror", error);
|
||||||
|
return JSON.stringify(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+114
-25
@@ -3,7 +3,7 @@ import https from "https";
|
|||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import HmacSHA256 from "crypto-js/hmac-sha256";
|
import HmacSHA256 from "crypto-js/hmac-sha256";
|
||||||
import { getFormCollection } from "../components/utils";
|
import { getFormCollection } from "../components/utils";
|
||||||
|
import { downloadFile } from "./azurestorage";
|
||||||
let BASE_URL;
|
let BASE_URL;
|
||||||
const port = parseInt(process.env.PORT, 10) || 3000;
|
const port = parseInt(process.env.PORT, 10) || 3000;
|
||||||
|
|
||||||
@@ -24,9 +24,17 @@ const WEBAPI_URL =
|
|||||||
process.env.RELAY_ROOT ||
|
process.env.RELAY_ROOT ||
|
||||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||||
|
|
||||||
const agent = new https.Agent({
|
export const consoleLogger = (err) => {
|
||||||
rejectUnauthorized: false,
|
var errStr =
|
||||||
});
|
"///////\nServer Error " +
|
||||||
|
"\n" +
|
||||||
|
err.response.status +
|
||||||
|
" : " +
|
||||||
|
err.response.statusText +
|
||||||
|
"\n///////";
|
||||||
|
|
||||||
|
return errStr;
|
||||||
|
};
|
||||||
|
|
||||||
export const getToken = () => {
|
export const getToken = () => {
|
||||||
return axios
|
return axios
|
||||||
@@ -125,7 +133,6 @@ export const hashAPIPath = (queryPath) => {
|
|||||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||||
);
|
);
|
||||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||||
|
|
||||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1029,35 +1036,117 @@ export const createAccount = (formValues) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const uploadFiles = (formValues) => {
|
export const uploadFiles = async (formValues, filesObj, uploadhash) => {
|
||||||
var data = formValues;
|
let files = filesObj;
|
||||||
var queryUrl = "/api/uploads";
|
|
||||||
var config = {
|
//console.log(formValues);
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append("appealData", JSON.stringify(formValues));
|
||||||
|
|
||||||
|
// files.forEach((file) => formData.append("files", file));
|
||||||
|
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
for (let j = 0; j < files[i].length; j++) {
|
||||||
|
console.log(files[i][j].name);
|
||||||
|
formData.append(files[i][j].name, files[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(formData);
|
||||||
|
|
||||||
|
var queryUrl = "/api/file/upload";
|
||||||
|
|
||||||
|
const config = {
|
||||||
method: "post",
|
method: "post",
|
||||||
url: queryUrl,
|
url: queryUrl,
|
||||||
data: data,
|
data: formData,
|
||||||
|
headers: { "content-type": "multipart/form-data" },
|
||||||
};
|
};
|
||||||
|
|
||||||
// const config = {
|
|
||||||
// method: "post",
|
|
||||||
// url: queryUrl,
|
|
||||||
// data: data,
|
|
||||||
// headers: { "content-type": "multipart/form-data" },
|
|
||||||
// onUploadProgress: (event) => {
|
|
||||||
// //console.log(
|
|
||||||
// `Current progress:`,
|
|
||||||
// Math.round((event.loaded * 100) / event.total)
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
|
|
||||||
//console.log(config);
|
//console.log(config);
|
||||||
return axios(config)
|
try {
|
||||||
|
const res = await axios(config);
|
||||||
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
console.log("this serror", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getFilesFromBlob = (containerName) => {
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
BASE_URL +
|
||||||
|
"/api/file/getbloblist?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
hashAPIPath(
|
||||||
|
"/api/file/getbloblist?container=" +
|
||||||
|
containerName.toLowerCase()
|
||||||
|
)
|
||||||
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
//console.log("posted ", res.data);
|
//console.log("//////////----", res.data);
|
||||||
return res.data;
|
return res.data;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("this serror", error);
|
console.log("this serror", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getFilesFromBlobHashed = (containerName, getblobshash) => {
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
BASE_URL +
|
||||||
|
"/api/file/getbloblist?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
getblobshash
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
//console.log("//////////----", res.data);
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("this serror", error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteBlob = async (containerName, blobName, deleteblobhash) => {
|
||||||
|
try {
|
||||||
|
const res = await axios.get(
|
||||||
|
BASE_URL +
|
||||||
|
"/api/file/deleteblob?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
"&blobname=" +
|
||||||
|
blobName +
|
||||||
|
deleteblobhash
|
||||||
|
);
|
||||||
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
console.log("this serror", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const downloadBlob = (containerName, blobName) => {
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
BASE_URL +
|
||||||
|
"/api/file/downloadblob?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
"&blobname=" +
|
||||||
|
blobName,
|
||||||
|
{ responseType: "blob" }
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
console.log("Downloaded blob content:www");
|
||||||
|
|
||||||
|
res.setHeader(
|
||||||
|
"content-disposition",
|
||||||
|
"attachment; filename=" + blobName
|
||||||
|
);
|
||||||
|
console.log("has downloaded");
|
||||||
|
|
||||||
|
return res.status(200).send(response.data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("this serror", error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
+130
-109
@@ -14,6 +14,13 @@ import FileUpload from "../newappeal/fileupload";
|
|||||||
import Dropzone, { useDropzone } from "react-dropzone";
|
import Dropzone, { useDropzone } from "react-dropzone";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { connect, useDispatch } from "react-redux";
|
import { connect, useDispatch } from "react-redux";
|
||||||
|
import {
|
||||||
|
getFilesFromBlobHashed,
|
||||||
|
deleteBlob,
|
||||||
|
downloadBlob,
|
||||||
|
} from "../../actions";
|
||||||
|
import { setFilesForAppeal } from "../../store/appealType/action";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addYears,
|
addYears,
|
||||||
@@ -1057,7 +1064,7 @@ export function NumericField(props) {
|
|||||||
(showIfHasParentShowValue == parentField) != false &&
|
(showIfHasParentShowValue == parentField) != false &&
|
||||||
showIfHasParentShowValue;
|
showIfHasParentShowValue;
|
||||||
|
|
||||||
console.log("parentField:", parentField, showIfHasParentShowValue);
|
//console.log("parentField:", parentField, showIfHasParentShowValue);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -1126,7 +1133,7 @@ export function DecimalField(props) {
|
|||||||
(showIfHasParentShowValue == parentField) != false &&
|
(showIfHasParentShowValue == parentField) != false &&
|
||||||
showIfHasParentShowValue;
|
showIfHasParentShowValue;
|
||||||
|
|
||||||
console.log("parentField:", parentField, showIfHasParentShowValue);
|
//console.log("parentField:", parentField, showIfHasParentShowValue);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -1246,6 +1253,8 @@ export function FileUploadField(props) {
|
|||||||
ticketnumber={props.ticketnumber}
|
ticketnumber={props.ticketnumber}
|
||||||
documentTypeCode={props.documentTypeCode}
|
documentTypeCode={props.documentTypeCode}
|
||||||
hint={props.hint}
|
hint={props.hint}
|
||||||
|
fileList={props.fileList}
|
||||||
|
setFilesForAppeal={props.setFilesForAppeal}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -1277,104 +1286,6 @@ const rejectStyle = {
|
|||||||
borderColor: "#ff1744",
|
borderColor: "#ff1744",
|
||||||
};
|
};
|
||||||
|
|
||||||
// const RenderFileUpload2 = ({
|
|
||||||
// id,
|
|
||||||
// className,
|
|
||||||
// rows,
|
|
||||||
// datafieldname,
|
|
||||||
// name,
|
|
||||||
// label,
|
|
||||||
// input,
|
|
||||||
// errorMsg,
|
|
||||||
// meta: { touched, errorStr },
|
|
||||||
// ...custom
|
|
||||||
// }) => {
|
|
||||||
// const [files, setFiles] = useState([]);
|
|
||||||
|
|
||||||
// const onDrop = useCallback((acceptedFiles, fileRejections, event) => {
|
|
||||||
// setFiles(
|
|
||||||
// acceptedFiles.map((file) =>
|
|
||||||
// Object.assign(file, {
|
|
||||||
// preview: URL.createObjectURL(file),
|
|
||||||
// })
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// console.log(acceptedFiles);
|
|
||||||
// event.target[acceptedFiles];
|
|
||||||
// console.log(event.target.files);
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
// const onChange = useCallback((acceptedFiles, fileRejections, event) => {
|
|
||||||
// setFiles(
|
|
||||||
// acceptedFiles.map((file) =>
|
|
||||||
// Object.assign(file, {
|
|
||||||
// preview: URL.createObjectURL(file),
|
|
||||||
// })
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// event.target.files[acceptedFiles];
|
|
||||||
// console.log(event.target.files);
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
// const {
|
|
||||||
// getRootProps,
|
|
||||||
// getInputProps,
|
|
||||||
// isDragActive,
|
|
||||||
// isDragAccept,
|
|
||||||
// isDragReject,
|
|
||||||
// } = useDropzone({
|
|
||||||
// onDrop,
|
|
||||||
// onChange,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const style = useMemo(
|
|
||||||
// () => ({
|
|
||||||
// ...baseStyle,
|
|
||||||
// ...(isDragActive ? activeStyle : {}),
|
|
||||||
// ...(isDragAccept ? acceptStyle : {}),
|
|
||||||
// ...(isDragReject ? rejectStyle : {}),
|
|
||||||
// }),
|
|
||||||
// [isDragActive, isDragReject, isDragAccept]
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const thumbs = files.map((file) => (
|
|
||||||
// <div key={file.name} className="govuk-!-margin-bottom-5 fileThumb">
|
|
||||||
// <img src={file.preview} alt={file.name} width="50" /> -{" "}
|
|
||||||
// <span className="govuk-body">
|
|
||||||
// {file.name} ({file.size / 1024}kb)
|
|
||||||
// </span>
|
|
||||||
// </div>
|
|
||||||
// ));
|
|
||||||
|
|
||||||
// // clean up
|
|
||||||
// useEffect(
|
|
||||||
// () => () => {
|
|
||||||
// files.forEach((file) => URL.revokeObjectURL(file.preview));
|
|
||||||
// },
|
|
||||||
// [files]
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const onChangeFile = (e) => {
|
|
||||||
// const {
|
|
||||||
// input: { onChange },
|
|
||||||
// } = props;
|
|
||||||
// onChange(e.target.files[0]);
|
|
||||||
// };
|
|
||||||
// return (
|
|
||||||
// <div className="govuk-grid-row">
|
|
||||||
// <div className="govuk-form-group"></div>
|
|
||||||
// <section className="container">
|
|
||||||
// <div {...getRootProps({ style })}>
|
|
||||||
// <input {...getInputProps()} />
|
|
||||||
// <div>Drag and drop your images here.</div>
|
|
||||||
// </div>
|
|
||||||
// </section>{" "}
|
|
||||||
// <aside>{thumbs}</aside>
|
|
||||||
// {touched && errorStr && <span>{errorStr}</span>}
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
const RenderFileUpload = (field) => {
|
const RenderFileUpload = (field) => {
|
||||||
const files = field.input.value;
|
const files = field.input.value;
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -1437,11 +1348,54 @@ const RenderFileUpload = (field) => {
|
|||||||
case "image/png":
|
case "image/png":
|
||||||
return URL.createObjectURL(fileObj);
|
return URL.createObjectURL(fileObj);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getThumbnailIconByExtension = (blobName) => {
|
||||||
|
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||||
|
|
||||||
|
switch (fileType) {
|
||||||
|
case "html":
|
||||||
|
return "/assets/images/documenttypes/html.png";
|
||||||
|
break;
|
||||||
|
case "txt":
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
case "doc":
|
||||||
|
return "/assets/images/documenttypes/doc.png";
|
||||||
|
break;
|
||||||
|
case "pdf":
|
||||||
|
return "/assets/images/documenttypes/pdf.png";
|
||||||
|
break;
|
||||||
|
case "docx":
|
||||||
|
return "/assets/images/documenttypes/docx.png";
|
||||||
|
break;
|
||||||
|
case "csv":
|
||||||
|
return "/assets/images/documenttypes/csv.png";
|
||||||
|
break;
|
||||||
|
case "xlsx":
|
||||||
|
return "/assets/images/documenttypes/xlsx.png";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "zip":
|
||||||
|
return "/assets/images/documenttypes/zip.png";
|
||||||
|
break;
|
||||||
|
case "jpeg":
|
||||||
|
case "jpg":
|
||||||
|
return "/assets/images/documenttypes/jpg.png";
|
||||||
|
case "png":
|
||||||
|
return "/assets/images/documenttypes/png.png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDocumentType = (docCode) => {
|
const getDocumentType = (docCode) => {
|
||||||
console.log(docCode);
|
|
||||||
switch (docCode) {
|
switch (docCode) {
|
||||||
case "000001":
|
case "000001":
|
||||||
return "000001";
|
return "000001";
|
||||||
@@ -1493,6 +1447,30 @@ const RenderFileUpload = (field) => {
|
|||||||
return "000000";
|
return "000000";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const filelistObj = field.fileList || {};
|
||||||
|
|
||||||
|
const blobList = jsonpath.query(
|
||||||
|
filelistObj,
|
||||||
|
"$..[?(@.documentType=='" + field.documentTypeCode + "')]"
|
||||||
|
);
|
||||||
|
|
||||||
|
const deleteThisBlob = async (
|
||||||
|
containerName,
|
||||||
|
blobName,
|
||||||
|
deleteblobhash,
|
||||||
|
getblobshash
|
||||||
|
) => {
|
||||||
|
//console.log(containerName, blobName, deleteblobhash);
|
||||||
|
deleteBlob(containerName, blobName, deleteblobhash)
|
||||||
|
.then((data) => data)
|
||||||
|
.then(() => {
|
||||||
|
getFilesFromBlobHashed(containerName, getblobshash).then(
|
||||||
|
(newfilelist) => field.setFilesForAppeal(newfilelist)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Dropzone
|
<Dropzone
|
||||||
@@ -1501,14 +1479,13 @@ const RenderFileUpload = (field) => {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
onDrop={(filesToUpload, e) => {
|
onDrop={(filesToUpload, e) => {
|
||||||
console.log(field.ticketnumber, field.documentTypeCode);
|
|
||||||
const renamedAcceptedFiles = filesToUpload.map(
|
const renamedAcceptedFiles = filesToUpload.map(
|
||||||
(file) =>
|
(file) =>
|
||||||
new File(
|
new File(
|
||||||
[file],
|
[file],
|
||||||
`${field.ticketnumber}_${getDocumentType(
|
`${getDocumentType(field.documentTypeCode)}_${
|
||||||
field.documentTypeCode
|
file.name
|
||||||
)}_${file.name}`,
|
}`,
|
||||||
{
|
{
|
||||||
type: file.type,
|
type: file.type,
|
||||||
}
|
}
|
||||||
@@ -1519,14 +1496,14 @@ const RenderFileUpload = (field) => {
|
|||||||
>
|
>
|
||||||
{({ getRootProps, getInputProps }) => (
|
{({ getRootProps, getInputProps }) => (
|
||||||
<>
|
<>
|
||||||
{field.hint != false && (
|
{/* {field.hint != false && (
|
||||||
<div className="govuk-hint">{t(field.hint)}</div>
|
<div className="govuk-hint">ss{t(field.hint)}</div>
|
||||||
)}
|
)}
|
||||||
<div className="govuk-form-group"></div>
|
<div className="govuk-form-group"></div> */}
|
||||||
<section className="container">
|
<section className="container">
|
||||||
<div {...getRootProps({ style })}>
|
<div {...getRootProps({ style })}>
|
||||||
{" "}
|
{" "}
|
||||||
<input {...getInputProps()} />
|
<input id={field.id} {...getInputProps()} />
|
||||||
<div>Drag and drop your files here.</div>
|
<div>Drag and drop your files here.</div>
|
||||||
</div>
|
</div>
|
||||||
<aside>{thumbs}</aside>
|
<aside>{thumbs}</aside>
|
||||||
@@ -1556,6 +1533,50 @@ const RenderFileUpload = (field) => {
|
|||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
{blobList.map((blob, i) => (
|
||||||
|
<div
|
||||||
|
key={blob.name + "_" + i}
|
||||||
|
className="govuk-!-margin-bottom-5 fileThumb govuk-!-margin-top-5"
|
||||||
|
>
|
||||||
|
<div className="">
|
||||||
|
<span
|
||||||
|
className="govuk-summary-list__actionLink watched_link govuk-!-margin-right-5 govuk-!-text-align-left"
|
||||||
|
onClick={() => {
|
||||||
|
deleteThisBlob(
|
||||||
|
field.ticketnumber,
|
||||||
|
blob.name,
|
||||||
|
blob.hasheddeletepath,
|
||||||
|
blob.hashgetblobs
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
title="Remove this file"
|
||||||
|
>
|
||||||
|
−
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
src={getThumbnailIconByExtension(blob.name)}
|
||||||
|
alt={blob.name}
|
||||||
|
width="50"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Link
|
||||||
|
key={i}
|
||||||
|
scroll={false}
|
||||||
|
href={
|
||||||
|
"/api/file/downloadblob?container=" +
|
||||||
|
field.ticketnumber.toLowerCase() +
|
||||||
|
"&blobname=" +
|
||||||
|
blob.name +
|
||||||
|
blob.hashedfilepath
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<a className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link">
|
||||||
|
{blob.name} ({bytesToSize(blob.contentLength)})
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
))}{" "}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const MyPortal = (props) => {
|
|||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
console.log("////////////", "\n", "logout", "\n", "//////////");
|
console.log("////////////\n" + "logout" + "\n////////////");
|
||||||
destroyCookie({}, "pinsUser"),
|
destroyCookie({}, "pinsUser"),
|
||||||
window.localStorage.clear(),
|
window.localStorage.clear(),
|
||||||
//router.replace(props.ggLogout);
|
//router.replace(props.ggLogout);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Field, reduxForm } from "redux-form";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import Dropzone, { useDropzone } from "react-dropzone";
|
import Dropzone, { useDropzone } from "react-dropzone";
|
||||||
import { uploadFiles } from "../../actions";
|
import { uploadFiles } from "../../actions";
|
||||||
|
import { getContainers } from "../../actions/azurestorage";
|
||||||
|
|
||||||
const required = (errorMsg) => (value) =>
|
const required = (errorMsg) => (value) =>
|
||||||
value || typeof value === "number" ? undefined : errorMsg;
|
value || typeof value === "number" ? undefined : errorMsg;
|
||||||
@@ -158,6 +159,60 @@ const RenderFileUpload = (field) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getDocumentType = (docCode) => {
|
||||||
|
switch (docCode) {
|
||||||
|
case "000001":
|
||||||
|
return "000001";
|
||||||
|
break;
|
||||||
|
case "000002":
|
||||||
|
return "000002";
|
||||||
|
break;
|
||||||
|
case "000003":
|
||||||
|
return "000003";
|
||||||
|
break;
|
||||||
|
case "000004":
|
||||||
|
return "000004";
|
||||||
|
break;
|
||||||
|
case "000005":
|
||||||
|
return "000005";
|
||||||
|
break;
|
||||||
|
case "000006":
|
||||||
|
return "000006";
|
||||||
|
break;
|
||||||
|
case "000007":
|
||||||
|
return "000007";
|
||||||
|
break;
|
||||||
|
case "000008":
|
||||||
|
return "000008";
|
||||||
|
break;
|
||||||
|
case "000009":
|
||||||
|
return "000009";
|
||||||
|
break;
|
||||||
|
case "000010":
|
||||||
|
return "000010";
|
||||||
|
break;
|
||||||
|
case "000011":
|
||||||
|
return "000011";
|
||||||
|
break;
|
||||||
|
case "000012":
|
||||||
|
return "000012";
|
||||||
|
break;
|
||||||
|
case "000013":
|
||||||
|
return "000013";
|
||||||
|
break;
|
||||||
|
case "000014":
|
||||||
|
return "000014";
|
||||||
|
break;
|
||||||
|
case "000015":
|
||||||
|
return "000015";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "000000";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Dropzone
|
<Dropzone
|
||||||
@@ -166,14 +221,20 @@ const RenderFileUpload = (field) => {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
onDrop={(filesToUpload, e) => {
|
onDrop={(filesToUpload, e) => {
|
||||||
|
console.log(field.ticketnumber, field.documentTypeCode);
|
||||||
const renamedAcceptedFiles = filesToUpload.map(
|
const renamedAcceptedFiles = filesToUpload.map(
|
||||||
(file) =>
|
(file) =>
|
||||||
new File([file], `${file.name}_${+new Date()}`, {
|
new File(
|
||||||
type: file.type,
|
[file],
|
||||||
})
|
`${field.ticketnumber}_${getDocumentType(
|
||||||
|
field.documentTypeCode
|
||||||
|
)}_${file.name}`,
|
||||||
|
{
|
||||||
|
type: file.type,
|
||||||
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
field.input.onChange(renamedAcceptedFiles);
|
field.input.onChange(renamedAcceptedFiles);
|
||||||
console.log(renamedAcceptedFiles);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ getRootProps, getInputProps }) => (
|
{({ getRootProps, getInputProps }) => (
|
||||||
@@ -221,7 +282,7 @@ const RenderFileUpload = (field) => {
|
|||||||
let UploadFile = (props) => {
|
let UploadFile = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
//const [showSpinnerState, setShowSpinnerState] = useState(false);
|
//const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||||
const { handleSubmit, pristine, reset, submitting } = props;
|
const { handleSubmit, pristine, reset, submitting, formContent } = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
@@ -229,8 +290,19 @@ let UploadFile = (props) => {
|
|||||||
const onHandleSubmit = async (values) => {
|
const onHandleSubmit = async (values) => {
|
||||||
//spinnerState();
|
//spinnerState();
|
||||||
console.log(values);
|
console.log(values);
|
||||||
|
console.log(formContent);
|
||||||
|
// getContainers();
|
||||||
|
|
||||||
const uploadAction = await uploadFiles(values);
|
var dataObj = Object.assign(values, formContent);
|
||||||
|
var fileObj = dataObj.fileList;
|
||||||
|
|
||||||
|
delete dataObj.fileList;
|
||||||
|
|
||||||
|
const uploadAction = await uploadFiles(dataObj, fileObj).then(
|
||||||
|
(data) => {
|
||||||
|
console.log("hello", data);
|
||||||
|
}
|
||||||
|
);
|
||||||
// router.push({
|
// router.push({
|
||||||
// pathname:
|
// pathname:
|
||||||
// router.locale == "cy"
|
// router.locale == "cy"
|
||||||
@@ -270,6 +342,7 @@ let UploadFile = (props) => {
|
|||||||
type="text"
|
type="text"
|
||||||
aria-describedby="caseReference-hint"
|
aria-describedby="caseReference-hint"
|
||||||
hint1="Case Reference"
|
hint1="Case Reference"
|
||||||
|
value="CAS-00764-L0Q9W2"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
@@ -281,6 +354,7 @@ let UploadFile = (props) => {
|
|||||||
//validate={[required]}
|
//validate={[required]}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
|
ticketnumber="CAS-00764-L0Q9W2"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-form-group">
|
<div className="govuk-form-group">
|
||||||
@@ -306,6 +380,69 @@ const mapStateToProps = (state) => {
|
|||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
|
formContent: {
|
||||||
|
"pinswg_caserecovered": "No",
|
||||||
|
"pinswg_siteaddresspostcode": "Site Address Postcode",
|
||||||
|
"pinswg_inspectorneededonsite": "Yes",
|
||||||
|
"pinswg_sitewithingreenbelt": "No",
|
||||||
|
"pinswg_siteaddressline2": "Site Address Line 2",
|
||||||
|
"pinswg_siteaddressline1": "Site Address Line 1",
|
||||||
|
"pinswg_s106unilateralsubmitted": "No",
|
||||||
|
"modifiedon": "2022-06-28T13:11:34Z",
|
||||||
|
"pinswg_developmentaffectsettingofalisted": "No",
|
||||||
|
"pinswg_planningappeals78id":
|
||||||
|
"57b533aa-43f1-ec11-aade-00224800be9c",
|
||||||
|
"pinswg_name": "CAS-00764-L0Q9W2",
|
||||||
|
"pinswg_whyisinspectorneededonsite": "to be nosey",
|
||||||
|
"pinswg_sitewithinsssi": "No",
|
||||||
|
"pinswg_healthandsafetyissuesonsite": "No",
|
||||||
|
"pinswg_developmentdescriptionchanged": "Yes",
|
||||||
|
"_stageid_value": "126e9c46-d51c-4623-aabf-aa30b34bfa54",
|
||||||
|
"traversedpath": "126e9c46-d51c-4623-aabf-aa30b34bfa54",
|
||||||
|
"createdon": "2022-06-21T09:22:29Z",
|
||||||
|
"timezoneruleversionnumber": 0,
|
||||||
|
"processid": "e4f065a6-157e-42f9-963a-9292d5041509",
|
||||||
|
"pinswg_priornotificationpriorapproval": "No",
|
||||||
|
"pinswg_predeterminedindicator": "No",
|
||||||
|
"pinswg_protectedspecies": "No",
|
||||||
|
"versionnumber": 912609,
|
||||||
|
"pinswg_siteaddresscounty": "Site Address County",
|
||||||
|
"pinswg_procedure": 846040000,
|
||||||
|
"pinswg_dateoflpadecision": "2022-06-22T23:00:00Z",
|
||||||
|
"pinswg_eiarequired": "No",
|
||||||
|
"pinswg_costappliedforindicator": "No",
|
||||||
|
"pinswg_areaofsiteinhectaresdec": 22,
|
||||||
|
"pinswg_detailedeiascreeningrequired": "No",
|
||||||
|
"pinswg_casepublishflag": "No",
|
||||||
|
"pinswg_siteaddresstown": "Site Address Town",
|
||||||
|
"utcconversiontimezonecode": 85,
|
||||||
|
"pinswg_caseworkreason": 846040005,
|
||||||
|
"pinswg_ownershipcertificate": 846040002,
|
||||||
|
"pinswg_lpadecisiononapplicationmade": "Yes",
|
||||||
|
"pinswg_floorspaceinsquaremeters": 111,
|
||||||
|
"_modifiedby_value": "149b3e11-5206-ec11-aac8-00224800be9c",
|
||||||
|
"pinswg_dateofapplication": "2022-06-20T23:00:00Z",
|
||||||
|
"pinswg_incarelatestoca": "No",
|
||||||
|
"_createdby_value": "149b3e11-5206-ec11-aac8-00224800be9c",
|
||||||
|
"pinswg_additionalappealsmade": "No",
|
||||||
|
"statuscode": 1,
|
||||||
|
"pinswg_siteviewablefromroad": "Yes",
|
||||||
|
"_pinswg_localplanningauthority_value":
|
||||||
|
"744c69f4-48da-eb11-aac5-00224800be9c",
|
||||||
|
"pinswg_lpaapplicationreference": "11111weweqweqwe",
|
||||||
|
"pinswg_recovered": "No",
|
||||||
|
"statecode": 0,
|
||||||
|
"pinswg_isfloodingandissue": "No",
|
||||||
|
"pinswg_isthesitewithinanaonb": "No",
|
||||||
|
"_organizationid_value": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||||
|
"pinswg_developmentdescription": "something to go here",
|
||||||
|
"pinswg_agriculturalholding": 846040000,
|
||||||
|
"_pinswg_planningappeals78ids_value":
|
||||||
|
"50b533aa-43f1-ec11-aade-00224800be9c",
|
||||||
|
},
|
||||||
|
initialValues: {
|
||||||
|
caseReference: "CAS-00764-L0Q9W2",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -320,5 +457,6 @@ export default connect(
|
|||||||
reduxForm({
|
reduxForm({
|
||||||
form: "uploadFileForm",
|
form: "uploadFileForm",
|
||||||
destroyOnUnmount: false,
|
destroyOnUnmount: false,
|
||||||
|
enableReinitialize: true, // this is needed!!
|
||||||
})(UploadFile)
|
})(UploadFile)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default function BuildField(props) {
|
|||||||
case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
case "{07FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}":
|
||||||
return <>{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
break;
|
break;
|
||||||
case "{ 4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
case "{4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
||||||
return <>{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
break;
|
break;
|
||||||
case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}":
|
case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}":
|
||||||
@@ -58,8 +58,12 @@ export default function BuildField(props) {
|
|||||||
case "{C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E}":
|
case "{C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E}":
|
||||||
return <>{fieldValue}</>;
|
return <>{fieldValue}</>;
|
||||||
break;
|
break;
|
||||||
|
case "{16D63FD6-119B-4353-BDCA-18358721C3FE}":
|
||||||
|
return <> docs {fieldValue}</>;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return <>{fieldValue}</>;
|
return <>ss{fieldValue}</>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,28 @@ let BuildCheckRow = (props) => {
|
|||||||
"')]"
|
"')]"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// if (datafieldname[0].value.indexOf("fileUpload") > 0) {
|
||||||
|
// isRequiredField.push({
|
||||||
|
// "LogicalName": datafieldname[0].value,
|
||||||
|
// "RequiredLevel": {
|
||||||
|
// "Value": "Recommended",
|
||||||
|
// "CanBeChanged": true,
|
||||||
|
// "ManagedPropertyLogicalName":
|
||||||
|
// "canmodifyrequirementlevelsettings",
|
||||||
|
// },
|
||||||
|
// "MetadataId":
|
||||||
|
// "32a7e6fc-4283-eb11-aac0-00224800be9c",
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// datafieldname[0].value.indexOf("fileUpload") > 0,
|
||||||
|
// isRequiredField,
|
||||||
|
// props.props.form["appealForm"].values[
|
||||||
|
// datafieldname[0].value
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof props.props.form["appealForm"].values[
|
typeof props.props.form["appealForm"].values[
|
||||||
datafieldname[0].value
|
datafieldname[0].value
|
||||||
@@ -147,6 +169,9 @@ let BuildCheckRow = (props) => {
|
|||||||
datafieldname[0].value
|
datafieldname[0].value
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
: fieldtype[0].value ==
|
||||||
|
"{16D63FD6-119B-4353-BDCA-18358721C3FE}"
|
||||||
|
? "ssss"
|
||||||
: props.props.form["appealForm"]
|
: props.props.form["appealForm"]
|
||||||
.values[
|
.values[
|
||||||
datafieldname[0].value
|
datafieldname[0].value
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ let BuildCheckSection = (props) => {
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
formTitle,
|
formTitle,
|
||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
|
updateCurrentSection,
|
||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -55,6 +56,62 @@ let BuildCheckSection = (props) => {
|
|||||||
// /searchresults
|
// /searchresults
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onHandleSubmit = (values) => {
|
||||||
|
//alert(1);
|
||||||
|
//updateCaseProgress(values);
|
||||||
|
// setCurrentSection(9999);
|
||||||
|
|
||||||
|
alert(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
function bytesToSize(bytes) {
|
||||||
|
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||||
|
if (bytes == 0) return "0 Byte";
|
||||||
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||||
|
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
const getThumbnailIconByExtension = (blobName) => {
|
||||||
|
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||||
|
|
||||||
|
switch (fileType) {
|
||||||
|
case "html":
|
||||||
|
return "/assets/images/documenttypes/html.png";
|
||||||
|
break;
|
||||||
|
case "txt":
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
case "doc":
|
||||||
|
return "/assets/images/documenttypes/doc.png";
|
||||||
|
break;
|
||||||
|
case "pdf":
|
||||||
|
return "/assets/images/documenttypes/pdf.png";
|
||||||
|
break;
|
||||||
|
case "docx":
|
||||||
|
return "/assets/images/documenttypes/docx.png";
|
||||||
|
break;
|
||||||
|
case "csv":
|
||||||
|
return "/assets/images/documenttypes/csv.png";
|
||||||
|
break;
|
||||||
|
case "xlsx":
|
||||||
|
return "/assets/images/documenttypes/xlsx.png";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "zip":
|
||||||
|
return "/assets/images/documenttypes/zip.png";
|
||||||
|
break;
|
||||||
|
case "jpeg":
|
||||||
|
case "jpg":
|
||||||
|
return "/assets/images/documenttypes/jpg.png";
|
||||||
|
case "png":
|
||||||
|
return "/assets/images/documenttypes/png.png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "/assets/images/documenttypes/txt.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-grid-row" key={1222}>
|
<div className="govuk-grid-row" key={1222}>
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
@@ -80,7 +137,50 @@ let BuildCheckSection = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</dl>
|
</dl>
|
||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list"></dl>
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list">
|
||||||
|
<div className="govuk-summary-list__row" key={"9999"}>
|
||||||
|
<dt>
|
||||||
|
{_.has(props.props.appealType.fileList.files) &&
|
||||||
|
props.props.appealType.fileList.files.length > 0
|
||||||
|
? props.props.appealType.fileList.files.map(
|
||||||
|
(blob, i) => (
|
||||||
|
<div
|
||||||
|
key={blob.name + "_" + i}
|
||||||
|
className="govuk-!-margin-bottom-5 fileThumb "
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={getThumbnailIconByExtension(
|
||||||
|
blob.name
|
||||||
|
)}
|
||||||
|
alt={blob.name}
|
||||||
|
width="50"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
|
||||||
|
{blob.name} (
|
||||||
|
{bytesToSize(
|
||||||
|
blob.contentLength
|
||||||
|
)}
|
||||||
|
)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
: ""}
|
||||||
|
</dt>
|
||||||
|
<dd className="govuk-summary-list__actions">
|
||||||
|
<a
|
||||||
|
className="govuk-link"
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
updateCurrentSection(sectionCount);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("newappeal:change-link-label")}
|
||||||
|
</a>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
<a
|
<a
|
||||||
@@ -111,6 +211,10 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setCurrentSection: (currentSection) => {
|
setCurrentSection: (currentSection) => {
|
||||||
dispatch(setCurrentSection(currentSection));
|
dispatch(setCurrentSection(currentSection));
|
||||||
},
|
},
|
||||||
|
updateCurrentSection: (whichSection) => {
|
||||||
|
dispatch(setCurrentSection(whichSection));
|
||||||
|
dispatch(setFormComplete("true"));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -183,6 +183,12 @@ export default function BuildField(props) {
|
|||||||
}
|
}
|
||||||
documentTypeCode={props.documentTypeCode}
|
documentTypeCode={props.documentTypeCode}
|
||||||
hint={props.hint}
|
hint={props.hint}
|
||||||
|
fileList={
|
||||||
|
props.props.props.props.appealType.fileList
|
||||||
|
}
|
||||||
|
setFilesForAppeal={
|
||||||
|
props.props.props.setFilesForAppeal
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { connect } from "react-redux";
|
|||||||
import xpath from "xpath";
|
import xpath from "xpath";
|
||||||
import { setCurrentSection } from "../../store/appealType/action";
|
import { setCurrentSection } from "../../store/appealType/action";
|
||||||
import { FieldsTranslations } from "../elements";
|
import { FieldsTranslations } from "../elements";
|
||||||
|
import { getProgressObj } from "../utils";
|
||||||
|
|
||||||
const BuildProgress = (props) => {
|
const BuildProgress = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -12,185 +13,23 @@ const BuildProgress = (props) => {
|
|||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
progObj,
|
||||||
titleList,
|
titleList,
|
||||||
currentSection,
|
currentSection,
|
||||||
documentListObj,
|
documentListObj,
|
||||||
formObjXML,
|
formObjXML,
|
||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
gotoSection,
|
gotoSection,
|
||||||
|
setCurrentSection,
|
||||||
} = props;
|
} = props;
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
|
|
||||||
const BuildFormObj = (formObjXML) => {
|
// const progObj = getProgressObj(
|
||||||
var doc = parser.parseFromString(formObjXML, "text/xml");
|
// formObjXML,
|
||||||
|
// titleList,
|
||||||
var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
// mandatoryFieldsData,
|
||||||
|
// props
|
||||||
const formObj = Object.keys(tabs).map((key, index) => {
|
// );
|
||||||
var sectionXML = xpath.select(
|
|
||||||
"//tabs/tab[" +
|
|
||||||
(index + 1) +
|
|
||||||
"]//rows/row/*/control[not(@parentField)]/../..",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
return BuildRowObj(sectionXML, titleList[key].value);
|
|
||||||
});
|
|
||||||
|
|
||||||
const progressObj = Object.keys(formObj).map((key, index) => {
|
|
||||||
let fieldObj = formObj[key].fieldsrowObj;
|
|
||||||
|
|
||||||
let rowCount = 0;
|
|
||||||
typeof props.props.initialValues != "undefined" &&
|
|
||||||
Object.keys(fieldObj).map((key, index) => {
|
|
||||||
fieldObj[key].datafieldname in props.props.initialValues &&
|
|
||||||
props.props.initialValues[
|
|
||||||
fieldObj[key].datafieldname
|
|
||||||
] != null &&
|
|
||||||
rowCount++;
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
"title": titleList[key].value,
|
|
||||||
rowCount,
|
|
||||||
"totalFields": formObj[key].fieldsTotal,
|
|
||||||
"allFieldsComplete": rowCount == formObj[key].fieldsTotal,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return progressObj;
|
|
||||||
};
|
|
||||||
|
|
||||||
const BuildRowObj = (rowXML, titleList) => {
|
|
||||||
const rowObj = Object.keys(rowXML).map((key, index) => {
|
|
||||||
var doc = parser.parseFromString(rowXML[key].outerHTML, "text/xml");
|
|
||||||
if (_.isEmpty(rowXML[key].innerHTML)) {
|
|
||||||
("");
|
|
||||||
} else {
|
|
||||||
var rows = xpath.select("//label/@description", doc);
|
|
||||||
var fieldtype = xpath.select("//@classid", doc);
|
|
||||||
var validation = xpath.select("//@validation", doc);
|
|
||||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
|
||||||
var datafieldcontent = xpath.select("//@datafieldcontent", doc);
|
|
||||||
var parentField = xpath.select("//@parentField", doc);
|
|
||||||
|
|
||||||
var parentFieldShowOnValue = xpath.select(
|
|
||||||
"//@parentFieldShowOnValue",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var requiredDocumentValue = xpath.select(
|
|
||||||
"//@requiredDocumentValue",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var requiredDocumentLabel = xpath.select(
|
|
||||||
"//@requiredDocumentLabel",
|
|
||||||
doc
|
|
||||||
);
|
|
||||||
|
|
||||||
var hint = xpath.select("//label/@hint", doc);
|
|
||||||
var dateStart = xpath.select("//@dateStart", doc);
|
|
||||||
var dateEnd = xpath.select("//@dateEnd", doc);
|
|
||||||
|
|
||||||
hint = !_.isEmpty(hint) && hint[0].value;
|
|
||||||
|
|
||||||
validation = !_.isEmpty(validation) ? validation[0].value : [];
|
|
||||||
|
|
||||||
parentField = !_.isEmpty(parentField) && parentField[0].value;
|
|
||||||
|
|
||||||
parentFieldShowOnValue =
|
|
||||||
!_.isEmpty(parentFieldShowOnValue) &&
|
|
||||||
parentFieldShowOnValue[0].value;
|
|
||||||
|
|
||||||
datafieldcontent =
|
|
||||||
!_.isEmpty(datafieldcontent) && datafieldcontent[0].value;
|
|
||||||
|
|
||||||
requiredDocumentValue =
|
|
||||||
!_.isEmpty(requiredDocumentValue) &&
|
|
||||||
requiredDocumentValue[0].value;
|
|
||||||
|
|
||||||
requiredDocumentLabel =
|
|
||||||
!_.isEmpty(requiredDocumentLabel) &&
|
|
||||||
requiredDocumentLabel[0].value;
|
|
||||||
|
|
||||||
dateStart = !_.isEmpty(dateStart) && dateStart[0].value;
|
|
||||||
|
|
||||||
dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value;
|
|
||||||
|
|
||||||
const isRequiredField = jsonpath.query(
|
|
||||||
mandatoryFieldsData,
|
|
||||||
"$..value[?(@.LogicalName=='" +
|
|
||||||
datafieldname[0].value +
|
|
||||||
"')]"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (datafieldname[0].value == "pinswg_fileUpload") {
|
|
||||||
return {
|
|
||||||
"fieldType": fieldtype[0].value,
|
|
||||||
"label": rows[0].value,
|
|
||||||
"datafieldname": datafieldname[0].value,
|
|
||||||
"key": key,
|
|
||||||
"picklistData": props.props.formData.pickListData,
|
|
||||||
"mandatoryFieldsData": mandatoryFieldsData,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
if (typeof isRequiredField[0] != "undefined") {
|
|
||||||
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
|
||||||
//console.log(datafieldname[0].value, validation);
|
|
||||||
return {
|
|
||||||
"fieldType": fieldtype[0].value,
|
|
||||||
"label": rows[0].value,
|
|
||||||
"datafieldname": datafieldname[0].value,
|
|
||||||
"datafieldcontent": datafieldcontent,
|
|
||||||
"parentField": parentField,
|
|
||||||
"parentFieldShowOnValue":
|
|
||||||
parentFieldShowOnValue,
|
|
||||||
"key": key,
|
|
||||||
"picklistData":
|
|
||||||
props.props.formData.pickListData,
|
|
||||||
"mandatoryFieldsData": mandatoryFieldsData,
|
|
||||||
"hint": hint,
|
|
||||||
"requiredDocumentLabel": requiredDocumentLabel,
|
|
||||||
"requiredDocumentValue": requiredDocumentValue,
|
|
||||||
"validation": validation,
|
|
||||||
"dateStart": dateStart,
|
|
||||||
"dateEnd": dateEnd,
|
|
||||||
"setDocumentsList":
|
|
||||||
props.props.setDocumentsList,
|
|
||||||
"documentList":
|
|
||||||
props.props.appealType.documentList,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
rowObj = rowObj.filter(function (el) {
|
|
||||||
return el != null;
|
|
||||||
});
|
|
||||||
|
|
||||||
const filterUnwanted = (rowObj) => {
|
|
||||||
const required = rowObj.filter((el) => {
|
|
||||||
return !_.isEmpty(el.validation);
|
|
||||||
});
|
|
||||||
return required;
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
"title": titleList,
|
|
||||||
"validationFieldsTotal": filterUnwanted(rowObj).length,
|
|
||||||
"fieldsTotal": rowObj.length,
|
|
||||||
"fieldsrowObj": rowObj,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const progObj = BuildFormObj(formObjXML);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -205,9 +44,82 @@ const BuildProgress = (props) => {
|
|||||||
{props.props.appealType.caseReference.ticketnumber}
|
{props.props.appealType.caseReference.ticketnumber}
|
||||||
</span>
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
|
||||||
|
|
||||||
<ol className="govuk-list" id="progress-list">
|
{/* <hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" /> */}
|
||||||
|
|
||||||
|
<div
|
||||||
|
id="step-by-step-navigation"
|
||||||
|
data-module="gemstepnav"
|
||||||
|
className="app-step-nav app-step-nav--active"
|
||||||
|
data-id="e01e924b-9c7c-4c71-8241-66a575c2f61f"
|
||||||
|
data-show-text="show"
|
||||||
|
data-hide-text="hide"
|
||||||
|
data-show-all-text="Show all"
|
||||||
|
data-hide-all-text="Hide all"
|
||||||
|
>
|
||||||
|
<ol className="app-step-nav__steps">
|
||||||
|
{Object.keys(progObj).map((key, index) => (
|
||||||
|
<li
|
||||||
|
key={key}
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
(progObj[index].allFieldsComplete
|
||||||
|
? " sectionComplete"
|
||||||
|
: " sectionIncomplete")
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position={index}
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
{index + 1}
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
parseInt(key) + 1
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
{FieldsTranslations(
|
||||||
|
progObj[index].title
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* <ol className="govuk-list" id="progress-list">
|
||||||
<ul className="govuk-list ">
|
<ul className="govuk-list ">
|
||||||
<li className="at-nav__page">
|
<li className="at-nav__page">
|
||||||
<ol className="govuk-list">
|
<ol className="govuk-list">
|
||||||
@@ -222,37 +134,40 @@ const BuildProgress = (props) => {
|
|||||||
</li>
|
</li>
|
||||||
) : (
|
) : (
|
||||||
<li key={key}>
|
<li key={key}>
|
||||||
{props.props.appealType
|
{" "}
|
||||||
.formComplete == "true" ||
|
<span
|
||||||
parseInt(key) + 1 <
|
title={
|
||||||
currentSection ||
|
progObj[index].title +
|
||||||
progObj[index].allFieldsComplete ==
|
` complete`
|
||||||
true ? (
|
}
|
||||||
<a
|
className={
|
||||||
className="govuk-link"
|
progObj[index]
|
||||||
href="#"
|
.allFieldsComplete ==
|
||||||
onClick={() => {
|
true
|
||||||
gotoSection(
|
? `sectionCompleteTick`
|
||||||
parseInt(key) + 1
|
: `sectionIncomplete`
|
||||||
);
|
}
|
||||||
}}
|
></span>
|
||||||
>
|
<a
|
||||||
{FieldsTranslations(
|
className="govuk-link"
|
||||||
progObj[index].title
|
href="#"
|
||||||
)}
|
onClick={() => {
|
||||||
</a>
|
gotoSection(
|
||||||
) : (
|
parseInt(key) + 1
|
||||||
FieldsTranslations(
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{FieldsTranslations(
|
||||||
progObj[index].title
|
progObj[index].title
|
||||||
)
|
)}
|
||||||
)}
|
</a>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ol>
|
</ol> */}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{Object.keys(documentListObj).length > 0 && (
|
{Object.keys(documentListObj).length > 0 && (
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ export default function BuildRow(props) {
|
|||||||
props.props.appealType.documentList
|
props.props.appealType.documentList
|
||||||
}
|
}
|
||||||
documentTypeCode={documentTypeCode}
|
documentTypeCode={documentTypeCode}
|
||||||
|
setFilesForAppeal={
|
||||||
|
props.props.setFilesForAppeal
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
// } else {
|
// } else {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import _, { has } from "lodash";
|
import _, { has, last } from "lodash";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
@@ -11,18 +11,41 @@ import {
|
|||||||
setCaseReference,
|
setCaseReference,
|
||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
setDocumentsList,
|
setDocumentsList,
|
||||||
|
setFilesForAppeal,
|
||||||
|
setNewAppealProgress,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
import { getFormCollectionByID } from "../utils";
|
import { getFormCollectionByID, getProgressObj } from "../utils";
|
||||||
import { updateCase, patchCase } from "../../actions";
|
import { updateCase, patchCase, uploadFiles } from "../../actions";
|
||||||
|
|
||||||
import { FieldsTranslations } from "../elements";
|
import { FieldsTranslations } from "../elements";
|
||||||
import jsonpath from "jsonpath";
|
import jsonpath from "jsonpath";
|
||||||
import BuildProgress from "./buildprogress";
|
import BuildProgress from "./buildprogress";
|
||||||
|
|
||||||
let BuildSection = (props) => {
|
let BuildSection = (props) => {
|
||||||
// useEffect(() => {
|
const [currentSectionSelected, setCurrentSectionSelected] = useState(1);
|
||||||
// window.scrollTo(0, 0);
|
const [pickupWhereLeftOff, setPickupWhereLeftOff] = useState(true);
|
||||||
// });
|
|
||||||
|
useEffect(() => {
|
||||||
|
progObj = getProgressObj(
|
||||||
|
formXML,
|
||||||
|
titleList,
|
||||||
|
mandatoryFieldsData,
|
||||||
|
props
|
||||||
|
);
|
||||||
|
// const lastIndex = progObj
|
||||||
|
// .map((whichIsLast) => whichIsLast.allFieldsComplete == true)
|
||||||
|
// .lastIndexOf(true);
|
||||||
|
|
||||||
|
// setCurrentSection(currentSectionSelected + 1);
|
||||||
|
|
||||||
|
// pickupWhereLeftOff == true && setCurrentSection(lastIndex + 1),
|
||||||
|
// setPickupWhereLeftOff(false);
|
||||||
|
|
||||||
|
// // lastIndex != currentSectionSelected
|
||||||
|
// // ? (setCurrentSectionSelected(lastIndex),
|
||||||
|
// // setPickupWhereLeftOff(true))
|
||||||
|
// // : setPickupWhereLeftOff(false);
|
||||||
|
});
|
||||||
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
@@ -67,12 +90,49 @@ let BuildSection = (props) => {
|
|||||||
doc
|
doc
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const progObj = getProgressObj(
|
||||||
|
formXML,
|
||||||
|
titleList,
|
||||||
|
mandatoryFieldsData,
|
||||||
|
props
|
||||||
|
);
|
||||||
|
|
||||||
|
const lastIndex = progObj
|
||||||
|
.map((whichIsLast) => whichIsLast.allFieldsComplete == true)
|
||||||
|
.lastIndexOf(true);
|
||||||
|
|
||||||
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
||||||
|
|
||||||
|
const uploadAppealFiles = (values) => {
|
||||||
|
// get filelists from values object
|
||||||
|
let fileListObj = _.filter(values, function (v, key) {
|
||||||
|
return _.includes(key, "pinswg_fileUpload");
|
||||||
|
});
|
||||||
|
|
||||||
|
//console.log(fileListObj);
|
||||||
|
|
||||||
|
var dataObj = values;
|
||||||
|
|
||||||
|
for (let key in dataObj) {
|
||||||
|
_.includes(key, "pinswg_fileUpload") == true && delete dataObj[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadFiles(dataObj, fileListObj).then((data) => {
|
||||||
|
//console.log("hello", data);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const updateCaseProgress = (values) => {
|
const updateCaseProgress = (values) => {
|
||||||
let incidentId = props.appealType.caseReference.incidentid;
|
let incidentId = props.appealType.caseReference.incidentid;
|
||||||
let updateBody = values || {};
|
let updateBody = values || {};
|
||||||
|
|
||||||
|
uploadAppealFiles(values);
|
||||||
|
props.setNewAppealProgress(
|
||||||
|
getProgressObj(formXML, titleList, mandatoryFieldsData, props)
|
||||||
|
);
|
||||||
|
|
||||||
let appTypeCollection = getFormCollectionByID(
|
let appTypeCollection = getFormCollectionByID(
|
||||||
props.appealType.appealTypeID
|
props.appealType.appealTypeID
|
||||||
);
|
);
|
||||||
@@ -118,8 +178,13 @@ let BuildSection = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
//alert(1);
|
//if (currentSection == sectionCount) {
|
||||||
//updateCaseProgress(values);
|
let valuesObj = values || {};
|
||||||
|
|
||||||
|
delete valuesObj["_pinswg_appellant_value"];
|
||||||
|
console.log("has errors:", props.invalid);
|
||||||
|
props.invalid == false && updateCaseProgress(valuesObj);
|
||||||
|
|
||||||
setCurrentSection(currentSection + 1);
|
setCurrentSection(currentSection + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,7 +285,22 @@ let BuildSection = (props) => {
|
|||||||
type="submit"
|
type="submit"
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
data-module="govuk-button"
|
data-module="govuk-button"
|
||||||
onClick={() => getErrors()}
|
onClick={() => {
|
||||||
|
getErrors();
|
||||||
|
let valuesObj = _.has(
|
||||||
|
props1.props.form[props1.form],
|
||||||
|
"values"
|
||||||
|
)
|
||||||
|
? props.props.form[props.form].values
|
||||||
|
: {};
|
||||||
|
|
||||||
|
//console.log("valuesobj:", valuesObj);
|
||||||
|
|
||||||
|
delete valuesObj["_pinswg_appellant_value"];
|
||||||
|
|
||||||
|
//console.log("on save:", valuesObj);
|
||||||
|
updateCaseProgress(valuesObj);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{t("common:continue-button")}
|
{t("common:continue-button")}
|
||||||
</button>
|
</button>
|
||||||
@@ -256,7 +336,11 @@ let BuildSection = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-column-one-third">
|
<div className="govuk-grid-column-one-third">
|
||||||
<div className="at-nav-container">
|
<div className="at-nav-container">
|
||||||
|
{/* <span>
|
||||||
|
Last section is {lastIndex} - {currentSection}
|
||||||
|
</span> */}
|
||||||
<BuildProgress
|
<BuildProgress
|
||||||
|
progObj={progObj}
|
||||||
props={props}
|
props={props}
|
||||||
titleList={titleList}
|
titleList={titleList}
|
||||||
documentListObj={documentListObj}
|
documentListObj={documentListObj}
|
||||||
@@ -264,94 +348,9 @@ let BuildSection = (props) => {
|
|||||||
mandatoryFieldsData={mandatoryFieldsData}
|
mandatoryFieldsData={mandatoryFieldsData}
|
||||||
currentSection={currentSection}
|
currentSection={currentSection}
|
||||||
initialValues={props.initialValues}
|
initialValues={props.initialValues}
|
||||||
|
setCurrentSection={setCurrentSection}
|
||||||
/>
|
/>
|
||||||
{/* <nav
|
|
||||||
role="navigation"
|
|
||||||
aria-labelledby="progress-list"
|
|
||||||
className="at-nav"
|
|
||||||
>
|
|
||||||
<h3 className="govuk-heading-s govuk-!-font-weight-bold gov-font-dark-grey progress-heading">
|
|
||||||
{t("newappeal:new-appeal-progress-nav-label")}:{" "}
|
|
||||||
<span className="progress-case-reference">
|
|
||||||
{props.appealType.caseReference.ticketnumber}
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
|
||||||
|
|
||||||
<ol className="govuk-list">
|
|
||||||
<ul className="govuk-list ">
|
|
||||||
<li className="at-nav__page">
|
|
||||||
<ol className="govuk-list">
|
|
||||||
{Object.keys(titleList).map((key) =>
|
|
||||||
parseInt(key) + 1 ==
|
|
||||||
currentSection ? (
|
|
||||||
<li key={key}>
|
|
||||||
<b>
|
|
||||||
{FieldsTranslations(
|
|
||||||
titleList[key].value
|
|
||||||
)}{" "}
|
|
||||||
</b>
|
|
||||||
</li>
|
|
||||||
) : (
|
|
||||||
<li key={key}>
|
|
||||||
{props.appealType
|
|
||||||
.formComplete ==
|
|
||||||
"true" ||
|
|
||||||
parseInt(key) + 1 <
|
|
||||||
currentSection ? (
|
|
||||||
<a
|
|
||||||
className="govuk-link"
|
|
||||||
href="#"
|
|
||||||
onClick={() => {
|
|
||||||
gotoSection(
|
|
||||||
parseInt(
|
|
||||||
key
|
|
||||||
) + 1
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{FieldsTranslations(
|
|
||||||
titleList[key]
|
|
||||||
.value
|
|
||||||
)}
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
FieldsTranslations(
|
|
||||||
titleList[key].value
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</li>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
{Object.keys(documentListObj).length > 0 && (
|
|
||||||
<div>
|
|
||||||
<h3 className="govuk-heading-s govuk-!-font-weight-bold gov-font-dark-grey">
|
|
||||||
{t("newappeal:new-appeal-documentlist-nav")}:
|
|
||||||
</h3>
|
|
||||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
|
||||||
<ol className="govuk-list document-list">
|
|
||||||
<ul className="govuk-list ">
|
|
||||||
<li className="at-nav__page">
|
|
||||||
<ol className="govuk-list govuk-list--bullet">
|
|
||||||
{Object.entries(
|
|
||||||
documentListObj
|
|
||||||
).map(([key, value]) => {
|
|
||||||
return (
|
|
||||||
<li key={key}>{value}</li>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
)} */}
|
|
||||||
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
<hr className="govuk-section-break govuk-section-break--m govuk-section-break--visible" />
|
||||||
<button
|
<button
|
||||||
className="govuk-button govuk-button--secondary progress-save "
|
className="govuk-button govuk-button--secondary progress-save "
|
||||||
@@ -402,6 +401,12 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setDocumentsList: (documentList) => {
|
setDocumentsList: (documentList) => {
|
||||||
dispatch(setDocumentsList(documentList));
|
dispatch(setDocumentsList(documentList));
|
||||||
},
|
},
|
||||||
|
setFilesForAppeal: (blobList) => {
|
||||||
|
dispatch(setFilesForAppeal(blobList));
|
||||||
|
},
|
||||||
|
setNewAppealProgress: (progressObj) => {
|
||||||
|
dispatch(setNewAppealProgress(progressObj));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import { getFormCollectionByID } from "../utils";
|
import { getFormCollectionByID } from "../utils";
|
||||||
import FileUpload from "./fileupload";
|
import FileUpload from "./fileupload";
|
||||||
import Aboutyou from "./aboutyou";
|
import Aboutyou from "./aboutyou";
|
||||||
import { createNewCase } from "../../actions";
|
import { createNewCase, consoleLogger } from "../../actions";
|
||||||
import { FieldsTranslations } from "../elements";
|
import { FieldsTranslations } from "../elements";
|
||||||
|
|
||||||
let CreateCase = (props) => {
|
let CreateCase = (props) => {
|
||||||
@@ -470,8 +470,8 @@ let CreateCase = (props) => {
|
|||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(consoleLogger(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
// router.replace(
|
// router.replace(
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import Link from "next/link";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import useTranslation from "next-translate/useTranslation";
|
|
||||||
|
|
||||||
export default function MakeEnforcementNotice() {
|
|
||||||
let { t } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
return (
|
|
||||||
<div className="card" id="casescomment-card">
|
|
||||||
<div className="card-body appealModule">
|
|
||||||
<p className="govuk-body-s">
|
|
||||||
Including an enforcement listed building notice.
|
|
||||||
</p>
|
|
||||||
<div className="appealCTA">
|
|
||||||
<Link href="/newappeal/selectappeal">
|
|
||||||
<a className="govuk-button">A enforcement notice</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -39,7 +39,7 @@ const TimeOut = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
console.log("////////////", "\n", "logout", "\n", "//////////");
|
console.log("////////////\n" + "logout" + "\n////////////");
|
||||||
destroyCookie({}, "pinsUser"),
|
destroyCookie({}, "pinsUser"),
|
||||||
window.localStorage.clear(),
|
window.localStorage.clear(),
|
||||||
signOut({ callbackUrl: "/logout" });
|
signOut({ callbackUrl: "/logout" });
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
getBasicPartSavedDetails,
|
getBasicPartSavedDetails,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
|
||||||
|
import xpath from "xpath";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the lookup collection by the appeal type entity
|
* Get the lookup collection by the appeal type entity
|
||||||
* @param String formtype - string from appeal entity name
|
* @param String formtype - string from appeal entity name
|
||||||
@@ -164,3 +166,178 @@ export const getSearchDetailsPaged = (searchResultsObj) => {
|
|||||||
// origin: protocol + "//" + host,
|
// origin: protocol + "//" + host,
|
||||||
// };
|
// };
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
export const getProgressObj = (
|
||||||
|
formObjXML,
|
||||||
|
titleList,
|
||||||
|
mandatoryFieldsData,
|
||||||
|
props
|
||||||
|
) => {
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const BuildFormObj = (formObjXML) => {
|
||||||
|
var doc = parser.parseFromString(formObjXML, "text/xml");
|
||||||
|
|
||||||
|
var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
||||||
|
|
||||||
|
const formObj = Object.keys(tabs).map((key, index) => {
|
||||||
|
var sectionXML = xpath.select(
|
||||||
|
"//tabs/tab[" +
|
||||||
|
(index + 1) +
|
||||||
|
"]//rows/row/*/control[not(@parentField)]/../..",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
|
||||||
|
return BuildRowObj(sectionXML, titleList[key].value);
|
||||||
|
});
|
||||||
|
|
||||||
|
const progressObj = Object.keys(formObj).map((key, index) => {
|
||||||
|
let fieldObj = formObj[key].fieldsrowObj;
|
||||||
|
|
||||||
|
let rowCount = 0;
|
||||||
|
|
||||||
|
!props.dirty &&
|
||||||
|
typeof props.initialValues != "undefined" &&
|
||||||
|
Object.keys(fieldObj).map((key, index) => {
|
||||||
|
fieldObj[key].datafieldname in props.initialValues &&
|
||||||
|
props.initialValues[fieldObj[key].datafieldname] !=
|
||||||
|
null &&
|
||||||
|
rowCount++;
|
||||||
|
});
|
||||||
|
props.dirty &&
|
||||||
|
Object.keys(fieldObj).map((key, index) => {
|
||||||
|
fieldObj[key].datafieldname in
|
||||||
|
props.props.form["appealForm"].values &&
|
||||||
|
props.props.form["appealForm"].values[
|
||||||
|
fieldObj[key].datafieldname
|
||||||
|
] != null &&
|
||||||
|
rowCount++;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
"title": titleList[key].value,
|
||||||
|
rowCount,
|
||||||
|
"totalFields": formObj[key].fieldsTotal,
|
||||||
|
"allFieldsComplete": rowCount == formObj[key].fieldsTotal,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return progressObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const BuildRowObj = (rowXML, titleList) => {
|
||||||
|
const rowObj = Object.keys(rowXML).map((key, index) => {
|
||||||
|
var doc = parser.parseFromString(rowXML[key].outerHTML, "text/xml");
|
||||||
|
if (_.isEmpty(rowXML[key].innerHTML)) {
|
||||||
|
("");
|
||||||
|
} else {
|
||||||
|
var rows = xpath.select("//label/@description", doc);
|
||||||
|
var fieldtype = xpath.select("//@classid", doc);
|
||||||
|
var validation = xpath.select("//@validation", doc);
|
||||||
|
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||||
|
var datafieldcontent = xpath.select("//@datafieldcontent", doc);
|
||||||
|
var parentField = xpath.select("//@parentField", doc);
|
||||||
|
|
||||||
|
var parentFieldShowOnValue = xpath.select(
|
||||||
|
"//@parentFieldShowOnValue",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
|
||||||
|
var requiredDocumentValue = xpath.select(
|
||||||
|
"//@requiredDocumentValue",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
|
||||||
|
var requiredDocumentLabel = xpath.select(
|
||||||
|
"//@requiredDocumentLabel",
|
||||||
|
doc
|
||||||
|
);
|
||||||
|
|
||||||
|
var hint = xpath.select("//label/@hint", doc);
|
||||||
|
var dateStart = xpath.select("//@dateStart", doc);
|
||||||
|
var dateEnd = xpath.select("//@dateEnd", doc);
|
||||||
|
|
||||||
|
hint = !_.isEmpty(hint) && hint[0].value;
|
||||||
|
|
||||||
|
validation = !_.isEmpty(validation) ? validation[0].value : [];
|
||||||
|
|
||||||
|
parentField = !_.isEmpty(parentField) && parentField[0].value;
|
||||||
|
|
||||||
|
parentFieldShowOnValue =
|
||||||
|
!_.isEmpty(parentFieldShowOnValue) &&
|
||||||
|
parentFieldShowOnValue[0].value;
|
||||||
|
|
||||||
|
datafieldcontent =
|
||||||
|
!_.isEmpty(datafieldcontent) && datafieldcontent[0].value;
|
||||||
|
|
||||||
|
requiredDocumentValue =
|
||||||
|
!_.isEmpty(requiredDocumentValue) &&
|
||||||
|
requiredDocumentValue[0].value;
|
||||||
|
|
||||||
|
requiredDocumentLabel =
|
||||||
|
!_.isEmpty(requiredDocumentLabel) &&
|
||||||
|
requiredDocumentLabel[0].value;
|
||||||
|
|
||||||
|
dateStart = !_.isEmpty(dateStart) && dateStart[0].value;
|
||||||
|
|
||||||
|
dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value;
|
||||||
|
|
||||||
|
const isRequiredField = jsonpath.query(
|
||||||
|
mandatoryFieldsData,
|
||||||
|
"$..value[?(@.LogicalName=='" +
|
||||||
|
datafieldname[0].value +
|
||||||
|
"')]"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (datafieldname[0].value == "pinswg_fileUpload") {
|
||||||
|
return {
|
||||||
|
"fieldType": fieldtype[0].value,
|
||||||
|
"label": rows[0].value,
|
||||||
|
"datafieldname": datafieldname[0].value,
|
||||||
|
"key": key,
|
||||||
|
"picklistData": props.props.formData.pickListData,
|
||||||
|
"mandatoryFieldsData": mandatoryFieldsData,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (typeof isRequiredField[0] != "undefined") {
|
||||||
|
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||||
|
//console.log(datafieldname[0].value, validation);
|
||||||
|
return {
|
||||||
|
"fieldType": fieldtype[0].value,
|
||||||
|
"label": rows[0].value,
|
||||||
|
"datafieldname": datafieldname[0].value,
|
||||||
|
"datafieldcontent": datafieldcontent,
|
||||||
|
"validation": validation,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rowObj = rowObj.filter(function (el) {
|
||||||
|
return el != null;
|
||||||
|
});
|
||||||
|
|
||||||
|
const filterUnwanted = (rowObj) => {
|
||||||
|
const required = rowObj.filter((el) => {
|
||||||
|
return !_.isEmpty(el.validation);
|
||||||
|
});
|
||||||
|
return required;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
"title": titleList,
|
||||||
|
"validationFieldsTotal": filterUnwanted(rowObj).length,
|
||||||
|
"fieldsTotal": rowObj.length,
|
||||||
|
"fieldsrowObj": rowObj,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const progObj = BuildFormObj(formObjXML);
|
||||||
|
//console.log(progObj);
|
||||||
|
return progObj;
|
||||||
|
};
|
||||||
|
|||||||
+6
-1
@@ -9,6 +9,8 @@
|
|||||||
"start": "node_modules/next/dist/bin/next start"
|
"start": "node_modules/next/dist/bin/next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@azure/identity": "^2.0.5",
|
||||||
|
"@azure/storage-blob": "^12.10.0",
|
||||||
"@googlemaps/react-wrapper": "^1.1.24",
|
"@googlemaps/react-wrapper": "^1.1.24",
|
||||||
"@magic-sdk/admin": "^1.4.0",
|
"@magic-sdk/admin": "^1.4.0",
|
||||||
"@next-auth/prisma-adapter": "^1.0.3",
|
"@next-auth/prisma-adapter": "^1.0.3",
|
||||||
@@ -24,6 +26,7 @@
|
|||||||
"dom": "^0.0.3",
|
"dom": "^0.0.3",
|
||||||
"dynamics-web-api": "^1.7.4",
|
"dynamics-web-api": "^1.7.4",
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
|
"formidable": "^2.0.1",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
"google-map-react": "^2.1.10",
|
"google-map-react": "^2.1.10",
|
||||||
"govuk-frontend": "3.13.0",
|
"govuk-frontend": "3.13.0",
|
||||||
@@ -37,6 +40,7 @@
|
|||||||
"magic-sdk": "^8.1.0",
|
"magic-sdk": "^8.1.0",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"multer": "^1.4.4",
|
"multer": "^1.4.4",
|
||||||
|
"multiparty": "^4.2.3",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"nanoid": "^3.2.0",
|
"nanoid": "^3.2.0",
|
||||||
"next": "^12.0.8",
|
"next": "^12.0.8",
|
||||||
@@ -69,6 +73,7 @@
|
|||||||
"sass-loader": "^12.4.0",
|
"sass-loader": "^12.4.0",
|
||||||
"swr": "^1.1.2",
|
"swr": "^1.1.2",
|
||||||
"typeorm": "^0.3.5",
|
"typeorm": "^0.3.5",
|
||||||
|
"uuid": "^8.3.2",
|
||||||
"webpack": "^5.66.0",
|
"webpack": "^5.66.0",
|
||||||
"xml2js": "^0.4.23",
|
"xml2js": "^0.4.23",
|
||||||
"xmldom": "^0.6.0",
|
"xmldom": "^0.6.0",
|
||||||
@@ -81,4 +86,4 @@
|
|||||||
"prettier": "2.5.1",
|
"prettier": "2.5.1",
|
||||||
"prisma": "^3.12.0"
|
"prisma": "^3.12.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
|
|
||||||
return "downloadComplete";
|
return "downloadComplete";
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -43,7 +43,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -65,7 +65,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
console.log(data);
|
console.log(data);
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -43,7 +43,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -43,7 +43,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
//console.log("deleted awaitingsubmission case - " + incidentID);
|
//console.log("deleted awaitingsubmission case - " + incidentID);
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -42,7 +42,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -43,7 +43,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
//console.log("deleted watched case - " + watchedCaseID);
|
//console.log("deleted watched case - " + watchedCaseID);
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -75,7 +75,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -39,7 +39,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import {
|
||||||
|
getToken,
|
||||||
|
azureHeadersPaged,
|
||||||
|
azureHeaders,
|
||||||
|
consoleLogger,
|
||||||
|
} from "../../../actions";
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /api/endpoint/getappealtypes_api:
|
* /api/endpoint/getappealtypes_api:
|
||||||
@@ -47,7 +52,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
loggedInUserId +
|
loggedInUserId +
|
||||||
" and servicestage eq 1 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
" and servicestage eq 1 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||||
|
|
||||||
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
@@ -38,7 +38,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
});
|
});
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -38,7 +38,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
//console.log(data);
|
//console.log(data);
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
|
import {
|
||||||
|
getToken,
|
||||||
|
azureHeaders,
|
||||||
|
azureHeadersPaged,
|
||||||
|
consoleLogger,
|
||||||
|
} from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -41,7 +46,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -44,7 +44,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -48,7 +48,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -49,7 +49,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
searchString +
|
searchString +
|
||||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||||
|
|
||||||
console.log("basic search ", queryUrl);
|
//console.log("basic search ", queryUrl);
|
||||||
|
|
||||||
var apiResponse = _.isEmpty(req.query)
|
var apiResponse = _.isEmpty(req.query)
|
||||||
? res.status(400).json()
|
? res.status(400).json()
|
||||||
@@ -49,7 +49,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -44,7 +44,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -52,7 +52,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
dataStr.split("/v8.2/")[1]));
|
dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -38,7 +38,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import {
|
||||||
|
getToken,
|
||||||
|
azureHeadersPaged,
|
||||||
|
azureHeaders,
|
||||||
|
consoleLogger,
|
||||||
|
} from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -36,7 +41,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -41,7 +41,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -38,7 +38,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import {
|
||||||
|
getToken,
|
||||||
|
azureHeadersPaged,
|
||||||
|
azureHeaders,
|
||||||
|
consoleLogger,
|
||||||
|
} from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -37,7 +42,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -37,7 +37,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -44,9 +44,11 @@ export default async function ApiProxy(req, res) {
|
|||||||
azureHeadersPaged(token.access_token)
|
azureHeadersPaged(token.access_token)
|
||||||
)
|
)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
|
console.log(data);
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import {
|
||||||
|
getToken,
|
||||||
|
azureHeadersPaged,
|
||||||
|
azureHeaders,
|
||||||
|
consoleLogger,
|
||||||
|
} from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -26,6 +31,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
var queryUrl =
|
var queryUrl =
|
||||||
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
|
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
|
||||||
|
|
||||||
|
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
@@ -34,7 +40,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import {
|
||||||
|
getToken,
|
||||||
|
azureHeadersPaged,
|
||||||
|
azureHeaders,
|
||||||
|
consoleLogger,
|
||||||
|
} from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -39,7 +39,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
});
|
});
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -54,7 +54,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -36,7 +36,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
})
|
})
|
||||||
: res.status(400).json();
|
: res.status(400).json();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -43,7 +43,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -39,7 +39,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -74,7 +74,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
// (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
// (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(dataArr);
|
res.status(200).json(dataArr);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -62,7 +62,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -36,7 +36,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -41,7 +41,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
});
|
});
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
@@ -52,7 +52,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ export default async function ApiProxy(req, res) {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch((err) => {
|
||||||
|
console.log(consoleLogger(err));
|
||||||
res.status(400).json(err);
|
res.status(400).json(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import {
|
||||||
|
createContainer,
|
||||||
|
getContainers,
|
||||||
|
getBlobs,
|
||||||
|
createBlob,
|
||||||
|
uploadFile,
|
||||||
|
deleteBlob,
|
||||||
|
} from "../../../actions/azurestorage";
|
||||||
|
import { hashAPIPath } from "../../../actions";
|
||||||
|
|
||||||
|
import middleware from "../middleware/middleware";
|
||||||
|
import nextConnect from "next-connect";
|
||||||
|
|
||||||
|
const ApiProxy = nextConnect();
|
||||||
|
ApiProxy.use(middleware);
|
||||||
|
|
||||||
|
ApiProxy.get(async (req, res) => {
|
||||||
|
var containerName = req.query.container;
|
||||||
|
var blobName = req.query.blobname;
|
||||||
|
var checkHash = req.query.hash;
|
||||||
|
|
||||||
|
var checkquerypath =
|
||||||
|
"/api/file/deleteblob?container=" +
|
||||||
|
containerName.toLowerCase() +
|
||||||
|
"&blobname=" +
|
||||||
|
blobName;
|
||||||
|
|
||||||
|
console.log(hashAPIPath(checkquerypath), checkHash);
|
||||||
|
console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||||
|
|
||||||
|
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||||
|
await deleteBlob(containerName, "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,72 @@
|
|||||||
|
import {
|
||||||
|
createContainer,
|
||||||
|
getContainers,
|
||||||
|
getBlobs,
|
||||||
|
createBlob,
|
||||||
|
uploadFile,
|
||||||
|
deleteBlob,
|
||||||
|
downloadFile,
|
||||||
|
} from "../../../actions/azurestorage";
|
||||||
|
import { BlobServiceClient, ContainerClient } from "@azure/storage-blob";
|
||||||
|
import {
|
||||||
|
DefaultAzureCredential,
|
||||||
|
InteractiveBrowserCredential,
|
||||||
|
EnvironmentCredential,
|
||||||
|
ClientSecretCredential,
|
||||||
|
} from "@azure/identity";
|
||||||
|
|
||||||
|
import middleware from "../middleware/middleware";
|
||||||
|
import nextConnect from "next-connect";
|
||||||
|
import CryptoJS from "crypto-js";
|
||||||
|
import { hashAPIPath } from "../../../actions";
|
||||||
|
|
||||||
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
|
const ApiProxy = nextConnect();
|
||||||
|
|
||||||
|
ApiProxy.use(middleware);
|
||||||
|
|
||||||
|
ApiProxy.get(async (req, res) => {
|
||||||
|
var containerName = req.query.container;
|
||||||
|
var blobName = req.query.blobname;
|
||||||
|
var checkHash = req.query.hash;
|
||||||
|
|
||||||
|
var checkquerypath =
|
||||||
|
"/api/file/downloadblob?container=" +
|
||||||
|
containerName +
|
||||||
|
"&blobname=" +
|
||||||
|
blobName;
|
||||||
|
|
||||||
|
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||||
|
const downloaded = await downloadFile(containerName, blobName);
|
||||||
|
|
||||||
|
res.setHeader(
|
||||||
|
"content-disposition",
|
||||||
|
"attachment; filename=" + blobName
|
||||||
|
);
|
||||||
|
return res.status(200).send(downloaded);
|
||||||
|
} else {
|
||||||
|
return res.status(400).json();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function streamToBuffer(readableStream) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const chunks = [];
|
||||||
|
readableStream.on("data", (data) => {
|
||||||
|
chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
||||||
|
});
|
||||||
|
readableStream.on("end", () => {
|
||||||
|
resolve(Buffer.concat(chunks));
|
||||||
|
});
|
||||||
|
readableStream.on("error", reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
api: {
|
||||||
|
bodyParser: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ApiProxy;
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import {
|
||||||
|
createContainer,
|
||||||
|
getContainers,
|
||||||
|
getBlobs,
|
||||||
|
createBlob,
|
||||||
|
uploadFile,
|
||||||
|
} from "../../../actions/azurestorage";
|
||||||
|
import { hashAPIPath } from "../../../actions";
|
||||||
|
|
||||||
|
import middleware from "../middleware/middleware";
|
||||||
|
import nextConnect from "next-connect";
|
||||||
|
|
||||||
|
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/getbloblist?container=" + containerName;
|
||||||
|
|
||||||
|
// console.log(hashAPIPath(checkquerypath), checkHash);
|
||||||
|
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||||
|
|
||||||
|
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||||
|
await getBlobs(containerName).then((data) => {
|
||||||
|
return res.status(200).json({ files: data });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return res.status(400).json();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
api: {
|
||||||
|
bodyParser: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ApiProxy;
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import {
|
||||||
|
createContainer,
|
||||||
|
getContainers,
|
||||||
|
getBlobs,
|
||||||
|
createBlob,
|
||||||
|
uploadFile,
|
||||||
|
} from "../../../actions/azurestorage";
|
||||||
|
|
||||||
|
import middleware from "../middleware/middleware";
|
||||||
|
import nextConnect from "next-connect";
|
||||||
|
|
||||||
|
const ApiProxy = nextConnect();
|
||||||
|
ApiProxy.use(middleware);
|
||||||
|
|
||||||
|
ApiProxy.post(async (req, res) => {
|
||||||
|
var checkHash = req.query.hash;
|
||||||
|
console.log(JSON.parse(req.body.appealData));
|
||||||
|
console.log(req.files);
|
||||||
|
|
||||||
|
const appealData = JSON.parse(req.body.appealData);
|
||||||
|
|
||||||
|
// var checkquerypath = "/api/file/upload";
|
||||||
|
|
||||||
|
// console.log(hashAPIPath(checkquerypath), checkHash);
|
||||||
|
// console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash);
|
||||||
|
|
||||||
|
// if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
|
||||||
|
createContainer(appealData.pinswg_name.trim()).then((containerName) => {
|
||||||
|
createBlob(appealData, containerName).then((data) => {
|
||||||
|
uploadFile(req.files, containerName, data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return res.status(200).json({ data: "success" });
|
||||||
|
// } else {
|
||||||
|
// return res.status(400).json();
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
api: {
|
||||||
|
bodyParser: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ApiProxy;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import nextConnect from "next-connect";
|
||||||
|
import multiparty from "multiparty";
|
||||||
|
|
||||||
|
const middleware = nextConnect();
|
||||||
|
|
||||||
|
middleware.use(async (req, res, next) => {
|
||||||
|
const form = new multiparty.Form();
|
||||||
|
|
||||||
|
await form.parse(req, function (err, fields, files) {
|
||||||
|
req.body = fields;
|
||||||
|
req.files = files;
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
export default middleware;
|
||||||
+27
-13
@@ -15,7 +15,7 @@ import {
|
|||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
setSearchResults,
|
setSearchResults,
|
||||||
} from "../../store/searchOutput/action";
|
} from "../../store/searchOutput/action";
|
||||||
|
import _ from "lodash";
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
@@ -58,19 +58,33 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
);
|
);
|
||||||
|
|
||||||
let searchResultsObj = await getDNSList();
|
let searchResultsObj = await getDNSList();
|
||||||
searchResultsObj =
|
if (_.has(searchResultsObj, "status") != false) {
|
||||||
searchResultsObj.status == 502
|
if (searchResultsObj.status == 400) {
|
||||||
? {
|
return {
|
||||||
value: [],
|
redirect: {
|
||||||
errorCode: searchResultsObj.status,
|
//destination: "/dns-not-found",
|
||||||
errorMsg: searchResultsObj.statusText,
|
destination: "/error",
|
||||||
}
|
permanent: false,
|
||||||
: searchResultsObj;
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
searchResultsObj =
|
||||||
|
searchResultsObj.status == 502
|
||||||
|
? {
|
||||||
|
value: [],
|
||||||
|
errorCode: searchResultsObj.status,
|
||||||
|
errorMsg: searchResultsObj.statusText,
|
||||||
|
}
|
||||||
|
: searchResultsObj;
|
||||||
|
|
||||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
const searchDetailsObj = await getSearchDetails(
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
searchResultsObj
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
);
|
||||||
store.dispatch(setSearch("DNS"));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
|
store.dispatch(setSearch("DNS"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+33
-18
@@ -1,3 +1,4 @@
|
|||||||
|
import _ from "lodash";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
@@ -121,26 +122,40 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
);
|
);
|
||||||
|
|
||||||
let searchResultsObj = await getBasicDNSSearch();
|
let searchResultsObj = await getBasicDNSSearch();
|
||||||
searchResultsObj =
|
if (_.has(searchResultsObj, "status") != false) {
|
||||||
searchResultsObj.status == 502
|
if (searchResultsObj.status == 400) {
|
||||||
? {
|
return {
|
||||||
value: [],
|
redirect: {
|
||||||
errorCode: searchResultsObj.status,
|
//destination: "/dns-not-found",
|
||||||
errorMsg: searchResultsObj.statusText,
|
destination: "/error",
|
||||||
}
|
permanent: false,
|
||||||
: searchResultsObj;
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
searchResultsObj =
|
||||||
|
searchResultsObj.status == 502
|
||||||
|
? {
|
||||||
|
value: [],
|
||||||
|
errorCode: searchResultsObj.status,
|
||||||
|
errorMsg: searchResultsObj.statusText,
|
||||||
|
}
|
||||||
|
: searchResultsObj;
|
||||||
|
|
||||||
const showMapCheck = process.env.SHOWMAPS || false;
|
const showMapCheck = process.env.SHOWMAPS || false;
|
||||||
|
|
||||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
const searchDetailsObj = await getSearchDetails(
|
||||||
const dnsCoords = await getDNSCoords();
|
searchResultsObj
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
);
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
const dnsCoords = await getDNSCoords();
|
||||||
store.dispatch(setSearch("DNS"));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setDNSCoords(dnsCoords));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
return {
|
store.dispatch(setSearch("DNS"));
|
||||||
props: { showMap: showMapCheck },
|
store.dispatch(setDNSCoords(dnsCoords));
|
||||||
};
|
return {
|
||||||
|
props: { showMap: showMapCheck },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import Head from "next/head";
|
||||||
|
import Link from "next/link";
|
||||||
|
import CookieBanner from "../components/cookieBanner";
|
||||||
|
import Footer from "../components/footer";
|
||||||
|
import Header from "../components/header";
|
||||||
|
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||||
|
import { useSession, signIn, signOut } from "next-auth/react";
|
||||||
|
|
||||||
|
function Error({ statusCode }, props) {
|
||||||
|
let { t, lang } = useTranslation();
|
||||||
|
const { footerLinks, pages } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Head>
|
||||||
|
<title>
|
||||||
|
{t("case:page-title")} - {t("common:service-name")}
|
||||||
|
</title>
|
||||||
|
</Head>
|
||||||
|
<div id="page_wrapper">
|
||||||
|
<CookieBanner />
|
||||||
|
<Header courseName={t("common:service-name")} />
|
||||||
|
<div className="govuk-width-container govuk-!-padding-bottom-9">
|
||||||
|
<main className="govuk-main-wrapper govuk-!-padding-top-9 govuk-!-padding-bottom-9">
|
||||||
|
<div className="govuk-grid-row">
|
||||||
|
<div className="govuk-grid-column-two-thirds ">
|
||||||
|
<h1>{t("common:error-page-title")}</h1>
|
||||||
|
<p className="govuk-body">
|
||||||
|
{statusCode
|
||||||
|
? `An error ${statusCode} occurred on server`
|
||||||
|
: `An error occured`}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="/"
|
||||||
|
className="govuk-link"
|
||||||
|
onClick={() => {
|
||||||
|
destroyCookie({}, "pinsUser"),
|
||||||
|
window.localStorage.clear(),
|
||||||
|
signOut({
|
||||||
|
callbackUrl: "/",
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
Go back home
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
<Footer footerLinks={footerLinks} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Error.getInitialProps = ({ res, err }) => {
|
||||||
|
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
|
||||||
|
console.log(res, err);
|
||||||
|
return { statusCode };
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Error;
|
||||||
+29
-26
@@ -32,6 +32,7 @@ const Home = (props) => {
|
|||||||
loginEmailStr,
|
loginEmailStr,
|
||||||
loggedInUserEmail,
|
loggedInUserEmail,
|
||||||
ggLocale,
|
ggLocale,
|
||||||
|
hasLoginCode,
|
||||||
} = props;
|
} = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ const Home = (props) => {
|
|||||||
expDate.setDate(now.getDate() + 1);
|
expDate.setDate(now.getDate() + 1);
|
||||||
|
|
||||||
//console.log("hashed email str", loginEmailStr);
|
//console.log("hashed email str", loginEmailStr);
|
||||||
_.isEmpty(loggedInUserId) != false && !hasGGCode
|
hasLoginCode != false
|
||||||
? console.log("no session")
|
? console.log("no session")
|
||||||
: _.has(loggedInUserId, "value")
|
: _.has(loggedInUserId, "value")
|
||||||
? _.isEmpty(loggedInUserId.value)
|
? _.isEmpty(loggedInUserId.value)
|
||||||
@@ -144,8 +145,8 @@ const Home = (props) => {
|
|||||||
showLogin={showLogin}
|
showLogin={showLogin}
|
||||||
showMap={showMap}
|
showMap={showMap}
|
||||||
loggedInUserId={loggedInUserId}
|
loggedInUserId={loggedInUserId}
|
||||||
GG_REDIRECT_URI={props.GG_REDIRECT_URI}
|
// GG_REDIRECT_URI={props.GG_REDIRECT_URI}
|
||||||
GG_CLIENT_ID={props.GG_CLIENT_ID}
|
// GG_CLIENT_ID={props.GG_CLIENT_ID}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -172,22 +173,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
const hasLoginCode = thisSession != null;
|
const hasLoginCode = thisSession != null;
|
||||||
|
|
||||||
let providerConfig = await getProviderConfig();
|
// let providerConfig = await getProviderConfig();
|
||||||
let ggLocale =
|
let ggLocale =
|
||||||
typeof query.ui_locales != "undefined" && query.ui_locales;
|
typeof query.ui_locales != "undefined" && query.ui_locales;
|
||||||
|
|
||||||
console.log(
|
console.log("\n", "hasloginCode:", hasLoginCode);
|
||||||
"endpoint: ",
|
|
||||||
providerConfig.token_endpoint,
|
|
||||||
"\n",
|
|
||||||
"hasloginCode:",
|
|
||||||
hasLoginCode,
|
|
||||||
"\n",
|
|
||||||
"redirect:",
|
|
||||||
process.env.GG_REDIRECT_URI
|
|
||||||
);
|
|
||||||
|
|
||||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
// store.dispatch(getGovGatewayConfig(providerConfig));
|
||||||
|
|
||||||
let ggToken = {};
|
let ggToken = {};
|
||||||
let ggUserInfo = {};
|
let ggUserInfo = {};
|
||||||
@@ -195,15 +187,28 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
let loginEmailStr = "";
|
let loginEmailStr = "";
|
||||||
|
|
||||||
if (hasLoginCode == true) {
|
if (hasLoginCode == true) {
|
||||||
(loginEmailStr = hashString(thisSession.user.email)),
|
loginEmailStr = hashString(thisSession.user.email);
|
||||||
(portalUserObj = await getPortalLogin(
|
portalUserObj = await getPortalLogin(
|
||||||
thisSession.user.email,
|
thisSession.user.email,
|
||||||
relayToken
|
relayToken
|
||||||
)),
|
);
|
||||||
console.log("loggin user stuff: ", portalUserObj),
|
|
||||||
store.dispatch(setAccountDetails(portalUserObj));
|
if (_.has(portalUserObj, "status") != false) {
|
||||||
|
if (portalUserObj.status == 400) {
|
||||||
|
return {
|
||||||
|
redirect: {
|
||||||
|
//destination: "/dns-not-found",
|
||||||
|
destination: "/error",
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
console.log("loggin user stuff: ", portalUserObj);
|
||||||
|
store.dispatch(setAccountDetails(portalUserObj));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("no session");
|
console.log("empty session");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ggToken.status == 400) {
|
if (ggToken.status == 400) {
|
||||||
@@ -219,11 +224,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
ggLocale: ggLocale,
|
ggLocale: ggLocale,
|
||||||
showLogin: showLoginCheck,
|
showLogin: showLoginCheck,
|
||||||
showMap: showMapCheck,
|
showMap: showMapCheck,
|
||||||
hasGGCode: hasLoginCode,
|
hasSession: hasLoginCode,
|
||||||
loggedInUserId: portalUserObj,
|
loggedInUserId: portalUserObj,
|
||||||
loggedInUserEmail: loginEmailStr,
|
loggedInUserEmail: loginEmailStr,
|
||||||
GG_REDIRECT_URI: process.env.GG_REDIRECT_URI,
|
|
||||||
GG_CLIENT_ID: process.env.GG_CLIENT_ID,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
getMandatoryFields,
|
getMandatoryFields,
|
||||||
getPickLists,
|
getPickLists,
|
||||||
getPartSavedAppeal,
|
getPartSavedAppeal,
|
||||||
|
getFilesFromBlob,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import { getProviderConfig } from "../../actions/govgateway";
|
import { getProviderConfig } from "../../actions/govgateway";
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
@@ -29,6 +30,7 @@ import {
|
|||||||
setAppealTypeID,
|
setAppealTypeID,
|
||||||
setAppealTypeTitle,
|
setAppealTypeTitle,
|
||||||
setCaseReference,
|
setCaseReference,
|
||||||
|
setFilesForAppeal,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
import { setForm } from "../../store/formData/action";
|
import { setForm } from "../../store/formData/action";
|
||||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||||
@@ -213,11 +215,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
console.log("the query", query.appealtypes);
|
console.log("the query", query.appealtypes);
|
||||||
let loggedInUser = cookies.pinsUser;
|
let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
const [appealTypeData, mandatoryFieldsData, pickListData] =
|
const [appealTypeData, mandatoryFieldsData, pickListData, blobList] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
await getAppealsTypes(),
|
await getAppealsTypes(),
|
||||||
await getMandatoryFields(query.appealtypes),
|
await getMandatoryFields(query.appealtypes),
|
||||||
await getPickLists(query.appealtypes),
|
await getPickLists(query.appealtypes),
|
||||||
|
await getFilesFromBlob(query.casereference),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let searchResultsObj = await getPartSavedAppeal(query.casereference);
|
let searchResultsObj = await getPartSavedAppeal(query.casereference);
|
||||||
@@ -232,7 +235,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("appeal:", searchDetailsObj);
|
//console.log("appeal:", searchDetailsObj);
|
||||||
|
|
||||||
searchDetailsObj = JSON.stringify(searchDetailsObj);
|
searchDetailsObj = JSON.stringify(searchDetailsObj);
|
||||||
searchDetailsObj = searchDetailsObj.replace(/:true/gm, `:"Yes"`);
|
searchDetailsObj = searchDetailsObj.replace(/:true/gm, `:"Yes"`);
|
||||||
@@ -265,6 +268,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
store.dispatch(setCaseReference(caseReference));
|
store.dispatch(setCaseReference(caseReference));
|
||||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
store.dispatch(setFilesForAppeal(blobList));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -290,6 +294,9 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setCaseReference: (refno) => {
|
setCaseReference: (refno) => {
|
||||||
dispatch(setCaseReference(refno));
|
dispatch(setCaseReference(refno));
|
||||||
},
|
},
|
||||||
|
setFilesForAppeal: (blobList) => {
|
||||||
|
dispatch(setFilesForAppeal(blobList));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -179,13 +179,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
await getAwaitingSubmission(loggedInUser),
|
await getAwaitingSubmission(loggedInUser),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//const cookiesMaker = nookies.get(ctx)
|
|
||||||
// console.log(
|
|
||||||
// "acc details:",
|
|
||||||
// accountDetails,
|
|
||||||
// _.has(accountDetails, "errorCode") != false
|
|
||||||
// );
|
|
||||||
|
|
||||||
if (_.has(accountDetails, "errorCode") != false) {
|
if (_.has(accountDetails, "errorCode") != false) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
@@ -229,7 +222,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const getDetails = (resultsObj, detailsType) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
console.log(detailsType);
|
//console.log(detailsType);
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
getAppealsTypes,
|
getAppealsTypes,
|
||||||
getMandatoryFields,
|
getMandatoryFields,
|
||||||
getPickLists,
|
getPickLists,
|
||||||
|
getFilesFromBlob,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import { getProviderConfig } from "../../actions/govgateway";
|
import { getProviderConfig } from "../../actions/govgateway";
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
@@ -30,6 +31,7 @@ import {
|
|||||||
setAppealTypeID,
|
setAppealTypeID,
|
||||||
setAppealTypeTitle,
|
setAppealTypeTitle,
|
||||||
setCaseReference,
|
setCaseReference,
|
||||||
|
setFilesForAppeal,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
import { setForm } from "../../store/formData/action";
|
import { setForm } from "../../store/formData/action";
|
||||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||||
@@ -220,11 +222,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
appealTypeData,
|
appealTypeData,
|
||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
pickListData,
|
pickListData,
|
||||||
|
//blobList,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
await getCase(query.id),
|
await getCase(query.id),
|
||||||
await getAppealsTypes(),
|
await getAppealsTypes(),
|
||||||
await getMandatoryFields(query.appealtypes),
|
await getMandatoryFields(query.appealtypes),
|
||||||
await getPickLists(query.appealtypes),
|
await getPickLists(query.appealtypes),
|
||||||
|
//await getFilesFromBlob(query.casereference),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
console.log("anything here", loggedInUser, query.id, caseReferenceData);
|
console.log("anything here", loggedInUser, query.id, caseReferenceData);
|
||||||
@@ -251,6 +255,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
store.dispatch(setCaseReference(caseReference));
|
store.dispatch(setCaseReference(caseReference));
|
||||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
//store.dispatch(setFilesForAppeal(blobList));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+31
-16
@@ -15,6 +15,7 @@ import {
|
|||||||
setSearchResults,
|
setSearchResults,
|
||||||
} from "../store/searchOutput/action";
|
} from "../store/searchOutput/action";
|
||||||
import { wrapper } from "../store/store";
|
import { wrapper } from "../store/store";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const { footerLinks, pages, isLinkedCase } = props;
|
const { footerLinks, pages, isLinkedCase } = props;
|
||||||
@@ -127,26 +128,40 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
let searchResultsObj = await getBasicSearch(query.q);
|
let searchResultsObj = await getBasicSearch(query.q);
|
||||||
|
|
||||||
searchResultsObj =
|
if (_.has(searchResultsObj, "status") != false) {
|
||||||
searchResultsObj.status == 502
|
if (searchResultsObj.status == 400) {
|
||||||
? {
|
return {
|
||||||
value: [],
|
redirect: {
|
||||||
errorCode: searchResultsObj.status,
|
//destination: "/dns-not-found",
|
||||||
errorMsg: searchResultsObj.statusText,
|
destination: "/error",
|
||||||
}
|
permanent: false,
|
||||||
: searchResultsObj;
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
searchResultsObj =
|
||||||
|
searchResultsObj.status == 502
|
||||||
|
? {
|
||||||
|
value: [],
|
||||||
|
errorCode: searchResultsObj.status,
|
||||||
|
errorMsg: searchResultsObj.statusText,
|
||||||
|
}
|
||||||
|
: searchResultsObj;
|
||||||
|
|
||||||
//console.log("sssss", searchResultsObj);
|
//console.log("sssss", searchResultsObj);
|
||||||
|
|
||||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
const searchDetailsObj = await getSearchDetails(
|
||||||
|
searchResultsObj
|
||||||
|
);
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch(query.q));
|
store.dispatch(setSearch(query.q));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { isLinkedCase: isLinked },
|
props: { isLinkedCase: isLinked },
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
import { BlobServiceClient, ContainerClient } from "@azure/storage-blob";
|
||||||
|
import {
|
||||||
|
DefaultAzureCredential,
|
||||||
|
InteractiveBrowserCredential,
|
||||||
|
EnvironmentCredential,
|
||||||
|
ClientSecretCredential,
|
||||||
|
} from "@azure/identity";
|
||||||
|
import { wrapper } from "../store/store";
|
||||||
|
|
||||||
|
import Head from "next/head";
|
||||||
|
|
||||||
|
const ShowStorage = (props) => {
|
||||||
|
const { container } = props;
|
||||||
|
// console.log("Containers:");
|
||||||
|
// // for await (const container of blobServiceClient.listContainers()) {
|
||||||
|
// // console.log(`- ${container.name}`);
|
||||||
|
// // }
|
||||||
|
|
||||||
|
console.log(container);
|
||||||
|
|
||||||
|
return <div>hello</div>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
|
(store) => async (ctx) => {
|
||||||
|
const { query, req, res } = ctx;
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"have therese?:",
|
||||||
|
process.env.AZURE_TENANT_ID,
|
||||||
|
process.env.AZURE_CLIENT_ID,
|
||||||
|
process.env.AZURE_CLIENT_SECRET
|
||||||
|
);
|
||||||
|
|
||||||
|
const creds = new DefaultAzureCredential();
|
||||||
|
|
||||||
|
const blobServiceClient = new BlobServiceClient(
|
||||||
|
`https://pedwdev.blob.core.windows.net`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
const containerName = `CAS-999999-22222`;
|
||||||
|
|
||||||
|
const containerClient = new ContainerClient(
|
||||||
|
`https://pedwdev.blob.core.windows.net/${containerName}`,
|
||||||
|
creds
|
||||||
|
);
|
||||||
|
|
||||||
|
// const createContainerResponse = await containerClient.create();
|
||||||
|
// console.log(
|
||||||
|
// `Created container ${containerName} successfully`,
|
||||||
|
// createContainerResponse.requestId
|
||||||
|
// );
|
||||||
|
|
||||||
|
console.log("Containers:");
|
||||||
|
for await (const container of blobServiceClient.listContainers()) {
|
||||||
|
console.log(`- ${container.name}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const appealID = uuidv4();
|
||||||
|
const uploadOptions = {
|
||||||
|
metadata: { reviewer: "john", reviewDate: "2022-04-01" },
|
||||||
|
tags: { owner: appealID },
|
||||||
|
};
|
||||||
|
// for (let index = 0; index < 7; index++) {
|
||||||
|
// // Create a blob
|
||||||
|
// const content = "hello";
|
||||||
|
// const blobName = appealID + "/BOBnewblob" + new Date().getTime();
|
||||||
|
// const blockBlobClient =
|
||||||
|
// containerClient.getBlockBlobClient(blobName);
|
||||||
|
|
||||||
|
// // const uploadBlobResponse = await blockBlobClient.upload(
|
||||||
|
// // content,
|
||||||
|
// // Buffer.byteLength(content),
|
||||||
|
// // uploadOptions
|
||||||
|
// // );
|
||||||
|
|
||||||
|
// const uploadBlobResponse = await blockBlobClient.uploadFile(
|
||||||
|
// "public/assets/images/HM-Govt-Supplier-to-Govt.jpg"
|
||||||
|
// // uploadOptions
|
||||||
|
// );
|
||||||
|
|
||||||
|
// const tags = {
|
||||||
|
// owner: appealID,
|
||||||
|
// };
|
||||||
|
|
||||||
|
// //console.log(tags);
|
||||||
|
// //await blockBlobClient.setTags(tags);
|
||||||
|
|
||||||
|
// // console.log(
|
||||||
|
// // `Uploaded block blob ${blobName} successfully`,
|
||||||
|
// // uploadBlobResponse.requestId
|
||||||
|
// // );
|
||||||
|
// }
|
||||||
|
|
||||||
|
console.log("Blobs:");
|
||||||
|
for await (const blob of containerClient.listBlobsFlat()) {
|
||||||
|
console.log(`- ${blob.name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export default ShowStorage;
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 964 B |
Binary file not shown.
|
After Width: | Height: | Size: 1017 B |
@@ -9,6 +9,8 @@ export const appealTypeDataActionTypes = {
|
|||||||
SETCASEREFERENCE: "SETCASEREFERENCE",
|
SETCASEREFERENCE: "SETCASEREFERENCE",
|
||||||
SETFORMCOMPLETE: "SETFORMCOMPLETE",
|
SETFORMCOMPLETE: "SETFORMCOMPLETE",
|
||||||
SETDOCUMENTLIST: "SETDOCUMENTLIST",
|
SETDOCUMENTLIST: "SETDOCUMENTLIST",
|
||||||
|
SETFILELIST: "SETFILELIST",
|
||||||
|
SETNEWAPPEALPROGRESS: "SETNEWAPPEALPROGRESS",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppealTypeObj = () => (dispatch) => {
|
export const getAppealTypeObj = () => (dispatch) => {
|
||||||
@@ -70,3 +72,17 @@ export const setDocumentsList = (documentList) => (dispatch) => {
|
|||||||
documentList: documentList,
|
documentList: documentList,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setFilesForAppeal = (fileList) => (dispatch) => {
|
||||||
|
return dispatch({
|
||||||
|
type: appealTypeDataActionTypes.SETFILELIST,
|
||||||
|
fileList: fileList,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setNewAppealProgress = (progress) => (dispatch) => {
|
||||||
|
return dispatch({
|
||||||
|
type: appealTypeDataActionTypes.SETNEWAPPEALPROGRESS,
|
||||||
|
progress: progress,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ const appealTypeDataInitialState = {
|
|||||||
caseReference: {},
|
caseReference: {},
|
||||||
formComplete: "false",
|
formComplete: "false",
|
||||||
documentList: {},
|
documentList: {},
|
||||||
|
fileList: {},
|
||||||
|
progress: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function reducer(state = appealTypeDataInitialState, action) {
|
export default function reducer(state = appealTypeDataInitialState, action) {
|
||||||
@@ -53,6 +55,16 @@ export default function reducer(state = appealTypeDataInitialState, action) {
|
|||||||
...state,
|
...state,
|
||||||
documentList: action.documentList,
|
documentList: action.documentList,
|
||||||
};
|
};
|
||||||
|
case appealTypeDataActionTypes.SETFILELIST:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
fileList: action.fileList,
|
||||||
|
};
|
||||||
|
case appealTypeDataActionTypes.SETNEWAPPEALPROGRESS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
progress: action.progress,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ h2,
|
|||||||
h3,
|
h3,
|
||||||
h4,
|
h4,
|
||||||
h5,
|
h5,
|
||||||
|
.app-step-nav__circle-background,
|
||||||
a {
|
a {
|
||||||
font-family: Arial, Helvetica, "Nimbus Sans L", sans-serif;
|
font-family: Arial, Helvetica, "Nimbus Sans L", sans-serif;
|
||||||
}
|
}
|
||||||
@@ -770,6 +771,82 @@ textarea,
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.at-nav {
|
||||||
|
.sectionCompleteTick {
|
||||||
|
display:inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height:16px;
|
||||||
|
background: $darkgrey;
|
||||||
|
border-radius:50%;
|
||||||
|
-ms-transform: rotate(45deg); /* IE 9 */
|
||||||
|
-webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
|
||||||
|
transform: rotate(45deg);
|
||||||
|
margin-left: -20px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionCompleteTick:before{
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 3px;
|
||||||
|
height: 9px;
|
||||||
|
background-color: #fff;
|
||||||
|
left: 8px;
|
||||||
|
top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionCompleteTick:after{
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 3px;
|
||||||
|
height: 3px;
|
||||||
|
background-color: #fff;
|
||||||
|
left: 5px;
|
||||||
|
top: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.app-step-nav__step {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 45px;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
*, .govuk-body, .govuk-body-xs, .govuk-body-s, .govuk-body-m, .govuk-footer, .govuk-heading-xl, .govuk-heading-l, .govuk-heading-m, .govuk-heading-s, .govuk-header-l, .govuk-header-m, .govuk-header__link, .govuk-footer__link, .govuk-link, .govuk-button, .govuk-label, .govuk-select, .govuk-radios__item, .govuk-breadcrumbs__link, .govuk-fieldset__legend--s, .govuk-input, .govuk-textarea, .govuk-panel, .govuk-panel__title, .govuk-warning-text__text, .govuk-hint, .app-cookie-banner, .govuk-error-message.govuk-form-group--error, h1, h2, h3, h4, h5, a {
|
||||||
|
font-family: Arial, Helvetica, "Nimbus Sans L", sans-serif;
|
||||||
|
}
|
||||||
|
user agent stylesheet
|
||||||
|
li {
|
||||||
|
display: list-item;
|
||||||
|
text-align: -webkit-match-parent;
|
||||||
|
}
|
||||||
|
user agent stylesheet
|
||||||
|
ol {
|
||||||
|
list-style-type: decimal;
|
||||||
|
}
|
||||||
|
.app-step-nav__step--active:last-child:before, .app-step-nav__step--active .app-step-nav__circle--number, .app-step-nav__step--active:after, .app-step-nav__step--active .app-step-nav__help:after
|
||||||
|
{
|
||||||
|
border-color: $lightgrey !important;
|
||||||
|
}
|
||||||
|
.app-step-nav__circle--number{
|
||||||
|
border-color: $lightgrey !important;
|
||||||
|
}
|
||||||
|
.app-step-nav__circle-background{
|
||||||
|
color:$lightgrey;
|
||||||
|
}
|
||||||
|
.sectionComplete{
|
||||||
|
.app-step-nav__circle {
|
||||||
|
background-color: $lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-step-nav__circle-background{
|
||||||
|
color:$white;
|
||||||
|
text-shadow: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.form-inline-label {
|
.form-inline-label {
|
||||||
.inlineFieldset {
|
.inlineFieldset {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -864,6 +941,7 @@ textarea,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.progress-save{
|
.progress-save{
|
||||||
padding: 10px 15px !important;
|
padding: 10px 15px !important;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|||||||
Reference in New Issue
Block a user