0f5b2b28701582da4fae0f1a5fc55f33b408c3d3
[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 JSON', code, response);
21                         self.data = response;
22                 }
23         );
24         var Reservation = $resource('/data/reservations/prijava/:id');
25         this.reservation = new Reservation();
26
27
28
29 // http://groups.google.com/group/angular/browse_thread/thread/af68afb22fd2d2ab/18fc5e3216a77e53?show_docid=18fc5e3216a77e53
30 </script>
31
32 <title>Reservations</title>
33
34 <style>
35 </style>
36
37 </head>
38 <body>
39
40 <div ng:controller="Calendar"> 
41
42 <h1>{{data.cal['X-WR-CALNAME']}}</h1>
43
44 <div>{{data.cal['X-WR-CALDESC'] | html}}</div>
45
46 <ul>
47 <li ng:repeat="c in data.events" ng:show="! reservation.UID || reservation.UID == c.UID">
48 {{c.DTSTART}} - {{c.DTEND}} 
49 <a href="" ng:click="reservation.UID = c.UID ; reservation.event = c">
50 <b>{{c.SUMMARY}}</b>
51 </a>
52 <div>{{c.LOCATION}}</div>
53 <div ng:show="c.DESCRIPTION">
54 {{c.DESCRIPTION}}
55 </div>
56 </li>
57 </ul>
58
59
60 <form ng:show="reservation.UID">
61
62 <div ng:show="! reservation._id">
63 Popunite vašu prijavu za
64 <b>{{reservation.event.SUMMARY}}</b>
65 <input type=button ng:click="reservation.UID = null" value="Odustani od prijave">
66 </div>
67
68 <div ng:show="reservation._id && reservation.UID" style="background: #ff8">
69 Vaša prijava za
70 <b>{{reservation.event.SUMMARY}}</b>
71 <input type=button ng:click="reservation.UID = null" value="Promjeni termin">
72 </div>
73
74 <br>
75 ime: <input name="reservation.name" ng:required>
76 <br>
77 prezime: <input name="reservation.surname" ng:required>
78 <br>
79 e-mail: <input name="reservation.email" ng:required>
80 <br>
81 odsjek: <input name="reservation.odsjek" ng:required>
82 <br>
83 zvanje: <input name="reservation.zvanje">
84 <br>
85 područke/tema zaninimanja: <input name="reservation.porducje">
86 <br>
87 <input type=button ng:click="reservation.$save()" value="Prijavi me">
88 <pre>{{reservation}}</pre>
89 </form>
90
91 <input name=debug type=checkbox>
92 <pre ng:show="debug">
93 data={{data}}
94 reservation={{reservation}}
95 </pre>
96
97 </div>
98
99
100 </body>
101 </html>