From ae9af450724a95b5fc44d23f2365c0a81b8ab6ca Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 2 Oct 2011 20:13:26 +0200 Subject: [PATCH] track submited reservations in CouchDB --- public/app/reservations/calendar.html | 71 ++++++++++++++++++--------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/public/app/reservations/calendar.html b/public/app/reservations/calendar.html index 3175451..7c13030 100644 --- a/public/app/reservations/calendar.html +++ b/public/app/reservations/calendar.html @@ -22,7 +22,10 @@ function Calendar($xhr,$resource){ } ); - var load_submited = function() { + var Reservation = $resource('/data/reservations/prijava/:id'); + this.reservation = new Reservation(); + + this.load_submited = function() { $xhr("GET" , "/reservations/events/submited" , function(code, response){ @@ -31,10 +34,33 @@ function Calendar($xhr,$resource){ } ); } - load_submited(); + this.load_submited(); - var Reservation = $resource('/data/reservations/prijava/:id'); - this.reservation = new Reservation(); + self.reservation.status = 'event'; + + this.select_event = function(c) { + console.info('select_event', c); + self.reservation.event = c; + self.reservation.status = 'changed'; + if (self.submited) self.reservation.slot_nr = ++self.submited[c.UID]; + } + + this.change_event = function() { + self.reservation.event = null; + self.reservation.status = 'event'; + self.load_submited(); + } + + this.save_submission = function() { + if ( self.reservation && self.reservation.event ) { + console.info('submit save'); + self.reservation.status = 'saved'; + self.reservation.$save(); + self.load_submited(); + } else { + console.info('submit ignored'); + } + } } @@ -56,12 +82,13 @@ function Calendar($xhr,$resource){
{{data.cal['X-WR-CALDESC'] | html}}
+
{{reservation.error}}
-
+ -
-Popunite vašu prijavu za +
+Vaša {{reservation.status}} prijava za {{reservation.event.SUMMARY}} - -
+u terminu {{reservation.event.DTSTART}} u trajanju od {{reservation.event.hours}} sata +broj {{reservation.slot_nr}} +je spremljena. + -
-Vaša prijava za -{{reservation.event.SUMMARY}} - +Promjeni termin
-
+ ime:
prezime: @@ -97,14 +124,14 @@ zvanje:
područke/tema zaninimanja:
- -
{{reservation}}
+
-data={{data}}
 reservation={{reservation}}
+submited={{submited}}
+data={{data}}
 
-- 2.20.1