Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui fixes. #1897

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,22 @@ const BoundaryRelationCreate = () => {
isError: "info",
transitionTime: 100000
});

const bh = [...boundaryData, ...newBoundaryData];
const local = bh.map(item => ({
code: `${hierarchyType}_${item.boundaryType}`.toUpperCase(),
message: item.boundaryType,
module: `hcm-boundary-${hierarchyType.toLowerCase()}`,
locale: locale
}));

const local = [
...boundaryData.map(item => ({
code: `${hierarchyType}_${item.boundaryType.trim().replace(/[\s_]+/g, '')}`.toUpperCase(),
jagankumar-egov marked this conversation as resolved.
Show resolved Hide resolved
message: `${t((defaultHierarchyType + "_" + item?.boundaryType).toUpperCase())}`,
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved
module: `hcm-boundary-${hierarchyType.toLowerCase()}`,
locale: locale
})),
...newBoundaryData.map(item => ({
code: `${hierarchyType}_${item.boundaryType.trim().replace(/[\s_]+/g, '')}`.toUpperCase(),
message: item.boundaryType.trim(),
module: `hcm-boundary-${hierarchyType.toLowerCase()}`,
locale: locale
}))
];
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved


const localisationResult = await localisationMutateAsync(local);
if (!localisationResult.success) {
Expand Down Expand Up @@ -409,17 +417,17 @@ const onConfirmClick=()=>{
setNewBoundaryData((prevItems) => {
// Loop through the array starting from the second element
return prevItems.map((item, idx) => {
item.boundaryType = item.boundaryType.trim();
item.boundaryType = item.boundaryType.trim().replace(/[\s_]+/g, '').toUpperCase();
if (idx === 0) {
if (newHierarchy) item.parentBoundaryType = null;
else {
if (boundaryData.length === 0) item.parentBoundaryType = null;
else item.parentBoundaryType = boundaryData[boundaryData.length - 1].boundaryType.trim();
else item.parentBoundaryType = boundaryData[boundaryData.length - 1].boundaryType;

}
}
if (idx > 0) {
item.parentBoundaryType = prevItems[idx - 1].boundaryType.trim();
item.parentBoundaryType = prevItems[idx - 1].boundaryType.trim().replace(/[\s_]+/g, '');
}
return item;
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ const ViewHierarchy = () => {
return new Promise((resolve, reject) => {
const poll = async () => {
try {
if (retries >= maxRetries) {
setDataCreationGoing(false);
reject(new Error("Max retries reached"));
return;
}
// if (retries >= maxRetries) {
// setDataCreationGoing(false);
// reject(new Error("Max retries reached"));
// return;
// }
jagankumar-egov marked this conversation as resolved.
Show resolved Hide resolved

const searchResponse = await Digit.CustomService.getResponse({
url: "/project-factory/v1/data/_search",
Expand Down Expand Up @@ -353,14 +353,14 @@ const ViewHierarchy = () => {
poll().catch(reject);

// Set a timeout for the entire polling operation
const timeoutDuration = (maxRetries + 1) * pollInterval;
setTimeout(() => {
if (retries < maxRetries) {
// Only reject if not already resolved
setDataCreationGoing(false);
reject(new Error("Polling timeout"));
}
}, timeoutDuration);
// const timeoutDuration = (maxRetries + 1) * pollInterval;
// setTimeout(() => {
// if (retries < maxRetries) {
// // Only reject if not already resolved
// setDataCreationGoing(false);
// reject(new Error("Polling timeout"));
// }
// }, timeoutDuration);
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved
});
};

Expand Down Expand Up @@ -397,7 +397,7 @@ const ViewHierarchy = () => {
return (
<div>
<div className="hierarchy-boundary-sub-heading2">
{`${t(( hierarchyType + "_" + hierItem?.boundaryType).toUpperCase())}`}
{`${t(( hierarchyType + "_" + hierItem?.boundaryType.trim().replace(/[\s_]+/g, '')).toUpperCase())}`}
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div style={{height:"1rem"}}></div>
{/* <Card type={"primary"} variant={"form"} className={"question-card-container"} >
Expand All @@ -416,7 +416,7 @@ const ViewHierarchy = () => {
<div>
<div style={{ display: "flex", justifyContent: "space-between" }} key={index}>
<div className="hierarchy-boundary-sub-heading2">
{`${t(( hierarchyType + "_" + hierItem?.boundaryType).toUpperCase().replace(/\s+/g, "_"))}`}
{`${t(( hierarchyType + "_" + hierItem?.boundaryType.trim().replace(/[\s_]+/g, '')).toUpperCase().replace(/\s+/g, "_"))}`}
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved
</div>
{/* <input
ref={inputRef}
Expand Down Expand Up @@ -448,7 +448,7 @@ const ViewHierarchy = () => {
return (
<div>
<div style={{ display: "flex", justifyContent: "space-between" }} key={index}>
<div className="hierarchy-boundary-sub-heading2">{`${t(( hierarchyType + "_" + hierItem?.boundaryType).toUpperCase().replace(/\s+/g, "_"))}`}
<div className="hierarchy-boundary-sub-heading2">{`${t(( hierarchyType + "_" + hierItem?.boundaryType.trim().replace(/[\s_]+/g, '')).toUpperCase().replace(/\s+/g, "_"))}`}
suryansh-egov marked this conversation as resolved.
Show resolved Hide resolved
</div>
{/* <Uploader
onUpload={() => {}}
Expand Down Expand Up @@ -537,8 +537,8 @@ const ViewHierarchy = () => {
icon="ArrowBack"
style={{marginLeft:"3.5rem"}}
label={t("COMMON_BACK")}
isDisabled={true}
// onClick={{}}
// isDisabled={true}
onClick={()=>{history.push(`/${window.contextPath}/employee/campaign/boundary/home`)}}
type="button"
variation="secondary"
textStyles={{width:'unset'}}
Expand Down