edit a partial completed appeal
This commit is contained in:
@@ -49,7 +49,7 @@ const Pinswg_dnsid = (props) => {
|
||||
className={
|
||||
showMap == "true"
|
||||
? "govuk-grid-column-one-half"
|
||||
: "govuk-grid-column-two-thirds"
|
||||
: "govuk-grid-column-full"
|
||||
}
|
||||
>
|
||||
<h2 className="govuk-heading-m govuk-!-margin-bottom-7">
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
subYears,
|
||||
subMonths,
|
||||
subDays,
|
||||
parseISO,
|
||||
} from "date-fns";
|
||||
|
||||
const RenderTextfield = ({
|
||||
@@ -92,7 +93,9 @@ export function Textfield(props) {
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
<div className="govuk-body">{t(hint)}</div>
|
||||
<div className="govuk-body">
|
||||
{t("newappeal:new-appeal-introduction-paragraph")}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
@@ -342,18 +345,29 @@ const RenderDatePicker = ({
|
||||
{errorMsg}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* {value}
|
||||
<br />
|
||||
{moment(value).format("DD/MM/YY")}
|
||||
<br /> */}
|
||||
|
||||
<DatePicker
|
||||
{...custom}
|
||||
locale={router.locale}
|
||||
autoOk={true}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
onChange={onChange}
|
||||
selected={value || null}
|
||||
selected={
|
||||
value
|
||||
? typeof value != "object"
|
||||
? parseISO(value)
|
||||
: value
|
||||
: null
|
||||
} //{parseISO(value) || null}
|
||||
className="govuk-input govuk-input--width-10"
|
||||
minDate={minDate}
|
||||
maxDate={maxDate}
|
||||
|
||||
// value={!value ? null : new Date(value)}
|
||||
//value={!value ? null : moment(value, "DD/MM/yyyy")}
|
||||
/>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -554,6 +568,7 @@ const RenderYesNo = ({
|
||||
type="radio"
|
||||
className="govuk-radios__input"
|
||||
value={options[key]}
|
||||
//checked={value == options[key]}
|
||||
onChange={(e) => {
|
||||
let docListObj = custom.documentList;
|
||||
if (
|
||||
@@ -690,6 +705,10 @@ const RenderRadio = ({
|
||||
type="radio"
|
||||
className="govuk-radios__input"
|
||||
value={options[key].split("|")[0]}
|
||||
// checked={
|
||||
// value ==
|
||||
// parseInt(options[key].split("|")[0])
|
||||
// }
|
||||
onChange={(e) => {
|
||||
let docListObj = custom.documentList;
|
||||
if (
|
||||
@@ -748,15 +767,23 @@ export function Radiofield(props) {
|
||||
.split(",");
|
||||
|
||||
//parentFieldShowOnValue
|
||||
var showIfHasParentShowValue =
|
||||
parentField != false &&
|
||||
!_.isEmpty(formProps[form]) &&
|
||||
_.has(formProps[form].values, parentField) &&
|
||||
parentFieldShowOnValue.indexOf(
|
||||
formProps[form].values[parentField].toString()
|
||||
) > -1;
|
||||
var showIfHasParentShowValue = parentField != false;
|
||||
//debugger;
|
||||
// parentField != false &&
|
||||
// !_.isEmpty(formProps[form]) &&
|
||||
// _.has(formProps[form].values, parentField) &&
|
||||
// parentFieldShowOnValue.indexOf(
|
||||
// formProps[form].values[parentField].toString()
|
||||
// ) > -1;
|
||||
|
||||
// console.log(showIfHasParentShowValue);
|
||||
(showIfHasParentShowValue == parentField) != false &&
|
||||
showIfHasParentShowValue;
|
||||
|
||||
console.log(
|
||||
datafieldname,
|
||||
showIfHasParentShowValue,
|
||||
formProps[form].values[parentField]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -175,6 +175,11 @@ const TopThree = (props) => {
|
||||
className="govuk-link--no-underline"
|
||||
data-id={index}
|
||||
onClick={() => {
|
||||
topThreeType == "awaitingSubmission" &&
|
||||
console.log(
|
||||
"appealDetails"
|
||||
// props.props.awaitingSubmission
|
||||
);
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
topThreeType != "watchedCases"
|
||||
@@ -209,7 +214,7 @@ const TopThree = (props) => {
|
||||
]
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}
|
||||
]}{" "}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
setCurrentSection,
|
||||
setDocumentsList,
|
||||
} from "../../store/appealType/action";
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
import { updateCase, patchCase } from "../../actions";
|
||||
|
||||
import { FieldsTranslations } from "../elements";
|
||||
|
||||
@@ -32,6 +34,9 @@ let BuildSection = (props) => {
|
||||
sectionCount,
|
||||
onSubmit,
|
||||
handleSubmit,
|
||||
load,
|
||||
pristine,
|
||||
reset,
|
||||
formTitle,
|
||||
setCurrentSection,
|
||||
refno,
|
||||
@@ -62,7 +67,64 @@ let BuildSection = (props) => {
|
||||
|
||||
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
||||
|
||||
const updateCaseProgress = (values) => {
|
||||
let incidentId = props.appealType.caseReference.incidentid;
|
||||
let updateBody = values || {};
|
||||
|
||||
let appTypeCollection = getFormCollectionByID(
|
||||
props.appealType.appealTypeID
|
||||
);
|
||||
let updateBindAppealTypeToIncident =
|
||||
appTypeCollection.NavigationProperty;
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_Appellant@odata.bind":
|
||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
||||
"/incidents(" + incidentId + ")",
|
||||
});
|
||||
|
||||
updateBody = JSON.stringify(updateBody);
|
||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||
updateBody = updateBody.replace(/:"No"/gm, `:false`);
|
||||
updateBody = JSON.parse(updateBody);
|
||||
|
||||
Object.keys(updateBody).forEach((key) => {
|
||||
if (updateBody[key] === null) {
|
||||
delete updateBody[key];
|
||||
}
|
||||
if (key.indexOf("_") == 0) {
|
||||
delete updateBody[key];
|
||||
}
|
||||
});
|
||||
|
||||
console.log(updateBody);
|
||||
|
||||
let updateFormCollection = appTypeCollection.LogicalCollectionName;
|
||||
let primaryAttribute = appTypeCollection.PrimaryIdAttribute;
|
||||
|
||||
console.log(
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
updateCase(
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
//console.log("patching////////");
|
||||
//patchCase(incidentId);
|
||||
};
|
||||
|
||||
const onHandleSubmit = (values) => {
|
||||
//alert(1);
|
||||
//updateCaseProgress(values);
|
||||
setCurrentSection(currentSection + 1);
|
||||
};
|
||||
|
||||
@@ -198,86 +260,116 @@ let BuildSection = (props) => {
|
||||
</form>
|
||||
</div>
|
||||
<div className="govuk-grid-column-one-third">
|
||||
<nav
|
||||
role="navigation"
|
||||
aria-labelledby="progress-list"
|
||||
className="at-nav"
|
||||
>
|
||||
<h3 className="govuk-heading-s govuk-!-font-weight-bold gov-font-dark-grey">
|
||||
{t("newappeal:new-appeal-progress-nav-label")}:
|
||||
</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")}:
|
||||
<div className="at-nav-container">
|
||||
<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 document-list">
|
||||
|
||||
<ol className="govuk-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 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>
|
||||
</div>
|
||||
)}
|
||||
</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" />
|
||||
<button
|
||||
className="govuk-button govuk-button--secondary progress-save "
|
||||
onClick={() => {
|
||||
let valuesObj = props.props.form[props.form].values;
|
||||
|
||||
console.log("valuesobj:", valuesObj);
|
||||
|
||||
delete valuesObj["_pinswg_appellant_value"];
|
||||
|
||||
console.log("on save:", valuesObj);
|
||||
updateCaseProgress(valuesObj);
|
||||
router.replace(
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
);
|
||||
}}
|
||||
>
|
||||
Save and exit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -289,6 +381,7 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
initialValues: state.appealType.caseReference.caseDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -316,5 +409,6 @@ export default connect(
|
||||
reduxForm({
|
||||
form: "appealForm",
|
||||
destroyOnUnmount: false,
|
||||
enableReinitialize: true, // this is needed!!
|
||||
})(BuildSection)
|
||||
);
|
||||
|
||||
@@ -41,7 +41,8 @@ const TimeOut = (props) => {
|
||||
console.log("////////////", "\n", "logout", "\n", "//////////");
|
||||
destroyCookie({}, "pinsUser"),
|
||||
window.localStorage.clear(),
|
||||
router.replace(props.ggLogout);
|
||||
//router.replace(props.ggLogout);
|
||||
router.replace("/logout");
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,6 +3,7 @@ import data from "../../data/collections.json";
|
||||
import {
|
||||
getBasicSearchDetails,
|
||||
getBasicSearchDetailsPaged,
|
||||
getBasicPartSavedDetails,
|
||||
} from "../../actions";
|
||||
|
||||
/*
|
||||
@@ -69,6 +70,37 @@ export const getSearchDetails = (searchResultsObj) => {
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the partially saved details of a case from the appeal type
|
||||
* @param object searchResultsObj
|
||||
*/
|
||||
export const getPartSavedDetails = (searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.title);
|
||||
} else {
|
||||
let formMeta = getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
);
|
||||
console.log(formMeta);
|
||||
detailsArr.push(
|
||||
getBasicPartSavedDetails(
|
||||
formMeta.LogicalCollectionName,
|
||||
searchDetail.title,
|
||||
formMeta.PrimaryIdAttribute,
|
||||
searchDetail.incidentid
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the details of a case from the appeal type
|
||||
* @param object searchResultsObj
|
||||
|
||||
Reference in New Issue
Block a user