-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5c6adb
commit 02b1cf2
Showing
12 changed files
with
273 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
micro-ui/web/micro-ui-internals/example/src/components/DocumentCard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import React from 'react' | ||
import { | ||
Card, | ||
CardCaption, | ||
CardHeader, | ||
CardText, | ||
LinkButton, | ||
DownloadImgIcon, | ||
ViewsIcon, | ||
ExternalLinkIcon, | ||
GenericFileIcon, | ||
PDFSvg | ||
} from "@egovernments/digit-ui-react-components"; | ||
import { format } from 'date-fns'; | ||
// import { getFileSize } from '../../utils'; | ||
var Digit = window.Digit || {}; | ||
|
||
|
||
const DocumentCard = ({ documentTitle, documentSize = 2.3, lastModifiedData, description, filestoreId, documentLink, t }) => { | ||
let isMobile = window.Digit.Utils.browser.isMobile(); | ||
|
||
|
||
return ( | ||
<div className="notice_and_circular_main"> | ||
<div className="notice_and_circular_image"> | ||
<GenericFileIcon height={`${isMobile ? 66 : 100}`} width={`${isMobile ? 53 : 100}`} /> | ||
</div> | ||
<div className="notice_and_circular_content"> | ||
<div className="notice_and_circular_heading_mb"> | ||
<CardHeader>{documentTitle}</CardHeader> | ||
|
||
{/* {documentSize ? <CardCaption>{getFileSize(documentSize)}</CardCaption> : null} */} | ||
</div> | ||
<div className="notice_and_circular_caption"> | ||
<CardCaption>{`${t(`CE_DCOUMENT_UPLOADED_ON`)} ${lastModifiedData ? format(new Date(lastModifiedData), "do MMMM yyyy") : "-"}`}</CardCaption> | ||
</div> | ||
<div className="notice_and_circular_text"> | ||
<CardText> | ||
{description?.length ? description : "NA"} | ||
</CardText> | ||
</div> | ||
<div className="view_download_main"> | ||
{filestoreId && filestoreId.length ? <LinkButton | ||
|
||
label={ | ||
<div className="views" | ||
// onClick={() => openUploadedDocument(filestoreId ? filestoreId : null, documentTitle)} | ||
> | ||
<ViewsIcon /> | ||
<p>{t(`CE_DOCUMENT_VIEW_LINK`)}</p> | ||
</div> | ||
} | ||
/> : null | ||
} | ||
{documentLink && documentLink.length ? | ||
(<LinkButton | ||
|
||
label={ | ||
<div className="views" | ||
// onClick={() => openDocumentLink(documentLink, documentTitle)} | ||
> | ||
<ExternalLinkIcon /> | ||
<p>{t(`CE_DOCUMENT_OPEN_LINK`)}</p> | ||
</div> | ||
} | ||
/>) : null | ||
} | ||
{filestoreId && filestoreId.length ? | ||
<LinkButton | ||
label={ | ||
<div className="views download_views_padding" > | ||
<DownloadImgIcon /> | ||
<p>{t(`CE_DOCUMENT_DOWNLOAD_LINK`)}</p> | ||
</div> | ||
} | ||
// onClick={() => downloadDocument(filestoreId ? filestoreId : null, documentTitle)} | ||
/> : null | ||
} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default DocumentCard; |
169 changes: 169 additions & 0 deletions
169
micro-ui/web/micro-ui-internals/example/src/components/EngagementCard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import React, { useEffect, Fragment, useMemo, useState } from "react"; | ||
import { Link } from "react-router-dom"; | ||
import { useTranslation } from "react-i18next"; | ||
import { | ||
EmployeeModuleCard, | ||
DocumentIconSolid, | ||
EventsIconSolid, | ||
PMBIconSolid, | ||
SurveyIconSolid, | ||
PropertyHouse, | ||
} from "@egovernments/digit-ui-react-components"; | ||
var Digit = window.Digit || {}; | ||
|
||
const EngagementCard = () => { | ||
const userRoles = Digit.SessionStorage.get("User")?.info?.roles; | ||
const isEmployee = userRoles.find((role) => role.code === "EMPLOYEE"); | ||
|
||
useEffect(() => { | ||
Digit.SessionStorage.set("CITIZENSURVEY.INBOX", null); | ||
}, []); | ||
|
||
if (!isEmployee) return null; | ||
const tenantId = Digit.ULBService.getCurrentTenantId(); | ||
const { data: documentsCount, isLoading: isLoadingDocs } = Digit.Hooks.engagement.useDocSearch( | ||
{ tenantIds: tenantId }, | ||
{ | ||
select: (data) => { | ||
return data?.totalCount; | ||
}, | ||
} | ||
); | ||
const { data: MessagesCount, isLoading: isLoadingMessages } = Digit.Hooks.events.useInbox( | ||
tenantId, | ||
{}, | ||
{ status: "ACTIVE,INACTIVE", eventTypes: "BROADCAST" }, | ||
{ | ||
select: (data) => data?.totalCount, | ||
} | ||
); | ||
|
||
const { data: totalEvents, isLoading: isLoadingEvents } = Digit.Hooks.events.useInbox( | ||
tenantId, | ||
{}, | ||
{ eventTypes: "EVENTSONGROUND" }, | ||
{ | ||
select: (data) => data?.totalCount, | ||
} | ||
); | ||
|
||
const { data: surveysCount, isLoading: isLoadingSurveys } = Digit.Hooks.survey.useSearch( | ||
{ tenantIds: tenantId }, | ||
{ select: (data) => data?.TotalCount } | ||
); | ||
|
||
const totalDocsCount = useMemo(() => (isLoadingDocs ? "-" : documentsCount), [isLoadingDocs, documentsCount]); | ||
const totalEventsCount = useMemo(() => (isLoadingEvents ? "-" : totalEvents), [isLoadingEvents, totalEvents]); | ||
const totalMessagesCount = useMemo(() => (isLoadingMessages ? "-" : MessagesCount), [isLoadingMessages, MessagesCount]); | ||
const totalSurveysCount = useMemo(() => (isLoadingSurveys ? "-" : surveysCount), [isLoadingSurveys, surveysCount]); | ||
|
||
const { t } = useTranslation(); | ||
let result = null; | ||
|
||
const propsForSurveyModuleCard = { | ||
Icon: "ImportContacts", | ||
moduleName: t("CS_COMMON_SURVEYS"), | ||
kpis: [ | ||
{ | ||
count: totalSurveysCount, | ||
label: t("TOTAL_SURVEYS"), | ||
link: `/${window?.contextPath}/employee/engagement/surveys/inbox`, | ||
}, | ||
], | ||
links: [ | ||
{ | ||
count: totalSurveysCount, | ||
label: t("ES_TITLE_INBOX"), | ||
link: `/${window?.contextPath}/employee/engagement/surveys/inbox`, | ||
}, | ||
{ | ||
label: t("CS_COMMON_NEW_SURVEY"), | ||
link: `/${window?.contextPath}/employee/engagement/surveys/create`, | ||
}, | ||
], | ||
}; | ||
|
||
const propsForPMBModuleCard = { | ||
Icon: "Campaign", | ||
moduleName: t("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"), | ||
kpis: [ | ||
{ | ||
count: totalMessagesCount, | ||
label: t("TOTAL_MESSAGES"), | ||
link: `/${window?.contextPath}/employee/engagement/messages/inbox`, | ||
}, | ||
], | ||
|
||
links: [ | ||
{ | ||
count: totalMessagesCount, | ||
label: t("ES_TITLE_INBOX"), | ||
link: `/${window?.contextPath}/employee/engagement/messages/inbox`, | ||
}, | ||
{ | ||
label: t("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"), | ||
link: `/${window?.contextPath}/employee/engagement/messages/create`, | ||
}, | ||
], | ||
}; | ||
const propsForEventsModuleCard = { | ||
Icon: "Event", | ||
moduleName: t("TOTAL_EVENTS"), | ||
kpis: [ | ||
{ | ||
count: totalEventsCount, | ||
label: t("TOTAL_EVENTS"), | ||
link: `/${window?.contextPath}/employee/engagement/event/inbox`, | ||
}, | ||
], | ||
|
||
links: [ | ||
{ | ||
count: totalEventsCount, | ||
label: t("ES_TITLE_INBOX"), | ||
link: `/${window?.contextPath}/employee/engagement/event/inbox`, | ||
}, | ||
{ | ||
label: t("ES_TITLE_NEW_EVENTS"), | ||
link: `/${window?.contextPath}/employee/engagement/event/new-event`, | ||
}, | ||
], | ||
}; | ||
const propsForDocumentModuleCard = { | ||
Icon: "File", | ||
moduleName: t("ES_TITLE_DOCS"), | ||
kpis: [ | ||
{ | ||
count: totalDocsCount, | ||
label: t("TOTAL_DOCUMENTS"), | ||
link: `/${window?.contextPath}/employee/engagement/documents/inbox`, | ||
}, | ||
], | ||
links: [ | ||
{ | ||
count: totalDocsCount, | ||
label: t("ES_TITLE_INBOX"), | ||
link: `/${window?.contextPath}/employee/engagement/documents/inbox`, | ||
}, | ||
{ | ||
label: t("NEW_DOCUMENT_TEXT"), | ||
link: `/${window?.contextPath}/employee/engagement/documents/new-doc`, | ||
}, | ||
], | ||
}; | ||
|
||
const engagementSubModulesProps = [propsForDocumentModuleCard, propsForEventsModuleCard, propsForPMBModuleCard, propsForSurveyModuleCard]; | ||
|
||
if (isEmployee) | ||
result = ( | ||
<> | ||
{engagementSubModulesProps.map((propsForModuleCard, index) => ( | ||
<EmployeeModuleCard key={index} longModuleName={true} {...propsForModuleCard} /> | ||
))} | ||
</> | ||
); | ||
|
||
return result; | ||
}; | ||
|
||
export default EngagementCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
micro-ui/web/micro-ui-internals/packages/modules/pgr/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
micro-ui/web/micro-ui-internals/packages/modules/workbench/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters