Updated event form to allow for time input

This commit is contained in:
Luke Vella 2015-02-01 23:35:15 +01:00
parent 47b60296eb
commit 6d81b21ed1
32 changed files with 456 additions and 88 deletions

View file

@ -3,9 +3,26 @@ angular.module('rallly')
$scope.title = "Schedule a New Event";
$scope.description = "Fill in the form below to create your event and share it with your friends and colleagues.";
$scope.event = {};
var states = [
'newevent.general',
'newevent.datetime',
'newevent.invite'
];
$scope.page = 1;
var goTo = function(page){
$scope.page = page;
$state.go(states[page-1]);
}
goTo($scope.page);
$scope.submit = function(){
if ($scope.form.$valid){
if ($scope.form.$valid && $scope.page == states.length){
$http.post('/api/event', $scope.event)
.success(function(event, status, headers, config){
$scope.event = event;
@ -14,6 +31,8 @@ angular.module('rallly')
}, {
absolute : true
});
$scope.page++;
$state.go('newevent.success');
})
.error(function(){
var modal = new ConfirmModal({
@ -22,6 +41,9 @@ angular.module('rallly')
cancelText : 'OK'
});
});
} else if ($scope.form.$valid) {
$scope.form.$setPristine();
$scope.nextPage();
} else {
var notification = new Notification({
title : 'Not so fast',
@ -31,5 +53,12 @@ angular.module('rallly')
}
}
$scope.clearDates = null
$scope.nextPage = function(){
goTo($scope.page+1);
}
$scope.prevPage = function(){
goTo($scope.page-1);
}
});