-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev-version-1' of https://github.com/Five-Fishes/Club-M…
…anagement-React-Client into event-attendee � Conflicts: � src/main/webapp/app/entities/event-attendee/event-attendee-create.tsx � src/main/webapp/app/entities/event-attendee/event-attendee-delete-dialog.tsx � src/main/webapp/app/entities/event-attendee/index.tsx � src/main/webapp/i18n/en/eventAttendee.json � src/main/webapp/i18n/zh-cn/eventAttendee.json
- Loading branch information
Showing
12 changed files
with
294 additions
and
15 deletions.
There are no files selected for viewing
162 changes: 162 additions & 0 deletions
162
src/main/webapp/app/entities/event-attendee/event-attendee-create.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
import 'app/styles/event-module.scss'; | ||
import React from 'react'; | ||
import axios from 'axios'; | ||
import { connect } from 'react-redux'; | ||
import { Link, RouteComponentProps } from 'react-router-dom'; | ||
import { Button, Row, Col, Label } from 'reactstrap'; | ||
import { AvFeedback, AvForm, AvGroup, AvInput, AvField } from 'availity-reactstrap-validation'; | ||
// tslint:disable-next-line:no-unused-variable | ||
import { Translate, translate, ICrudGetAction, ICrudGetAllAction, ICrudPutAction } from 'react-jhipster'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { IRootState } from 'app/shared/reducers'; | ||
|
||
import { getEntity, updateEntity, createEntity, reset } from './event-attendee.reducer'; | ||
import { IEventAttendee } from 'app/shared/model/event-attendee.model'; | ||
// tslint:disable-next-line:no-unused-variable | ||
import { IEvent } from 'app/shared/model/event.model'; | ||
|
||
export interface IEventAttendeeUpdateProps extends StateProps, DispatchProps, RouteComponentProps<{ id: string; eventId: string }> {} | ||
|
||
export interface IEventAttendeeUpdateState { | ||
event: IEvent; | ||
} | ||
|
||
export class EventAttendeeUpdate extends React.Component<IEventAttendeeUpdateProps, IEventAttendeeUpdateState> { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
event: null | ||
}; | ||
} | ||
|
||
getEvent = async () => { | ||
const event = await axios.get<IEvent>(`api/events/${this.props.match.params.eventId}`); | ||
this.setState({ event: event.data }); | ||
}; | ||
|
||
componentDidMount() { | ||
this.getEvent(); | ||
} | ||
|
||
componentWillUpdate(nextProps, nextState) { | ||
if (nextProps.updateSuccess !== this.props.updateSuccess && nextProps.updateSuccess) { | ||
this.handleClose(); | ||
} | ||
} | ||
|
||
saveEntity = (event, errors, values) => { | ||
if (errors.length === 0) { | ||
const { eventAttendeeEntity } = this.props; | ||
const entity = { | ||
...eventAttendeeEntity, | ||
...values | ||
}; | ||
|
||
this.props.createEntity(entity); | ||
} | ||
}; | ||
|
||
handleClose = () => { | ||
this.props.history.push(`/entity/event/${this.props.match.params.eventId}`); | ||
}; | ||
|
||
render() { | ||
const { userId, loading, updating, match } = this.props; | ||
|
||
return ( | ||
<div> | ||
<Row className="justify-content-center"> | ||
<Col md="8"> | ||
<h2 id="clubmanagementApp.eventAttendee.home.createOrEditLabel"> | ||
<Translate contentKey="clubmanagementApp.eventAttendee.home.registerLabel">Register as EventAttendee</Translate> | ||
</h2> | ||
</Col> | ||
</Row> | ||
<Row className="justify-content-center"> | ||
<Col md="8"> | ||
{loading ? ( | ||
<p>Loading...</p> | ||
) : ( | ||
<AvForm onSubmit={this.saveEntity}> | ||
<AvGroup hidden> | ||
<Label id="userIdLabel" for="event-attendee-userId"> | ||
<Translate contentKey="clubmanagementApp.eventAttendee.userId">User</Translate> | ||
</Label> | ||
<AvField id="event-attendee-userId" type="string" className="form-control" name="userId" value={userId} disabled /> | ||
</AvGroup> | ||
<AvGroup> | ||
<Label id="eventIdLabel" for="event-attendee-eventId"> | ||
<Translate contentKey="clubmanagementApp.event.detail.title">Event</Translate> | ||
</Label> | ||
<AvField | ||
type="string" | ||
className="form-control" | ||
name="event" | ||
value={this.state.event ? this.state.event.name : null} | ||
disabled | ||
/> | ||
<AvField | ||
id="event-attendee-eventId" | ||
type="string" | ||
className="form-control" | ||
name="eventId" | ||
value={match.params.eventId} | ||
disabled | ||
hidden | ||
/> | ||
</AvGroup> | ||
<AvGroup> | ||
<Label id="provideTransportLabel" check> | ||
<AvInput | ||
id="event-attendee-provideTransport" | ||
type="checkbox" | ||
className="form-control transport-checkbox" | ||
name="provideTransport" | ||
/> | ||
<Translate contentKey="clubmanagementApp.eventAttendee.provideTransport">Provide Transport</Translate> | ||
</Label> | ||
</AvGroup> | ||
<div className="text-center mx-4 d-flex justify-content-between justify-content-md-center mb-2"> | ||
<Button tag={Link} id="cancel-save" to={`/entity/event/${match.params.eventId}`} replace color="cancel"> | ||
<FontAwesomeIcon icon="arrow-left" /> | ||
| ||
<Translate contentKey="entity.action.cancel">Cancel</Translate> | ||
</Button> | ||
| ||
<Button color="action" id="save-entity" type="submit" disabled={updating}> | ||
<FontAwesomeIcon icon="save" /> | ||
| ||
<Translate contentKey="entity.action.register">Register</Translate> | ||
</Button> | ||
</div> | ||
</AvForm> | ||
)} | ||
</Col> | ||
</Row> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = (storeState: IRootState) => ({ | ||
userId: storeState.authentication.id, | ||
eventAttendeeEntity: storeState.eventAttendee.entity, | ||
loading: storeState.eventAttendee.loading, | ||
updating: storeState.eventAttendee.updating, | ||
updateSuccess: storeState.eventAttendee.updateSuccess | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
getEntity, | ||
updateEntity, | ||
createEntity, | ||
reset | ||
}; | ||
|
||
type StateProps = ReturnType<typeof mapStateToProps>; | ||
type DispatchProps = typeof mapDispatchToProps; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(EventAttendeeUpdate); |
68 changes: 68 additions & 0 deletions
68
src/main/webapp/app/entities/event-attendee/event-attendee-delete-dialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap'; | ||
import { Translate, ICrudGetAction, ICrudDeleteAction } from 'react-jhipster'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
|
||
import { IEventAttendee } from 'app/shared/model/event-attendee.model'; | ||
import { IRootState } from 'app/shared/reducers'; | ||
import { getEntity, deleteEntity } from './event-attendee.reducer'; | ||
|
||
export interface IEventAttendeeDeleteDialogProps extends StateProps, DispatchProps, RouteComponentProps<{ attendeeId: string }> {} | ||
|
||
export class EventAttendeeDeleteDialog extends React.Component<IEventAttendeeDeleteDialogProps> { | ||
componentDidMount() { | ||
this.props.getEntity(this.props.match.params.attendeeId); | ||
} | ||
|
||
confirmDelete = event => { | ||
this.props.deleteEntity(this.props.eventAttendeeEntity.id); | ||
this.handleClose(event); | ||
}; | ||
|
||
handleClose = event => { | ||
event.stopPropagation(); | ||
this.props.history.goBack(); | ||
}; | ||
|
||
render() { | ||
const { eventAttendeeEntity } = this.props; | ||
return ( | ||
<Modal isOpen toggle={this.handleClose}> | ||
<ModalHeader toggle={this.handleClose}> | ||
<Translate contentKey="entity.delete.title">Confirm delete operation</Translate> | ||
</ModalHeader> | ||
<ModalBody id="clubmanagementApp.eventAttendee.delete.question"> | ||
<Translate contentKey="clubmanagementApp.eventAttendee.delete.question">Are you sure you want to unregister?</Translate> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="secondary" onClick={this.handleClose}> | ||
<FontAwesomeIcon icon="ban" /> | ||
| ||
<Translate contentKey="entity.action.no">No</Translate> | ||
</Button> | ||
<Button id="jhi-confirm-delete-eventAttendee" color="cancel" onClick={this.confirmDelete}> | ||
<FontAwesomeIcon icon="trash" /> | ||
| ||
<Translate contentKey="entity.action.yes">Yes</Translate> | ||
</Button> | ||
</ModalFooter> | ||
</Modal> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = ({ eventAttendee }: IRootState) => ({ | ||
eventAttendeeEntity: eventAttendee.entity | ||
}); | ||
|
||
const mapDispatchToProps = { getEntity, deleteEntity }; | ||
|
||
type StateProps = ReturnType<typeof mapStateToProps>; | ||
type DispatchProps = typeof mapDispatchToProps; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(EventAttendeeDeleteDialog); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,8 @@ | |
color: #0e516d !important; | ||
font-size: 32px; | ||
} | ||
|
||
.transport-checkbox { | ||
height: 25px !important; | ||
margin-top: 0px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.