diff --git a/sei-camunda-modeler/client/RequestListPlugin.js b/sei-camunda-modeler/client/RequestListPlugin.js index ad7cf0e..963251d 100644 --- a/sei-camunda-modeler/client/RequestListPlugin.js +++ b/sei-camunda-modeler/client/RequestListPlugin.js @@ -1,6 +1,7 @@ import React, { Fragment } from 'camunda-modeler-plugin-helpers/react'; import { Modal, Fill } from 'camunda-modeler-plugin-helpers/components'; import CandidateUserModal from './modal/CandidateUserModal'; +import AssigneeModal from './modal/AssigneeModal'; import TipdocModal from './modal/TipdocModal'; import CandidateGroupsModal from './modal/CandidateGroupsModal'; import LoginModal from './modal/LoginModal'; @@ -140,6 +141,8 @@ export default class RequestListPlugin extends React.PureComponent { constructor(props) { super(props); + this.inputFiltro = React.createRef(); + this.loadingIcon = LoadingIcon; this.state = { showModal: false, @@ -162,8 +165,12 @@ export default class RequestListPlugin extends React.PureComponent { this.setIdContent = this.setIdContent.bind(this); this.setIdProcess = this.setIdProcess.bind(this); this.selectContent = this.selectContent.bind(this); + this.setContentFilter = this.setContentFilter.bind(this); this.selectProcess = this.selectProcess.bind(this); + this.setProcessFilter = this.setProcessFilter.bind(this); + this.setAssignee = this.setAssignee.bind(this); this.selectAssignee = this.selectAssignee.bind(this); + this.setAssigneeFilter = this.setAssigneeFilter.bind(this); this.setCandidateUser = this.setCandidateUser.bind(this); this.selectCandidateUser = this.selectCandidateUser.bind(this); @@ -350,7 +357,7 @@ export default class RequestListPlugin extends React.PureComponent { const { modeler } = event; modeler.on('propertiesPanel.changed', ({ current: { element } }) => { - + if (TYPES.includes(element.type)) { if (element.type == 'bpmn:Participant') { @@ -373,6 +380,9 @@ export default class RequestListPlugin extends React.PureComponent { } async componentDidUpdate(_, prevState) { + if (prevState.documentType != '') { + this.state.documentType = ''; + } if (!prevState.showModal && this.state.showModal) { let usersData = []; @@ -408,6 +418,7 @@ export default class RequestListPlugin extends React.PureComponent { data, filteredData: data, usersData, + filteredProcess: processData, filteredUsers: usersData, groupData, filteredGroups: groupData, @@ -520,6 +531,18 @@ export default class RequestListPlugin extends React.PureComponent { } } + setContentFilter(e) { + const filter = e.target.value; + const { data } = this.state; + + let filteredData = data; + + if (filter) { + filteredData = data.filter(d => d.titulo.toLowerCase().includes(filter.toLowerCase())); + } + this.setState({ filteredData }); + } + selectProcess(e) { const target = e.target; if (target.classList.contains('btn-select-repo')) { @@ -529,6 +552,18 @@ export default class RequestListPlugin extends React.PureComponent { } } + setProcessFilter(e) { + const filter = e.target.value; + const { processData } = this.state; + + let filteredProcess = processData; + + if (filter) { + filteredProcess = processData.filter(d => d.titulo.toLowerCase().includes(filter.toLowerCase())); + } + this.setState({ filteredProcess }); + } + setAssignee(value) { const assignee = document.querySelector('#camunda-assignee'); assignee.value = value; @@ -550,6 +585,18 @@ export default class RequestListPlugin extends React.PureComponent { } } + setAssigneeFilter(e) { + const filter = e.target.value; + const { assigneeData } = this.state; + + let filteredAssignee = assigneeData; + + if (filter) { + filteredAssignee = usersData.filter(d => d.nome.toLowerCase().includes(filter.toLowerCase())); + } + this.setState({ filteredAssignee }); + } + selectCandidateUser(e) { const target = e.target; if (target.classList.contains('btn-select-repo')) { @@ -634,12 +681,12 @@ export default class RequestListPlugin extends React.PureComponent { setCandidateGroupFilter(e) { const filter = e.target.value; - const { groupsData } = this.state; + const { groupData } = this.state; - let filteredGroups = groupsData; + let filteredGroups = groupData; if (filter) { - filteredGroups = groupsData.filter(d => d.nome.toLowerCase().includes(filter.toLowerCase())); + filteredGroups = groupData.filter(d => d.titulo.toLowerCase().includes(filter.toLowerCase())); } this.setState({ filteredGroups }); @@ -649,25 +696,25 @@ export default class RequestListPlugin extends React.PureComponent { this.setState({ documentType: type }); } - renderTipDocModal(data) { + renderTipDocModal() { const { filteredData = [] } = this.state; return ; } - renderProcessModal(data) { - const { processData = [] } = this.state; + renderProcessModal() { + const { filteredProcess = [] } = this.state; return @@ -695,15 +742,14 @@ export default class RequestListPlugin extends React.PureComponent { } renderAssigneeModal() { - const { filteredAssignee = [] } = this.state; - const selectedUsers = []; - - return } @@ -803,6 +849,7 @@ export default class RequestListPlugin extends React.PureComponent { renderModal() { const { modalType } = this.state; + switch (modalType) { case MODAL_TYPE.listDoc: return this.renderTipDocModal(); @@ -847,4 +894,9 @@ export default class RequestListPlugin extends React.PureComponent { } ); } + + focus() { + // Focalize a entrada de texto usando a API DOM + this.inputFiltro.current.focus(); + } } diff --git a/sei-camunda-modeler/client/modal/AssigneeModal.js b/sei-camunda-modeler/client/modal/AssigneeModal.js index 4e2f6ba..bbcabf9 100644 --- a/sei-camunda-modeler/client/modal/AssigneeModal.js +++ b/sei-camunda-modeler/client/modal/AssigneeModal.js @@ -8,23 +8,25 @@ const Body = Modal.Body || (({ children }) =>
{children}
); const Footer = Modal.Footer || (({ children }) =>
{children}
); -export default function AssigneeModal({ assignees, setFilter, setAssignee, onClose }) { +export default function AssigneeModal({ assignees, setFilter, setAssignee, onClose, selectedAssignees }) { return ( - Lista de Cargos + Lista de Usuários -
- -
    - {assignees.map(({ id, cargo }) => ( -
  • - {cargo} - + {assignees.map(({ id, nome, sigla }) => ( +
  • + {sigla}{nome} + {selectedAssignees.find(user => user === sigla) ? ( + ) : ( + + )}
  • ))}
diff --git a/sei-camunda-modeler/client/modal/CandidateGroupsModal.js b/sei-camunda-modeler/client/modal/CandidateGroupsModal.js index 90c7eb0..eee6e6e 100644 --- a/sei-camunda-modeler/client/modal/CandidateGroupsModal.js +++ b/sei-camunda-modeler/client/modal/CandidateGroupsModal.js @@ -14,9 +14,6 @@ export default function CandidateGroupsModal({ groups, setFilter, setCandidateGr Lista de Cargos -
- -
    {groups.map(({ id, titulo }) => (
  • diff --git a/sei-camunda-modeler/client/modal/CandidateUserModal.js b/sei-camunda-modeler/client/modal/CandidateUserModal.js index 4580bd2..dec6098 100644 --- a/sei-camunda-modeler/client/modal/CandidateUserModal.js +++ b/sei-camunda-modeler/client/modal/CandidateUserModal.js @@ -15,12 +15,9 @@ export default function CandidateUserModal({ users, setFilter, setCandidateUser, Lista de Usuários -
    - -
      {users.map(({ id, nome, sigla }) => ( -
    • +
    • {sigla}{nome} {selectedUsers.find(user => user === sigla) ? (