Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
215b2ef
added queue implementation
Jun 8, 2020
b8a5d2e
added SubscribedStoreID functionality
Jun 8, 2020
f0728cd
fixed queue position
Jun 8, 2020
cdbc78d
changed the db structure to the one decided in design doc
Jun 8, 2020
03165bc
fixed bug with uid
Jun 8, 2020
1467690
Added dynamic routing and multiple queues
Jun 8, 2020
827c6ff
Fixed Queue Position error
Jun 8, 2020
42fc244
changed exitQueue function
Jun 8, 2020
6b76de7
changed currentStoreRef
Jun 8, 2020
8c712f2
modified setCurrentStoreRef
Jun 8, 2020
7a1e0e6
Single marker Map
shradhasehgal Jun 6, 2020
41d99ca
Redirection of marker + display of places started
shradhasehgal Jun 8, 2020
dea613f
Map page done + UI styling
shradhasehgal Jun 8, 2020
deabd2a
changed currentUserRef to currentUserKey
Jun 8, 2020
744d067
added queue implementation
Jun 8, 2020
4958424
added SubscribedStoreID functionality
Jun 8, 2020
90ddfd9
fixed queue position
Jun 8, 2020
8fffdf0
changed the db structure to the one decided in design doc
Jun 8, 2020
41b5c8d
fixed bug with uid
Jun 8, 2020
58c635e
Added dynamic routing and multiple queues
Jun 8, 2020
180b0ee
Fixed Queue Position error
Jun 8, 2020
6b83202
changed exitQueue function
Jun 8, 2020
c4df852
changed currentStoreRef
Jun 8, 2020
377403b
modified setCurrentStoreRef
Jun 8, 2020
2c8daf5
changed currentUserRef to currentUserKey
Jun 8, 2020
27b1ba8
Merge branch 'feature/queue' of https://github.com/googleinterns/virt…
Jun 9, 2020
d3efb2a
Merge branch 'feature/queue' of https://github.com/googleinterns/virt…
Jun 9, 2020
195b14d
Fixed queue implementation, Changed auth session persistence
Jun 9, 2020
22190f8
Removed debugging statements
Jun 9, 2020
0dcf7a2
Merge branch 'feature/queue' of https://github.com/googleinterns/virt…
Jun 9, 2020
46f49b6
Reset firebase auth
Jun 11, 2020
14c158d
Separated database functions into a separate file
Jun 14, 2020
e9594d7
removed debugging statements
Jun 14, 2020
9630be8
Added waiting_time module
Jun 14, 2020
70f28af
added multi-path update for enterQueue and exitQueue
Jun 15, 2020
9c62f89
Added token number
Jun 15, 2020
69a30f2
added token number display feature
Jun 15, 2020
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: 1 addition & 1 deletion frontend/.env_sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ VUE_APP_FIREBASE_PROJECT_ID = 'YourProjectId'
VUE_APP_FIREBASE_API_KEY = 'YourAPIKey'
VUE_APP_FIREBASE_MESSAGING_SENDER_ID = 'Your_MessageSenderID'
VUE_APP_FIREBASE_APPID: 'Your_AppID',
VUE_APP_FIREBASE_MEASUREMENT_ID: 'Your_Measurement_ID'
VUE_APP_FIREBASE_MEASUREMENT_ID: 'Your_Measurement_ID'
40 changes: 40 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"bulma": "^0.9.0",
"core-js": "^3.6.5",
"firebase": "^7.14.6",
"vue": "^2.6.11",
"vue-router": "^3.2.0"
"vue-router": "^3.2.0",
"vue2-google-maps": "^0.10.7"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.4.0",
Expand Down
51 changes: 50 additions & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png" />


<nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>

<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Home
</a>

<a class="navbar-item">
Queues
</a>

</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-light">
Sign up
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
</div>
</nav>
<router-view />
</div>
</template>
Expand All @@ -26,4 +62,17 @@
#nav a.router-link-exact-active {
color: #42b983;
}

.navbar{
margin-bottom: 5%;
padding: px;
}

.navbar-brand{
margin-left: 5%;
}

.navbar-end{
margin-right: 5%;
}
</style>
66 changes: 66 additions & 0 deletions frontend/src/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import firebase from "firebase";

export function getQueuePosition(storeId, userId, callBack){
//Pass a callBack function as an argument while calling this function, the callBack function has queuePosition as an argument
//If userId is null, function returns queueLength
let dbRef = firebase.database().ref();
dbRef.child(this.getUserPath(storeId)).once("value", snap => {
var queuePosition = 1;
snap.forEach(function(childSnap){
if(userId==childSnap.val().UserID){
return true;
}
queuePosition++;
});
callBack(queuePosition);
});
}

export const database_call = {
getQueuePosition: function(storeId, userId, callBack){
//Pass a callBack function as an argument while calling this function, the callBack function has queuePosition as an argument
//If userId is null, function returns queueLength
let dbRef = firebase.database().ref();
dbRef.child(this.getUserPath(storeId)).once("value", snap => {
var queuePosition = 1;
snap.forEach(function(childSnap){
if(userId==childSnap.val().UserID){
return true;
}
queuePosition++;
});
callBack(queuePosition);
});
},
getCurrentUserKey: function(storeId, userId, callBack){
//Pass a callBack function as an argument while calling this function, the callBack function has queuePosition as an argument
let dbRef = firebase.database().ref();
dbRef.child(this.getUserPath(storeId)).orderByChild("UserID").equalTo(userId).once("value", snap => {
var currentUserKey = null;
if(snap.exists()){
currentUserKey = Object.keys(snap.val())[0];
}
callBack(currentUserKey);
});
},
getCurrentStoreKey: function(storeId, userId, callBack){
//Pass a callBack function as an argument while calling this function, the callBack function has queuePosition as an argument
let dbRef = firebase.database().ref();
dbRef.child(this.getStorePath(userId)).orderByChild("StoreID").equalTo(storeId).once("value", snap =>{
var currentStoreKey = null;
if(snap.exists()){
currentStoreKey = Object.keys(snap.val())[0];
}
callBack(currentStoreKey);
});
},
getStorePath: function(userId){
return `User/${userId}/SubscribedStoreID`;
},
getUserPath: function(storeId){
return `Store/${storeId}/UsersInQueue`;
},
printHello: function(){
console.log("Hello!");
}
}
8 changes: 8 additions & 0 deletions frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Vue from 'vue'
import firebase from 'firebase'
import App from './App.vue'
import router from './router'
import * as VueGoogleMaps from "vue2-google-maps";
import './../node_modules/bulma/css/bulma.css';

Vue.config.productionTip = false
let app = '';
Expand Down Expand Up @@ -29,3 +31,9 @@ firebase.auth().onAuthStateChanged(() => {
}
});

Vue.use(VueGoogleMaps, {
load: {
key: "AIzaSyCu4bZPx3unoBtAr8YUzVfiBmw6oqZBk0g",
libraries: "places" // necessary for places input
}
});
14 changes: 11 additions & 3 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import SignUp from '../views/SignUp.vue'
import Maps from '../views/Map.vue'
import Queue from '../views/Queue.vue'
Vue.use(VueRouter)

const routes = [
Expand All @@ -26,11 +28,17 @@ const routes = [
component: SignUp
},
{
path: '*',
redirect: '/login'
path: '/map',
name: 'Maps',
component: Maps
},
{
path: '/',
path: '/queue/:StoreId',
name: 'Queue',
component: Queue
},
{
path: '*',
redirect: '/login'
}
]
Expand Down
33 changes: 32 additions & 1 deletion frontend/src/views/Home.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template>
<div class="home">
<h1>Welcome to the Home page</h1>
<router-link v-bind:to="{path:'/queue'}">Enter Queue</router-link>
<br>
<h2>List of available stores:</h2>
<ul>
<li v-for="store in stores" :key="store.StoreId"><button @click="showQueue(store.StoreId)">{{store.StoreName}}</button></li>
</ul>
<br><br>
<button @click="logout">Logout</button>
</div>
</template>
Expand All @@ -13,15 +18,41 @@ import firebase from "firebase";
export default {
name: "Home",
components: {},
data(){
return{
stores : []
}
},
methods: {
showQueue: function(StoreId){
this.$router.replace("queue/" + StoreId);
},
logout: function() {
firebase
.auth()
.signOut()
.then(() => {
this.$router.replace("login");
});
},
populateStores: function() {
console.log(this.uid);
var dbRef = firebase.database().ref();
dbRef.child("Store").orderByChild("StoreName").once("value", snap => {
var tempStores = [];
snap.forEach(function(childSnap){
tempStores.push({
StoreId: childSnap.key,
StoreName: childSnap.val().StoreName
});
});
this.stores = tempStores;
console.log(tempStores);
});
}
},
created() {
this.populateStores();
}
};
</script>
2 changes: 1 addition & 1 deletion frontend/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
},
methods: {
login: function() {
firebase
firebase
.auth()
.signInWithEmailAndPassword(this.email, this.password)
.then(
Expand Down
Loading