reps pdf upload directory restructure
This commit is contained in:
@@ -1,212 +0,0 @@
|
||||
import Link from "next/link";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import _ from "lodash";
|
||||
import { Field, FieldArray, reduxForm, formValueSelector } from "redux-form";
|
||||
import { connect } from "react-redux";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
|
||||
import { setRepresentationCapacity } from "../../../store/currentView/action";
|
||||
import RepCapacitySelection from "./representationCapacitySelection";
|
||||
import RepDetails from "./representationDetails";
|
||||
import RepAppellant from "./representationAppellant";
|
||||
import RepAgent from "./representationAgent";
|
||||
import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
|
||||
import RepLandOwner from "./representationLandowner";
|
||||
import {
|
||||
RenderPickList,
|
||||
RenderRadioList,
|
||||
RenderTextfield,
|
||||
} from "./representationElements";
|
||||
|
||||
let MakeRepresentation = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
|
||||
const [clearRepForm, setClearRepForm] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
caseReference,
|
||||
myCases,
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
searchResultsObj,
|
||||
currentType,
|
||||
currentView,
|
||||
setRepresentationCapacity,
|
||||
} = props;
|
||||
const formObj = props.props.form;
|
||||
let setCaseQueryObj = props[currentType];
|
||||
var casesObj = {};
|
||||
|
||||
currentType == "searchResultsObj"
|
||||
? (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.title=="' + caseReference + '")]'
|
||||
))
|
||||
: (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.reference=="' + caseReference + '")]'
|
||||
));
|
||||
|
||||
casesObj = Object.assign({}, ...casesObj);
|
||||
|
||||
const capacityOptionsArr = [
|
||||
"Appellant",
|
||||
"Agent",
|
||||
"Interested Party/Person",
|
||||
"Land Owner",
|
||||
];
|
||||
|
||||
const appellantApplicantRepresentationArr = [
|
||||
"Other",
|
||||
"Statement",
|
||||
"Statement of common ground",
|
||||
"Written statement of evidence",
|
||||
];
|
||||
|
||||
const interestedPersonRepresentationArr = [
|
||||
"Interested Party/Person correspondence",
|
||||
];
|
||||
|
||||
const landOwnerRepresentationArr = [
|
||||
"Other",
|
||||
"Statement",
|
||||
"Written statement of evidence",
|
||||
];
|
||||
|
||||
const repCapacityType = () => {
|
||||
currentView.representationCapacity == false
|
||||
? false
|
||||
: _.isEmpty(formObj["representationForm"])
|
||||
? false
|
||||
: _.isEmpty(formObj["representationForm"].values)
|
||||
? false
|
||||
: _.isEmpty(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
)
|
||||
? setRepresentationCapacity(false)
|
||||
: setRepresentationCapacity(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
return currentView.representationCapacity;
|
||||
};
|
||||
|
||||
const whichControl = () => {
|
||||
repCapacityType();
|
||||
switch (currentView.representationCapacity) {
|
||||
case false:
|
||||
return (
|
||||
<RepCapacitySelection
|
||||
formObj={formObj}
|
||||
capacityOptionsArr={capacityOptionsArr}
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "appellant":
|
||||
setRepresentationCapacity("appellant");
|
||||
return (
|
||||
<RepAppellant
|
||||
formObj={formObj}
|
||||
appellantApplicantRepresentationArr={
|
||||
appellantApplicantRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "agent":
|
||||
setRepresentationCapacity("agent");
|
||||
return (
|
||||
<RepAgent
|
||||
formObj={formObj}
|
||||
appellantApplicantRepresentationArr={
|
||||
appellantApplicantRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "interestedpartyperson":
|
||||
setRepresentationCapacity("interestedpartyperson");
|
||||
return (
|
||||
<RepInterestedPartyPerson
|
||||
formObj={formObj}
|
||||
interestedPersonRepresentationArr={
|
||||
interestedPersonRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "landowner":
|
||||
setRepresentationCapacity("landowner");
|
||||
return (
|
||||
<RepLandOwner
|
||||
formObj={formObj}
|
||||
landOwnerRepresentationArr={landOwnerRepresentationArr}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return (
|
||||
<RepCapacitySelection
|
||||
formObj={formObj}
|
||||
capacityOptionsArr={capacityOptionsArr}
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{whichControl()} - {props.firstValue}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setRepresentationCapacity: (representationCapacity) => {
|
||||
dispatch(setRepresentationCapacity(representationCapacity));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const selector = formValueSelector("representationForm");
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
destroyOnUnmount: false,
|
||||
})(MakeRepresentation)
|
||||
);
|
||||
@@ -81,6 +81,7 @@ let MakeRepresentation = (props) => {
|
||||
handleSubmit,
|
||||
setRepresentationSubmitConfirmation,
|
||||
setRepresentationMessageSent,
|
||||
initialValues,
|
||||
} = props;
|
||||
const formObj = props.props.form;
|
||||
let setCaseQueryObj = props[currentType] || {};
|
||||
@@ -156,6 +157,7 @@ let MakeRepresentation = (props) => {
|
||||
currentView.representationCapacity,
|
||||
_.isEmpty(currentView.representationCapacity)
|
||||
);
|
||||
|
||||
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
|
||||
return (
|
||||
<RepLPACapacitySelection
|
||||
@@ -246,7 +248,7 @@ let MakeRepresentation = (props) => {
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "interestedparty/person":
|
||||
case "interestedparty":
|
||||
// setRepresentationCapacity("interestedpartyperson");
|
||||
return (
|
||||
<RepInterestedPartyPerson
|
||||
@@ -335,7 +337,7 @@ let MakeRepresentation = (props) => {
|
||||
case "Land Owner":
|
||||
repType = "LO";
|
||||
break;
|
||||
case "LPA":
|
||||
case "lpa":
|
||||
repType = "LPA";
|
||||
break;
|
||||
|
||||
@@ -344,19 +346,22 @@ let MakeRepresentation = (props) => {
|
||||
}
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"repfile_name": updateBody.hasOwnProperty("repfile_name")
|
||||
? updateBody.repfile_name
|
||||
: year +
|
||||
"-" +
|
||||
month +
|
||||
"-" +
|
||||
day +
|
||||
"-" +
|
||||
time +
|
||||
"-" +
|
||||
repType +
|
||||
"-REP" +
|
||||
"_" +
|
||||
props.props.accountDetails.accountDetails.lastname,
|
||||
"pinswg_name":
|
||||
year +
|
||||
"-" +
|
||||
month +
|
||||
"-" +
|
||||
day +
|
||||
"-" +
|
||||
time +
|
||||
"-" +
|
||||
repType +
|
||||
"-REP" +
|
||||
"_" +
|
||||
props.props.accountDetails.accountDetails.lastname,
|
||||
props.props.currentView.caseReference.currentReference,
|
||||
"containerID": props.props.accountDetails.containerID,
|
||||
"appealType": props.props.currentView.caseReference.appealType,
|
||||
"incidentID": props.props.currentView.caseReference.incidentid,
|
||||
@@ -408,7 +413,15 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
console.log("attached docs: - ", buildFileArray);
|
||||
|
||||
let setCaseDetailsObj = props.props.searchResultsObj.searchDetailsObj;
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.props.myRepresentations.myRepresentations
|
||||
: props.props.searchResultsObj.searchDetailsObj
|
||||
: props.props.searchResultsObj.searchDetailsObj;
|
||||
|
||||
router.query.hasOwnProperty("state") &&
|
||||
router.query.state == "edit" &&
|
||||
setRepresentationSubmit(true);
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
@@ -438,6 +451,20 @@ let MakeRepresentation = (props) => {
|
||||
detailsObj.pinswg_siteaddresstown +
|
||||
" " +
|
||||
detailsObj.pinswg_siteaddresspostcode,
|
||||
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
||||
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
||||
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
||||
"pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode,
|
||||
"_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"],
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
|
||||
detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
"representationCapacity": router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.props.currentView.representationCapacity
|
||||
: values.representationCapacity
|
||||
: values.representationCapacity,
|
||||
});
|
||||
console.log(values);
|
||||
currentView.representationSubmit != true
|
||||
@@ -455,10 +482,14 @@ let MakeRepresentation = (props) => {
|
||||
console.log("has errors:", props.invalid),
|
||||
props.invalid == false &&
|
||||
updateRepresentation(values, false, false),
|
||||
values.representationDocuments.map((Blob) =>
|
||||
buildFileArray.push({ "name": Blob.name, "size": Blob.size })
|
||||
),
|
||||
Object.assign(values, { "filesList": buildFileArray }),
|
||||
values.hasOwnProperty("representationDocuments") &&
|
||||
(values.representationDocuments.map((Blob) =>
|
||||
buildFileArray.push({
|
||||
"name": Blob.name,
|
||||
"size": Blob.size,
|
||||
})
|
||||
),
|
||||
Object.assign(values, { "filesList": buildFileArray })),
|
||||
generateRepPDF(
|
||||
values,
|
||||
props.props.accountDetails.containerID,
|
||||
@@ -495,7 +526,7 @@ let MakeRepresentation = (props) => {
|
||||
dataObj,
|
||||
fileListObj,
|
||||
values.containerID,
|
||||
props.caseReference
|
||||
props.caseReference + "/" + dataObj.repfile_name
|
||||
).then((data) => {
|
||||
//console.log("hello", data);
|
||||
|
||||
@@ -507,9 +538,21 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
console.log(
|
||||
"what is representationSubmit state: " +
|
||||
currentView.representationSubmit
|
||||
currentView.representationSubmit,
|
||||
props.initialValues
|
||||
);
|
||||
|
||||
try {
|
||||
let value = props.initialValues;
|
||||
console.log("has props"), value;
|
||||
setRepresentationCapacity(
|
||||
props.initialValues.representationCapacity.toLowerCase()
|
||||
);
|
||||
//setRepresentationSubmit(false);
|
||||
} catch {
|
||||
console.log("not has props");
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
@@ -567,12 +610,16 @@ let MakeRepresentation = (props) => {
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
console.log("\\\\\\\\\\\\\\\\\\\\\\\\\\\\/nin map state", state);
|
||||
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -610,5 +657,6 @@ export default connect(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
destroyOnUnmount: false,
|
||||
enableReinitialize: true,
|
||||
})(MakeRepresentation)
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { connect } from "react-redux";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { Field, reduxForm } from "redux-form";
|
||||
@@ -12,9 +13,11 @@ import {
|
||||
FileUploadField,
|
||||
} from "./representationElements";
|
||||
import {
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
} from "../../../store/currentView/action";
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
|
||||
const RepAgent = (props) => {
|
||||
@@ -117,7 +120,6 @@ const RepAgent = (props) => {
|
||||
aria-describedby={props.name + "-hint"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
@@ -132,6 +134,37 @@ const RepAgent = (props) => {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
) &&
|
||||
props.currentView.caseReference.repDetails.filesList
|
||||
.length > 0 ? (
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
{props.currentView.caseReference.repDetails.filesList.map(
|
||||
(blob, i) => (
|
||||
<div
|
||||
key={blob.name + "_" + i}
|
||||
className="govuk-!-margin-bottom-5 fileThumb "
|
||||
>
|
||||
<img
|
||||
src={getThumbnailIconByExtension(
|
||||
blob.name
|
||||
)}
|
||||
alt={blob.name}
|
||||
width="50"
|
||||
/>
|
||||
|
||||
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
|
||||
{blob.name} (
|
||||
{bytesToSize(blob.size)})
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
@@ -146,13 +179,12 @@ const RepAgent = (props) => {
|
||||
</button>
|
||||
{/* <a
|
||||
onClick={() => {
|
||||
setRepresentationSubmit(false);
|
||||
setRepresentationSubmit(true);
|
||||
}}
|
||||
className="govuk-button"
|
||||
>
|
||||
Continue
|
||||
Continue ww
|
||||
</a> */}
|
||||
|
||||
<a
|
||||
onClick={() => {
|
||||
setRepresentationCapacity();
|
||||
|
||||
@@ -14,6 +14,12 @@ import {
|
||||
RenderFileUpload,
|
||||
FileUploadField,
|
||||
} from "./representationElements";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
// import {
|
||||
// setRepresentationCapacity,
|
||||
@@ -97,7 +103,6 @@ const RepAppellant = (props) => {
|
||||
aria-describedby={props.name + "-hint"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
@@ -112,6 +117,37 @@ const RepAppellant = (props) => {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
) &&
|
||||
props.currentView.caseReference.repDetails.filesList
|
||||
.length > 0 ? (
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
{props.currentView.caseReference.repDetails.filesList.map(
|
||||
(blob, i) => (
|
||||
<div
|
||||
key={blob.name + "_" + i}
|
||||
className="govuk-!-margin-bottom-5 fileThumb "
|
||||
>
|
||||
<img
|
||||
src={getThumbnailIconByExtension(
|
||||
blob.name
|
||||
)}
|
||||
alt={blob.name}
|
||||
width="50"
|
||||
/>
|
||||
|
||||
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
|
||||
{blob.name} (
|
||||
{bytesToSize(blob.size)})
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
|
||||
@@ -49,6 +49,8 @@ let RepCapacitySelection = (props) => {
|
||||
casesObj={casesObj}
|
||||
caseReference={props.props.caseReference}
|
||||
searchResultsObj={props.props.searchResultsObj}
|
||||
myRepresentations={props.props.myRepresentations}
|
||||
props={props}
|
||||
/>{" "}
|
||||
<div id="rep-details" className="vo_hiddens">
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
@@ -4,6 +4,11 @@ import { useRouter } from "next/router";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import RepComplete from "./representationComplete";
|
||||
import RepLPAQuestionnaireCheck from "./representationLPAQuestionnaireCheck";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
const RepCompleteSubmit = (props) => {
|
||||
let { t } = useTranslation();
|
||||
@@ -30,54 +35,6 @@ const RepCompleteSubmit = (props) => {
|
||||
|
||||
const repFormData = formObj.representationForm.values;
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
console.log("///////// formObj:", formObj);
|
||||
|
||||
return (
|
||||
@@ -240,7 +197,10 @@ const RepCompleteSubmit = (props) => {
|
||||
</dt>
|
||||
|
||||
<dd className="govuk-summary-list__value">
|
||||
{formObj.representationForm.values
|
||||
{formObj.representationForm.values.hasOwnProperty(
|
||||
"representationDocuments"
|
||||
) &&
|
||||
formObj.representationForm.values
|
||||
.representationDocuments.length > 0
|
||||
? formObj.representationForm.values.representationDocuments.map(
|
||||
(blob, i) => (
|
||||
|
||||
@@ -11,12 +11,24 @@ const RepDetails = (props) => {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { currentType, casesObj, caseReference } = props;
|
||||
const { currentType, casesObj } = props;
|
||||
|
||||
let setCaseDetailsObj = props.searchResultsObj.searchDetailsObj;
|
||||
let { caseReference } = props;
|
||||
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.myRepresentations.myRepresentations
|
||||
: props.searchResultsObj.searchDetailsObj
|
||||
: props.searchResultsObj.searchDetailsObj;
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
caseReference = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? router.query.case
|
||||
: caseReference
|
||||
: caseReference;
|
||||
|
||||
detailsObj = jsonpath.query(
|
||||
setCaseDetailsObj,
|
||||
'$..[?(@.pinswg_name=="' + caseReference + '")]'
|
||||
@@ -38,9 +50,14 @@ const RepDetails = (props) => {
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.appellantApplicant || ""}
|
||||
{detailsObj.firstName +
|
||||
{
|
||||
detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
{/* {detailsObj.firstName +
|
||||
" " +
|
||||
detailsObj.lastName || "not entered"}
|
||||
detailsObj.lastName || "not entered"} */}
|
||||
</dd>
|
||||
</div>
|
||||
{/* <div className="govuk-summary-list__row">
|
||||
|
||||
@@ -21,6 +21,12 @@ import {
|
||||
parseISO,
|
||||
} from "date-fns";
|
||||
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export const RenderRadioList = ({
|
||||
@@ -740,13 +746,6 @@ export const RenderFileUpload = (field) => {
|
||||
</div>
|
||||
));
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIcon = (fileObj, fileType) => {
|
||||
switch (fileType) {
|
||||
case "text/html":
|
||||
@@ -784,47 +783,6 @@ export const RenderFileUpload = (field) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
const getDocumentType = (docCode) => {
|
||||
switch (docCode) {
|
||||
case "000001":
|
||||
|
||||
@@ -81,13 +81,8 @@ let RepLPA = (props) => {
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
{props.representationTypeValue}
|
||||
{props.procedureTypeValue}
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
{console.log(props)}
|
||||
typeof props.representationTypeValue == "undefined"
|
||||
{props.representationTypeValue != "Questionnaire" ? (
|
||||
<>
|
||||
<p className="govuk-body">
|
||||
@@ -924,24 +919,25 @@ let RepLPA = (props) => {
|
||||
const selector = formValueSelector("representationForm"); // <-- same as form name
|
||||
|
||||
RepLPA = connect((state) => {
|
||||
const representationTypeValue = selector(state, "representationType");
|
||||
const procedureTypeValue = selector(state, "procedureType");
|
||||
const representationType = selector(state, "representationType");
|
||||
const procedureType = selector(state, "procedureType");
|
||||
|
||||
return {
|
||||
procedureTypeValue,
|
||||
representationTypeValue,
|
||||
procedureType,
|
||||
representationType,
|
||||
};
|
||||
})(RepLPA);
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
console.log();
|
||||
return {
|
||||
initialValues: {
|
||||
onBehalfOfLPA:
|
||||
props.props.props.accountDetails.accountDetails[
|
||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
},
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ let RepLPACapacitySelection = (props) => {
|
||||
casesObj={casesObj}
|
||||
caseReference={props.props.caseReference}
|
||||
searchResultsObj={props.props.searchResultsObj}
|
||||
props={props.props}
|
||||
/>{" "}
|
||||
<div id="rep-details" className="vo_hiddens">
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
@@ -60,12 +60,13 @@ RepLPAQuestionnaire = connect((state) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
console.log();
|
||||
return {
|
||||
initialValues: {
|
||||
onBehalfOfLPA:
|
||||
props.props.props.props.accountDetails.accountDetails[
|
||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
},
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,11 @@ const RepLPADetails = (props) => {
|
||||
|
||||
const { currentType, casesObj, caseReference } = props;
|
||||
|
||||
let setCaseDetailsObj = props.searchResultsObj.searchDetailsObj;
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.props.myRepresentations.myRepresentations
|
||||
: props.props.searchResultsObj.searchDetailsObj
|
||||
: props.props.searchResultsObj.searchDetailsObj;
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
|
||||
@@ -777,12 +777,13 @@ RepLPAQuestionnaire = connect((state) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
console.log();
|
||||
return {
|
||||
initialValues: {
|
||||
onBehalfOfLPA:
|
||||
props.props.props.props.accountDetails.accountDetails[
|
||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
},
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ import {
|
||||
import { setFilesForAppeal } from "../../store/appealType/action";
|
||||
import Link from "next/link";
|
||||
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../utils";
|
||||
|
||||
import {
|
||||
addYears,
|
||||
addMonths,
|
||||
@@ -1309,13 +1315,6 @@ const RenderFileUpload = (field) => {
|
||||
</div>
|
||||
));
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIcon = (fileObj, fileType) => {
|
||||
switch (fileType) {
|
||||
case "text/html":
|
||||
@@ -1353,47 +1352,6 @@ const RenderFileUpload = (field) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
const getDocumentType = (docCode) => {
|
||||
switch (docCode) {
|
||||
case "000001":
|
||||
|
||||
+7
-11
@@ -155,17 +155,13 @@ const MyPortal = (props) => {
|
||||
watchedCases={props.watchedCases}
|
||||
/>
|
||||
)}
|
||||
{isLPA
|
||||
? ""
|
||||
: props.myRepresentations.myRepresentations[
|
||||
"@odata.count"
|
||||
] > 0 && (
|
||||
<MyRepresentations
|
||||
myRepresentations={
|
||||
props.myRepresentations
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{props.myRepresentations.myRepresentations[
|
||||
"@odata.count"
|
||||
] > 0 && (
|
||||
<MyRepresentations
|
||||
myRepresentations={props.myRepresentations}
|
||||
/>
|
||||
)}
|
||||
{isLPA ? "" : <Dns />}
|
||||
|
||||
{/* <YourAccount /> */}
|
||||
|
||||
@@ -130,6 +130,11 @@ const TopThree = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const repRaisedDate = (datePart) => {
|
||||
var dateObj = new Date(parseInt(datePart.split("-")[3]));
|
||||
return dateObj.toLocaleString();
|
||||
};
|
||||
|
||||
let topThreeOnlyArr = showTopThreeArr; //.slice(0, 3);
|
||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
@@ -138,13 +143,14 @@ const TopThree = (props) => {
|
||||
<div className="cardModuleReference">
|
||||
<b>Representation ID:</b>{" "}
|
||||
<Link
|
||||
// href={{
|
||||
// pathname: "/myportal/representation",
|
||||
// query: {
|
||||
// case: showTopThreeArr[key].casereference,
|
||||
// },
|
||||
// }}
|
||||
href="#"
|
||||
href={{
|
||||
pathname: "/myportal/representation",
|
||||
query: {
|
||||
case: showTopThreeArr[key].caseRef,
|
||||
state: "edit",
|
||||
},
|
||||
}}
|
||||
// href="#"
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
@@ -152,26 +158,13 @@ const TopThree = (props) => {
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
topThreeType != "watchedCases"
|
||||
? topThreeType !=
|
||||
"myRepresentations"
|
||||
? showTopThreeArr[key]
|
||||
.ticketnumber
|
||||
: showTopThreeArr[key]
|
||||
.casereference
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
showTopThreeArr[key].caseRef,
|
||||
"currentType": topThreeType,
|
||||
|
||||
"incidentid": getIncidentId(
|
||||
topThreeType,
|
||||
showTopThreeArr[key]
|
||||
),
|
||||
|
||||
"incidentid":
|
||||
showTopThreeArr[key].incidentID,
|
||||
"appealType":
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype,
|
||||
showTopThreeArr[key].appealType,
|
||||
"repDetails": showTopThreeArr[key],
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -189,6 +182,16 @@ const TopThree = (props) => {
|
||||
{" "}
|
||||
{showTopThreeArr[key].representationType}
|
||||
</div>
|
||||
<div className="cardModuleReference">
|
||||
<b>Capacity:</b>
|
||||
{" "}
|
||||
{showTopThreeArr[key].representationCapacity}
|
||||
</div>
|
||||
<div className="cardModuleReference">
|
||||
<b>Date raised:</b>
|
||||
{" "}
|
||||
{repRaisedDate(showTopThreeArr[key].repfile_name)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -9,6 +9,11 @@ import { connect } from "react-redux";
|
||||
import Dropzone, { useDropzone } from "react-dropzone";
|
||||
import { uploadFiles } from "../../actions";
|
||||
import { getContainers } from "../../actions/azurestorage";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../utils";
|
||||
|
||||
const required = (errorMsg) => (value) =>
|
||||
value || typeof value === "number" ? undefined : errorMsg;
|
||||
@@ -119,13 +124,6 @@ const RenderFileUpload = (field) => {
|
||||
</div>
|
||||
));
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIcon = (fileObj, fileType) => {
|
||||
switch (fileType) {
|
||||
case "text/html":
|
||||
|
||||
@@ -11,6 +11,12 @@ import {
|
||||
setFormComplete,
|
||||
} from "../../store/appealType/action";
|
||||
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../utils";
|
||||
|
||||
let BuildCheckSection = (props) => {
|
||||
useEffect(() => {
|
||||
setFormComplete();
|
||||
@@ -64,54 +70,6 @@ let BuildCheckSection = (props) => {
|
||||
alert(1);
|
||||
};
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row" key={1222}>
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
@@ -271,24 +271,25 @@ export const finalComments_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -1328,24 +1328,26 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection:
|
||||
"row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -271,24 +271,25 @@ export const other_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -271,24 +271,25 @@ export const statement_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -271,24 +271,25 @@ export const writtenStatement_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -369,3 +369,51 @@ export const getTempCaseRef = () => {
|
||||
randomString(6).toUpperCase()
|
||||
);
|
||||
};
|
||||
|
||||
export const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
export const bytesToSize = (bytes) => {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user