Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/cat3/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<script src="lib/ng-file-upload/ng-file-upload.min.js"></script>
<script src="src/partials/globals/toaster/angular-toastr.tpls.js"></script>
<script src="src/partials/globals/drag-and-drop/angular-drag-and-drop-lists.min.js"></script>
<script src="https://cdn.firebase.com/js/client/1.1.1/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.8.0/angularfire.min.js"></script>
<!-- Application configuration -->
<script src="uiConfig.js"></script>
<script src="lib/d3/d3.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion client/cat3/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All modules/feature will be through
* */

var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr',
var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr','firebase',
'global.login',
'global.breadcrumb',
'authentication',
Expand Down
13 changes: 10 additions & 3 deletions client/cat3/src/partials/sections/dashboard/track/track.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<div>
<strong>{{Text}}</strong>
</div>
<div class="col-xs-4 text-center" ng-repeat="day in days">
<h2>{{ day.name }}</h2>
<div class="time-slot" ng-repeat="slot in day.slots">
<input type="checkbox" id="{{ day.name }}-{{ $index }}" ng-model="slot.booked" ng-disabled="slot.booked">
<label for="{{ day.name }}-{{ $index }}">{{ slot.time }}<br>
<span ng-if="slot.booked">Booked</span>
<span ng-if="!slot.booked">Available</span>
</label>
</div>
</div>
123 changes: 120 additions & 3 deletions client/cat3/src/partials/sections/dashboard/track/trackCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,124 @@
(function (angular) {
"use strict";
angular.module('dashboard.track', [])
.controller('trackCtrl',['$scope', function ($scope) {
$scope.Text = 'Track page';
.controller('trackCtrl',['$scope','$firebase', function ($scope,$firebase) {

// get # of real time users
var listRef = new Firebase("https://burning-torch-4263.firebaseio.com/presence/");
var userRef = listRef.push();

// Add ourselves to presence list when online.
var presenceRef = new Firebase("https://burning-torch-4263.firebaseio.com/.info/connected");
presenceRef.on("value", function(snap) {
if (snap.val()) {
userRef.set(true);
// Remove ourselves when we disconnect.
userRef.onDisconnect().remove();
}
});

listRef.on("value", function(snap) {
$scope.online = snap.numChildren();
});

var ref = new Firebase("https://burning-torch-4263.firebaseio.com/days");
var fb = $firebase(ref);

// three way data binding
var syncObject = fb.$asObject();
syncObject.$bindTo($scope, 'days');

$scope.reset = function() {
fb.$set({
monday: {
name: 'Monday',
slots: {
0900: {
time: '9:00am',
booked: false
},
0110: {
time: '11:00am',
booked: false
},
100: {
time: '1:00pm',
booked: false
},
300: {
time: '3:00pm',
booked: false
},
500: {
time: '5:00pm',
booked: false
},
700: {
time: '7:00pm',
booked: false
}
}
},
tuesday: {
name: 'Tuesday',
slots: {
0900: {
time: '9:00am',
booked: false
},
0110: {
time: '11:00am',
booked: false
},
100: {
time: '1:00pm',
booked: false
},
300: {
time: '3:00pm',
booked: false
},
500: {
time: '5:00pm',
booked: false
},
700: {
time: '7:00pm',
booked: false
}
}
},
wednesday: {
name: 'Wednesday',
slots: {
0900: {
time: '9:00am',
booked: false
},
0110: {
time: '11:00am',
booked: false
},
100: {
time: '1:00pm',
booked: false
},
300: {
time: '3:00pm',
booked: false
},
500: {
time: '5:00pm',
booked: false
},
700: {
time: '7:00pm',
booked: false
}
}
}
});
};

}]);

})(angular);