/* Controllers */
-function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route, Organizations, RegistrationState) {
+function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $route, Organizations, ValidStates) {
$scope.$routeParams = $routeParams;
$scope.$location = $location;
$scope.organizations = data;
$log.info('organizations promise ', $scope.organizations);
});
- $scope.RegistrationState = RegistrationState();
+ $scope.ValidStates = ValidStates();
$scope.info = { message: '', css_class: '' } ; // alert box
$scope.update = function(registration, state, info_message) {
- registration.state = state;
+ if ( $scope.ValidStates.indexOf( state ) > $scope.ValidStates.indexOf( registration.state ) ) {
+ registration.state = state;
+ $log.info( 'registration.state updated to ',state);
+ } else {
+ $log.info('registration.state NOT changed');
+ }
if ( ! $scope.has_work && registration.work ) {
delete( registration.work );
registration.$save( function(registration) {
$log.info('id =', registration.id, 'state = ', registration.state);
if ( registration.id && registration.state ) {
- $log.error( $location.path(), registration.state, $routeParams );
+ $log.info( 'have id && state', $location.path(), registration.state, $routeParams );
if ( $location.path().split(/\//)[1] != registration.state ) {
$location.path( '/' + registration.state + '/' + registration.id );
} else {
$scope.user.registration_type == 'symposium' ||
$scope.user.registration_type == 'round'
) {
+ if ( angular.isUndefined( $scope.registration.work ) ) {
+ $log.info('create empty work');
+ $scope.registration.work = { persons: [ $scope.user ] };
+ if ( angular.isUndefined( $scope.work ) )
+ $scope.work = $scope.registration.work;
+ }
+
+
$scope.work.type = $scope.user.registration_type;
$scope.has_work = true;
$log.info( $scope.user.registration_type, " type updated");
$scope.show_submission_type = function() {
// FIXME check if all submission are allowed by date and allow them!
+ if ( angular.isUndefined( $scope.user ) || angular.isUndefined( $scope.registration ) ) return false;
return (
angular.isUndefined( $scope.user.registration_type ) // new registration
|| angular.isUndefined( $scope.registration.state ) // not saved yet
$scope.reset();
}
-RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'RegistrationState' ];
+RegistrationCtrl.$inject = [ '$scope', '$log', 'Registration', '$routeParams', '$location', '$route', 'Organizations', 'ValidStates' ];
-function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, RegistrationState ) {
+function ListCtrl($scope, $log, Registration, RegistrationTypes, $filter, ValidStates ) {
$scope.list = [];
$scope.list_results = 0;
page: 1,
limit: 10,
results: 1,
- last_page: 1
+ last_page: 1,
+ show_all: false
};
$scope.search = {};
$scope.ready = false;
states: true,
pager_numeric: false
};
- $scope.RegistrationState = RegistrationState();
+ $scope.ValidStates = ValidStates();
$scope.create_counts = function( array ) {
$log.info('create_counts', array.length );
var from = ( $scope.pager.page - 1 ) * $scope.pager.limit;
$scope.list = [];
angular.forEach( filtered, function(v,k) {
- if ( k >= from && k < from + $scope.pager.limit ) {
+ if ( k >= from && k < from + $scope.pager.limit || $scope.pager.show_all ) {
v.nr = k + 1;
this.push(v);
}
}
}
-ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'RegistrationState' ];
+ListCtrl.$inject = [ '$scope', '$log', 'Registration', 'RegistrationTypes', '$filter', 'ValidStates' ];