Skip to content

Commit

Permalink
Merge pull request #1392 from harshitg927/issue-1389
Browse files Browse the repository at this point in the history
Fix: Organization Management: Dropdown Navigation, Checkbox Sync, and Address Fields
  • Loading branch information
mozzy11 authored Jan 16, 2025
2 parents ed358fc + 2d06092 commit 5fd5349
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ function OrganizationAddModify() {
isActive: typeOfActivity.isActive,
internetAddress: typeOfActivity.internetAddress,
selectedTypes: typeOfActivity.selectedTypes,
cliaNum: typeOfActivity.cliaNum,
streetAddress: typeOfActivity.streetAddress,
city: typeOfActivity.city,
};

const organizationsManagementIdInfoPost = {
Expand All @@ -169,6 +172,9 @@ function OrganizationAddModify() {
internetAddress: typeOfActivity.internetAddress,
selectedTypes: typeOfActivity.selectedTypes,
organization: typeOfActivity.organization,
cliaNum: typeOfActivity.cliaNum,
streetAddress: typeOfActivity.streetAddress,
city: typeOfActivity.city,
};
setOrgInfo(organizationsManagementIdInfo);
setOrgInfoPost(organizationsManagementIdInfoPost);
Expand Down Expand Up @@ -230,6 +236,42 @@ function OrganizationAddModify() {
}));
}

function handleStreetAddressChange(e) {
setSaveButton(false);
setOrgInfoPost((prevOrgInfoPost) => ({
...prevOrgInfoPost,
streetAddress: e.target.value,
}));
setOrgInfo((prevOrgInfo) => ({
...prevOrgInfo,
streetAddress: e.target.value,
}));
}

function handleCityChange(e) {
setSaveButton(false);
setOrgInfoPost((prevOrgInfoPost) => ({
...prevOrgInfoPost,
city: e.target.value,
}));
setOrgInfo((prevOrgInfo) => ({
...prevOrgInfo,
city: e.target.value,
}));
}

function handleCliaNumberChange(e) {
setSaveButton(false);
setOrgInfoPost((prevOrgInfoPost) => ({
...prevOrgInfoPost,
cliaNum: e.target.value,
}));
setOrgInfo((prevOrgInfo) => ({
...prevOrgInfo,
cliaNum: e.target.value,
}));
}

function handleIsActiveChange(e) {
setSaveButton(false);
setOrgInfoPost((prevOrgInfoPost) => ({
Expand Down Expand Up @@ -501,7 +543,7 @@ function OrganizationAddModify() {
</Column>
<Column lg={8} md={4} sm={4}>
<TextInput
id="internet-address"
id="org-internet-address"
className="defalut"
type="text"
labelText=""
Expand All @@ -519,6 +561,80 @@ function OrganizationAddModify() {
/>
</Column>
</Grid>
<Grid fullWidth={true}>
<Column lg={8} md={4} sm={4}>
<>
<FormattedMessage id="organization.streetAddress" /> :
</>
</Column>
<Column lg={8} md={4} sm={4}>
<TextInput
id="org-street-address"
className="defalut"
type="text"
labelText=""
maxLength={15}
placeholder={intl.formatMessage({
id: "organization.add.placeholder",
})}
// invalid={errors.order && touched.order}
// invalidText={errors.order}
// required={true}
value={
orgInfo && orgInfo.streetAddress
? orgInfo.streetAddress
: ""
}
onChange={(e) => handleStreetAddressChange(e)}
/>
</Column>
</Grid>
<Grid fullWidth={true}>
<Column lg={8} md={4} sm={4}>
<>
<FormattedMessage id="organization.city" /> :
</>
</Column>
<Column lg={8} md={4} sm={4}>
<TextInput
id="org-city"
className="defalut"
type="text"
labelText=""
maxLength={15}
placeholder={intl.formatMessage({
id: "organization.add.placeholder",
})}
// invalid={errors.order && touched.order}
// invalidText={errors.order}
// required={true}
value={orgInfo && orgInfo.city ? orgInfo.city : ""}
onChange={(e) => handleCityChange(e)}
/>
</Column>
</Grid>
<Grid fullWidth={true}>
<Column lg={8} md={4} sm={4}>
<>
<FormattedMessage id="organization.clia.number" /> :
</>
</Column>
<Column lg={8} md={4} sm={4}>
<TextInput
id="org-clia-number"
className="defalut"
type="text"
placeholder={intl.formatMessage({
id: "organization.add.placeholder",
})}
// invalid={errors.order && touched.order}
// invalidText={errors.order}
// required={true}
value={orgInfo && orgInfo.cliaNum ? orgInfo.cliaNum : ""}
onChange={(e) => handleCliaNumberChange(e)}
/>
</Column>
</Grid>
<Grid fullWidth={true}>
<Column lg={8} md={4} sm={4}>
<>
Expand Down Expand Up @@ -623,16 +739,10 @@ function OrganizationAddModify() {
<TableSelectAll
id="table-select-all"
{...getSelectionProps()}
checked={
selectedRowIds.length === pageSize &&
typeOfActivityShow
.slice((page - 1) * pageSize, page * pageSize)
.filter(
(row) =>
!row.disabled &&
selectedRowIds.includes(row.id),
).length === pageSize
}
checked={typeOfActivityShow
.slice((page - 1) * pageSize, page * pageSize)
.filter((row) => !row.disabled)
.every((row) => selectedRowIds.includes(row.id))}
indeterminate={
selectedRowIds.length > 0 &&
selectedRowIds.length <
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ function OrganizationManagement() {
: "",
orgPrefix: item.shortName || "",
active: item.isActive || "",
streetAddress: item.internetAddress || "",
city: item.state || "",
cliaNumber: item.cliaNumber || "",
internetAddress: item.internetAddress || "",
streetAddress: item.streetAddress || "",
city: item.city || "",
cliaNumber: item.cliaNum || "",
};
});
const newOrganizationsManagementListArray = Object.values(
Expand Down Expand Up @@ -212,9 +213,10 @@ function OrganizationManagement() {
: "",
orgPrefix: item.shortName || "",
active: item.isActive || "",
streetAddress: item.internetAddress || "",
city: item.state || "",
cliaNumber: item.cliaNumber || "",
internetAddress: item.internetAddress || "",
streetAddress: item.streetAddress || "",
city: item.city || "",
cliaNumber: item.cliaNum || "",
};
},
);
Expand Down Expand Up @@ -393,6 +395,12 @@ function OrganizationManagement() {
id: "organization.isActive",
}),
},
{
key: "internetAddress",
header: intl.formatMessage({
id: "organization.internetaddress",
}),
},
{
key: "streetAddress",
header: intl.formatMessage({
Expand Down Expand Up @@ -612,6 +620,12 @@ function OrganizationManagement() {
id: "organization.isActive",
}),
},
{
key: "internetAddress",
header: intl.formatMessage({
id: "organization.internetaddress",
}),
},
{
key: "streetAddress",
header: intl.formatMessage({
Expand Down
26 changes: 20 additions & 6 deletions frontend/src/components/common/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,31 @@ function AutoComplete(props) {
};

const onKeyDown = (e) => {
// Handeling enter key
const { onSelect } = props;
if (e.keyCode === 13) {
setActiveSuggestion(0);
setUserInput(filteredSuggestions[activeSuggestion]);
setShowSuggestions(false);
} else if (e.keyCode === 38) {
if (filteredSuggestions[activeSuggestion]) {
const selectedValue = filteredSuggestions[activeSuggestion].value;
setUserInput(selectedValue);
setTextValue(selectedValue);
setShowSuggestions(false);
setInvalid(false);

if (typeof onSelect === "function") {
onSelect(filteredSuggestions[activeSuggestion].id);
}
}
}
// Handeling up arrow
else if (e.keyCode === 38) {
if (activeSuggestion === 0) {
return;
}
setActiveSuggestion(activeSuggestion - 1);
} else if (e.keyCode === 40) {
if (activeSuggestion - 1 === filteredSuggestions.length) {
}
// Handeling down arrow
else if (e.keyCode === 40) {
if (activeSuggestion === filteredSuggestions.length - 1) {
return;
}
setActiveSuggestion(activeSuggestion + 1);
Expand Down

0 comments on commit 5fd5349

Please sign in to comment.