diff --git a/.gitignore b/.gitignore index 91affb2268228030f769aa536aa4111733cd4df1..49bb99df82599fdf65aa796d6bdff59299d8b849 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .ftpconfig node_modules/ package-lock.json + +.idea/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index c6cc8c8196a2226f7e8c986e437830c7e56949a2..0000000000000000000000000000000000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <profile version="1.0"> - <option name="myName" value="Project Default" /> - <inspection_tool class="Eslint" enabled="true" level="ERROR" enabled_by_default="true" /> - </profile> -</component> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfbbc029bcab630581847471d7f238ec53..0000000000000000000000000000000000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="" vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/src/events/eventDraft.js b/src/events/eventDraft.js index 463cce447ef078c8fc2959ab083f31fa41fe8393..805e58966f6e3f405916176f2ef1e781d9c907ea 100644 --- a/src/events/eventDraft.js +++ b/src/events/eventDraft.js @@ -1,8 +1,10 @@ import m from 'mithril'; -import { Button, Card, TextField } from "polythene-mithril" +import { Button} from "polythene-mithril" import EditView from '../views/editView'; import { styler } from 'polythene-core-css'; + + const draftStyle = [ { '.footer': { @@ -10,9 +12,9 @@ const draftStyle = [ left: 0, bottom: 0, width: '100%', - 'background-color': 'red', - color: 'white', - 'text-align': 'center', + 'background-color': '#E8462B', + color: '#FFFFFF', + 'text-align': 'right', } } ] @@ -26,25 +28,21 @@ export default class eventDraft extends EditView { } view() { - - const fieldDescriptionEn = m(TextField, { - label: 'Description [EN]', - required: true, - floatingLabel: true, - dense: true, - multiLine: true, - rows: 6, - }); - - const buttonMaker = m(Button, { + //Submit Button + const buttonMaker = m(Button, { label: "Submit Request", + color: "white", - }); + //Error pop-up in case not all mandatory fields were completed + //CURRENTLY: Error triggered onclick + events: { + onclick: () => alert("You did not complete all prioritary fields!") + } + }); - // ]) return m('div',[ - m('h1', {class: "title"}, "Request a new event"), + m('h2', {class: "title"}, "Creating a new event:"), m('div.footer', buttonMaker), ]); } diff --git a/src/events/eventWithExport.js b/src/events/eventWithExport.js index 77a1ba41251f6ecb8ad251b8707c6c614a5f92f1..0c9ac713803e1907df7b386af96b809e7853d5bd 100644 --- a/src/events/eventWithExport.js +++ b/src/events/eventWithExport.js @@ -5,10 +5,27 @@ import { Card } from 'polythene-mithril'; import EditView from '../views/editView'; +import {styler} from 'polythene-core-css'; + +const draftStyle = [ + { + '.footer': { + position: 'fixed', + left: 0, + bottom: 0, + width: '100%', + 'background-color': '#E8462B', + 'text-align': 'right', + } + } +] + +styler.add('eventDraft', draftStyle); export default class eventWithExport extends EditView { constructor(vnode) { super(vnode, 'events'); + this.performedEdits = 0; } view() { @@ -18,6 +35,8 @@ export default class eventWithExport extends EditView { required: true, floatingLabel: true, dense: true, + onChange : (newState) => {this.title_en = this.title_en;}, + value: this.title_en, }); const fieldDescriptionEn = m(TextField, { label: 'Description [EN]', @@ -25,21 +44,26 @@ export default class eventWithExport extends EditView { floatingLabel: true, dense: true, multiLine: true, - rows: 6, - }); - const creatorButton = m(Button, { - label: 'EXPORT' - // label: 'Create a hyperlink string describing your project.' + rows: 6, + onChange : (newState) => {this.fieldDescriptionEn = this.fieldDescriptionEn;}, + value: this.fieldDescriptionEn, }); // Needs administrator (Kulturi). const fieldLocation = m(TextField, { label: 'Location:', floatingLabel: true, required: true, + onChange : (newState) => {this.fieldLocation = this.fieldLocation;}, + value: this.fieldLocation, + }); + const buttonMaker = m(Button, { + label: "Submit Request!", + onClick: () => alert("You did not finish the editing of the fields.") }); return m('div', [ - m('h1', 'For the event creator:', fieldTitleEn, fieldDescriptionEn, 'For the AMIV administrator:', fieldLocation, creatorButton), + m('h1', 'For the event creator:', fieldTitleEn , fieldDescriptionEn, 'For the AMIV administrator:', fieldLocation), + m('div.footer', buttonMaker), ]); } } \ No newline at end of file diff --git a/src/events/newEvent.js b/src/events/newEvent.js index 015adc1615b48e14216a15cb99f3f3af2079ef3a..3cff68aa1d0a4391bd6e61ca577ec273ace06f9c 100644 --- a/src/events/newEvent.js +++ b/src/events/newEvent.js @@ -1,13 +1,248 @@ import m from 'mithril'; +import { TextField, Button, Checkbox, RadioGroup, IconButton, SVG } from 'polythene-mithril'; import EditView from '../views/editView'; - +import { icons } from '../views/elements'; export default class newEvent extends EditView { constructor(vnode) { super(vnode, 'events'); + this.currentpage = 1; + } + + addOne() { + this.currentpage = this.currentpage + 1; + if (this.currentpage === 4) { + this.currentpage = 3; + } } - view() { - return m('h1', 'Hello World'); + subOne() { + this.currentpage = this.currentpage - 1; + if (this.currentpage === 0) { + this.currentpage = 1; + } + } + + view(vnode) { + if (!this.currentpage) return ''; + // German and English Information + const fieldTitleEn = m(TextField, { + label: 'Event Title [EN]', + required: true, + floatingLabel: true, + dense: true, + onChange: (newState) => { this.title_en = newState.value; console.log(this.title_en); }, + value: vnode.state.title_en, + }); + + const fieldCatchphraseEn = m(TextField, { + label: 'Catchphrase [EN]', + floatingLabel: true, + dense: true, + help: 'Fun description to make your event look more interesting than it is', + focusHelp: true, + }); + + const fieldDescriptionEn = m(TextField, { + label: 'Description [EN]', + required: true, + floatingLabel: true, + dense: true, + multiLine: true, + rows: 6, + }); + + const fieldTitleDe = m(TextField, { + label: 'Event Title [DE]', + floatingLabel: true, + dense: true, + }); + + const fieldCatchphraseDe = m(TextField, { + label: 'Catchphrase [DE]', + floatingLabel: true, + dense: true, + help: 'Fun description to make your event look more interesting than it is', + focusHelp: true, + }); + + const fieldDescriptionDe = m(TextField, { + label: 'Description [DE]', + floatingLabel: true, + dense: true, + multiLine: true, + rows: 6, + }); + + // Start of relevant data + + const fieldPrice = m(TextField, { + label: 'Price:', + type: 'number', + help: 'In Rappen/Cents', + focusHelp: true, + floatingLabel: true, + required: true, + }); + const fieldStartDate = m(TextField, { + label: 'Event Start[Date and Time]:', + help: 'Format: 01.01.1970-18:00', + focusHelp: true, + floatingLabel: true, + required: true, + }); + const fieldEndDate = m(TextField, { + label: 'Event End[Date and Time]:', + help: 'Format: 01.01.1970-1800', + focusHelp: true, + floatingLabel: true, + required: true, + }); + const fieldStartRegDate = m(TextField, { + label: 'Registration Start[Date and Time]:', + help: 'Format: 01.01.1970-18:00', + focusHelp: true, + floatingLabel: true, + required: true, + }); + const fieldEndRegDate = m(TextField, { + label: 'Registration End[Date and Time]:', + help: 'Format: 01.01.1970-1800', + focusHelp: true, + floatingLabel: true, + required: true, + }); + const fieldLocation = m(TextField, { + label: 'Location:', + floatingLabel: true, + required: true, + }); + const fieldNumberOfParticipants = m(TextField, { + label: 'Number of open spots:', + type: 'number', + floatingLabel: true, + required: true, + }); + + // Everything above is working fine atm. (13:35) + + const fieldAdvStart = m(TextField, { + label: 'Registration Start[Date and Time]:', + type: 'datetime', + help: 'Format: 01.01.1970-18:00', + focusHelp: true, + floatingLabel: true, + required: true, + }); + const fieldAdvEnd = m(TextField, { + label: 'Registration End[Date and Time]:', + help: 'Format: 01.01.1970-1800', + focusHelp: true, + floatingLabel: true, + required: true, + }); + + const buttonBannerUp = m(Button, { + label: 'Select Banner File', + events: { + onclick: () => console.log('click'), + }, + }); + + const buttonInfoUp = m(Button, { + label: 'Select Infoscreen File', + events: { + onclick: () => console.log('click'), + }, + }); + + const buttonPosterUp = m(Button, { + label: 'Select Poster File', + events: { + onclick: () => console.log('click'), + }, + }); + + const buttonThumbUp = m(Button, { + label: 'Select Thumbnail File', + events: { + onclick: () => console.log('click'), + }, + }); + + const buttonUploadAll = m(Button, { + label: 'Upload', + events: { + onclick: () => console.log('click'), + }, + }); + + const iconRight = m( + IconButton, { events: { onclick: () => { this.addOne(); } } }, + m(SVG, m.trust(icons.ArrowRight)), + ); + + const iconLeft = m( + IconButton, { events: { onclick: () => { this.subOne(); } } }, + m(SVG, m.trust(icons.ArrowLeft)), + ); + + const checkboxAnnounce = m(Checkbox, { + defaultChecked: false, + label: 'Advertise in Announce?', + value: '100', + }); + + const checkboxWebsite = m(Checkbox, { + defaultChecked: false, + label: 'Advertise on Website?', + value: '100', + }); + + const checkboxInfoScreen = m(Checkbox, { + defaultChecked: false, + label: 'Advertise on Infoscreen?', + value: '100', + }); + + const checkboxAllowMail = m(Checkbox, { + defaultChecked: false, + label: 'Allow non AMIV Members?', + value: '100', + }); + + const radioButtonSelectionMode = m(RadioGroup, { + name: 'Selection Mode', + buttons: [ + { + value: 'fcfs', + label: 'First come, first serve', + }, + { + value: 'manual', + label: 'Selection made by organizer', + }, + ], + }); + + function layoutWith(page) { + return m('div', page); + } + // checks currentPage and selects the fitting page + if (this.currentpage === 1) { + return layoutWith(m('h1', 'Event description:', iconLeft, iconRight, m('br'), fieldTitleEn, fieldCatchphraseEn, fieldDescriptionEn, fieldTitleDe, fieldCatchphraseDe, fieldDescriptionDe)); + } else if (this.currentpage === 2) { + return layoutWith(m( + 'h1', 'Critical Information:', iconLeft, iconRight, m('br'), fieldStartDate, fieldEndDate, fieldStartRegDate, + fieldEndRegDate, fieldLocation, fieldPrice, fieldNumberOfParticipants, + )); + } else if (this.currentpage === 3) { + return layoutWith(m( + 'h1', 'Advertise Information', iconLeft, iconRight, m('br'), fieldAdvStart, fieldAdvEnd, checkboxWebsite, + checkboxAnnounce, checkboxInfoScreen, buttonBannerUp, buttonInfoUp, buttonPosterUp, + buttonThumbUp, m('br'), buttonUploadAll, m('br'), checkboxAllowMail, radioButtonSelectionMode, + )); + } + return layoutWith(m('')); } } diff --git a/src/views/elements.js b/src/views/elements.js index 3e60b74ddf111fe15266b3f55fb5b2f42e566ab0..98cd7d9e67eca4461b7f2cf728dd2bd0b9df6343 100644 --- a/src/views/elements.js +++ b/src/views/elements.js @@ -52,6 +52,7 @@ export const icons = { ArrowDown: '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"/><path d="M0-.75h24v24H0z" fill="none"/></svg>', 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>', }; export const BackButton = {