+68
-62
@@ -223,6 +223,7 @@ export const getAdvancedSearch = (token, searchString) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getBasicSearchDetails = (token, appealType, caseReference) => {
|
export const getBasicSearchDetails = (token, appealType, caseReference) => {
|
||||||
|
//console.log("check appealtype:", appealType, caseReference);
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL +
|
WEBAPI_URL +
|
||||||
@@ -234,7 +235,7 @@ export const getBasicSearchDetails = (token, appealType, caseReference) => {
|
|||||||
)
|
)
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("thiserror", error);
|
console.log("this error", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -298,6 +299,7 @@ export const getSearchDocumentHistory1 = (documentID) => {
|
|||||||
console.log("thiserror", error);
|
console.log("thiserror", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
|
export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
@@ -399,49 +401,6 @@ export const getAppealsTypes = (token) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//get list of entitydefinitions
|
|
||||||
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/EntityDefinitions?$select=LogicalName
|
|
||||||
|
|
||||||
// get list of appealtypes
|
|
||||||
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true
|
|
||||||
|
|
||||||
//get crm xml form for appealtype
|
|
||||||
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/systemforms?$select=formid,name,formxml&$filter=(objecttypecode%20eq%20%27pinswg_dns%27and%20type%20eq%202)&$count=true
|
|
||||||
// then use regex to remove the escape
|
|
||||||
// convert xml to json and return
|
|
||||||
// promise example
|
|
||||||
// var xml2js = require('xml2js');
|
|
||||||
// var xml = '<foo></foo>';
|
|
||||||
|
|
||||||
// // With parser
|
|
||||||
// var parser = new xml2js.Parser(/* options */);
|
|
||||||
// parser.parseStringPromise(data).then(function (result) {
|
|
||||||
// console.dir(result);
|
|
||||||
// console.log('Done');
|
|
||||||
// })
|
|
||||||
// .catch(function (err) {
|
|
||||||
// // Failed
|
|
||||||
// });
|
|
||||||
|
|
||||||
// export const getAppealTypeDetail = (caseReference, appealcasetype) => {
|
|
||||||
// console.log("got to axios", searchString);
|
|
||||||
// console.log("api_root: ", BASE_URL);
|
|
||||||
// // example appealcasetype type pinswg_householderappealhases
|
|
||||||
// return axios
|
|
||||||
// .get(
|
|
||||||
// "https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/" +
|
|
||||||
// appealcasetype +
|
|
||||||
// "?$filter=pinswg_name eq '" +
|
|
||||||
// caseReference +
|
|
||||||
// "'",
|
|
||||||
// { httpsAgent: new https.Agent({ rejectUnauthorized: false }) }
|
|
||||||
// )
|
|
||||||
// .then((res) => res.data)
|
|
||||||
// .catch((error) => {
|
|
||||||
// console.log("thi serror", error);
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
export const getLPA = (token) => {
|
export const getLPA = (token) => {
|
||||||
// console.log("api_root: ", BASE_URL);
|
// console.log("api_root: ", BASE_URL);
|
||||||
return axios
|
return axios
|
||||||
@@ -507,13 +466,27 @@ export const getAppealID = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createCase = (token, appealTypeId) => {
|
export const getLogin = (emailAddress, pwd) => {
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
"/api/proxy/contacts?$filter=emailaddress1 eq '" +
|
||||||
|
emailAddress +
|
||||||
|
"' and pinswg_custom_password eq '" +
|
||||||
|
pwd +
|
||||||
|
"'&$count=true&$select=emailaddress1,%20contactid,pinswg_custom_password, yomifullname, firstname, lastname"
|
||||||
|
)
|
||||||
|
.then((res) => res.data)
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("thiserror", error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createCase = (token, appealTypeId, contactid) => {
|
||||||
appealTypeId = parseInt(appealTypeId);
|
appealTypeId = parseInt(appealTypeId);
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
"title": "insertion test case",
|
"title": "insertion test case",
|
||||||
"caseorigincode": 3,
|
"caseorigincode": 3,
|
||||||
"customerid_contact@odata.bind":
|
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
|
||||||
"/contacts(f8b454ed-eded-eb11-aac7-00224800be9c)",
|
|
||||||
"pinswg_appealcasetype": appealTypeId,
|
"pinswg_appealcasetype": appealTypeId,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -586,6 +559,7 @@ export const updateCase = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getMyCases = (token, loggedInUserId) => {
|
export const getMyCases = (token, loggedInUserId) => {
|
||||||
|
console.log("in action ", loggedInUserId);
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL +
|
WEBAPI_URL +
|
||||||
@@ -594,13 +568,15 @@ export const getMyCases = (token, loggedInUserId) => {
|
|||||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
|
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
|
||||||
azureHeaders(token)
|
azureHeaders(token)
|
||||||
)
|
)
|
||||||
.then((res) => res.data)
|
.then((res) => {
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("thi serror", error);
|
console.log("thi serror", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMyRepresentations = (token) => {
|
export const getMyRepresentations = (token, loggedInUserId) => {
|
||||||
return (
|
return (
|
||||||
axios
|
axios
|
||||||
// .get(BASE_URL + "/api/lookups/myRepresentations", {
|
// .get(BASE_URL + "/api/lookups/myRepresentations", {
|
||||||
@@ -608,7 +584,9 @@ export const getMyRepresentations = (token) => {
|
|||||||
// })
|
// })
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL +
|
WEBAPI_URL +
|
||||||
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3",
|
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
|
||||||
azureHeaders(token)
|
azureHeaders(token)
|
||||||
)
|
)
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -618,7 +596,7 @@ export const getMyRepresentations = (token) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getWatchedCases = (token) => {
|
export const getWatchedCases = (token, loggedInUserId) => {
|
||||||
return (
|
return (
|
||||||
axios
|
axios
|
||||||
|
|
||||||
@@ -627,7 +605,9 @@ export const getWatchedCases = (token) => {
|
|||||||
// })
|
// })
|
||||||
.get(
|
.get(
|
||||||
WEBAPI_URL +
|
WEBAPI_URL +
|
||||||
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3",
|
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
|
||||||
azureHeaders(token)
|
azureHeaders(token)
|
||||||
)
|
)
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -664,17 +644,43 @@ export const getPortalModuelDetails = (token, appealType, caseReference) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getFileFromCRM = (docRef) => {
|
export const getEmailAccountCheck = (emailAddress) => {
|
||||||
const weburl = "/api/proxy/documents/download/" + docRef;
|
let token = getSASToken();
|
||||||
|
|
||||||
console.log("proxy url", weburl);
|
|
||||||
return axios
|
return axios
|
||||||
.get(weburl, { responseType: "arraybuffer" })
|
.get(
|
||||||
.then((res) => {
|
"/api/proxy/contacts?$filter=emailaddress1 eq '" +
|
||||||
console.log(res);
|
emailAddress +
|
||||||
return res;
|
"'&$count=true&$select=emailaddress1, contactid"
|
||||||
})
|
)
|
||||||
|
.then((res) => res.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("thi serror", error);
|
console.log("thiserror", error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createAccount = (formValues) => {
|
||||||
|
var data = JSON.stringify(formValues);
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "post",
|
||||||
|
url: "/api/proxy/contacts",
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"ServiceBusAuthorization": getSASToken(),
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
// console.log(config);
|
||||||
|
return axios(config)
|
||||||
|
.then((res) => {
|
||||||
|
// console.log("posted ", res.data);
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("this serror", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
getFormSubmitErrors,
|
getFormSubmitErrors,
|
||||||
} from "redux-form";
|
} from "redux-form";
|
||||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||||
|
import { setAccCr } from "../../store/accountDetails/action";
|
||||||
|
|
||||||
const RegisterFormCheck = (props) => {
|
const RegisterFormCheck = (props) => {
|
||||||
const {
|
const {
|
||||||
@@ -18,6 +19,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
value,
|
value,
|
||||||
setRegisterFormComplete,
|
setRegisterFormComplete,
|
||||||
setAccountCreatedComplete,
|
setAccountCreatedComplete,
|
||||||
|
setAccCr,
|
||||||
} = props;
|
} = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
@@ -70,7 +72,6 @@ const RegisterFormCheck = (props) => {
|
|||||||
>
|
>
|
||||||
Change
|
Change
|
||||||
<span className="govuk-visually-hidden">
|
<span className="govuk-visually-hidden">
|
||||||
{" "}
|
|
||||||
last name
|
last name
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -81,7 +82,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.email
|
.emailaddress1
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -105,7 +106,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.telephone
|
.telephone1
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -123,7 +124,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
</a>
|
</a>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-summary-list__row">
|
{/* <div className="govuk-summary-list__row">
|
||||||
<dt className="govuk-summary-list__key">Company/Group</dt>
|
<dt className="govuk-summary-list__key">Company/Group</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
@@ -146,7 +147,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div> */}
|
||||||
</dl>
|
</dl>
|
||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||||
<h2 className="govuk-heading-m">Your address</h2>
|
<h2 className="govuk-heading-m">Your address</h2>
|
||||||
@@ -156,7 +157,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.addressline1
|
.address1_line1
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -180,7 +181,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.addressline2
|
.address1_line2
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -204,7 +205,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.towncity
|
.address1_city
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -228,7 +229,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.county
|
.address1_county
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -252,7 +253,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{
|
{
|
||||||
props.props.props.form.accountRegisterForm.values
|
props.props.props.form.accountRegisterForm.values
|
||||||
.postcode
|
.address1_postalcode
|
||||||
}
|
}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__actions">
|
<dd className="govuk-summary-list__actions">
|
||||||
@@ -278,6 +279,7 @@ const RegisterFormCheck = (props) => {
|
|||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
data-module="govuk-button"
|
data-module="govuk-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
setAccCr(false);
|
||||||
setAccountCreatedComplete(true);
|
setAccountCreatedComplete(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -304,6 +306,9 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setCurrentSection: (currentSection) => {
|
setCurrentSection: (currentSection) => {
|
||||||
dispatch(setCurrentSection(currentSection));
|
dispatch(setCurrentSection(currentSection));
|
||||||
},
|
},
|
||||||
|
setAccCr: (accState) => {
|
||||||
|
dispatch(setAccCr(accState));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
|
||||||
|
import jsonpath from "jsonpath";
|
||||||
import {
|
import {
|
||||||
Field,
|
Field,
|
||||||
reduxForm,
|
reduxForm,
|
||||||
@@ -18,6 +20,10 @@ import {
|
|||||||
setAccountCreatedComplete,
|
setAccountCreatedComplete,
|
||||||
} from "react-redux";
|
} from "react-redux";
|
||||||
|
|
||||||
|
import { setAccCr, setLogout } from "../../store/accountDetails/action";
|
||||||
|
|
||||||
|
import { getEmailAccountCheck, createAccount } from "../../actions";
|
||||||
|
|
||||||
const RegisterComplete = (props) => {
|
const RegisterComplete = (props) => {
|
||||||
const {
|
const {
|
||||||
footerLinks,
|
footerLinks,
|
||||||
@@ -26,13 +32,50 @@ const RegisterComplete = (props) => {
|
|||||||
value,
|
value,
|
||||||
setRegisterFormComplete,
|
setRegisterFormComplete,
|
||||||
setAccountCreatedComplete,
|
setAccountCreatedComplete,
|
||||||
|
setAccCr,
|
||||||
} = props;
|
} = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
return (
|
const [accountCreated, setAccountCreated] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let accountBody = props.props.props.form.accountRegisterForm.values;
|
||||||
|
let emailAddress =
|
||||||
|
props.props.props.form.accountRegisterForm.values.emailaddress1;
|
||||||
|
Object.assign(accountBody, {
|
||||||
|
"pinswg_typeofinvolvement": 846040001,
|
||||||
|
});
|
||||||
|
|
||||||
|
accountBody = _.omit(accountBody, ["custom_password_check"]);
|
||||||
|
|
||||||
|
let checkEmailObj = {};
|
||||||
|
|
||||||
|
switch (props.accountDetails.accCr) {
|
||||||
|
case "created":
|
||||||
|
case "exists":
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
let emailExists = getEmailAccountCheck(
|
||||||
|
accountBody.emailaddress1
|
||||||
|
).then((data) => {
|
||||||
|
data["@odata.count"] > 0
|
||||||
|
? setAccCr("exists")
|
||||||
|
: (checkEmailObj = createAccount(accountBody).then(
|
||||||
|
(data) => {
|
||||||
|
//console.log(data);
|
||||||
|
setAccCr("created");
|
||||||
|
}
|
||||||
|
));
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return props.accountDetails.accCr == "created" ? (
|
||||||
<>
|
<>
|
||||||
<p className="govuk-body">We have sent you a confirmation email.</p>
|
<p className="govuk-body">We have sent you a confirmation email.</p>
|
||||||
|
|
||||||
@@ -43,18 +86,35 @@ const RegisterComplete = (props) => {
|
|||||||
metus non quam mollis egestas. Integer ac leo cursus, laoreet
|
metus non quam mollis egestas. Integer ac leo cursus, laoreet
|
||||||
nulla sed, tempus tellus. Mauris condimentum erat arcu.
|
nulla sed, tempus tellus. Mauris condimentum erat arcu.
|
||||||
</p>
|
</p>
|
||||||
<p className="govuk-body">
|
|
||||||
Sed imperdiet dignissim ipsum. Orci varius natoque penatibus et
|
|
||||||
magnis dis parturient montes, nascetur ridiculus mus. In id leo
|
|
||||||
in turpis aliquam venenatis ut non erat. Ut est arcu, luctus sit
|
|
||||||
amet pretium sed, iaculis non purus. Etiam dictum tortor commodo
|
|
||||||
luctus rhoncus.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p className="govuk-body">
|
<p className="govuk-body">
|
||||||
<Link href="/">
|
<a
|
||||||
<a className="govuk-link">Login to My Portal</a>
|
href="/"
|
||||||
</Link>
|
className="govuk-link"
|
||||||
|
onClick={() => {
|
||||||
|
setLogout(), window.localStorage.clear();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Login to My Portal
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<h2 className="govuk-heading-m">
|
||||||
|
Please try again with a different email address
|
||||||
|
</h2>
|
||||||
|
<p className="govuk-body">
|
||||||
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
setRegisterFormComplete(false),
|
||||||
|
setAccountCreatedComplete(false),
|
||||||
|
setAccCr("false");
|
||||||
|
}}
|
||||||
|
className="govuk-link"
|
||||||
|
>
|
||||||
|
Try registering again
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -73,8 +133,11 @@ const mapStateToProps = (state) => {
|
|||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
setCurrentSection: (currentSection) => {
|
setAccCr: (accountCreated) => {
|
||||||
dispatch(setCurrentSection(currentSection));
|
dispatch(setAccCr(accountCreated));
|
||||||
|
},
|
||||||
|
setLogout: () => {
|
||||||
|
dispatch(setLogout());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -87,9 +87,21 @@ const RegisterForm = (props) => {
|
|||||||
? "Invalid phone number"
|
? "Invalid phone number"
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
const passwordsMatch = (value, allValues) =>
|
||||||
|
value !== allValues.pinswg_custom_password
|
||||||
|
? "Passwords don't match"
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
const minLength = (min) => (value) =>
|
||||||
|
value && value.length < min
|
||||||
|
? `Must be ${min} characters or more`
|
||||||
|
: undefined;
|
||||||
|
const minLength5 = minLength(5);
|
||||||
|
|
||||||
const [hasErrors, setHasErrors] = useState("");
|
const [hasErrors, setHasErrors] = useState("");
|
||||||
|
|
||||||
const onHandleSubmit = (values) => {
|
const onHandleSubmit = (values) => {
|
||||||
|
//console.log(values);
|
||||||
setRegisterFormComplete(true);
|
setRegisterFormComplete(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,8 +137,8 @@ const RegisterForm = (props) => {
|
|||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
name="email"
|
name="emailaddress1"
|
||||||
id="email"
|
id="emailaddress1"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="email"
|
type="email"
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
@@ -134,8 +146,8 @@ const RegisterForm = (props) => {
|
|||||||
label="Email address"
|
label="Email address"
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
name="telephone"
|
name="telephone1"
|
||||||
id="telephone"
|
id="telephone1"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="number"
|
type="number"
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
@@ -144,14 +156,29 @@ const RegisterForm = (props) => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
name="companygroup"
|
name="pinswg_custom_password"
|
||||||
id="companygroup"
|
id="pinswg_custom_password"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="password"
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
label="Company/Group"
|
label="Password"
|
||||||
|
validate={[required, minLength5]}
|
||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
/>
|
/>
|
||||||
|
<Field
|
||||||
|
name="custom_password_check"
|
||||||
|
id="custom_password_check"
|
||||||
|
component={RenderTextfield}
|
||||||
|
type="password"
|
||||||
|
className="govuk-input govuk-input--width-20"
|
||||||
|
label="Confirm password"
|
||||||
|
validate={[
|
||||||
|
required,
|
||||||
|
passwordsMatch,
|
||||||
|
minLength5,
|
||||||
|
]}
|
||||||
|
errorMsg="Passwords do not match"
|
||||||
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset className="govuk-fieldset">
|
<fieldset className="govuk-fieldset">
|
||||||
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
|
||||||
@@ -161,8 +188,8 @@ const RegisterForm = (props) => {
|
|||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
name="addressline1"
|
name="address1_line1"
|
||||||
id="addressline1"
|
id="address1_line1"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="text"
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
@@ -171,8 +198,8 @@ const RegisterForm = (props) => {
|
|||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
name="addressline2"
|
name="address1_line2"
|
||||||
id="addressline2"
|
id="address1_line2"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="text"
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
@@ -180,8 +207,8 @@ const RegisterForm = (props) => {
|
|||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
name="towncity"
|
name="address1_city"
|
||||||
id="towncity"
|
id="address1_city"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="text"
|
||||||
className="govuk-input govuk-input--width-10"
|
className="govuk-input govuk-input--width-10"
|
||||||
@@ -190,8 +217,8 @@ const RegisterForm = (props) => {
|
|||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
name="county"
|
name="address1_county"
|
||||||
id="county"
|
id="address1_county"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="text"
|
||||||
className="govuk-input govuk-input--width-10"
|
className="govuk-input govuk-input--width-10"
|
||||||
@@ -200,8 +227,8 @@ const RegisterForm = (props) => {
|
|||||||
errorMsg="Is required"
|
errorMsg="Is required"
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
name="postcode"
|
name="address1_postalcode"
|
||||||
id="postcode"
|
id="address1_postalcode"
|
||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="text"
|
||||||
className="govuk-input govuk-input--width-5"
|
className="govuk-input govuk-input--width-5"
|
||||||
@@ -229,7 +256,11 @@ const RegisterForm = (props) => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<RegisterComplete />
|
<RegisterComplete
|
||||||
|
props={props}
|
||||||
|
setRegisterFormComplete={setRegisterFormComplete}
|
||||||
|
setAccountCreatedComplete={setAccountCreatedComplete}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ const DocumentDetails = (props) => {
|
|||||||
documentDetailsArr = documentDetailsArr.value;
|
documentDetailsArr = documentDetailsArr.value;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
<dl className="documentList govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||||
<div className="govuk-summary-list__row results-headings">
|
<div className="govuk-summary-list__row results-headings">
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-!-padding-left-2">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16 ">
|
||||||
{t("case:documents-name-label")}
|
{t("case:documents-name-label")}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
@@ -58,9 +58,9 @@ const DocumentDetails = (props) => {
|
|||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("case:documents-date-published-label")}
|
{t("case:documents-date-published-label")}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
{/* <dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||||
{t("case:documents-size-label")}
|
{t("case:documents-size-label")}
|
||||||
</dd>
|
</dd> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{documentDetailsArr.map((item) => {
|
{documentDetailsArr.map((item) => {
|
||||||
@@ -88,29 +88,25 @@ const DocumentDetails = (props) => {
|
|||||||
className="govuk-summary-list__row"
|
className="govuk-summary-list__row"
|
||||||
key={key}
|
key={key}
|
||||||
>
|
>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
<Link
|
<a
|
||||||
href={
|
href={
|
||||||
"/api/proxy/documents/download/" +
|
"/api/proxy/documents/download/" +
|
||||||
detailsObj.pinswg_isharedocumentreference
|
detailsObj.pinswg_isharedocumentreference
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<a>
|
<span className="results-visually-hidden">
|
||||||
<span className="results-visually-hidden">
|
{t("case:documents-name-label")}
|
||||||
{t(
|
:
|
||||||
"case:documents-name-label"
|
</span>
|
||||||
)}
|
{_.has(historyObj, [
|
||||||
:
|
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue",
|
||||||
</span>
|
])
|
||||||
{_.has(historyObj, [
|
? historyObj[
|
||||||
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue",
|
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue"
|
||||||
])
|
]
|
||||||
? historyObj[
|
: ""}
|
||||||
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue"
|
</a>
|
||||||
]
|
|
||||||
: ""}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
@@ -152,12 +148,12 @@ const DocumentDetails = (props) => {
|
|||||||
)
|
)
|
||||||
: ""}
|
: ""}
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t("case:documents-size-label")}:
|
{t("case:documents-size-label")}:
|
||||||
</span>
|
</span>
|
||||||
92
|
92
|
||||||
</dd>
|
</dd> */}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
@@ -212,11 +208,6 @@ const DocumentDetails = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const searchDocumentResultsObj = docDetailsObj();
|
const searchDocumentResultsObj = docDetailsObj();
|
||||||
|
|
||||||
const getFileFromCRM = (event, docRef) => {
|
|
||||||
console.log(e, docRef);
|
|
||||||
return alert(docRef);
|
|
||||||
};
|
|
||||||
}, [incidentid, setDocumentHistory, setDocumentDetails]);
|
}, [incidentid, setDocumentHistory, setDocumentDetails]);
|
||||||
|
|
||||||
function formatDates(dateObj) {
|
function formatDates(dateObj) {
|
||||||
|
|||||||
@@ -541,13 +541,13 @@ const CaseSummary = (props) => {
|
|||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{_.has(
|
{_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_dateoflpadecision"
|
"pinswg_casedecisiondate"
|
||||||
)
|
)
|
||||||
? !_.isEmpty(
|
? !_.isEmpty(
|
||||||
detailsObj.pinswg_dateoflpadecision
|
detailsObj.pinswg_casedecisiondate
|
||||||
)
|
)
|
||||||
? formatDates(
|
? formatDates(
|
||||||
detailsObj.pinswg_dateoflpadecision
|
detailsObj.pinswg_casedecisiondate
|
||||||
)
|
)
|
||||||
: t(
|
: t(
|
||||||
"case:summary-no-date-entered-label"
|
"case:summary-no-date-entered-label"
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { Field, reduxForm } from "redux-form";
|
import { Field, reduxForm } from "redux-form";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import DatePicker from "react-datepicker";
|
import DatePicker, { registerLocale, setDefaultLocale } from "react-datepicker";
|
||||||
|
import cy from "date-fns/locale/cy";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import "react-datepicker/dist/react-datepicker.css";
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -140,6 +141,8 @@ const RenderDatePicker = ({
|
|||||||
meta: { touched, error },
|
meta: { touched, error },
|
||||||
...custom
|
...custom
|
||||||
}) => {
|
}) => {
|
||||||
|
const router = useRouter();
|
||||||
|
registerLocale("cy", cy);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
@@ -175,6 +178,7 @@ const RenderDatePicker = ({
|
|||||||
)}
|
)}
|
||||||
<DatePicker
|
<DatePicker
|
||||||
{...custom}
|
{...custom}
|
||||||
|
locale={router.locale}
|
||||||
autoOk={true}
|
autoOk={true}
|
||||||
dateFormat="dd/MM/yyyy"
|
dateFormat="dd/MM/yyyy"
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
|||||||
+9
-10
@@ -27,6 +27,7 @@ const Header = (props) => {
|
|||||||
"/dnsapplications",
|
"/dnsapplications",
|
||||||
"/dnsdetails",
|
"/dnsdetails",
|
||||||
"/404",
|
"/404",
|
||||||
|
"/account/register",
|
||||||
];
|
];
|
||||||
const hasContactLink = [
|
const hasContactLink = [
|
||||||
"/dns",
|
"/dns",
|
||||||
@@ -112,22 +113,20 @@ const Header = (props) => {
|
|||||||
""
|
""
|
||||||
) : (
|
) : (
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<a
|
||||||
href={
|
href={
|
||||||
router.locale == "cy"
|
router.locale == "cy"
|
||||||
? "/allgofnodi"
|
? "/allgofnodi"
|
||||||
: "/logout"
|
: "/logout"
|
||||||
}
|
}
|
||||||
>
|
onClick={() => {
|
||||||
<a
|
setLogout(),
|
||||||
onClick={() => {
|
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
}}
|
}}
|
||||||
className="govuk-header__link "
|
className="govuk-header__link "
|
||||||
>
|
>
|
||||||
{t("common:signout-label")}
|
{t("common:signout-label")}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
+229
-67
@@ -1,66 +1,187 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { Field, reduxForm } from "redux-form";
|
||||||
|
import LoadingOverlay from "react-loading-overlay";
|
||||||
|
import { getLogin } from "../../actions";
|
||||||
|
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
||||||
|
import Cookies from "cookies";
|
||||||
|
|
||||||
export default function Login() {
|
const required = (errorMsg) => (value) =>
|
||||||
|
value || typeof value === "number" ? undefined : errorMsg;
|
||||||
|
|
||||||
|
export const minLength = (errorMsg) => (value) =>
|
||||||
|
value && value.length < 4
|
||||||
|
? errorMsg //`Must be ${min} characters or more`
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
const RenderTextfield = ({
|
||||||
|
id,
|
||||||
|
className,
|
||||||
|
rows,
|
||||||
|
datafieldname,
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
input,
|
||||||
|
hint1,
|
||||||
|
hint2,
|
||||||
|
meta: { touched, error },
|
||||||
|
...custom
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
touched && error
|
||||||
|
? "govuk-form-group govuk-form-group--error"
|
||||||
|
: "govuk-form-group "
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div id="basicSearch-hint" className="govuk-hint ">
|
||||||
|
<span className="govuk-body-m">{hint1}</span>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<span className="govuk-body-s">{hint2}</span>
|
||||||
|
</div>
|
||||||
|
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
|
||||||
|
{label}
|
||||||
|
</label>
|
||||||
|
{touched && error && (
|
||||||
|
<span id={id + "-error"} className="govuk-error-message">
|
||||||
|
<span className="govuk-visually-hidden">Error:</span>{" "}
|
||||||
|
{error}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<input {...input} className={className} name={name} id={id} />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const RenderPasswordfield = ({
|
||||||
|
id,
|
||||||
|
className,
|
||||||
|
rows,
|
||||||
|
datafieldname,
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
input,
|
||||||
|
hint1,
|
||||||
|
hint2,
|
||||||
|
meta: { touched, error },
|
||||||
|
...custom
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
touched && error
|
||||||
|
? "govuk-form-group govuk-form-group--error"
|
||||||
|
: "govuk-form-group "
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div id="basicSearch-hint" className="govuk-hint ">
|
||||||
|
<span className="govuk-body-m">{hint1}</span>
|
||||||
|
</div>
|
||||||
|
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
|
||||||
|
{label}
|
||||||
|
</label>
|
||||||
|
{touched && error && (
|
||||||
|
<span id={id + "-error"} className="govuk-error-message">
|
||||||
|
<span className="govuk-visually-hidden">Error:</span>{" "}
|
||||||
|
{error}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<input
|
||||||
|
{...input}
|
||||||
|
type="password"
|
||||||
|
className={className}
|
||||||
|
name={name}
|
||||||
|
id={id}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let Login = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
const { handleSubmit, pristine, reset, submitting, setLoggedInUserId } =
|
||||||
|
props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
|
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||||
|
|
||||||
|
let spinnerState = () => {
|
||||||
|
showSpinnerState == true
|
||||||
|
? setShowSpinnerState(false)
|
||||||
|
: setShowSpinnerState(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onHandleSubmit = (values) => {
|
||||||
|
spinnerState();
|
||||||
|
|
||||||
|
getLogin(values.loginUserID, values.loginUserPassword).then((data) => {
|
||||||
|
setLoggedInUserId(data.value[0].contactid);
|
||||||
|
|
||||||
|
spinnerState();
|
||||||
|
router.replace({
|
||||||
|
pathname: router.locale == "cy" ? "/fymhorth" : "/myportal",
|
||||||
|
query: { q: data.value[0].contactid },
|
||||||
|
shallow: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" id="login-card">
|
<div className="card" id="login-card">
|
||||||
<div className="card-body active">
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
<h3 className="heading-small card-heading">
|
<div className="card-body active">
|
||||||
{t("home:login-card-title")}
|
<h3 className="heading-small card-heading">
|
||||||
</h3>
|
{t("home:login-card-title")}
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<Field
|
||||||
|
// validate={[
|
||||||
|
// required(
|
||||||
|
// t("home:casesearch-search-validation-required")
|
||||||
|
// ),
|
||||||
|
// minLength(
|
||||||
|
// t("home:casesearch-search-validation-minlength")
|
||||||
|
// ),
|
||||||
|
// ]}
|
||||||
|
className="govuk-input"
|
||||||
|
component={RenderTextfield}
|
||||||
|
id="loginUserID"
|
||||||
|
name="loginUserID"
|
||||||
|
type="text"
|
||||||
|
aria-describedby="basicSearch-hint"
|
||||||
|
hint1={t("home:login-card-id-label")}
|
||||||
|
hint2={t("home:login-card-id-hint")}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Field
|
||||||
|
// validate={[
|
||||||
|
// required(
|
||||||
|
// t("home:casesearch-search-validation-required")
|
||||||
|
// ),
|
||||||
|
// minLength(
|
||||||
|
// t("home:casesearch-search-validation-minlength")
|
||||||
|
// ),
|
||||||
|
// ]}
|
||||||
|
className="govuk-input"
|
||||||
|
component={RenderPasswordfield}
|
||||||
|
id="loginUserPassword"
|
||||||
|
name="loginUserPassword"
|
||||||
|
type="password"
|
||||||
|
label="Password"
|
||||||
|
/>
|
||||||
|
|
||||||
<form action="/myportal" method="POST" id="loginForm">
|
|
||||||
<div className="govuk-form-group">
|
<div className="govuk-form-group">
|
||||||
{" "}
|
{/* <Link
|
||||||
<label
|
|
||||||
htmlFor="user_id"
|
|
||||||
className="govuk-label"
|
|
||||||
aria-describedby="user_id-hint"
|
|
||||||
>
|
|
||||||
{t("home:login-card-id-label")}
|
|
||||||
</label>
|
|
||||||
<div className="govuk-hint" id="user_id-hint">
|
|
||||||
{t("home:login-card-id-hint")}
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="user_id"
|
|
||||||
id="user_id"
|
|
||||||
className="govuk-input govuk-!-width-one-half"
|
|
||||||
maxLength="22"
|
|
||||||
aria-describedby="user_id-hint"
|
|
||||||
autoComplete="username"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
{" "}
|
|
||||||
<label htmlFor="password" className="govuk-label">
|
|
||||||
{t("home:login-card-password-label")}
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
name="password"
|
|
||||||
id="password"
|
|
||||||
className="govuk-input govuk-!-width-three-quarters"
|
|
||||||
autoComplete="current-password"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="govuk-form-group">
|
|
||||||
{/* <button
|
|
||||||
type="submit"
|
|
||||||
className="govuk-button"
|
|
||||||
data-module="govuk-button"
|
|
||||||
id="continue"
|
|
||||||
formnovalidate=""
|
|
||||||
>
|
|
||||||
{t("home:login-card-button")}
|
|
||||||
</button> */}
|
|
||||||
<Link
|
|
||||||
href={
|
href={
|
||||||
router.locale == "cy"
|
router.locale == "cy"
|
||||||
? "/fymhorth"
|
? "/fymhorth"
|
||||||
@@ -70,23 +191,64 @@ export default function Login() {
|
|||||||
<a className="govuk-button">
|
<a className="govuk-button">
|
||||||
{t("home:login-card-button")}
|
{t("home:login-card-button")}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link> */}
|
||||||
|
<button type="submit" className="govuk-button">
|
||||||
|
{t("home:login-card-button")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
{t("home:login-card-register-label")}{" "}
|
||||||
|
<Link href="/account/register">
|
||||||
|
<a>{t("home:login-card-register-link")}</a>
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
<p className="govuk-body-s">
|
||||||
|
<Link href="/">
|
||||||
|
<a>{t("home:login-card-forgotten-label")} </a>
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
|
||||||
<p className="govuk-body-s">
|
|
||||||
{t("home:login-card-register-label")}{" "}
|
|
||||||
<Link href="/account/register">
|
|
||||||
<a>{t("home:login-card-register-link")}</a>
|
|
||||||
</Link>
|
|
||||||
</p>
|
|
||||||
<p className="govuk-body-s">
|
|
||||||
<Link href="/">
|
|
||||||
<a>{t("home:login-card-forgotten-label")} </a>
|
|
||||||
</Link>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
<LoadingOverlay
|
||||||
|
active={showSpinnerState}
|
||||||
|
spinner
|
||||||
|
text="Logging in"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => {
|
||||||
|
return {
|
||||||
|
currentView: state.currentView,
|
||||||
|
search: state.search,
|
||||||
|
searchResultsObj: state.searchResultsObj,
|
||||||
|
formData: state.formData,
|
||||||
|
appealType: state.appealType,
|
||||||
|
//form: state.form,
|
||||||
|
myCases: state.myCases,
|
||||||
|
watchedCases: state.watchedCases,
|
||||||
|
myRepresentations: state.myRepresentations,
|
||||||
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => {
|
||||||
|
return {
|
||||||
|
setLoggedInUserId: (userID) => {
|
||||||
|
dispatch(setLoggedInUserId(userID));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(
|
||||||
|
reduxForm({
|
||||||
|
form: "loginForm",
|
||||||
|
destroyOnUnmount: false,
|
||||||
|
})(Login)
|
||||||
|
);
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Banner from "../components/banner";
|
|
||||||
import Footer from "../components/footer";
|
import Footer from "../components/footer";
|
||||||
import Header from "../components/header";
|
import Header from "../components/header";
|
||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
|
||||||
export default function SkipLink(props) {
|
export default function SkipLink(props) {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Appeals Casework Portal</title>
|
<title>{t("common:service-name")}</title>
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<div className="">
|
<div className="">
|
||||||
<Header courseName="Planning Casework Portal" />
|
<Header courseName="Planning Casework Portal" />
|
||||||
<div className="govuk-width-container">
|
<div className="govuk-width-container">
|
||||||
<Banner />
|
|
||||||
<main
|
<main
|
||||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||||
id="main-content"
|
id="main-content"
|
||||||
@@ -23,10 +24,12 @@ export default function SkipLink(props) {
|
|||||||
<div className="govuk-grid-column-two-thirds">
|
<div className="govuk-grid-column-two-thirds">
|
||||||
<noscript>
|
<noscript>
|
||||||
<h1 className="govuk-heading-l">
|
<h1 className="govuk-heading-l">
|
||||||
Please enable javascript
|
{t("common:enable-js-label")}
|
||||||
</h1>
|
</h1>
|
||||||
</noscript>
|
</noscript>
|
||||||
<h1 className="govuk-heading-m">Loading...</h1>
|
<h1 className="govuk-heading-m">
|
||||||
|
{t("common:loading-label")}...
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
+2
-2
@@ -28,8 +28,8 @@ export default function Home({ children, pages }) {
|
|||||||
<CaseSearch />
|
<CaseSearch />
|
||||||
<CaseComment />
|
<CaseComment />
|
||||||
<Dns />
|
<Dns />
|
||||||
{/*<Login />
|
<Login />
|
||||||
<Inspectorate /> */}
|
{/* <Inspectorate /> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default function YourAccount() {
|
|||||||
<div>
|
<div>
|
||||||
<Link href="/account/personaldetails">
|
<Link href="/account/personaldetails">
|
||||||
<a className="govuk-button-secondary">
|
<a className="govuk-button-secondary">
|
||||||
Edit your account details
|
View your account details
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ const SearchResults = (props) => {
|
|||||||
return (
|
return (
|
||||||
<div className="govuk-summary-list__row" key={key}>
|
<div className="govuk-summary-list__row" key={key}>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
|
{router.pathname.indexOf("myportal")}
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
router.locale == "cy"
|
router.locale == "cy"
|
||||||
|
|||||||
@@ -352,7 +352,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
|
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
|
||||||
"LogicalName": "pinswg_listedbuildingconservationareaconsents7",
|
"LogicalName": "pinswg_listedbuildingconservationareaconsent",
|
||||||
"PrimaryIdAttribute": "pinswg_listedbuildingandconservationareaconsenid",
|
"PrimaryIdAttribute": "pinswg_listedbuildingandconservationareaconsenid",
|
||||||
"UrlName": "listedbuildingandconservationareaconsen",
|
"UrlName": "listedbuildingandconservationareaconsen",
|
||||||
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c"
|
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
"loading-label": "Llwytho",
|
||||||
|
"enable-js-label": "Os gwelwch yn dda galluogi javascript",
|
||||||
"gov-wales-link": "https://llyw.cymru",
|
"gov-wales-link": "https://llyw.cymru",
|
||||||
"gov-wales-label": "LLYW.CYMRU",
|
"gov-wales-label": "LLYW.CYMRU",
|
||||||
"service-name": "Cynllunio gwaith achos",
|
"service-name": "Cynllunio gwaith achos",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
"loading-label": "Loading",
|
||||||
|
"enable-js-label": "Please enable javascript",
|
||||||
"gov-wales-link": "https://www.gov.wales",
|
"gov-wales-link": "https://www.gov.wales",
|
||||||
"gov-wales-label": "GOV.WALES",
|
"gov-wales-label": "GOV.WALES",
|
||||||
"service-name": "Planning casework",
|
"service-name": "Planning casework",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"cookies": "^0.8.0",
|
"cookies": "^0.8.0",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
|
"date-fns": "^2.25.0",
|
||||||
"dom": "^0.0.3",
|
"dom": "^0.0.3",
|
||||||
"dynamics-web-api": "^1.7.4",
|
"dynamics-web-api": "^1.7.4",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
|||||||
@@ -56,7 +56,13 @@ const Home = (props) => {
|
|||||||
<h1>Create a new account</h1>
|
<h1>Create a new account</h1>
|
||||||
) : (
|
) : (
|
||||||
<h1>
|
<h1>
|
||||||
Your account has been created
|
{props.accountDetails.accCr !=
|
||||||
|
"false"
|
||||||
|
? props.accountDetails
|
||||||
|
.accCr == "exists"
|
||||||
|
? "Your account has not created"
|
||||||
|
: "Your account has been created"
|
||||||
|
: "Checking for account.."}
|
||||||
</h1>
|
</h1>
|
||||||
)}
|
)}
|
||||||
<RegisterForm
|
<RegisterForm
|
||||||
|
|||||||
@@ -9,18 +9,6 @@ const PROXY_RELAY_URL =
|
|||||||
"/" +
|
"/" +
|
||||||
(process.env.RELAYPATH || "dev-pedw-hc") +
|
(process.env.RELAYPATH || "dev-pedw-hc") +
|
||||||
"/";
|
"/";
|
||||||
//"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
|
||||||
|
|
||||||
// const azureHeaders = {
|
|
||||||
// headers: {
|
|
||||||
// "OData-MaxVersion": "4.0",
|
|
||||||
// "OData-Version": "4.0",
|
|
||||||
// "Accept": "application/json",
|
|
||||||
// "Prefer": 'odata.include-annotations="*",return=representation',
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// "ServiceBusAuthorization": SASToken,
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
|
|
||||||
const getSASToken = () => {
|
const getSASToken = () => {
|
||||||
var m_ResourceURI =
|
var m_ResourceURI =
|
||||||
@@ -61,7 +49,7 @@ const getSASToken = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function ApiProxy(req, res) {
|
export default async function ApiProxy(req, res) {
|
||||||
console.log(req.method);
|
//console.log(req.method);
|
||||||
|
|
||||||
var data = JSON.stringify(req.body);
|
var data = JSON.stringify(req.body);
|
||||||
const SASToken = getSASToken();
|
const SASToken = getSASToken();
|
||||||
@@ -82,7 +70,6 @@ export default async function ApiProxy(req, res) {
|
|||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
|
|
||||||
url: PROXY_RELAY_URL + req.query.route[0],
|
url: PROXY_RELAY_URL + req.query.route[0],
|
||||||
headers: {
|
headers: {
|
||||||
"OData-MaxVersion": "4.0",
|
"OData-MaxVersion": "4.0",
|
||||||
@@ -112,7 +99,13 @@ export default async function ApiProxy(req, res) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let apiPath = req.url.split("/api/proxy/")[1];
|
let apiPath = req.url.split("/api/proxy/")[1];
|
||||||
let hasDocument = apiPath.indexOf("/download") > 0 ? true : false;
|
let hasDocument = apiPath.indexOf("/download") > 0 ? true : false;
|
||||||
|
console.log(
|
||||||
|
"//////////////",
|
||||||
|
req.url.split("/api/proxy/")[1],
|
||||||
|
PROXY_RELAY_URL + req.query.route[0],
|
||||||
|
req.method,
|
||||||
|
hasDocument
|
||||||
|
);
|
||||||
axios(
|
axios(
|
||||||
req.method == "GET"
|
req.method == "GET"
|
||||||
? hasDocument
|
? hasDocument
|
||||||
@@ -121,18 +114,21 @@ export default async function ApiProxy(req, res) {
|
|||||||
: config
|
: config
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// console.log(response);
|
|
||||||
res.statusCode = 200;
|
res.statusCode = 200;
|
||||||
if (hasDocument) {
|
if (hasDocument) {
|
||||||
res.setHeader("Content-Type", "text/plain");
|
res.setHeader(
|
||||||
|
"Content-disposition",
|
||||||
|
"attachment; filename=" +
|
||||||
|
response.headers["content-disposition"].split(
|
||||||
|
"filename="
|
||||||
|
)[1]
|
||||||
|
);
|
||||||
res.end(response.data);
|
res.end(response.data);
|
||||||
} else {
|
} else {
|
||||||
res.setHeader("Content-Type", "application/json");
|
res.setHeader("Content-Type", "application/json");
|
||||||
res.setHeader("Cache-Control", "max-age=1800000");
|
// res.setHeader("Cache-Control", "max-age=1800000");
|
||||||
res.end(JSON.stringify(response.data));
|
res.end(JSON.stringify(response.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("response data", response.data);
|
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
+5
-1
@@ -10,6 +10,7 @@ import { useSelector, shallowEqual, connect } from "react-redux";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { setLogout } from "../store/accountDetails/action";
|
import { setLogout } from "../store/accountDetails/action";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
const LogOut = (props) => {
|
const LogOut = (props) => {
|
||||||
const { footerLinks, pages, setLogout } = props;
|
const { footerLinks, pages, setLogout } = props;
|
||||||
@@ -17,7 +18,10 @@ const LogOut = (props) => {
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
setLogout();
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLogout();
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
|
|||||||
+50
-45
@@ -82,58 +82,63 @@ const Home = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) => async (ctx) => {
|
||||||
async ({ query, req, res }) => {
|
const { query, req, res } = ctx;
|
||||||
//console.log("the query", query);
|
console.log("the query", query);
|
||||||
|
|
||||||
const token = await getSASToken();
|
const { cookies } = req;
|
||||||
|
|
||||||
const [
|
console.log(cookies);
|
||||||
myCases,
|
const token = await getSASToken();
|
||||||
myRepresentations,
|
|
||||||
watchedCases,
|
let loggedInUser =
|
||||||
awaitingSubmission,
|
typeof query.q == undefined ? cookies.pinsUser : query.q;
|
||||||
] = await Promise.all([
|
|
||||||
await getMyCases(token, "f8b454ed-eded-eb11-aac7-00224800be9c"),
|
console.log("qweqe ", loggedInUser);
|
||||||
await getMyRepresentations(token),
|
|
||||||
await getWatchedCases(token),
|
const [myCases, myRepresentations, watchedCases, awaitingSubmission] =
|
||||||
|
await Promise.all([
|
||||||
|
await getMyCases(token, loggedInUser),
|
||||||
|
await getMyRepresentations(token, loggedInUser),
|
||||||
|
await getWatchedCases(token, loggedInUser),
|
||||||
await getAwaitingSubmission(token),
|
await getAwaitingSubmission(token),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const cookies = new Cookies(req, res);
|
const cookiesMaker = new Cookies(req, res);
|
||||||
|
|
||||||
cookies.set("pinsUser", "f8b454ed-eded-eb11-aac7-00224800be9c", {
|
cookiesMaker.set("pinsUser", query.q, {
|
||||||
httpOnly: true, // true by default
|
httpOnly: true, // true by default
|
||||||
});
|
});
|
||||||
//console.log("my cases ", myCases);
|
|
||||||
const [
|
|
||||||
myCasesDetails,
|
|
||||||
// myRepresentationsDetails,
|
|
||||||
// watchedCasesDetails,
|
|
||||||
// awaitingSubmissionDetails,
|
|
||||||
] = await Promise.all([
|
|
||||||
await getDetails(token, myCases),
|
|
||||||
// await getDetails(myRepresentations),
|
|
||||||
// await getDetails(watchedCases),
|
|
||||||
// await getDetails(awaitingSubmission),
|
|
||||||
]);
|
|
||||||
|
|
||||||
store.dispatch(
|
console.log(" from cookie ", cookiesMaker.get("pinsUser"));
|
||||||
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
|
console.log(myCases);
|
||||||
);
|
|
||||||
store.dispatch(setMyCases(myCases));
|
const [
|
||||||
store.dispatch(setMyCasesDetails(myCasesDetails));
|
myCasesDetails,
|
||||||
store.dispatch(setMyRepresentations(myRepresentations));
|
myRepresentationsDetails,
|
||||||
// store.dispatch(
|
watchedCasesDetails,
|
||||||
// setMyRepresentationsDetails(myRepresentationsDetails)
|
// awaitingSubmissionDetails,
|
||||||
// );
|
] = await Promise.all([
|
||||||
store.dispatch(setWatchedCases(watchedCases));
|
await getDetails(token, myCases),
|
||||||
//store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
await getDetails(token, myRepresentations),
|
||||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
await getDetails(token, watchedCases),
|
||||||
// store.dispatch(
|
// await getDetails(awaitingSubmission),
|
||||||
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
]);
|
||||||
// );
|
|
||||||
}
|
console.log(myCasesDetails);
|
||||||
|
|
||||||
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
|
store.dispatch(setMyCases(myCases));
|
||||||
|
store.dispatch(setMyCasesDetails(myCasesDetails));
|
||||||
|
store.dispatch(setMyRepresentations(myRepresentations));
|
||||||
|
store.dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
|
||||||
|
store.dispatch(setWatchedCases(watchedCases));
|
||||||
|
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||||
|
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||||
|
// store.dispatch(
|
||||||
|
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||||
|
// );
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const getFormCollection = (formtype) => {
|
const getFormCollection = (formtype) => {
|
||||||
|
|||||||
@@ -20,9 +20,17 @@ import { setSearch, getSearchObj } from "../../store/search/action";
|
|||||||
import {
|
import {
|
||||||
setSearchResults,
|
setSearchResults,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
|
setDocumentDetails,
|
||||||
|
setDocumentHistory,
|
||||||
getSearchResultsObj,
|
getSearchResultsObj,
|
||||||
} from "../../store/searchOutput/action";
|
} from "../../store/searchOutput/action";
|
||||||
import { getBasicSearch, getBasicSearchDetails } from "../../actions";
|
import {
|
||||||
|
getBasicSearch,
|
||||||
|
getBasicSearchDetails,
|
||||||
|
getSearchDocumentDetails,
|
||||||
|
getSearchDocumentHistory,
|
||||||
|
getSASToken,
|
||||||
|
} from "../../actions";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const { footerLinks, pages } = props;
|
const { footerLinks, pages } = props;
|
||||||
@@ -47,6 +55,7 @@ const Home = (props) => {
|
|||||||
<SearchResults
|
<SearchResults
|
||||||
searchString={props.search.searchString}
|
searchString={props.search.searchString}
|
||||||
searchResultsObj={props.searchResultsObj}
|
searchResultsObj={props.searchResultsObj}
|
||||||
|
myportal="true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Footer footerLinks={footerLinks} />
|
<Footer footerLinks={footerLinks} />
|
||||||
@@ -59,14 +68,38 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
(store) =>
|
(store) =>
|
||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
console.log("query-", query);
|
console.log("query-", query);
|
||||||
// const [searchResultsObj, searchDetailsObj] = await Promise.all(
|
|
||||||
// await getBasicSearch(query.q),
|
const token = await getSASToken();
|
||||||
// await getBasicSearchDetails(query.d)
|
|
||||||
|
let searchResultsObj = await getBasicSearch(token, query.q);
|
||||||
|
|
||||||
|
searchResultsObj =
|
||||||
|
searchResultsObj.status == 502
|
||||||
|
? {
|
||||||
|
value: [],
|
||||||
|
errorCode: searchResultsObj.status,
|
||||||
|
errorMsg: searchResultsObj.statusText,
|
||||||
|
}
|
||||||
|
: searchResultsObj;
|
||||||
|
|
||||||
|
//console.log("sssss", searchResultsObj);
|
||||||
|
|
||||||
|
const searchDetailsObj = await getSearchDetails(
|
||||||
|
token,
|
||||||
|
searchResultsObj
|
||||||
|
);
|
||||||
|
|
||||||
|
// const searchDocumentResultsObj = await getDocumentDetails(
|
||||||
|
// token,
|
||||||
|
// searchResultsObj
|
||||||
// );
|
// );
|
||||||
|
|
||||||
const searchResultsObj = await getBasicSearch(query.q);
|
// const searchDocumentHistoryObj = await getDocumentHistory(
|
||||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
// token,
|
||||||
// console.log(searchDetailsObj);
|
// searchDocumentResultsObj
|
||||||
|
// );
|
||||||
|
// console.log(searchDocumentHistoryObj);
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch(query.q));
|
store.dispatch(setSearch(query.q));
|
||||||
@@ -82,7 +115,7 @@ const getFormCollection = (formtype) => {
|
|||||||
return collectionName[0];
|
return collectionName[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSearchDetails = (searchResultsObj) => {
|
const getSearchDetails = (token, searchResultsObj) => {
|
||||||
//console.log(searchResultsObj);
|
//console.log(searchResultsObj);
|
||||||
|
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
@@ -93,13 +126,15 @@ const getSearchDetails = (searchResultsObj) => {
|
|||||||
} else {
|
} else {
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getBasicSearchDetails(
|
getBasicSearchDetails(
|
||||||
|
token,
|
||||||
getFormCollection(
|
getFormCollection(
|
||||||
"pinswg_" +
|
"pinswg_" +
|
||||||
searchDetail[
|
searchDetail[
|
||||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
]
|
]
|
||||||
.replace(/[\s\-\+\(\)\,\&\.]/g, "")
|
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
.slice(0, 39)
|
||||||
),
|
),
|
||||||
searchDetail.ticketnumber
|
searchDetail.ticketnumber
|
||||||
)
|
)
|
||||||
@@ -122,6 +157,7 @@ const mapStateToProps = (state) => {
|
|||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
|
accountDetails: state.accountDetails,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -258,49 +258,42 @@ let Home = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) => async (ctx) => {
|
||||||
async ({ query, req, res }) => {
|
const { query, req, res } = ctx;
|
||||||
console.log("the query", query);
|
const { cookies } = req;
|
||||||
const token = await getSASToken();
|
|
||||||
const [
|
|
||||||
caseReferenceData,
|
|
||||||
appealTypeData,
|
|
||||||
mandatoryFieldsData,
|
|
||||||
pickListData,
|
|
||||||
formdata,
|
|
||||||
] = await Promise.all([
|
|
||||||
await createCase(token, query.apt),
|
|
||||||
await getAppealsTypes(token),
|
|
||||||
await getMandatoryFields(token, query.appealtypes),
|
|
||||||
await getPickLists(token, query.appealtypes),
|
|
||||||
await getFormData(token, query.appealtypes),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// let updateCaseReferenceData = await updateCase(
|
console.log(cookies);
|
||||||
// caseReferenceData.incidentid,
|
console.log("the query", query);
|
||||||
// query.apt
|
let loggedInUser = cookies.pinsUser;
|
||||||
// );
|
|
||||||
|
|
||||||
const cookies = new Cookies(req, res);
|
const token = await getSASToken();
|
||||||
// Get a cookie
|
const [
|
||||||
|
caseReferenceData,
|
||||||
|
appealTypeData,
|
||||||
|
mandatoryFieldsData,
|
||||||
|
pickListData,
|
||||||
|
formdata,
|
||||||
|
] = await Promise.all([
|
||||||
|
await createCase(token, query.apt, loggedInUser),
|
||||||
|
await getAppealsTypes(token),
|
||||||
|
await getMandatoryFields(token, query.appealtypes),
|
||||||
|
await getPickLists(token, query.appealtypes),
|
||||||
|
await getFormData(token, query.appealtypes),
|
||||||
|
]);
|
||||||
|
|
||||||
console.log(cookies.get("pipinsUser"));
|
let caseReference = caseReferenceData;
|
||||||
|
let xmlStr = formdata;
|
||||||
|
xmlStr = formdata.value[0].formxml;
|
||||||
|
xmlStr = xmlStr.replace(/\\"/g, "");
|
||||||
|
|
||||||
let caseReference = caseReferenceData;
|
//console.log(caseReference, query.appealtypes, formdata);
|
||||||
let xmlStr = formdata;
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
xmlStr = formdata.value[0].formxml;
|
store.dispatch(setAppealLPA(query.lpa));
|
||||||
xmlStr = xmlStr.replace(/\\"/g, "");
|
store.dispatch(setAppealTypeID(query.apt));
|
||||||
|
store.dispatch(setCaseReference(caseReference));
|
||||||
//console.log(caseReference, query.appealtypes, formdata);
|
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||||
store.dispatch(
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
|
}
|
||||||
);
|
|
||||||
store.dispatch(setAppealLPA(query.lpa));
|
|
||||||
store.dispatch(setAppealTypeID(query.apt));
|
|
||||||
store.dispatch(setCaseReference(caseReference));
|
|
||||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
|
|||||||
+21
-10
@@ -19,6 +19,10 @@ import { reduxForm, formValueSelector } from "redux-form";
|
|||||||
|
|
||||||
import CreateCase from "../../components/newappeal/createCase";
|
import CreateCase from "../../components/newappeal/createCase";
|
||||||
import xpath from "xpath";
|
import xpath from "xpath";
|
||||||
|
import {
|
||||||
|
setLoggedInUserId,
|
||||||
|
setAccountDetails,
|
||||||
|
} from "../../store/accountDetails/action";
|
||||||
import {
|
import {
|
||||||
setAppealType,
|
setAppealType,
|
||||||
setAppealTypeTitle,
|
setAppealTypeTitle,
|
||||||
@@ -78,18 +82,25 @@ const Home = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) => async (ctx) => {
|
||||||
async ({ query, req, res }) => {
|
const { req, res } = ctx;
|
||||||
const token = await getSASToken();
|
const { cookies } = req;
|
||||||
|
|
||||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
console.log(cookies);
|
||||||
await getAppealsTypes(token),
|
|
||||||
await getLPA(token),
|
|
||||||
]);
|
|
||||||
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
let loggedInUser = cookies.pinsUser;
|
||||||
store.dispatch(setLPA(lpaData));
|
|
||||||
}
|
const token = await getSASToken();
|
||||||
|
|
||||||
|
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||||
|
await getAppealsTypes(token),
|
||||||
|
await getLPA(token),
|
||||||
|
]);
|
||||||
|
|
||||||
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
store.dispatch(setLPA(lpaData));
|
||||||
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
|
|||||||
@@ -123,9 +123,24 @@ const getSearchDetails = (token, searchResultsObj) => {
|
|||||||
//console.log("search results", searchResultsObj);
|
//console.log("search results", searchResultsObj);
|
||||||
searchResultsObj = searchResultsObj.value;
|
searchResultsObj = searchResultsObj.value;
|
||||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||||
|
//console.log(searchDetail);
|
||||||
if (searchDetail.pinswg_appealcasetype == null) {
|
if (searchDetail.pinswg_appealcasetype == null) {
|
||||||
console.log(searchDetail.ticketnumber);
|
console.log(searchDetail.ticketnumber);
|
||||||
} else {
|
} else {
|
||||||
|
// console.log(
|
||||||
|
// "appealtype collection name",
|
||||||
|
// searchDetail[
|
||||||
|
// "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
|
// ],
|
||||||
|
// "pinswg_" +
|
||||||
|
// searchDetail[
|
||||||
|
// "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
|
// ]
|
||||||
|
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||||
|
// .toLowerCase()
|
||||||
|
// .slice(0, 39),
|
||||||
|
// searchDetail.ticketnumber
|
||||||
|
// );
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getBasicSearchDetails(
|
getBasicSearchDetails(
|
||||||
token,
|
token,
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
|
import actions from "redux-form/lib/actions";
|
||||||
|
|
||||||
export const AccountDetailsDataActionTypes = {
|
export const AccountDetailsDataActionTypes = {
|
||||||
GETACCOUNTDETAILSDATA: "GETACCOUNTDETAILSDATA",
|
GETACCOUNTDETAILSDATA: "GETACCOUNTDETAILSDATA",
|
||||||
SETACCOUNTDETAILSDATA: "SETACCOUNTDETAILSDATA",
|
SETACCOUNTDETAILSDATA: "SETACCOUNTDETAILSDATA",
|
||||||
SETLOGGEDINUSER: "SETLOGGEDINUSER",
|
SETLOGGEDINUSER: "SETLOGGEDINUSER",
|
||||||
|
SETACCOUNTCREATED: "SETACCOUNTCREATED",
|
||||||
|
USER_LOGOUT: "USER_LOGOUT",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAccountDetailsObj = () => (dispatch) => {
|
export const getAccountDetailsObj = () => (dispatch) => {
|
||||||
@@ -29,3 +33,10 @@ export const setLogout = () => (dispatch) => {
|
|||||||
type: "USER_LOGOUT",
|
type: "USER_LOGOUT",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setAccCr = (accCr) => (dispatch) => {
|
||||||
|
return dispatch({
|
||||||
|
type: AccountDetailsDataActionTypes.SETACCOUNTCREATED,
|
||||||
|
accCr: accCr,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { AccountDetailsDataActionTypes } from "./action";
|
|||||||
const AccountDetailsDataInitialState = {
|
const AccountDetailsDataInitialState = {
|
||||||
accountDetails: {},
|
accountDetails: {},
|
||||||
loggedinUserId: "",
|
loggedinUserId: "",
|
||||||
|
accCr: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function reducer(
|
export default function reducer(
|
||||||
@@ -20,6 +21,11 @@ export default function reducer(
|
|||||||
...state,
|
...state,
|
||||||
loggedinUserId: action.loggedinUserId,
|
loggedinUserId: action.loggedinUserId,
|
||||||
};
|
};
|
||||||
|
case AccountDetailsDataActionTypes.SETACCOUNTCREATED:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
accCr: action.accCr,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ html {
|
|||||||
.govuk-button,
|
.govuk-button,
|
||||||
.govuk-label,
|
.govuk-label,
|
||||||
.govuk-select,
|
.govuk-select,
|
||||||
|
.govuk-radios__item,
|
||||||
.govuk-breadcrumbs__link,
|
.govuk-breadcrumbs__link,
|
||||||
.govuk-fieldset__legend--s,
|
.govuk-fieldset__legend--s,
|
||||||
.govuk-input,
|
.govuk-input,
|
||||||
@@ -136,6 +137,7 @@ body {
|
|||||||
a.longLinkBreak {
|
a.longLinkBreak {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.govuk-header {
|
.govuk-header {
|
||||||
background-color: $charcoal;
|
background-color: $charcoal;
|
||||||
|
|
||||||
@@ -189,6 +191,18 @@ a.longLinkBreak {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.govuk-input,
|
||||||
|
.govuk-select,
|
||||||
|
textarea,
|
||||||
|
.react-datepicker__input-container input {
|
||||||
|
border: 1px solid $darkgrey;
|
||||||
|
padding: 10px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.govuk-radios__label:before {
|
||||||
|
border: 1px solid $darkgrey;
|
||||||
|
}
|
||||||
|
|
||||||
.govuk-checkboxes__conditional--hidden {
|
.govuk-checkboxes__conditional--hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -628,11 +642,26 @@ a.longLinkBreak {
|
|||||||
outline: 3px solid transparent;
|
outline: 3px solid transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.documentList {
|
||||||
|
.govuk-summary-list__key:first-of-type {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
.govuk-summary-list__key:last-of-type {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.results .govuk-summary-list__row {
|
.results .govuk-summary-list__row {
|
||||||
@media screen and (max-width: 900px) {
|
@media screen and (max-width: 900px) {
|
||||||
padding: 20px 10px;
|
padding: 20px 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.results .govuk-summary-list__key {
|
||||||
|
&:last-of-type {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.results_wider {
|
.results_wider {
|
||||||
width: 170px !important;
|
width: 170px !important;
|
||||||
@@ -679,8 +708,8 @@ a.longLinkBreak {
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
height: 2.5rem;
|
height: 2.5rem;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
padding: 5px;
|
padding: 10px 15px;
|
||||||
border: 2px solid #0b0c0c;
|
border: 1px solid $darkgrey !important;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
@@ -690,6 +719,17 @@ a.longLinkBreak {
|
|||||||
line-height: 1.3157894737;
|
line-height: 1.3157894737;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.react-datepicker-popper[data-placement^="top"]
|
||||||
|
.react-datepicker__triangle::before,
|
||||||
|
.react-datepicker-popper[data-placement^="bottom"]
|
||||||
|
.react-datepicker__triangle::before,
|
||||||
|
.react-datepicker-popper[data-placement^="top"]
|
||||||
|
.react-datepicker__triangle::after,
|
||||||
|
.react-datepicker-popper[data-placement^="bottom"]
|
||||||
|
.react-datepicker__triangle::after {
|
||||||
|
left: -20px !important;
|
||||||
|
}
|
||||||
|
|
||||||
//sharebar
|
//sharebar
|
||||||
|
|
||||||
.btn--arrow-up a {
|
.btn--arrow-up a {
|
||||||
|
|||||||
Reference in New Issue
Block a user