Office driver api get data works
This commit is contained in:
@@ -15,18 +15,14 @@
|
||||
Auburn Oil
|
||||
</q-toolbar-title>
|
||||
<div>
|
||||
<div v-if="user">
|
||||
Welcome {{employee.employee_first_name}} {{employee.employee_last_name}}
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="user.user_id > 0">
|
||||
Welcome {{ employee.employee_first_name }} {{ employee.employee_last_name }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<router-link :to="{ name: 'login' }" class="">
|
||||
<q-btn color="secondary" label="Login"/>
|
||||
</router-link>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<q-btn color="secondary" label="Login"/>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
</q-header>
|
||||
@@ -42,60 +38,62 @@
|
||||
<q-item-section avatar>
|
||||
<q-icon name="inbox"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Home
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'today' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="inbox"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Todays Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'tomorrow' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="drafts"/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
Tomorrow Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'waiting' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="drafts"/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
Waiting Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'stats' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>label
|
||||
<q-item-section avatar>
|
||||
<q-icon name="star"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Stats
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'stats' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="send"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Automatics
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'tomorrow' }" class="nodec">
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="drafts"/>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
Tomorrow Deliveries
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</router-link>
|
||||
|
||||
</q-list>
|
||||
|
||||
@@ -109,17 +107,13 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue'
|
||||
import EssentialLink from 'components/EssentialLink.vue'
|
||||
import {useRoute} from 'vue-router' //
|
||||
import authHeader from "../services/auth.header"
|
||||
import axios from "axios"
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MainLayout',
|
||||
|
||||
components: {
|
||||
EssentialLink
|
||||
},
|
||||
components: {},
|
||||
|
||||
data() {
|
||||
return {
|
||||
@@ -134,7 +128,7 @@ export default defineComponent({
|
||||
last_seen: '',
|
||||
admin: 0,
|
||||
admin_role: 0,
|
||||
confirmed: 0,
|
||||
confirmed: 0
|
||||
|
||||
},
|
||||
loaded: false,
|
||||
@@ -151,51 +145,50 @@ export default defineComponent({
|
||||
employee_start_date: "",
|
||||
employee_end_date: "",
|
||||
employee_type: '',
|
||||
employee_state: '',
|
||||
employee_state: ''
|
||||
},
|
||||
leftDrawerOpen: false,
|
||||
|
||||
leftDrawerOpen: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.userStatus()
|
||||
|
||||
},
|
||||
methods: {
|
||||
toggleLeftDrawer() {
|
||||
this.leftDrawerOpen = !this.leftDrawerOpen
|
||||
},
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
const path = import.meta.env.VITE_BASE_URL + '/auth/whoami'
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user;
|
||||
this.user = response.data.user
|
||||
this.getEmployee(this.user.user_id)
|
||||
} else {
|
||||
this.user.user_id = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
getEmployee(userid: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/employee/" + userid;
|
||||
const path = import.meta.env.VITE_BASE_URL + "/employee/" + userid
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
headers: authHeader()
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data) {
|
||||
|
||||
this.employee = response.data;
|
||||
this.loaded = true;
|
||||
this.employee = response.data
|
||||
this.loaded = true
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -205,6 +198,4 @@ export default defineComponent({
|
||||
.nodec {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user