-
Notifications
You must be signed in to change notification settings - Fork 46
Pgr hrms dtpk #2868
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
base: develop
Are you sure you want to change the base?
Pgr hrms dtpk #2868
Changes from all commits
8903191
66dff87
317e90e
b351ac0
8263473
dee92e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,6 +18,11 @@ const SelectDateofBirthEmployment = ({ t, config, onSelect, formData = {}, userT | |||||||||
}, | ||||||||||
]; | ||||||||||
|
||||||||||
const fieldStyle = { | ||||||||||
maxWidth: "36.25rem", | ||||||||||
paddingRight: "2.5rem", | ||||||||||
}; | ||||||||||
|
||||||||||
function setValue(value, input) { | ||||||||||
onSelect(config.key, { ...formData[config.key], [input]: value }); | ||||||||||
} | ||||||||||
|
@@ -31,7 +36,9 @@ const SelectDateofBirthEmployment = ({ t, config, onSelect, formData = {}, userT | |||||||||
{t(input.label)} | ||||||||||
{input.isMandatory ? " * " : null} | ||||||||||
</CardLabel> | ||||||||||
<div className="field"> | ||||||||||
<div className="field" style={{ | ||||||||||
fieldStyle | ||||||||||
}}> | ||||||||||
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix style application syntax error. The style object is not being applied correctly. The current syntax creates a nested object instead of applying the fieldStyle directly. - <div className="field" style={{
- fieldStyle
- }}>
+ <div className="field" style={fieldStyle}> 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||
<DatePicker | ||||||||||
key={input.name} | ||||||||||
date={formData && formData[config.key] ? formData[config.key][input.name] : undefined} | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import { Toast } from "@egovernments/digit-ui-components"; | |
|
||
const CreateEmployee = () => { | ||
const tenantId = Digit.ULBService.getCurrentTenantId(); | ||
const userInfo = Digit.UserService.getUser(); | ||
const [canSubmit, setSubmitValve] = useState(false); | ||
const [mobileNumber, setMobileNumber] = useState(null); | ||
const [showToast, setShowToast] = useState(null); | ||
|
@@ -144,6 +145,34 @@ const CreateEmployee = () => { | |
}; | ||
|
||
|
||
const ToastOverlay = ({ showToast, t, onClose }) => { | ||
if (!showToast) return null; | ||
return ( | ||
<div style={{ | ||
position: "fixed", | ||
bottom: "100px", | ||
left: "50%", | ||
transform: "translateX(-50%)", | ||
zIndex: 9999, | ||
maxWidth: "90%", | ||
}}> | ||
<Toast | ||
type={showToast.key} | ||
label={t(showToast.label)} | ||
onClose={onClose} | ||
/> | ||
</div> | ||
); | ||
}; | ||
Comment on lines
+148
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Consider extracting inline styles to a CSS class or styled component. The ToastOverlay component improves code organization, but the inline styles could be better managed. Consider creating a CSS class or using styled-components: .toast-overlay {
position: fixed;
bottom: 100px;
left: 50%;
transform: translateX(-50%);
z-index: 9999;
max-width: 90%;
} - <div style={{
- position: "fixed",
- bottom: "100px",
- left: "50%",
- transform: "translateX(-50%)",
- zIndex: 9999,
- maxWidth: "90%",
- }}>
+ <div className="toast-overlay"> 🤖 Prompt for AI Agents
|
||
|
||
function hasMatchingJurisdiction(jurisdictions = [], parentCity = "") { | ||
if (!Array.isArray(jurisdictions) || !parentCity) return false; | ||
|
||
return jurisdictions.some(j => j?.boundary === parentCity); | ||
} | ||
|
||
|
||
|
||
|
||
const onSubmit = async (data) => { | ||
const hasCurrentAssignment = data?.Assignments?.some(assignment => assignment?.isCurrentAssignment === true); | ||
|
@@ -155,10 +184,20 @@ const CreateEmployee = () => { | |
}; | ||
}); | ||
|
||
|
||
if(!hasMatchingJurisdiction(data?.Jurisdictions,userInfo.info.tenantId)){ | ||
setShowToast({ key: "error", label: "ERR_BASE_TENANT_MANDATORY" }); | ||
return; | ||
} | ||
|
||
if(!canSubmit){ | ||
setShowToast({ key: "error", label: "ERR_ALL_MANDATORY_FIELDS" }); | ||
return; | ||
} | ||
|
||
|
||
|
||
|
||
if (!hasCurrentAssignment) { | ||
setShowToast({ key: "error", label: "ERR_NO_CURRENT_ASSIGNMENT" }); | ||
return; | ||
|
@@ -167,9 +206,11 @@ const CreateEmployee = () => { | |
setShowToast({ key: "error", label: "ERR_BASE_TENANT_MANDATORY" }); | ||
return; | ||
} | ||
|
||
|
||
if (!Object.values(data.Jurisdictions.reduce((acc, sum) => { | ||
if (sum && sum?.tenantId) { | ||
acc[sum.tenantId] = acc[sum.tenantId] ? acc[sum.tenantId] + 1 : 1; | ||
if (sum && sum?.boundary) { | ||
acc[sum.boundary] = acc[sum.boundary] ? acc[sum.boundary] + 1 : 1; | ||
} | ||
return acc; | ||
}, {})).every(s => s == 1)) { | ||
|
@@ -281,15 +322,8 @@ const CreateEmployee = () => { | |
// isDisabled={!canSubmit} | ||
label={t("HR_COMMON_BUTTON_SUBMIT")} | ||
/> | ||
{showToast && ( | ||
<Toast | ||
type={showToast.key} | ||
label={t(showToast.label)} | ||
onClose={() => { | ||
setShowToast(null); | ||
}} | ||
/> | ||
)} | ||
|
||
<ToastOverlay showToast={showToast} t={t} onClose={() => setShowToast(null)} /> | ||
</div> | ||
); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Fix markdown formatting issues.
The changelog entry has several formatting issues that should be addressed:
Also consider using a consistent date format with other entries (some use DD-MMM-YYYY, others use DD-Month-YYYY).
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
1-1: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
1-1: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
2-2: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
2-2: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
🤖 Prompt for AI Agents