use views to report number of submited reservations
[angular-mojolicious.git] / public / app / reservations / calendar.html
1 <!DOCTYPE HTML>
2 <html xmlns:ng="http://angularjs.org">
3 <head>
4 <meta charset="utf-8">
5 <!--
6 <script src="angular.js" ng:autobind></script>
7 -->
8 <script src="http://code.angularjs.org/0.9.15/angular-0.9.15.min.js"
9    ng:autobind></script>
10
11 <script>
12 Calendar.$inject = ['$xhr', '$resource']; 
13
14 function Calendar($xhr,$resource){ 
15         console.info('Calendar');
16         var self = this;
17         $xhr("GET"
18                 , "/reservations/get/www.google.com/calendar/ical/8tg8ecg285qshtp75813jktqa0%40group.calendar.google.com/private-b9d68b530fde2c6060979f8a05aa0865/basic.ics"
19                 , function(code, response){ 
20                         console.log('xhr calendar', code, response);
21                         self.data = response;
22                 }
23         );
24
25         var load_submited = function() {
26                 $xhr("GET"
27                         , "/reservations/events/submited"
28                         , function(code, response){ 
29                                 console.log('xhr submited', code, response);
30                                 self.submited = response;
31                         }
32                 );
33         }
34         load_submited();
35
36         var Reservation = $resource('/data/reservations/prijava/:id');
37         this.reservation = new Reservation();
38
39
40
41 // http://groups.google.com/group/angular/browse_thread/thread/af68afb22fd2d2ab/18fc5e3216a77e53?show_docid=18fc5e3216a77e53
42 </script>
43
44 <title>Reservations</title>
45
46 <style>
47 </style>
48
49 </head>
50 <body>
51
52 <div ng:controller="Calendar"> 
53
54 <h1>{{data.cal['X-WR-CALNAME']}}</h1>
55
56 <div>{{data.cal['X-WR-CALDESC'] | html}}</div>
57
58 <ul>
59 <li ng:repeat="c in data.events" ng:show="! reservation.UID || reservation.UID == c.UID">
60 {{c.DTSTART}} - {{c.DTEND}} 
61 <a href="" ng:click="reservation.UID = c.UID ; reservation.event = c">{{c.SUMMARY}}</a>
62 <b ng:show="submited[c.UID]">
63 broj prijava: {{submited[c.UID]}}
64 </b>
65 <div>{{c.LOCATION}}</div>
66 <div ng:show="c.DESCRIPTION">
67 {{c.DESCRIPTION}}
68 </div>
69 </li>
70 </ul>
71
72
73 <form ng:show="reservation.UID">
74
75 <div ng:show="! reservation._id">
76 Popunite vašu prijavu za
77 <b>{{reservation.event.SUMMARY}}</b>
78 <input type=button ng:click="reservation.UID = null" value="Odustani od prijave">
79 </div>
80
81 <div ng:show="reservation._id && reservation.UID" style="background: #ff8">
82 Vaša prijava za
83 <b>{{reservation.event.SUMMARY}}</b>
84 <input type=button ng:click="reservation.UID = null" value="Promjeni termin">
85 </div>
86
87 <br>
88 ime: <input name="reservation.name" ng:required>
89 <br>
90 prezime: <input name="reservation.surname" ng:required>
91 <br>
92 e-mail: <input name="reservation.email" ng:required>
93 <br>
94 odsjek: <input name="reservation.odsjek" ng:required>
95 <br>
96 zvanje: <input name="reservation.zvanje">
97 <br>
98 područke/tema zaninimanja: <input name="reservation.porducje">
99 <br>
100 <input type=button ng:click="reservation.$save(); load_reservations();" value="Prijavi me">
101 <pre>{{reservation}}</pre>
102 </form>
103
104 <input name=debug type=checkbox>
105 <pre ng:show="debug">
106 data={{data}}
107 reservation={{reservation}}
108 </pre>
109
110 </div>
111
112
113 </body>
114 </html>