Skip to content
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

Fix: Organization Management: Dropdown Navigation, Checkbox Sync, and Address Fields #1392

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,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 +537,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 +555,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="number"
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 +733,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
20 changes: 14 additions & 6 deletions frontend/src/components/common/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,25 @@ function AutoComplete(props) {
};

const onKeyDown = (e) => {
// Handeling enter key
if (e.keyCode === 13) {
setActiveSuggestion(0);
setUserInput(filteredSuggestions[activeSuggestion]);
setShowSuggestions(false);
} else if (e.keyCode === 38) {
e.preventDefault();
if (filteredSuggestions[activeSuggestion]) {
const selectedValue = filteredSuggestions[activeSuggestion].value;
setTextValue(selectedValue); // Update local state
setShowSuggestions(false);
}
}
// 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
Loading