Merged PR 1169: view all delete button for awaiting submission
view all delete button for awaiting submission Related work items: #11282, #11283
This commit is contained in:
+24
-8
@@ -862,8 +862,15 @@ export const getAwaitingSubmission = (loggedInUserId) => {
|
||||
export const getAwaitingSubmissionFromBlob = (containerName) => {
|
||||
console.log(
|
||||
"///////////////////////\ngetAwaitingSubmissionFromBlob: " +
|
||||
containerName,
|
||||
BASE_URL +
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" +
|
||||
containerName +
|
||||
"\n///////////////////////\n"
|
||||
hashAPIPath(
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" +
|
||||
containerName
|
||||
),
|
||||
"\n///////////////////////\n"
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
@@ -915,15 +922,24 @@ export const getRepsFromBlob = (containerName) => {
|
||||
};
|
||||
|
||||
export const getAwaitingSubmissionFromBlobProxy = (containerName) => {
|
||||
console.log(
|
||||
"///////////////////////getAwaitingSubmissionFromBlobProxy: " +
|
||||
containerName,
|
||||
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
||||
containerName,
|
||||
"\n///////////////////////\n"
|
||||
);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" +
|
||||
containerName +
|
||||
hashAPIPath(
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" +
|
||||
containerName
|
||||
)
|
||||
// BASE_URL +
|
||||
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
|
||||
containerName
|
||||
// +
|
||||
// hashAPIPath(
|
||||
// "/api/file/getawaitingsubmissionfromblob?container=" +
|
||||
// containerName
|
||||
// )
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
@@ -11,6 +10,32 @@ import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
} 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 {
|
||||
@@ -20,6 +45,9 @@ const ViewAllResults = (props) => {
|
||||
setCurrentReference,
|
||||
myportal,
|
||||
setSearchResults,
|
||||
accountDetails,
|
||||
setAwaitingSubmissionFromBlob,
|
||||
setAwaitingSubmissionDetails,
|
||||
} = props;
|
||||
|
||||
let { t } = useTranslation();
|
||||
@@ -541,6 +569,34 @@ const ViewAllResults = (props) => {
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</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
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
</button>
|
||||
</dd>
|
||||
)}
|
||||
</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 (
|
||||
<>
|
||||
<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) => {
|
||||
return {
|
||||
setCurrentReference: (currentReference) => {
|
||||
@@ -788,7 +876,13 @@ const mapDispatchToProps = (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);
|
||||
|
||||
@@ -316,15 +316,28 @@ export const getProgressObj = (
|
||||
mandatoryFieldsData
|
||||
);
|
||||
|
||||
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,
|
||||
};
|
||||
if (datafieldname[0].value.includes("pinswg_fileUpload")) {
|
||||
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 {
|
||||
"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") {
|
||||
@@ -350,6 +363,14 @@ export const getProgressObj = (
|
||||
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 required = rowObj.filter((el) => {
|
||||
return !_.isEmpty(el.validation);
|
||||
|
||||
@@ -346,7 +346,7 @@
|
||||
<labels>
|
||||
<label description="Statement of case" ishareDocumentCode="000000" />
|
||||
</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>
|
||||
<labels>
|
||||
|
||||
@@ -1800,6 +1800,15 @@
|
||||
"ManagedPropertyLogicalName": "canmodifyrequirementlevelsettings"
|
||||
},
|
||||
"MetadataId": "8eb4ce7e-8f45-432c-8064-60405103e901"
|
||||
},
|
||||
{
|
||||
"LogicalName": "pinswg_fileUpload",
|
||||
"RequiredLevel": {
|
||||
"Value": "Recommended",
|
||||
"CanBeChanged": true,
|
||||
"ManagedPropertyLogicalName": "canmodifyrequirementlevelsettings"
|
||||
},
|
||||
"MetadataId": "917f813a-4183-eb11-aac0-00224800be0c"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,7 +13,7 @@ module.exports = {
|
||||
"/": ["common", "home", "case"],
|
||||
"/error": ["common", "home", "myportal"],
|
||||
"/myportal": ["myportal", "common", "home", "case"],
|
||||
"/myportal/viewall": ["search", "myportal"],
|
||||
"/myportal/viewall": ["search", "myportal", "case"],
|
||||
"/myportal/advancedsearch": ["search", "myportal"],
|
||||
"/myportal/advancedsearchresults": ["search", "myportal"],
|
||||
"/myportal/searchresults": ["search", "myportal", "case"],
|
||||
|
||||
@@ -17,11 +17,11 @@ ApiProxy.get(async (req, res) => {
|
||||
var checkquerypath =
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" + containerName;
|
||||
|
||||
// console.log(
|
||||
// "///////////////////////\ngetawaitingsubmissionblob url :",
|
||||
// req.url,
|
||||
// "\n///////////////////////\n"
|
||||
// );
|
||||
console.log(
|
||||
"///////////////////////\ngetawaitingsubmissionblob url :",
|
||||
req.url,
|
||||
"\n///////////////////////\n"
|
||||
);
|
||||
// console.log(hashAPIPath(checkquerypath), 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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user