diff --git a/src/events/viewEvent.js b/src/events/viewEvent.js index f782c9cd2a4c758b68c7826437b81e5a83f852df..180887d8fa4eea5b2d8678eba2d2b33d254a7e21 100644 --- a/src/events/viewEvent.js +++ b/src/events/viewEvent.js @@ -150,6 +150,7 @@ export default class viewEvent extends ItemView { constructor() { super('events'); this.signupHandler = new ResourceHandler('eventsignups'); + this.description = false; this.details = false; this.emailAdresses = false; this.emaillist = ['']; @@ -183,6 +184,10 @@ export default class viewEvent extends ItemView { console.log(Object.keys(this)); console.log(this['data']); + let displayDescriptionButton = m(Toolbar, { compact: true, events: { onclick: () => this.description = !this.description } }, [ + m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }), + m(ToolbarTitle, { text: "description" }), + ]); let displayDetailsButton = m(Toolbar, { compact: true, events: { onclick: () => this.details = !this.details } }, [ m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }), m(ToolbarTitle, { text: "details" }), @@ -194,19 +199,25 @@ export default class viewEvent extends ItemView { + let displayDescription = null; let displayDetails = null; - let displayWaitlist = null; let displayEmailAdresses = null; - if (this.details) { - displayDetailsButton = m(Toolbar, { compact: true, events: { onclick: () => this.details = !this.details } }, [ + if (this.description) { + displayDescriptionButton = m(Toolbar, { compact: true, events: { onclick: () => this.description = !this.description } }, [ m(IconButton, { icon: { svg: m.trust(icons.ArrowDown) } }), - m(ToolbarTitle, { text: "details" }), + m(ToolbarTitle, { text: "description" }), ]); - displayDetails = m(Card, { + displayDescription = m(Card, { className: 'eventInfoCard', content: [ - + { + any: { + content: [ + this.data.allow_email_signup ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'non AMIV-Members allowed')]) : '', + ] + } + }, { any: { content: [ @@ -237,11 +248,63 @@ export default class viewEvent extends ItemView { ] } }, + { + any: { + content: [ + this.data.priority ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Price')]) : '', + this.data.priority ? m('div', m('p.propertyText', ` ${this.data.price}`)) : '', + ] + } + }, ] }) } + if (this.details) { + displayDetailsButton = m(Toolbar, { compact: true, events: { onclick: () => this.details = !this.details } }, [ + m(IconButton, { icon: { svg: m.trust(icons.ArrowDown) } }), + m(ToolbarTitle, { text: "details" }), + ]); + displayDetails = m(Card, { + className: 'eventInfoCard', + content: [ + { + any: { + content: [ + this.data.time_advertising_start ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Advertising Time')]) : '', + this.data.time_advertising_start ? m('div', m('p.propertyText', ` ${dateFormatter(this.data.time_advertising_start)} - ${dateFormatter(this.data.time_advertising_end)}`)) : '', + ] + } + }, + { + any: { + content: [ + this.data.time_register_start ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Registration Time')]) : '', + this.data.time_register_start ? m('div', m('p.propertyText', ` ${dateFormatter(this.data.time_register_start)} - ${dateFormatter(this.data.time_register_end)}`)) : '', + ] + } + }, + { + any: { + content: [ + this.data.selection_strategy ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Selection strategy')]) : '', + this.data.selection_strategy ? m('div', m('p.propertyText', ` ${this.data.selection_strategy}`)) : '', + ] + } + }, + { + any: { + content: [ + this.data.show_annonce ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Annonce is shown')]) : '', + this.data.show_annonce ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Infoscreen is shown')]) : '', + this.data.show_website ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Website is shown')]) : '',] + } + }, + ] + + }) + } if (this.emailAdresses) { displayEmailAdressesButton = m(Toolbar, { compact: true, events: { onclick: () => this.emailAdresses = !this.emailAdresses } }, [ @@ -276,6 +339,12 @@ export default class viewEvent extends ItemView { }); } + let displaySpots = '-'; + + if(this.data.spots !== 0) { + displaySpots = this.data.spots; + } + return m("div", { style: { height: '100%', 'overflow-y': 'scroll', padding: '10px'} @@ -287,17 +356,25 @@ export default class viewEvent extends ItemView { }), m("h1", {style: { 'margin-top': '0px', 'margin-bottom': '0px' } }, [this.data.title_de]), m('div', { style: { float: 'left', 'margin-right': '20px'} }, [ - this.data.time_start ? m('div', m('span.propertyTitle', `Time`)) : '', - this.data.time_start ? m('div', m('p.propertyText', ` ${dateFormatter(this.data.time_start)} to ${dateFormatter(this.data.time_end)}`)) : '', + m('div', this.data.signup_count ? m('span.propertyTitle', `Signups`) : m.trust(' ')), + m('div', this.data.signup_count ? m('p.propertyText', ` ${this.data.signup_count} / ${displaySpots}`) : m.trust(' ')), + ]), + m('div', { style: { float: 'left', 'margin-right': '20px'} }, [ + m('div', this.data.location ? m('span.propertyTitle', `Location`) : m.trust(' ') ), + m('div', this.data.location ? m('p.propertyText', ` ${this.data.location}`) : m.trust(' ')), ]), m('div', [ - this.data.location ? m('div', m('span.propertyTitle', `Location`)) : m.trust(' '), - this.data.location ? m('div', m('p.propertyText', ` ${this.data.location}`)) : ' ', + m('div', this.data.time_start ? m('span.propertyTitle', `Time`): m.trust(' ')), + m('div', this.data.time_start ? m('p.propertyText', ` ${dateFormatter(this.data.time_start)} - ${dateFormatter(this.data.time_end)}`): m.trust(' ')), ]), + m('div.eventViewContainer', { style: { 'margin-top': '50px' } }, [ m('div.eventViewLeft', [ + displayDescriptionButton, + displayDescription, + displayDetailsButton, displayDetails,