diff --git a/src/events/newEvent.js b/src/events/newEvent.js index ddc37b107ecbfee606854f10257f00fa8c477621..1aef5b23b2097be1ce8b3d2e2e1ab920737d2105 100644 --- a/src/events/newEvent.js +++ b/src/events/newEvent.js @@ -13,13 +13,12 @@ const style = [ ]; styler.add('event-add', style); - export default class newEvent extends EditView { constructor(vnode) { super(vnode, 'events', {}); this.currentpage = 1; + this.data = {}; } - addOne() { this.currentpage = this.currentpage + 1; if (this.currentpage === 5) { @@ -91,16 +90,18 @@ export default class newEvent extends EditView { }, priority: { label: 'Priority', - } + }, }; const iconRight = m( - IconButton, { events: { onclick: () => { this.addOne(); } } }, + IconButton, + { events: { onclick: () => { this.addOne(); } } }, m(SVG, m.trust(icons.ArrowRight)), ); const iconLeft = m( - IconButton, { events: { onclick: () => { this.subOne(); } } }, + IconButton, + { events: { onclick: () => { this.subOne(); } } }, m(SVG, m.trust(icons.ArrowLeft)), ); @@ -126,6 +127,12 @@ export default class newEvent extends EditView { defaultChecked: false, label: 'Allow non AMIV Members?', value: '100', + onChange: (state) => { + this.allow_email_signup = state.checked; + this.data.allow_email_signup = state.checked; + console.log(this.data); // Temp proof of concept. + }, + checked: this.allow_email_signup, }); const radioButtonSelectionMode = m(RadioGroup, { @@ -140,10 +147,16 @@ export default class newEvent extends EditView { label: 'Selection made by organizer', }, ], + onChange: (state) => { + this.selection_strategy = state.value; + this.data.selection_strategy = state.value; + console.log(this.data); // Temp proof of concept. + }, + value: this.selection_strategy, }); const title = [ - 'Create an Event', 'When and Where?', 'Signups', 'Advertisement' + 'Create an Event', 'When and Where?', 'Signups', 'Advertisement', ][this.currentpage - 1]; // checks currentPage and selects the fitting page @@ -182,6 +195,7 @@ export default class newEvent extends EditView { label: 'Location', floatingLabel: true, })), + radioButtonSelectionMode, checkboxAllowMail, ]), m('div', { style: { diff --git a/src/events/viewEvent.js b/src/events/viewEvent.js index 3fbcdb414d8c4a4be81ad154a8ab55f6e4319904..07ff4ae6df063b5a071e537e0da234fab7a6e527 100644 --- a/src/events/viewEvent.js +++ b/src/events/viewEvent.js @@ -5,6 +5,7 @@ import { Card, TextField, IconButton, + Icon, Toolbar, ToolbarTitle, } from 'polythene-mithril'; @@ -152,7 +153,8 @@ export default class viewEvent extends ItemView { super('events'); this.signupHandler = new ResourceHandler('eventsignups'); this.description = false; - this.details = false; + this.advertisement = false; + this.registration = false; this.emailAdresses = false; this.emaillist = ['']; this.showAllEmails = false; @@ -189,9 +191,13 @@ export default class viewEvent extends ItemView { m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }), m(ToolbarTitle, { text: "description" }), ]); - let displayDetailsButton = m(Toolbar, { compact: true, events: { onclick: () => this.details = !this.details } }, [ + let displayAdvertisementButton = m(Toolbar, { compact: true, events: { onclick: () => this.advertisement = !this.advertisement } }, [ m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }), - m(ToolbarTitle, { text: "details" }), + m(ToolbarTitle, { text: "advertisement" }), + ]); + let displayRegistrationButton = m(Toolbar, { compact: true, events: { onclick: () => this.registration = !this.registration } }, [ + m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }), + m(ToolbarTitle, { text: "registration" }), ]); let displayEmailAdressesButton = m(Toolbar, { compact: true, events: { onclick: () => this.emailAdresses = !this.emailAdresses } }, [ m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }), @@ -201,7 +207,8 @@ export default class viewEvent extends ItemView { let displayDescription = null; - let displayDetails = null; + let displayAdvertisement = null; + let displayRegistration = null; let displayEmailAdresses = null; if (this.description) { @@ -212,13 +219,6 @@ export default class viewEvent extends ItemView { 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: [ @@ -241,19 +241,46 @@ export default class viewEvent extends ItemView { ] } }, + ] + + }) + } + + if (this.advertisement) { + displayAdvertisementButton = m(Toolbar, { compact: true, events: { onclick: () => this.advertisement = !this.advertisement } }, [ + m(IconButton, { icon: { svg: m.trust(icons.ArrowDown) } }), + m(ToolbarTitle, { text: "advertisement" }), + ]); + displayAdvertisement = m(Card, { + className: 'eventInfoCard', + + content: [ { any: { content: [ - this.data.priority ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Priority')]) : '', - this.data.priority ? m('div', m('p.propertyText', ` ${this.data.priority}`)) : '', + + m('p', + [ + m('span', { style: { float: 'left'} }, 'annonce:'), this.data.show_annonce ? m(Icon, { style: { float: 'left'}, svg: m.trust(icons.iconCheckedSVG) }): m(Icon, { style: { float: 'left'}, svg: m.trust(icons.iconClearSVG) } ), + m('span', { style: { float: 'left'} }, ' infoscreen:'), this.data.show_infoscreen ? m(Icon, { style: { float: 'left'}, svg: m.trust(icons.iconCheckedSVG) }): m(Icon, { style: { float: 'left'}, svg: m.trust(icons.iconClearSVG) } ), + m('span', { style: { float: 'left'} }, ' website:'), this.data.show_website ? m(Icon, { style: { float: 'left'}, svg: m.trust(icons.iconCheckedSVG) }): m(Icon, { style: { float: 'left'}, svg: m.trust(icons.iconClearSVG) } ) + ]), ] } }, { 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}`)) : '', + 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.priority ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Priority')]) : '', + this.data.priority ? m('div', m('p.propertyText', ` ${this.data.priority}`)) : '', ] } }, @@ -262,19 +289,19 @@ export default class viewEvent extends ItemView { }) } - if (this.details) { - displayDetailsButton = m(Toolbar, { compact: true, events: { onclick: () => this.details = !this.details } }, [ + if (this.registration) { + displayEmailAdressesButton = m(Toolbar, { compact: true, events: { onclick: () => this.registration = !this.registration } }, [ m(IconButton, { icon: { svg: m.trust(icons.ArrowDown) } }), - m(ToolbarTitle, { text: "details" }), + m(ToolbarTitle, { text: "registration" }), ]); - displayDetails = m(Card, { + displayRegistration = 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)}`)) : '', + this.data.price ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'Price')]) : '', + this.data.price ? m('div', m('p.propertyText', ` ${this.data.price}`)) : '', ] } }, @@ -286,6 +313,7 @@ export default class viewEvent extends ItemView { ] } }, + { any: { content: [ @@ -297,14 +325,13 @@ export default class viewEvent extends ItemView { { 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')]) : '',] + this.data.allow_email_signup ? m('div', {style: { 'margin-top': '10px', 'margin-bottom': '3px' } }, [m('span.propertyTitle', 'non AMIV-Members allowed')]) : '', + ] } }, - ] + ], - }) + }); } if (this.emailAdresses) { @@ -383,8 +410,11 @@ export default class viewEvent extends ItemView { displayDescriptionButton, displayDescription, - displayDetailsButton, - displayDetails, + displayAdvertisementButton, + displayAdvertisement, + + displayRegistrationButton, + displayRegistration, displayEmailAdressesButton, displayEmailAdresses, diff --git a/src/views/elements.js b/src/views/elements.js index 875001950f82a8a3d671ea1c4dc9ba5384afffe2..52c0624383402870cb3b6185cc8629239f0c552f 100644 --- a/src/views/elements.js +++ b/src/views/elements.js @@ -135,6 +135,7 @@ export const icons = { iconUsersSVG: '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M3 5v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2zm12 4c0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3 3 1.34 3 3zm-9 8c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1H6v-1z"/><path d="M0 0h24v24H0z" fill="none"/></svg>', iconEventSVG: '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"/><path d="M0 0h24v24H0z" fill="none"/></svg>', ArrowLeft: '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg>', + iconCheckedSVG: '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/></svg>', }; export const BackButton = {