You need to sign in or sign up before continuing.
Newer
Older
import { TextField, Button, Checkbox, RadioGroup, IconButton, SVG } from 'polythene-mithril';
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;
}
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
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(''));