reps trigger for logged out & upload storage acc

This commit is contained in:
2023-01-05 14:26:08 +00:00
parent 98aefdd867
commit ee4d00a500
16 changed files with 251 additions and 465 deletions
+17 -35
View File
@@ -67,7 +67,7 @@ let MakeRepresentation = (props) => {
setRepresentationSubmitConfirmation,
} = props;
const formObj = props.props.form;
let setCaseQueryObj = props[currentType];
let setCaseQueryObj = props[currentType] || {};
var casesObj = {};
currentType == "searchResultsObj"
@@ -84,16 +84,6 @@ let MakeRepresentation = (props) => {
var detailsObj = {};
currentType == "searchResultsObj"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.title=="' + caseReference + '")]'
))
: (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.reference=="' + caseReference + '")]'
));
const capacityOptionsArr = [
"Appellant",
"Agent",
@@ -213,6 +203,7 @@ let MakeRepresentation = (props) => {
setRepresentationSubmit={setRepresentationSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
/>
);
break;
@@ -248,6 +239,7 @@ let MakeRepresentation = (props) => {
let day = repDate.getDate();
let month = repDate.getMonth() + 1;
let year = repDate.getFullYear();
let time = repDate.getTime();
const repType = "";
switch (values.representationCapacity) {
@@ -276,6 +268,8 @@ let MakeRepresentation = (props) => {
"-" +
day +
"-" +
time +
"-" +
repType +
"-REP" +
"_" +
@@ -299,7 +293,7 @@ let MakeRepresentation = (props) => {
//console.log(updateBody);
window.alert(`form is :\n\n${JSON.stringify(updateBody, null, 2)}`);
//window.alert(`form is :\n\n${JSON.stringify(updateBody, null, 2)}`);
const reference = "PEDW-PARTIAL-REP";
const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75";
@@ -323,35 +317,23 @@ let MakeRepresentation = (props) => {
const onHandleSubmit = (values) => {
currentView.representationSubmit != true
? // console.log(
// values,
// values.representationCapacity,
// currentView.representationCapacity
// );
// console.log(_.isEmpty(currentView.representationCapacity));
// console.log(
// values.representationCapacity
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
// .toLowerCase() == currentView.representationCapacity
// );
_.isEmpty(currentView.representationCapacity)
? _.isEmpty(currentView.representationCapacity)
? setRepresentationCapacity(
values.representationCapacity
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
)
: setRepresentationSubmit(true)
: currentView.representationSubmit == true &&
(console.log("capacity", currentView.representationCapacity),
: currentView.representationSubmit == true
? (console.log("capacity", currentView.representationCapacity),
console.log("has errors:", props.invalid),
props.invalid == false &&
updateRepresentation(values, false, false),
uploadRepresentationFiles(values),
setRepresentationSubmitConfirmation(true));
setRepresentationSubmitConfirmation(true))
: console.log("nit updated");
window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
//window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
};
const uploadRepresentationFiles = (values) => {
@@ -388,15 +370,15 @@ let MakeRepresentation = (props) => {
const repForm = props.props.form;
// console.log(
// "waht is representationSubmit:",
// currentView.representationSubmit
// );
console.log(
"waht is representationSubmit:",
currentView.representationSubmit
);
return (
<div>
<form onSubmit={handleSubmit(onHandleSubmit)}>
{currentView.representationSubmit == "true" ? (
{currentView.representationSubmit == true ? (
<RepCompleteSubmit
formObj={formObj}
capacityOptionsArr={capacityOptionsArr}