more changes but working
[angular-mojolicious.git] / templates / conference / Registration.html.ep
1 <script>
2
3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
4
5 function Registration($resource){
6         this.master = {
7                 person: {
8                         name: '', surname: '', inst: '', email: ''
9                 },
10                 type: 'participant',
11                 work: {
12                         title: '',
13                         abstract: '',
14                         authors:[ { name:'', surname:'', inst:'', email:'' } ]
15                 },
16                 symposium: { organizers: [ {name:'', surname:'', inst:'', email:'' } ], work_nr: 1 }
17         };
18         this.Registration = $resource( '/data/conference/Registration/:id', { id:'' } );
19         this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } );
20         this.reset();
21         this.$watch('$location.hashPath', this.hash_change);
22 }
23 Registration.$inject=['$resource'];
24
25 Registration.prototype = {
26         hash_change: function() {
27                 var id = this.$location.hashPath;
28 console.debug( 'hash_change', id, this.registration.$id );
29                 if ( id != this.registration.$id ) {
30                         if (id) {
31                                 var self = this;
32                                 this.registration = this.Registration.get({ id: id }, function(registration) {
33                                         self.last_saved = angular.copy(registration);
34                                         if ( registration.type == 'symposium' ) {
35                                                 var s_id = registration.symposium.$id || registration.$id;
36                                                 // first registration doesn't have symposium.$id, but we used same $id
37 console.debug( 'load symposium ', s_id );
38                                                 self.symposium = self.Symposium.get({ id: s_id });
39                                         }
40                                 });
41                         }
42                         else this.reset();
43                 }
44         },
45         reset: function() {
46                 console.debug( this.Registration );
47                 var last = this.registration;
48                 if ( last && last.type == 'symposium' ) {
49                         if ( last.$id ) last.symposium.work_nr++; // only if saved
50                 }
51                 this.registration = new this.Registration( this.master );
52                 if ( last ) {
53                         this.registration.type      = last.type;
54                         this.registration.person    = last.person;
55
56                         if ( last.type == 'symposium' )
57                         this.registration.symposium = last.symposium;
58                 }
59                 this.last_saved = angular.copy( this.registration ); // FIXME was: {};
60 console.debug( 'reset', this.registration, this.$location.hashPath, last );
61         },
62         save: function(){
63                 var self = this;
64                 this.registration.$save(function(registration){
65                         self.$location.hashPath = registration.$id;
66
67                         // save symposium to separate resource
68                         if ( registration.type == 'symposium' ) {
69                                 if ( ! self.symposium ) { 
70                                         self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
71                                         self.symposium = new self.Symposium( registration.symposium );
72                                         self.symposium.works = [];
73                                 }
74                                 registration.work.$id = registration.$id; // preserve $id
75                                 self.symposium.works[ registration.symposium.work_nr - 1 ] = registration.work;
76 console.debug('save_symposium', self.symposium );
77                                 self.symposium.$save();
78                         }
79
80                         self.last_saved = angular.copy(registration);
81                 });
82         }
83 };
84
85 angular.validator.max_length = function(input, len) {
86         var ok = input.length <= len;
87 console.debug( 'max_length', ok, input.length, len );
88         return ok ? '' : 'must be shorter than '+len+' characters';
89 }
90
91 </script>
92
93
94 <style type="text/css">
95
96 body {
97         background: #F6F6F6;
98         margin: 40px;
99         font-family: Arial;
100         color: #374E5A;
101         font-size: 14px;
102         line-height: 16px;
103 }
104
105
106 label {
107         display: block;
108         color: #D74F25;
109         color: #374E5A;
110         color: #afafaf;
111         margin-top: 10px;
112         font-size: 14px;
113         font-family: Arial;
114 }
115 h1 {
116 /*      margin-bottom: 6px;     */
117         padding-left: 20px;
118         font: 18px arial;
119         color: #0c1426;
120         text-decoration: none;
121         display: block;
122         background: url(http://mjesec.ffzg.hr/drzb2011/images/kvadrat.gif) no-repeat left;
123         border-bottom: 1px solid #CCC;
124 }
125 h2 {
126         margin-top: 60px;
127         font-size: 14px;
128         padding: 2px 0;
129         border-bottom: 2px solid #D74F25;
130         border-bottom: 1px solid #46d0fe;
131 }
132
133 a {
134         color: #D74F25;
135 }
136
137 label {
138         color: #374E5A;
139 }
140
141 .input {
142         color: #afafaf;
143         float: left;
144         margin: 2px;
145         padding: 0 6px;
146 }
147
148 .input1 {
149         width: 40.8em;
150 }
151
152 .input2 {
153         width: 8em;
154 }
155
156 .input3 {
157         width: 13em;
158 }
159 .input4 {
160         width: 10em;
161 }
162
163 .input5 {
164         width: 21.4em;
165 }
166 .input6 {
167         width: 6.3em;
168 }
169
170 .clear {
171         clear: both;
172 }
173
174
175 .authors {
176         clear: both;
177         margin-bottom: 6px;
178 }
179
180 .addPerson {
181         color: #D74F25;
182         color: #EDC8BC;
183         color: #EAB3A2;
184         font-size: 90%;
185 }
186
187 input, textarea, .gohome {
188         font: 14px arial;
189         color: #000000;
190         border: solid 1px #dedede;
191         padding: 6px;
192         background: #f6f6f6;
193 }
194
195 input:focus, textarea:focus
196 {
197         
198         background: #ffffff;
199         font-family: arial;
200         color: #000000;
201 /*      border: 1px solid #46d0fe; */
202 }
203
204 .ng-validation-error {
205         border: 1px solid #FF6666;
206         border: 1px solid #EDC8BC;
207         border: 1px solid #FF9966;
208         border: 1px solid #EAB3A2;
209         border: 1px solid #D74F25;
210         border: 1px solid #DC6844;
211         border: 1px solid #DE7F61;
212 }
213
214
215
216 #work, #submission {
217         margin-bottom: 20px;
218 }
219
220 .button {
221         margin-top: 20px;
222         width: 40.8em;
223 }
224
225 .button input {
226         margin-bottom: 120px;
227         float: left;
228         color: #ffffff;
229         display: block;
230         text-decoration: none;
231         background: #d74f25;
232 }
233
234 .button input:hover, .gohome:hover {
235         background: #dc6844;
236 }
237
238 .button2 {
239 }
240
241 .gohome  {
242         float: left;
243         color: #ffffff;
244         display: block;
245         text-decoration: none;
246         background: #d74f25;
247         padding: 7px;
248 }
249
250 .gohome a {
251         color: #fff;
252         text-decoration: none;
253 }
254
255 .list {
256         margin-top: 20px;
257         font-weight: bold;
258 }
259
260 .warrning {
261         color: #FF6666;
262 }
263
264 .sworks {
265         margin-top: 20px;
266 }
267
268
269 .newWork {
270         clear: left;
271         margin-top: 50px;
272 }
273 .saved {
274         color: #D74F25; 
275         margin-bottom: 20px;
276         font-weight: bold;
277 }
278 .saved2 {
279         color: #374E5A;
280         font-style: italic;
281         display: block;
282 }
283 .saved3 {
284         color: #374E5A;
285         display: block;
286         font-weight: normal;
287         margin-top: 20px;
288 }
289 .footer {
290         height: 10px;
291 }
292
293 </style>
294
295
296
297 <h1>Registration and Proposal Submission</h1>
298
299 <div>
300 <p>Svi sudionici skupa, bez obzira na to jesu li izlagači, suautori ili slušači, trebaju prijaviti svoje sudjelovanje kroz sustav elektroničke prijave.</p>
301  
302 <p>Sažetak izlaganja/postera prijavljuje samo prvi autor, odnosno onaj autor koji će rad izložiti. Ostali suautori prilikom prijave na skup ne trebaju prijaviti sažetak, nego se samo registrirati.</p>
303  
304 <p>Organizatori simpozija/okruglog stola prijavljuju i sažetak simpozija i/ili okruglog stola,  i sažetak svakog pripadajućeg rada. Autori radova unutar simpozija ne prijavljuju pojedinačno svoje sažetke.</p>
305  
306 <p>Duljina sažetka ne može prelaziti 2000 znakova.</p>
307 </div>
308
309
310 <div class="root" ng:controller="Registration" ng:init="$window.$root = this;">
311
312
313 <div id="participant">
314         <h2>Contact Information</h2>
315         <div class="labelTop">
316                 <div class="input input4">First name</div>
317                 <div class="input input4">Surname</div>
318         </div>
319         <div style="clear: both">
320                 <input class="input4" name="registration.person.name" ng:required>
321                 <input class="input4" name="registration.person.surname" ng:required>
322         </div>
323         <div class="labelTop">
324                 <div class="input input5">Institution</div>
325         </div>  
326         <div style="clear: both">
327                 <input class="input5" name="registration.person.inst">
328         </div>
329         <div class="labelTop">
330                 <div class="input input5">Address</div>
331         </div>  
332         <div style="clear: both">
333                 <input class="input5" name="registration.person.address1" ng:required>
334         </div>
335         <div class="labelTop">
336                 <div class="input input6">City</div>
337                 <div class="input input6">ZIP</div>
338                 <div class="input input6">Country</div>
339         </div>
340         <div style="clear: both">
341                 <input class="input6" name="registration.person.city" ng:required>
342                 <input class="input6" name="registration.person.zip">
343                 <input class="input6" name="registration.person.country">
344         </div>
345         <div class="labelTop">
346                 <div class="input input4">E-mail</div>
347                 <div class="input input4">Phone number</div>
348         </div>
349         <div style="clear: both">
350                 <input class="input4" name="registration.person.email" ng:validate="email" ng:required>
351                 <input class="input4" name="registration.person.phone">
352         </div>
353 </div>
354
355
356 <div id="submission" ng:show="registration.type != 'symposium'">
357         <div>
358                 <h2>Registration Type</h2>
359                 <label><input type="radio" name="registration.type" value="participant" ng:required>Attendance with no presentation</label>
360                 <label><input type="radio" name="registration.type" value="sparticipant" ng:required>Symposium participant</label>
361                 <label><input type="radio" name="registration.type" value="symposium" ng:required>Symposium organizer</label>
362                 <label><input type="radio" name="registration.type" value="lecture" ng:required>Oral presentation</label>
363                 <label><input type="radio" name="registration.type" value="poster" ng:required>Poster presentation</label>
364                 <label><input type="radio" name="registration.type" value="round" ng:required>Round table discussion</label>
365         </div>
366 </div>
367
368         <!-- dodano za syposium participants -->
369         <div ng:show="registration.type == 'sparticipant'">
370                 <h2>Symposia</h2>
371                 <label for="registration.symposium.title">Topic:</label>
372                         <input class="input1" name="registration.symposium.title" ng:required>
373         </div>
374
375
376 <div id="work" ng:show="registration.type != 'participant' && registration.type != 'sparticipant'">
377         <div ng:show="registration.type == 'symposium'">
378
379                 <h2>Symposia</h2>
380                 <label for="registration.symposium.title">Topic:</label>
381                         <input class="input1" name="registration.symposium.title" ng:required>
382                 <label>Organizer:</label>
383                         <div class="input input2">First name</div><div class="input input2">Surname</div><div class="input input3">Institution</div><div class="input input2">E-mail</div>
384                         <div class="clear" ng:repeat="organizer in registration.symposium.organizers">
385                         <input class="input2" name="organizer.name" ng:required>
386                         <input class="input2" name="organizer.surname" ng:required>
387                         <input class="input3" name="organizer.inst" >
388                         <input class="input2" name="organizer.email" ng:required ng:validate="email">
389                         <a href="" ng:click="registration.symposium.organizers.$remove(organizer)">X</a>
390                         </div>
391                 <a class="addPerson" href="" ng:click="registration.symposium.organizers.$add()">Add another organizer</a>
392                 <label>Summary (2000 characters max.)</label>
393                         <textarea class="input1" name="registration.symposium.abstract" rows="10" ng:validate="max_length:2000" ng:required></textarea>
394         </div>
395
396                 <div ng:show="symposium">
397                         <label class="list">List of already submitted papers for symposium {{registration.symposium.title}}</label>
398                         <ol>
399                         <li ng:repeat="w in symposium.works">
400                         <a ng:show="registration.$id != w.$id" href="#{{w.$id}}" >{{w.title}}</a>
401                         <b ng:show="registration.$id == w.$id">{{w.title}}</b>
402                         </li>
403                         </ol>
404                 </div>
405
406   <div ng:show="registration.type">
407
408         <h2 ng:show="registration.type == 'symposium'">Symposia paper ({{registration.symposium.work_nr}})</h2>
409         <h2 ng:show="registration.type == 'lecture'">Oral Presentation Sumbission</h2>
410         <h2 ng:show="registration.type == 'poster'">Poster Presentation Sumbission</h2>
411         <h2 ng:show="registration.type == 'round'">Round Table Disscussion Sumbission</h2>
412
413
414         <label>Title:</label>
415                 <input class="input1" name="registration.work.title" ng:required>
416         <label>Authors</label>
417         <div>
418                 <div class="input input2">First name</div><div class="input input2">Surname</div><div class="input input3">Institution</div><div class="input input2">E-mail</div>
419         </div>
420         <div class="clear" ng:repeat="author in registration.work.authors">
421                 <input class="input2" name="author.name" ng:required>
422                 <input class="input2" name="author.surname" ng:required>
423                 <input class="input3" name="author.inst" >
424                 <input class="input2" name="author.email" ng:required ng:validate="email">
425                 <a href="" ng:click="registration.work.authors.$remove(author)">X</a>
426         </div>
427         <a class="addPerson" href="" ng:click="registration.work.authors.$add()">Add another author</a>
428
429
430         <label>Abstract (2000 characters max.):</label>
431                 <textarea class="input1" name="registration.work.abstract" rows="10" ng:validate="max_length:2000" ng:required></textarea>
432
433
434   </div> <!-- ng:show="registration.type" -->
435 </div>
436
437 <div class="button" ng:show="! last_saved.$equals(registration) && $invalidWidgets.visible() == 0">
438 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration) && $invalidWidgets.visible() == 0">
439 </div>
440
441 <div ng:show="$invalidWidgets.visible() &gt; 0" style="color:red; margin-top: 20px">Please fill all required fields correctly ({{$invalidWidgets.visible()}} fields left). Red colored fields call for your attention.
442 </div>
443
444
445
446
447 <div style="margin-bottom: 40px" ng:show="registration.$id && last_saved.$equals(registration)">
448         <div class="saved" ng:show="registration.type == 'participant' || registration.type == 'sparticipant'">
449                 <span class="saved2">{{registration.person.name}} {{registration.person.surname}}</span> you finished your registration successfully. 
450                 <span class="saved3">Registration ID: {{registration.$id}}.</span>
451         </div>
452
453         <div class="saved" ng:show="registration.type != 'participant' && registration.type != 'sparticipant'">
454                 You finished your registration successfully.
455 <!--
456                 <span class="saved3">Submitted paper: <b>{{registration.work.title}}</b></span>
457                 <span class="saved3">Registration ID: {{registration.$id}}.</span>
458 -->
459         </div>
460 <!--
461         Please review your data, correct and save if needed (just start typing and Save button will show automatically).
462 -->
463 <!--    
464         <div>
465         Registration ID: {{registration.$id}}. You can bookmark this page and review it later.
466         </div>
467 -->
468         <div class="button" ng:show="registration.$id && registration.type != 'participant' && registration.type != 'sparticipant' && last_saved.$equals(registration)">
469                 <input type="reset" value="Submit another paper" ng:click="reset()">
470         </div>
471         <div class="gohome"><a href="http://psihologija.ffzg.hr/drzb2011/">Go to conference home page</a></div>
472 </div>
473 <!--
474 <div class="button2" ng:show="registration.$id && registration.type != 'participant' && registration.type != 'sparticipant' && last_saved.$equals(registration)">
475         <input type="reset" value="Submit another paper" ng:click="reset()">
476         <div class="gohome"><a href="http://psihologija.ffzg.hr/drzb2011/">Go to conference home page</a></div>
477 </div>
478 -->
479
480 <div class="footer"></div>
481
482 <!--
483 <div ng:show="registration.$id">
484 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
485 </div>
486 -->
487
488 <input type=checkbox name=debug style="float: right; clear: both">
489 <pre ng:show="debug">
490
491 dirty={{! last_saved.$equals(registration)}} invalid={{$invalidWidgets.visible()}}
492
493 registration = {{registration}}
494
495 last_saved = {{last_saved}}
496
497 master = {{master}}
498
499 symposium = {{symposium}}
500
501 $id={{$id}}
502 registration.$id={{registration.$id}}
503 </pre>