create (allmost) all fields in form required for registration
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 13 Dec 2012 22:29:01 +0000 (23:29 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 13 Dec 2012 22:29:01 +0000 (23:29 +0100)
app/css/app.css
app/js/controllers.js
app/partials/registration.html

index 37b7b65..adbc141 100644 (file)
@@ -38,3 +38,11 @@ input.ng-invalid-required {
 input.ng-valid-required {
        border: 1px solid green;
 }
+
+.left {
+       clear: both;
+       display: block;
+       margin-top: 0.5em;
+       margin-bottom: 0.5em;
+}
+
index b940e90..00cd437 100644 (file)
@@ -33,6 +33,51 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
                $log.info( $routeParams.registrationId );
        }
 
+       $scope.has_work = function() {
+               if (
+                       $scope.user.registration_type == 'lecture' ||
+                       $scope.user.registration_type == 'poster' ||
+                       $scope.user.registration_type == 'symposium' ||
+                       $scope.user.registration_type == 'round'
+               ) {
+                       if ( $scope.work ) {
+                               $scope.work.type = $scope.user.registration_type;
+                               $log.info( $scope.user.registration_type, " type updated");
+                       } else {
+                               $scope.work = {
+                                       type: $scope.user.registration_type,
+                                       persons: [ $scope.user ],
+                               };
+                               $log.info( $scope.user.registration_type, " type created");
+                       }
+                       return true;
+               } else {
+                       $log.info( $scope.user.registration_type, "NO work" );
+                       return false;
+               }
+       }
+
+       $scope.change_student = function() {
+               if ( $scope.user.student ) {
+                       $scope.user.hpd_member = false;
+                       $scope.user.reception = false;
+                       $scope.user.dinner = false;
+               }
+       }
+
+       $scope.addPerson = function() {
+               $scope.work.persons.push({ firstname: '' });
+       };
+       $scope.removePerson = function(person) {
+               var persons = $scope.work.persons;
+               for (var i = 0, ii = persons.length; i < ii; i++) {
+                       if (person === persons[i]) {
+                               persons.splice(i, 1);
+                       }
+               }
+       };
+
        $scope.reset();
 }
 //RegistrationCtrl.$inject = [ '$scope', '$log' ];
index 7a9030c..38927f2 100644 (file)
@@ -1,11 +1,22 @@
 
 <form ng-controller="RegistrationCtrl" name="RegistrationForm">
 
+<h2>Odaberite tip registracije</h2>
+
+<label class="left"><input type="radio" ng-model="user.registration_type" value="lecture" >Prijava usmenog izlaganja - <i>popunjava prvi autor, odnosno osoba koja će izložiti rad. Ostali autori trebaju se samo registrirati.</i></label>
+<label class="left"><input type="radio" ng-model="user.registration_type" value="poster" >Prijava poster prezentacije - <i>popunjava prvi autor, ondnosno osoba koja će izložiti rad. Ostali autori trebaju se samo registrirati.</i></label>
+<label class="left"><input type="radio" ng-model="user.registration_type" value="symposium" >Prijava simpozija - <i>popunjava organizator simpozija, upisuje sažetke svih radova. Autori radova na simpoziju trebaju se samo registrirati.</i></label>
+<label class="left"><input type="radio" ng-model="user.registration_type" value="round" >Prijava okruglog stola - <i>popunjava organizator okruglog stola. Sudionici se trebaju registrirati.</i></label>
+<hr />
+<label class="left"><input type="radio" ng-model="user.registration_type" value="participant" >Registracija - <i>popunjavaju slušači i suatori, te autori i suatori radova na simpoziju i sudionici okruglog stola.</i></label>
+<label class="left"><input type="radio" ng-model="user.registration_type" value="accomp" >Registracija za osobe u pratnji.</label>
+
+<div ng-show="user.registration_type">
+
 <h2>Registration - contact details</h2>
 
 <input ng-model="user.firstname" placeholder="first name" required />
 <input ng-model="user.surname"   placeholder="surname" required />
-<br>
 <input ng-model="user.organization" placeholder="organizacija" >
 <br>
 <input ng-model="user.address" placeholder="address" >
 <input ng-model="user.email" type="email" placeholder="e-mail@example.com" required />
 <input ng-model="user.phone" placeholder="+385-1-555-1234" />
 
+<label class="left">
+<input ng-model="user.student" type="checkbox" ng-change="change_student()">
+Označite ako ste student.
+</label>
+
+<div ng-show="! user.student">
+
+<label class="left">
+<input ng-model="user.hpd_member" type="checkbox">
+Označite ako ste član HPD-a
+</label>
+
+<label class="left">
+<input type="checkbox" ng-model="user.reception">
+Označite ako ćete biti na domjenku dobrodošlice
+</label>
+
+<label class="left">
+<input type="checkbox" ng-model="user.dinner">
+Označite ako ćete biti na zajedničkoj večeri? (Večera je uključena u kotizaciju.)
+</label>
+
+<label class="left">
+<input type="checkbox" ng-model="user.r1.required">
+Trebam R-1 račun
+</label>
+
+<div ng-show="user.r1.required">
+Organizacija koja uplaćuje račun
+
+<input class="left" ng-model="user.r1.organization" required placeholder="naziv">
+<input class="left" ng-model="user.r1.address" required placeholder="adresa">
+<input class="left" ng-model="user.r1.OIB" required placeholder="OIB">
+
+</div><!-- r1.required -->
+
+
+</div><!-- not student -->
+
+</div><!-- selected registration_type -->
+
+
+<div ng-show="has_work()">
+
+<div ng-switch on="work.type">
+<h2 ng-switch-when="lecture">Prijava predavanja</h2>
+<h2 ng-switch-when="symposium">Prijava simpozija</h2>
+<h2 ng-switch-when="poster">Prijava postera</h2>
+<h2 ng-switch-when="symposium">Simpozij</h2>
+<h2 ng-switch-when="round">Prijava teme okruglog stola</h2>
+<b ng-switch-default>Has unknown work type {{work.type}} to submit</b>
+</div>
+
+<input ng-model="work.title" placeholder="title" required >
+<div ng-repeat="person in work.persons">
+       <input ng-model="person.firstname" placeholder="first name" required />
+       <input ng-model="person.surname"   placeholder="surname" required />
+       <input ng-model="person.organization" placeholder="organizacija" >
+       <input ng-model="person.email" type="email" placeholder="e-mail@example.com" required />
+       <a href="" ng-click="removePerson(person)">remove</a>
+</div>
+<a href="" ng-click="addPerson()">add another</a>
 <br>
 
+Sažetak ({{work.abstract.length || 0}}  od maks. 2000 znakova)
+<br>
+<textarea ng-model="work.abstract" ng-maxlength="2000" rows="10" cols="80" required ></textarea>
+
+
+</div><!-- has_work -->
+
 <button ng-click="update(user)" ng-show="RegistrationForm.$valid">Register for conference</button>
 
 <pre>
 user={{user}}
 
+work={{work}}
+
 $routeParams={{$routeParams}}
 
 {{RegistrationForm.$valid}}
@@ -34,4 +116,3 @@ location={{$location.path()}}
 
 </form>
 
-