-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added updated api for census and workflow integration (#1598)
* added updated api for census and workflow integration * updated approve popup to workflow popup * updated workflow action * resolved coderabbit comments --------- Co-authored-by: rachana-egov <[email protected]> Co-authored-by: Nipun Arora <[email protected]>
- Loading branch information
1 parent
b81defc
commit 4594453
Showing
10 changed files
with
203 additions
and
757 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
/> --> | ||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> | ||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> | ||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].3/dist/index.css" /> | ||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].4/dist/index.css" /> | ||
|
||
<!-- added below css for hcm-workbench module inclusion--> | ||
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> --> | ||
|
2 changes: 1 addition & 1 deletion
2
health/micro-ui/web/micro-ui-internals/packages/css/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@egovernments/digit-ui-health-css", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"license": "MIT", | ||
"main": "dist/index.css", | ||
"author": "Jagankumar <[email protected]>", | ||
|
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 |
---|---|---|
|
@@ -1146,5 +1146,5 @@ tbody { | |
} | ||
|
||
.digit-action-bar-wrap div { | ||
width: 100%; | ||
width: unset; | ||
} |
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
104 changes: 104 additions & 0 deletions
104
...icro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/WorkflowPopUp.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,104 @@ | ||
import React, { useState } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { PopUp, Button, TextArea, ErrorMessage } from "@egovernments/digit-ui-components"; | ||
import { useMyContext } from "../utils/context"; // Ensure that the translation function `t` is handled here | ||
|
||
|
||
{/* use this component for comment like this | ||
<WorkflowPopUp | ||
onClose={() => setShowPopup(false)} | ||
onSubmit={(comment) => console.log("Submitted comment:", comment)} | ||
census={censusData} | ||
/> */} | ||
|
||
const WorkflowPopUp = ({ onClose, onSubmit, heading }) => { | ||
const { state } = useMyContext(); // Extract state from context | ||
const { t } = useTranslation(); | ||
|
||
const [comment, setComment] = useState(""); // Track TextArea input | ||
const [error, setError] = useState(false); // Track error state | ||
|
||
// Handle TextArea input change | ||
const handleTextAreaChange = (e) => { | ||
setComment(e.target.value); | ||
if (e.target.value.trim()) { | ||
setError(false); // Reset error when input is not empty | ||
} | ||
}; | ||
|
||
// Handle keypress "Enter" to submit the form | ||
const handleKeyPress = (e) => { | ||
if (e.key === "Enter") { | ||
handleSave(); | ||
} | ||
}; | ||
|
||
// Handle Save | ||
const handleSave = () => { | ||
if (!comment.trim()) { | ||
setError(true); // Show error if TextArea is empty | ||
return; // Do not proceed further | ||
} | ||
|
||
// Send the comment to the parent component or handle it here | ||
if (onSubmit) { | ||
onSubmit(comment); // Pass the comment via onSubmit prop | ||
} | ||
|
||
// Close the popup after submitting the comment | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<PopUp | ||
onClose={onClose} | ||
heading={t(heading)} | ||
children={[ | ||
<div> | ||
<div key="comment-section" className="comment-label"> | ||
{t(`HCM_MICROPLAN_ADD_COMMENT_LABEL`)}{" "} | ||
<span className="required">*</span> | ||
</div> | ||
<TextArea | ||
style={{ maxWidth: "100%" }} | ||
value={comment} | ||
onChange={handleTextAreaChange} | ||
onKeyPress={handleKeyPress} // Handle "Enter" key to submit | ||
error={error ? true : false} // Show error message if needed | ||
/> | ||
{error && ( | ||
<ErrorMessage | ||
message={t('HCM_MICROPLAN_ADD_COMMENT_REQUIRED')} | ||
truncateMessage={true} | ||
maxLength={256} | ||
showIcon={true} | ||
/> | ||
)} | ||
</div> | ||
]} | ||
onOverlayClick={onClose} | ||
footerChildren={[ | ||
<Button | ||
key="close-button" | ||
className={"campaign-type-alert-button"} | ||
type={"button"} | ||
size={"large"} | ||
variation={"secondary"} | ||
label={t(`HCM_MICROPLAN_EDIT_POPULATION_CLOSE`)} | ||
onClick={onClose} | ||
/>, | ||
<Button | ||
key="approve-button" | ||
className={"campaign-type-alert-button"} | ||
type={"button"} | ||
size={"large"} | ||
variation={"primary"} | ||
label={t(`HCM_MICROPLAN_EDIT_POPULATION_SEND_FOR_APPOVAL`)} | ||
onClick={handleSave} // Call the save function | ||
/>, | ||
]} | ||
/> | ||
); | ||
}; | ||
|
||
export default WorkflowPopUp; |
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
Oops, something went wrong.