add methods and store for case reference
This commit is contained in:
@@ -196,6 +196,12 @@ export const getLPA = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const createCase = (lpaType, appealType) => {
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
return "CAS-00010-CK1N3S";
|
||||||
|
};
|
||||||
|
|
||||||
// var req = new XMLHttpRequest();
|
// var req = new XMLHttpRequest();
|
||||||
// req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=contains(title, '000')&$count=true", true);
|
// req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=contains(title, '000')&$count=true", true);
|
||||||
// req.setRequestHeader("OData-MaxVersion", "4.0");
|
// req.setRequestHeader("OData-MaxVersion", "4.0");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { Field, reduxForm } from "redux-form";
|
import { Field, reduxForm } from "redux-form";
|
||||||
|
import router from "next/router";
|
||||||
|
|
||||||
export function Textfield(props) {
|
export function Textfield(props) {
|
||||||
const { name, label } = props;
|
const { name, label } = props;
|
||||||
@@ -293,19 +294,22 @@ export function DecimalField(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ReadOnlyfield(props) {
|
const RenderCaseID = {};
|
||||||
const { name, label } = props;
|
|
||||||
|
|
||||||
|
export function ReadOnlyfield(props) {
|
||||||
|
const { name, label, value } = props;
|
||||||
|
console.log(props.value.refno);
|
||||||
return (
|
return (
|
||||||
<div className="govuk-form-group">
|
<div className="govuk-form-group">
|
||||||
<label className="govuk-label " htmlFor={props.name}>
|
<label className="govuk-label " htmlFor={props.name}>
|
||||||
{props.label}
|
{props.label}
|
||||||
</label>
|
</label>
|
||||||
<Field
|
<input
|
||||||
|
type="text"
|
||||||
name={props.name}
|
name={props.name}
|
||||||
id={props.name}
|
id={props.name}
|
||||||
component="input"
|
component={RenderCaseID}
|
||||||
type="text"
|
value={value}
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function BuildField(props) {
|
|||||||
<ReadOnlyfield
|
<ReadOnlyfield
|
||||||
name={props.datafieldname}
|
name={props.datafieldname}
|
||||||
label={props.label}
|
label={props.label}
|
||||||
|
value={props.props.props.appealType.caseReference}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function BuildRow(props) {
|
|||||||
label={rows[0].value}
|
label={rows[0].value}
|
||||||
datafieldname={datafieldname[0].value}
|
datafieldname={datafieldname[0].value}
|
||||||
key={key}
|
key={key}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ import xpath from "xpath";
|
|||||||
import BuildRow from "./buildrow";
|
import BuildRow from "./buildrow";
|
||||||
import { reduxForm, formValueSelector } from "redux-form";
|
import { reduxForm, formValueSelector } from "redux-form";
|
||||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||||
import { setCurrentSection } from "../../store/appealType/action";
|
import {
|
||||||
|
setCaseReference,
|
||||||
|
setCurrentSection,
|
||||||
|
} from "../../store/appealType/action";
|
||||||
|
import { query } from "jsonpath";
|
||||||
|
|
||||||
let BuildSection = (props) => {
|
let BuildSection = (props) => {
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
@@ -25,6 +29,7 @@ let BuildSection = (props) => {
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
formTitle,
|
formTitle,
|
||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
|
refno,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const currentSection = props.appealType.currentSection;
|
const currentSection = props.appealType.currentSection;
|
||||||
@@ -50,8 +55,13 @@ let BuildSection = (props) => {
|
|||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
setCurrentSection(currentSection + 1);
|
setCurrentSection(currentSection + 1);
|
||||||
|
setCaseReference(router.query.refno);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// const initialValues = {
|
||||||
|
// email: router.query.refno,
|
||||||
|
// };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-two-thirds">
|
<div className="govuk-grid-column-two-thirds">
|
||||||
@@ -64,6 +74,7 @@ let BuildSection = (props) => {
|
|||||||
whichSection={props.whichSection}
|
whichSection={props.whichSection}
|
||||||
sectionCount={props.sectionCount}
|
sectionCount={props.sectionCount}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
|
props={props}
|
||||||
/>
|
/>
|
||||||
{}
|
{}
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
@@ -126,7 +137,9 @@ let BuildSection = (props) => {
|
|||||||
<b>{titleList[key].value}</b>
|
<b>{titleList[key].value}</b>
|
||||||
</li>
|
</li>
|
||||||
) : (
|
) : (
|
||||||
<li>{titleList[key].value}</li>
|
<li key={key}>
|
||||||
|
{titleList[key].value}
|
||||||
|
</li>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ let CompleteAppeal = (props) => {
|
|||||||
<div className="govuk-panel__body">
|
<div className="govuk-panel__body">
|
||||||
Your reference number
|
Your reference number
|
||||||
<br />
|
<br />
|
||||||
<strong>CAS-00010-J9W6L5</strong>
|
<strong>{props.appealType.caseReference}</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import {
|
|||||||
getAppealTypeObj,
|
getAppealTypeObj,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
|
|
||||||
|
import { createCase } from "../../actions";
|
||||||
|
|
||||||
let CreateCase = (props) => {
|
let CreateCase = (props) => {
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// window.scrollTo(0, 0);
|
// window.scrollTo(0, 0);
|
||||||
@@ -100,9 +102,18 @@ let CreateCase = (props) => {
|
|||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
router.replace("/newappeal/" + values.appealTypes, null, {
|
|
||||||
shallow: true,
|
console.log(createCase("asasa", "asasa"));
|
||||||
});
|
|
||||||
|
const caseReference = createCase("123123", "213132");
|
||||||
|
|
||||||
|
router.replace(
|
||||||
|
"/newappeal/" + values.appealTypes + "?refno=" + caseReference,
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
shallow: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
console.log(values);
|
console.log(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
setAppealTypeTitle,
|
setAppealTypeTitle,
|
||||||
setAppealTypeID,
|
setAppealTypeID,
|
||||||
getAppealTypeObj,
|
getAppealTypeObj,
|
||||||
|
setCaseReference,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
import { setForm, getFormObj } from "../../store/formData/action";
|
import { setForm, getFormObj } from "../../store/formData/action";
|
||||||
import { getFormData, getAppealsTypes } from "../../actions";
|
import { getFormData, getAppealsTypes } from "../../actions";
|
||||||
@@ -31,10 +32,6 @@ import BuildCheckSection from "../../components/newappeal/buildchecksection";
|
|||||||
import CompleteAppeal from "../../components/newappeal/complete";
|
import CompleteAppeal from "../../components/newappeal/complete";
|
||||||
|
|
||||||
let Home = (props) => {
|
let Home = (props) => {
|
||||||
useEffect(() => {
|
|
||||||
props.setFormTitle(formTitle);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const { footerLinks, pages, formData } = props;
|
const { footerLinks, pages, formData } = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
@@ -42,6 +39,10 @@ let Home = (props) => {
|
|||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
const { appealtypes } = router.query;
|
const { appealtypes } = router.query;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
props.setFormTitle(formTitle);
|
||||||
|
props.setCaseReference(router.query.refno);
|
||||||
|
}, []);
|
||||||
const formXML = props.formData.formData;
|
const formXML = props.formData.formData;
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
var doc = parser.parseFromString(formXML, "text/xml");
|
var doc = parser.parseFromString(formXML, "text/xml");
|
||||||
@@ -171,6 +172,9 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setFormTitle: (title) => {
|
setFormTitle: (title) => {
|
||||||
dispatch(setAppealTypeTitle(title));
|
dispatch(setAppealTypeTitle(title));
|
||||||
},
|
},
|
||||||
|
setCaseReference: (refno) => {
|
||||||
|
dispatch(setCaseReference(refno));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export const appealTypeDataActionTypes = {
|
|||||||
UPDATEAPPEALTYPEDATA: "UPDATEAPPEALTYPEDATA",
|
UPDATEAPPEALTYPEDATA: "UPDATEAPPEALTYPEDATA",
|
||||||
SETCURRENTSECTION: "SETCURRENTSECTION",
|
SETCURRENTSECTION: "SETCURRENTSECTION",
|
||||||
SETAPPEALLPA: "SETAPPEALLPA",
|
SETAPPEALLPA: "SETAPPEALLPA",
|
||||||
|
SETCASEREFERENCE: "SETCASEREFERENCE",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppealTypeObj = () => (dispatch) => {
|
export const getAppealTypeObj = () => (dispatch) => {
|
||||||
@@ -48,3 +49,10 @@ export const setAppealLPA = (appealLPA) => (dispatch) => {
|
|||||||
appealLPA: appealLPA,
|
appealLPA: appealLPA,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setCaseReference = (caseReference) => (dispatch) => {
|
||||||
|
return dispatch({
|
||||||
|
type: appealTypeDataActionTypes.SETCASEREFERENCE,
|
||||||
|
caseReference: caseReference,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const appealTypeDataInitialState = {
|
|||||||
appealTypeID: {},
|
appealTypeID: {},
|
||||||
currentSection: 1,
|
currentSection: 1,
|
||||||
appealLPA: "",
|
appealLPA: "",
|
||||||
|
caseReference: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function reducer(state = appealTypeDataInitialState, action) {
|
export default function reducer(state = appealTypeDataInitialState, action) {
|
||||||
@@ -35,7 +36,11 @@ export default function reducer(state = appealTypeDataInitialState, action) {
|
|||||||
...state,
|
...state,
|
||||||
appealLPA: action.appealLPA,
|
appealLPA: action.appealLPA,
|
||||||
};
|
};
|
||||||
|
case appealTypeDataActionTypes.SETCASEREFERENCE:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
caseReference: action.caseReference,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user