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

Add Belga user search using credentials to the reassign modal [SDBELGA-770] #1919

Merged
merged 10 commits into from
Mar 1, 2024
23 changes: 13 additions & 10 deletions client/components/Assignments/AssignmentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
Row,
SelectInput,
ColouredValueInput,
SelectUserInput,
} from '../UI/Form';
import {ContactsPreviewList, SelectSearchContactsField} from '../Contacts';
import {SelectUser} from 'superdesk-core/scripts/core/ui/components/SelectUser';

export class AssignmentEditorComponent extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -297,15 +297,18 @@ export class AssignmentEditorComponent extends React.Component {
/>
</Row>
) : (
<SelectUserInput
field={this.FIELDS.USER}
label={gettext('User')}
value={this.state.user}
onChange={this.onUserChange}
users={this.state.filteredUsers}
popupContainer={popupContainer}
readOnly={disableUserSelection}
/>
<Row style={{padding: '2rem 0', margin: '0 0 1.8em 0'}}>
<SelectUser
selectedUserId = {this.state.userId}
onSelect={(user) => {
this.onUserChange(null, user);
}}
autoFocus={false}
horizontalSpacing={true}
clearable={true}
data-test-id= {this.FIELDS.USER}
/>
</Row>
)}

{showPriority && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class EditCoverageAssignmentModalComponent extends React.Component {
show={true}
onHide={handleHide}
fill={false}
removeTabIndexAttribute={true}
>
<Modal.Header>
<h3 className="modal__heading">{gettext('Coverage Assignment Details')}</h3>
Expand Down
38 changes: 24 additions & 14 deletions client/components/Coverages/CoverageAddAdvancedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {getUserInterfaceLanguageFromCV} from '../../utils/users';
import {getVocabularyItemFieldTranslated} from '../../utils/vocabularies';

import Modal from '../Modal';
import {SelectInput, SelectUserInput} from '../UI/Form';
import {SelectInput} from '../UI/Form';
import {SelectUser} from 'superdesk-core/scripts/core/ui/components/SelectUser';

const isInvalid = (coverage) => coverage.user && !coverage.desk;

Expand All @@ -35,7 +36,7 @@ interface ICoverageSelector {
name: IG2ContentType['name'];
icon: string;
desk: IDesk['_id'];
user: IUser['_id'];
user: IUser;
status: IPlanningNewsCoverageStatus;
popupContainer: any;
filteredDesks: Array<IDesk>;
Expand Down Expand Up @@ -228,6 +229,7 @@ export class CoverageAddAdvancedModal extends React.Component<IProps, IState> {
event.stopPropagation();
this.props.close();
}}
removeTabIndexAttribute={true}
>
<Modal.Header>
<h3 className="modal__heading">
Expand Down Expand Up @@ -276,18 +278,26 @@ export class CoverageAddAdvancedModal extends React.Component<IProps, IState> {
</div>

<div className="grid__item grid__item--col4">
<SelectUserInput
field={'user'}
value={coverage.user}
onChange={(field, value) => this.onUserChange(coverage, value)}
labelField="name"
keyField="_id"
users={coverage.filteredUsers}
clearable={true}
popupContainer={() => coverage.popupContainer}
inline={true}
/>
<div ref={(node) => coverage.popupContainer = node} />
<div
style={
{
margin: '0 0 1.8em 0',
paddingBlockStart: '1.8rem',
position: 'relative'}
}
>
<SelectUser
selectedUserId = {coverage.user?._id}
onSelect={(user) => {
this.onUserChange(coverage, user);
}}
autoFocus={false}
horizontalSpacing={true}
clearable={true}
data-test-id= {'user'}
/>
<div ref={(node) => coverage.popupContainer = node} />
</div>
</div>

<div className="grid__item grid__item--col4">
Expand Down
Loading