import * as React from 'react'; import {ISuperdesk, IUser} from 'superdesk-api'; interface IProps { closeModal(): void; } interface IState { selectedUserId?: string; fetchedUsers?: Array; } export function getMarkForUserModal(options: { superdesk: ISuperdesk, markForUser: (markedForUserId: string | null) => void, markForUserAndSend: (markedForUserId: string | null) => void, locked: boolean; lockedInOtherSession: boolean, markedForUserInitial?: string, message?: string, }): React.ComponentType { const { superdesk, markForUser, markForUserAndSend, locked, lockedInOtherSession, markedForUserInitial, message, } = options; const {gettext} = superdesk.localization; const { Modal, ModalHeader, ModalBody, ModalFooter, SelectUser, } = superdesk.components; const {logger} = superdesk.utilities; return class MarkForUserModalComponent extends React.Component { constructor(props: IProps) { super(props); this.state = { selectedUserId: markedForUserInitial, }; } render() { return ( {gettext('Mark for user')} { message == null ? null : (
{message}
) } { lockedInOtherSession === true ? (
{gettext('Item is locked and marked user can not be changed.')}
) : null } this.setState({selectedUserId: selectedUser._id})} selectedUserId={this.state.selectedUserId} autoFocus={true} />
{ markedForUserInitial !== undefined ? ( ) : null }
); } }; }