From e13e630cd6e4fc0b1ff92098a28a770794c7bb9a Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Wed, 20 Apr 2022 10:19:29 -0500 Subject: =?UTF-8?q?A=C3=B1adir=20plantilla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Base para front --- .../app/components/Calendar/DetailEvent.js | 167 +++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 front/odiparpack/app/components/Calendar/DetailEvent.js (limited to 'front/odiparpack/app/components/Calendar/DetailEvent.js') diff --git a/front/odiparpack/app/components/Calendar/DetailEvent.js b/front/odiparpack/app/components/Calendar/DetailEvent.js new file mode 100644 index 0000000..b25d8b9 --- /dev/null +++ b/front/odiparpack/app/components/Calendar/DetailEvent.js @@ -0,0 +1,167 @@ +import React, { Fragment } from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import MoreVertIcon from '@material-ui/icons/MoreVert'; +import Today from '@material-ui/icons/Today'; +import { Typography, IconButton, Menu, MenuItem, Divider, Popover } from '@material-ui/core'; +import styles from './calendar-jss'; + + +const ITEM_HEIGHT = 48; + +class DetailEvent extends React.Component { + state = { + anchorElOpt: null, + }; + + handleClickOpt = event => { + this.setState({ anchorElOpt: event.currentTarget }); + }; + + handleCloseOpt = () => { + this.setState({ anchorElOpt: null }); + }; + + handleDeleteEvent = (event) => { + this.setState({ anchorElOpt: null }); + this.props.remove(event); + this.props.close(); + }; + + render() { + const getDate = date => { + if (date._isAMomentObject) { + return date.format('MMMM Do YYYY'); + } + let dd = date.getDate(); + const monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December' + ]; + const mm = monthNames[date.getMonth()]; // January is 0! + const yyyy = date.getFullYear(); + + if (dd < 10) { + dd = '0' + dd; + } + + const convertedDate = mm + ', ' + dd + ' ' + yyyy; + + return convertedDate; + }; + + const getTime = time => { + if (time._isAMomentObject) { + return time.format('LT'); + } + let h = time.getHours(); + let m = time.getMinutes(); + + if (h < 10) { + h = '0' + h; + } + + if (m < 10) { + m = '0' + m; + } + + const convertedTime = h + ':' + m; + return convertedTime; + }; + + const { + classes, + anchorEl, + event, + close, + anchorPos + } = this.props; + const { anchorElOpt } = this.state; + return ( + + + + + {event !== null + && ( + + + this.handleDeleteEvent(event)}> + Delete Event + + + + + {' '} + {event.title} + +
+ +Start: + {getDate(event.start)} + {' '} +- + {getTime(event.start)} + + + +End: + {getDate(event.end)} + {' '} +- + {getTime(event.end)} + +
+
+ ) + } +
+ ); + } +} + +DetailEvent.propTypes = { + classes: PropTypes.object.isRequired, + anchorEl: PropTypes.bool.isRequired, + anchorPos: PropTypes.object.isRequired, + event: PropTypes.object, + close: PropTypes.func.isRequired, + remove: PropTypes.func.isRequired, +}; + +DetailEvent.defaultProps = { + event: null, +}; + +export default withStyles(styles)(DetailEvent); -- cgit v1.2.3