Skip to content

Commit

Permalink
Added ShowMore Popup for Boundary Summary Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramkrishna-egov committed Oct 25, 2024
1 parent 5e88a4c commit 78be1ba
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import FacilityPopup from "./components/FacilityPopup";
import UserAccessMgmt from "./components/UserAccessMgmt";
import UserAccessMgmtTableWrapper from "./components/UserAccessMgmtTableWrapper";
import { DataMgmtComponent } from "./components/DataMgmtComponent";
import { ShowMoreWrapper } from "./components/ShowMoreWrapper";

export const MicroplanModule = ({ stateCode, userType, tenants }) => {
const { path, url } = useRouteMatch();
Expand Down Expand Up @@ -82,7 +83,8 @@ const componentsToRegister = {
FacilityPopup,
UserAccessMgmt,
UserAccessMgmtTableWrapper,
DataMgmtComponent
DataMgmtComponent,
ShowMoreWrapper,
};

export const initMicroplanComponents = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { Fragment, useEffect, useState } from "react";
import { Button, PopUp, Chip, Loader,} from "@egovernments/digit-ui-components";
import { useTranslation } from "react-i18next";


export const ShowMoreWrapper = ({ setShowPopUp, alreadyQueuedSelectedState, heading="" }) => {
const { t } = useTranslation();

return (
<PopUp
className={""}
style={{
maxWidth: '40%'
}}
type={"default"}
heading={t(heading)}
children={[]}
onOverlayClick={() => {
setShowPopUp(false);
}}
onClose={() => {
setShowPopUp(false);
}}
>
<div className="digit-tag-container userAccessCell">
{alreadyQueuedSelectedState?.map((item, index) => (
<Chip
key={index}
text={t(item)}
className=""
error=""
extraStyles={{}}
iconReq=""
hideClose={true}
/>
))}
</div>
</PopUp>
);

};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import DataTable from "react-data-table-component";
import { CardSubHeader, Card } from "@egovernments/digit-ui-react-components";
import { tableCustomStyle } from "./tableCustomStyle";
import { ShowMoreWrapper } from "./ShowMoreWrapper";


function groupEmployeesByPlan(data, planData) {
Expand Down Expand Up @@ -31,43 +32,6 @@ function groupEmployeesByPlan(data, planData) {
return groupedEmployees ? Object.values(groupedEmployees) : [];
}

const Wrapper = ({ setShowPopUp, alreadyQueuedSelectedState }) => {

const { t } = useTranslation();
return (
<PopUp
className={""}
style={{
maxWidth: '40%'
}}
type={"default"}
heading={t("MICROPLAN_ADMINISTRATIVE_AREA")}
children={[]}
onOverlayClick={() => {
setShowPopUp(false);
}}
onClose={() => {
setShowPopUp(false);
}}
>
<div className="digit-tag-container userAccessCell">
{alreadyQueuedSelectedState?.map((item, index) => (
<Chip
key={index}
text={t(item)}
className=""
error=""
extraStyles={{}}
iconReq=""
hideClose={true}
/>
))}
</div>
</PopUp>
);

};

const UserAccessMgmtTableWrapper = ({ role,}) => {
const { t } = useTranslation();
const tenantId = Digit.ULBService.getCurrentTenantId();
Expand Down Expand Up @@ -189,10 +153,11 @@ const UserAccessMgmtTableWrapper = ({ role,}) => {
/>
)}
{showPopUp && (
<Wrapper
setShowPopUp={setShowPopUp}
alreadyQueuedSelectedState={row?.planData?.jurisdiction}
/>
<ShowMoreWrapper
setShowPopUp={setShowPopUp}
alreadyQueuedSelectedState={row?.planData?.jurisdiction}
heading={"MICROPLAN_ADMINISTRATIVE_AREA"}
/>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,71 @@
import React from 'react'
import React, { useState } from 'react'
import HeaderComp from './HeaderComp';
import { Card } from '@egovernments/digit-ui-components';
import { Chip } from '@egovernments/digit-ui-components';
import { Card, Button, PopUp, Chip, Loader } from '@egovernments/digit-ui-components';
import { ShowMoreWrapper } from './ShowMoreWrapper';
import { useTranslation } from 'react-i18next';

const SubBoundaryView = ({ title, arr }) => {
const [showPopUp, setShowPopUp] = useState(false);
const { t } = useTranslation();

const openPopUp = () => {
setShowPopUp(true);
};

return (
<div>
{
arr && arr.length > 0 ? (
<Card>
<HeaderComp title={title} />
{/* Flex container for the chips */}
<div className="subBoundarycomp-container">
{arr.map((el, ind) => {
<div className="digit-tag-container userAccessCell">
{arr?.slice(0, 10)?.map((el, ind) => {
return (
<div className="digit-tag-container">
<Chip
key={ind}
className=""
error=""
extraStyles={{}}
iconReq=""
onClick={function noRefCheck() { }}
onTagClick={function noRefCheck() { }}
text={el}
hideClose={true}
text={t(el)}
/>
</div>
);
})}
}


)}
{arr?.length > (10) && (
<Button
label={`+${arr?.length - (10)} ${t("ES_MORE")}`}
onClick={() => openPopUp()}
variation="link"
style={{
height: "2rem",
minWidth: "4.188rem",
minHeight: "2rem",
padding: "0.5rem",
justifyContent: "center",
alignItems: "center",
}}
textStyles={{
height: "auto",
fontSize: "0.875rem",
fontWeight: "400",
width: "100%",
lineHeight: "16px",
color: "#C84C0E",
}}
/>
)}
{showPopUp && (
<ShowMoreWrapper
setShowPopUp={setShowPopUp}
alreadyQueuedSelectedState={arr}
heading={title}
/>
)}
</div>
</Card>
) : (
Expand Down

0 comments on commit 78be1ba

Please sign in to comment.