view all delete button for awaiting submission

This commit is contained in:
2024-05-30 06:30:59 +01:00
parent 9b8936198a
commit 2c41f2476b
8 changed files with 211 additions and 26 deletions
+24 -8
View File
@@ -862,8 +862,15 @@ export const getAwaitingSubmission = (loggedInUserId) => {
export const getAwaitingSubmissionFromBlob = (containerName) => { export const getAwaitingSubmissionFromBlob = (containerName) => {
console.log( console.log(
"///////////////////////\ngetAwaitingSubmissionFromBlob: " + "///////////////////////\ngetAwaitingSubmissionFromBlob: " +
containerName,
BASE_URL +
"/api/file/getawaitingsubmissionfromblob?container=" +
containerName + containerName +
"\n///////////////////////\n" hashAPIPath(
"/api/file/getawaitingsubmissionfromblob?container=" +
containerName
),
"\n///////////////////////\n"
); );
return axios return axios
.get( .get(
@@ -915,15 +922,24 @@ export const getRepsFromBlob = (containerName) => {
}; };
export const getAwaitingSubmissionFromBlobProxy = (containerName) => { export const getAwaitingSubmissionFromBlobProxy = (containerName) => {
console.log(
"///////////////////////getAwaitingSubmissionFromBlobProxy: " +
containerName,
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName,
"\n///////////////////////\n"
);
return axios return axios
.get( .get(
BASE_URL + // BASE_URL +
"/api/file/getawaitingsubmissionfromblob?container=" + "/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName + containerName
hashAPIPath( // +
"/api/file/getawaitingsubmissionfromblob?container=" + // hashAPIPath(
containerName // "/api/file/getawaitingsubmissionfromblob?container=" +
) // containerName
// )
) )
.then((res) => { .then((res) => {
return res.data; return res.data;
+96 -2
View File
@@ -1,7 +1,6 @@
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import { setCurrentReference } from "../../store/currentView/action";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { JSONPath as jsonpath } from "jsonpath-plus"; import { JSONPath as jsonpath } from "jsonpath-plus";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
@@ -11,6 +10,32 @@ import {
setSearchResults, setSearchResults,
setSearchDetails, setSearchDetails,
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { parseCookies, setCookie, destroyCookie } from "nookies";
import {
getWatchedCasesProxy,
getPortalModuleDetailsProxy,
deleteWatchedCases,
deleteAwaitingSubmissions,
deleteAwaitingSubmissionsFromBlob,
getAwaitingSubmissionFromBlobProxy,
getAwaitingSubmissionProxy,
} from "../../actions";
import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action";
import {
setWatchedCases,
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import {
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} from "../../store/awaitingSubmission/action";
import {
setCurrentLinkedCases,
setCurrentReference,
setCurrentView,
} from "../../store/currentView/action";
const ViewAllResults = (props) => { const ViewAllResults = (props) => {
const { const {
@@ -20,6 +45,9 @@ const ViewAllResults = (props) => {
setCurrentReference, setCurrentReference,
myportal, myportal,
setSearchResults, setSearchResults,
accountDetails,
setAwaitingSubmissionFromBlob,
setAwaitingSubmissionDetails,
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -541,6 +569,34 @@ const ViewAllResults = (props) => {
"statuscode@OData.Community.Display.V1.FormattedValue" "statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"} ] || "N/A"}
</dd> </dd>
{currentView.viewKey == "awaitingSubmissionDetails" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
<button
title={t(
"case:do-you-want-to-delete-case-label"
)}
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
onClick={() => {
confirm(
t(
"case:do-you-want-to-delete-case-label"
) +
item.ticketnumber +
"?\n" +
t(
"case:do-you-want-to-delete-case-disclaimer-label"
)
) &&
deleteCaseItem(
props.accountDetails.containerID,
item.ticketnumber
);
}}
>
&mdash;
</button>
</dd>
)}
</div> </div>
); );
}); });
@@ -590,6 +646,29 @@ const ViewAllResults = (props) => {
}; };
} }
const deleteCaseItem = (containerID, caseID) => {
let cookies = parseCookies();
console.log("sssss", containerID, caseID);
deleteAwaitingSubmissionsFromBlob(containerID, caseID)
.then((data) => {
return data;
})
.then(() => {
getAwaitingSubmissionFromBlobProxy(containerID)
.then((data) => {
setAwaitingSubmissionFromBlob(data);
setAwaitingSubmissionDetails(data);
})
.then(() => {
setCurrentView({
"viewName": "Awaiting Submission",
"viewKey": "awaitingSubmissionDetails",
});
});
});
};
return ( return (
<> <>
<div className="govuk-grid-row"> <div className="govuk-grid-row">
@@ -777,6 +856,15 @@ const ViewAllResults = (props) => {
); );
}; };
const mapStateToProps = (state) => {
return {
// currentView: state.currentView,
accountDetails: state.accountDetails,
// search: state.search,
// searchResultsObj: state.searchResultsObj,
};
};
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentReference: (currentReference) => { setCurrentReference: (currentReference) => {
@@ -788,7 +876,13 @@ const mapDispatchToProps = (dispatch) => {
setSearchDetails: (searchDetailsObj) => { setSearchDetails: (searchDetailsObj) => {
dispatch(setSearchDetails(searchDetailsObj)); dispatch(setSearchDetails(searchDetailsObj));
}, },
setAwaitingSubmissionFromBlob: (awaitingSubmission) => {
dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission));
},
setAwaitingSubmissionDetails: (awaitingSubmission) => {
dispatch(setAwaitingSubmissionDetails(awaitingSubmission));
},
}; };
}; };
export default connect(null, mapDispatchToProps)(ViewAllResults); export default connect(mapStateToProps, mapDispatchToProps)(ViewAllResults);
+30 -9
View File
@@ -316,15 +316,28 @@ export const getProgressObj = (
mandatoryFieldsData mandatoryFieldsData
); );
if (datafieldname[0].value == "pinswg_fileUpload") { if (datafieldname[0].value.includes("pinswg_fileUpload")) {
return { if (typeof isRequiredField[0] != "undefined") {
"fieldType": fieldtype[0].value, if (isRequiredField[0].RequiredLevel.Value != "None") {
"label": rows[0].value, //console.log(datafieldname[0].value, validation);
"datafieldname": datafieldname[0].value, return {
"key": key, "fieldType": fieldtype[0].value,
"picklistData": props.props.formData.pickListData, "label": rows[0].value,
"mandatoryFieldsData": mandatoryFieldsData, "datafieldname": datafieldname[0].value,
}; "datafieldcontent": datafieldcontent,
"validation": validation,
};
}
} else {
return {
"fieldType": fieldtype[0].value,
"label": rows[0].value,
"datafieldname": datafieldname[0].value,
"key": key,
"picklistData": props.props.formData.pickListData,
"mandatoryFieldsData": mandatoryFieldsData,
};
}
} else { } else {
if (typeof isRequiredField[0] != "undefined") { if (typeof isRequiredField[0] != "undefined") {
if (isRequiredField[0].RequiredLevel.Value != "None") { if (isRequiredField[0].RequiredLevel.Value != "None") {
@@ -350,6 +363,14 @@ export const getProgressObj = (
return el != null; return el != null;
}); });
rowObj = rowObj.filter(function (el) {
return typeof el.validation != "undefined";
});
rowObj = rowObj.filter(function (el) {
return el.validation.indexOf("required") > -1;
});
const filterUnwanted = (rowObj) => { const filterUnwanted = (rowObj) => {
const required = rowObj.filter((el) => { const required = rowObj.filter((el) => {
return !_.isEmpty(el.validation); return !_.isEmpty(el.validation);
+1 -1
View File
@@ -346,7 +346,7 @@
<labels> <labels>
<label description="Statement of case" ishareDocumentCode="000000" /> <label description="Statement of case" ishareDocumentCode="000000" />
</labels> </labels>
<control id="pinswg_fileUpload" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload" disabled="false" /> <control id="pinswg_fileUpload" validation="[required]" classid="{16D63FD6-119B-4353-BDCA-18358721C3FE}" datafieldname="pinswg_fileUpload" disabled="false" />
</row> </row>
<row> <row>
<labels> <labels>
@@ -1800,6 +1800,15 @@
"ManagedPropertyLogicalName": "canmodifyrequirementlevelsettings" "ManagedPropertyLogicalName": "canmodifyrequirementlevelsettings"
}, },
"MetadataId": "8eb4ce7e-8f45-432c-8064-60405103e901" "MetadataId": "8eb4ce7e-8f45-432c-8064-60405103e901"
},
{
"LogicalName": "pinswg_fileUpload",
"RequiredLevel": {
"Value": "Recommended",
"CanBeChanged": true,
"ManagedPropertyLogicalName": "canmodifyrequirementlevelsettings"
},
"MetadataId": "917f813a-4183-eb11-aac0-00224800be0c"
} }
] ]
} }
+1 -1
View File
@@ -13,7 +13,7 @@ module.exports = {
"/": ["common", "home", "case"], "/": ["common", "home", "case"],
"/error": ["common", "home", "myportal"], "/error": ["common", "home", "myportal"],
"/myportal": ["myportal", "common", "home", "case"], "/myportal": ["myportal", "common", "home", "case"],
"/myportal/viewall": ["search", "myportal"], "/myportal/viewall": ["search", "myportal", "case"],
"/myportal/advancedsearch": ["search", "myportal"], "/myportal/advancedsearch": ["search", "myportal"],
"/myportal/advancedsearchresults": ["search", "myportal"], "/myportal/advancedsearchresults": ["search", "myportal"],
"/myportal/searchresults": ["search", "myportal", "case"], "/myportal/searchresults": ["search", "myportal", "case"],
@@ -17,11 +17,11 @@ ApiProxy.get(async (req, res) => {
var checkquerypath = var checkquerypath =
"/api/file/getawaitingsubmissionfromblob?container=" + containerName; "/api/file/getawaitingsubmissionfromblob?container=" + containerName;
// console.log( console.log(
// "///////////////////////\ngetawaitingsubmissionblob url :", "///////////////////////\ngetawaitingsubmissionblob url :",
// req.url, req.url,
// "\n///////////////////////\n" "\n///////////////////////\n"
// ); );
// console.log(hashAPIPath(checkquerypath), checkHash); // console.log(hashAPIPath(checkquerypath), checkHash);
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
@@ -0,0 +1,45 @@
import {
downloadAllProgressFiles,
getAllProgressBlobs,
} from "../../../actions/azurestorage";
import _ from "lodash";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
import {
getToken,
azureHeaders,
consoleLogger,
hashAPIPath,
} from "../../../actions";
import axios from "axios";
import CryptoJS from "crypto-js";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
export default async function ApiProxy(req, res) {
var containerName = req.query.container;
var checkHash = req.query.hash;
var token = await getToken();
var queryUrl =
"/api/file/getawaitingsubmissionfromblob?container=" + containerName;
return axios
.get(
BASE_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch((err) => {
consoleLogger(err);
res.status(400).json(err);
});
}