fix(user): default to current company in user edit popup
Pass currentCompanyId to Popup so the form defaults to the currently active company instead of always picking the first item from companyList.
This commit is contained in:
@@ -29,6 +29,7 @@ export default (props: {
|
|||||||
action: NewAction;
|
action: NewAction;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
roleList: API.RolesListItem[];
|
roleList: API.RolesListItem[];
|
||||||
|
currentCompanyId: number | string;
|
||||||
companyList: API.CompanyListItem[];
|
companyList: API.CompanyListItem[];
|
||||||
dataSourceList: API.DataSourceListItem[];
|
dataSourceList: API.DataSourceListItem[];
|
||||||
formValues: Partial<UserListItem | undefined>;
|
formValues: Partial<UserListItem | undefined>;
|
||||||
@@ -48,6 +49,7 @@ export default (props: {
|
|||||||
roleList,
|
roleList,
|
||||||
companyList,
|
companyList,
|
||||||
dataSourceList,
|
dataSourceList,
|
||||||
|
currentCompanyId,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const dataSourceForm = (
|
const dataSourceForm = (
|
||||||
@@ -165,7 +167,7 @@ export default (props: {
|
|||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
companyId: companyList[0]?.id,
|
companyId: currentCompanyId || companyList[0]?.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
open={visible}
|
open={visible}
|
||||||
|
|||||||
@@ -412,6 +412,7 @@ const User: React.FC = () => {
|
|||||||
visible={visible}
|
visible={visible}
|
||||||
formValues={formValues}
|
formValues={formValues}
|
||||||
roleList={roleList}
|
roleList={roleList}
|
||||||
|
currentCompanyId={companyType}
|
||||||
companyList={companyList}
|
companyList={companyList}
|
||||||
dataSourceList={dataSourceList}
|
dataSourceList={dataSourceList}
|
||||||
onDone={handleDone}
|
onDone={handleDone}
|
||||||
|
|||||||
Reference in New Issue
Block a user