diff --git a/src/Components/Search/Event.js b/src/Components/Search/Event.js index cf9d3721f..089a06957 100644 --- a/src/Components/Search/Event.js +++ b/src/Components/Search/Event.js @@ -16,8 +16,23 @@ import { hostedEventsCalls } from '../../GraphQL/Calls/index'; import { toLocalTime } from '../../utils'; class Event extends React.Component { + constructor() { + super(); + this.state = { + keyId: '', + participantId: '', + botId: '', + }; + } + render() { - const { classes, event, enrollable = false } = this.props; + const { keyId, participantId, botId } = this.state; + const { + classes, + event, + availableKey = [], + enrollable = false, + } = this.props; const { id, title, @@ -65,50 +80,64 @@ class Event extends React.Component { You are participating as : { participatingAs.map(team => `${team.name}, `) } - { enrollable + { enrollable && fbs.length ? { window.location.reload(); }} > {enrollToEvent => ( - { + this.setState({ participantId: val.target.value.split('|')[0], botId: val.target.value.split('|')[1], + }); + }} + name='bot' + displayEmpty + className={classes.selectEmpty} + > + + Enroll as : + + { fbs.map(finb => {finb.text}) } + + + + })} + > + Enroll + + )} : '' diff --git a/src/Components/Search/Tabs/Future.js b/src/Components/Search/Tabs/Future.js index 23d3b1c9f..90fba08a7 100644 --- a/src/Components/Search/Tabs/Future.js +++ b/src/Components/Search/Tabs/Future.js @@ -9,10 +9,10 @@ import Event from '../Event'; class Future extends React.Component { render() { const { classes } = this.props; - const { Events } = this.props; + const { Events, AKey } = this.props; const events = Events.map((event, index) => ( - + )); return (
diff --git a/src/Components/Search/index.js b/src/Components/Search/index.js index 83358cdd2..e5f1d5fdd 100644 --- a/src/Components/Search/index.js +++ b/src/Components/Search/index.js @@ -107,7 +107,7 @@ class Search extends React.Component { }} {({ loading, error, data }) => { @@ -115,7 +115,7 @@ class Search extends React.Component { if (error) return `Error! ${error.message}`; return ( - {value === 1 && } + {value === 1 && } ); }} diff --git a/src/GraphQL/Calls/hostedEvents.js b/src/GraphQL/Calls/hostedEvents.js index 2b46bc2ab..489119c7f 100644 --- a/src/GraphQL/Calls/hostedEvents.js +++ b/src/GraphQL/Calls/hostedEvents.js @@ -42,6 +42,33 @@ const EVENTS_EVENTSBYHOST = gql` ${eventFullInfo} `; +const EVENTS_EVENT_AND_AKEY = gql` + query Events_Events( + $hostId: String, + $state: events_EventStateEnum, + $minStartDate: Int, + $maxStartDate: Int, + $minEndDate: Int, + $maxEndDate: Int + ){ + events_Events( + hostId: $hostId, + state: $state, + minStartDate: $minStartDate, + maxStartDate: $maxStartDate, + minEndDate: $minEndDate, + maxEndDate: $maxEndDate + ) { + ...EventFullInfo + } + keyVault_AvailableKeys{ + id + key + } + } + ${eventFullInfo} +`; + const EVENTS_PUBLISHEVENT = gql` mutation Events_ChangeEventState($eventId: ID!, $state: events_EventStateEnum) { events_ChangeEventState(eventId: $eventId, state: $state) { @@ -52,10 +79,10 @@ const EVENTS_PUBLISHEVENT = gql` `; const REGISTER_EVENT = gql` - mutation Events_RegisterToEvent($eventId: ID!, $participantId: String!, $botId: String!) { + mutation Events_RegisterToEvent($eventId: ID!, $keyId: String!, $participantId: String!, $botId: String!) { events_RegisterToEvent( eventId: $eventId - participant: { participantId: $participantId, botId: $botId } + participant: { keyId: $keyId, participantId: $participantId, botId: $botId } ) { ...EventFullInfo } @@ -67,6 +94,7 @@ export default { EVENTS_CREATEEVENT, EVENTS_EDITEVENT, EVENTS_EVENTSBYHOST, + EVENTS_EVENT_AND_AKEY, EVENTS_PUBLISHEVENT, REGISTER_EVENT, };