Format Home component
This commit is contained in:
parent
3321f4a58a
commit
6f9e9141b7
@ -4,7 +4,7 @@
|
|||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-card class="pa-3">
|
<v-card class="pa-3">
|
||||||
<p style="font-size:30pt">User Information</p>
|
<p style="font-size:30pt">User Information</p>
|
||||||
<p style="font-size:15pt"> Username: {{username}}</p>
|
<p style="font-size:15pt">Username: {{username}}</p>
|
||||||
<p style="font-size:15pt">Firstname: {{firstname}}</p>
|
<p style="font-size:15pt">Firstname: {{firstname}}</p>
|
||||||
<p style="font-size:15pt">Lastname: {{lastname}}</p>
|
<p style="font-size:15pt">Lastname: {{lastname}}</p>
|
||||||
</v-card>
|
</v-card>
|
||||||
@ -33,9 +33,8 @@
|
|||||||
<pre><v-icon color="green" v-bind:class="{'d-none':today.type == 'BREAK'}">mdi-currency-usd</v-icon><v-icon
|
<pre><v-icon color="green" v-bind:class="{'d-none':today.type == 'BREAK'}">mdi-currency-usd</v-icon><v-icon
|
||||||
color="red"
|
color="red"
|
||||||
v-bind:class="{'d-none':today.type == 'PAID'}"
|
v-bind:class="{'d-none':today.type == 'PAID'}"
|
||||||
>mdi-currency-usd-off</v-icon>{{" " + today.type}}</pre>
|
>mdi-currency-usd-off</v-icon>{{" " + today.type}}</pre>
|
||||||
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" Start " + today.startdate}}</pre>
|
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" Start " + today.startdate}}</pre>
|
||||||
|
|
||||||
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" End " + today.enddate}}</pre>
|
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" End " + today.enddate}}</pre>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
@ -47,15 +46,11 @@
|
|||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-card>
|
<v-card>
|
||||||
<p class="pa-2" style="font-size:30pt">Accounts</p>
|
<p class="pa-2" style="font-size:30pt">Accounts</p>
|
||||||
<div
|
<div :key="timeTrackAccount._links.self.href" v-for="timeTrackAccount in timeTrackAccounts">
|
||||||
:key="timeTrackAccount._links.self.href"
|
|
||||||
v-for="timeTrackAccount in timeTrackAccounts"
|
|
||||||
>
|
|
||||||
<v-row no-gutters align="center">
|
<v-row no-gutters align="center">
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-card color="background" elevation="0" class="ma-2">
|
<v-card color="background" elevation="0" class="ma-2">
|
||||||
<pre><v-icon color="primary">mdi-account-tie</v-icon>{{" Account " + timeTrackAccount.name}}</pre>
|
<pre><v-icon color="primary">mdi-account-tie</v-icon>{{" Account " + timeTrackAccount.name}}</pre>
|
||||||
|
|
||||||
<pre><v-icon color="primary">mdi-currency-usd</v-icon>{{" Revenue " + timeTrackAccount.revenue}}</pre>
|
<pre><v-icon color="primary">mdi-currency-usd</v-icon>{{" Revenue " + timeTrackAccount.revenue}}</pre>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
@ -63,7 +58,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-card v-if="loggedIn == 'false'" class="pa-3">
|
<v-card v-if="loggedIn == 'false'" class="pa-3">
|
||||||
<p style="font-size:20pt">Welcome to Geo Timetracking</p>
|
<p style="font-size:20pt">Welcome to Geo Timetracking</p>
|
||||||
@ -72,10 +66,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {baseUri} from "../variables.js";
|
||||||
|
|
||||||
|
export default {
|
||||||
import { baseUri } from "../variables.js";
|
|
||||||
export default {
|
|
||||||
name: "Home",
|
name: "Home",
|
||||||
components: {},
|
components: {},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@ -89,25 +82,22 @@ export default {
|
|||||||
haveLocation: ""
|
haveLocation: ""
|
||||||
}),
|
}),
|
||||||
created() {
|
created() {
|
||||||
if(sessionStorage.getItem("loggedin") == "true"){
|
if (sessionStorage.getItem("loggedin") == "true") {
|
||||||
//Get todays records
|
//Get todays records
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
var today;
|
var today;
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function () {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
today = JSON.parse(xhttp.responseText);
|
today = JSON.parse(xhttp.responseText);
|
||||||
today = today._embedded.records;
|
today = today._embedded.records;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttp.open("GET", baseUri + "/records/search/today", false);
|
xhttp.open("GET", baseUri + "/records/search/today", false);
|
||||||
|
|
||||||
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
|
||||||
xhttp.send(null);
|
xhttp.send(null);
|
||||||
|
|
||||||
for (let index = 0; index < today.length; index++) {
|
for (let index = 0; index < today.length; index++) {
|
||||||
var record = today[index];
|
var record = today[index];
|
||||||
|
|
||||||
var start = record.startdate;
|
var start = record.startdate;
|
||||||
|
|
||||||
start = start.split("T");
|
start = start.split("T");
|
||||||
@ -123,10 +113,9 @@ export default {
|
|||||||
}
|
}
|
||||||
this.todaysRecord = today;
|
this.todaysRecord = today;
|
||||||
|
|
||||||
|
|
||||||
var timeTrackAccountsTMP;
|
var timeTrackAccountsTMP;
|
||||||
var accountxhttp = new XMLHttpRequest();
|
var accountxhttp = new XMLHttpRequest();
|
||||||
accountxhttp.onreadystatechange = function() {
|
accountxhttp.onreadystatechange = function () {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
timeTrackAccountsTMP = JSON.parse(accountxhttp.responseText);
|
timeTrackAccountsTMP = JSON.parse(accountxhttp.responseText);
|
||||||
timeTrackAccountsTMP = timeTrackAccountsTMP._embedded.accounts;
|
timeTrackAccountsTMP = timeTrackAccountsTMP._embedded.accounts;
|
||||||
@ -141,16 +130,14 @@ export default {
|
|||||||
);
|
);
|
||||||
|
|
||||||
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
|
||||||
accountxhttp.send(null);
|
accountxhttp.send(null);
|
||||||
|
|
||||||
this.timeTrackAccounts = timeTrackAccountsTMP;
|
this.timeTrackAccounts = timeTrackAccountsTMP;
|
||||||
|
|
||||||
//Get Location
|
//Get Location
|
||||||
var location;
|
var location;
|
||||||
var locSuc = false;
|
var locSuc = false;
|
||||||
var locationxhttp = new XMLHttpRequest();
|
var locationxhttp = new XMLHttpRequest();
|
||||||
locationxhttp.onreadystatechange = function() {
|
locationxhttp.onreadystatechange = function () {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
locSuc = true;
|
locSuc = true;
|
||||||
location = JSON.parse(locationxhttp.responseText);
|
location = JSON.parse(locationxhttp.responseText);
|
||||||
@ -162,19 +149,12 @@ export default {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
locationxhttp.setRequestHeader(
|
locationxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
"Authorization",
|
|
||||||
sessionStorage.getItem("jwt")
|
|
||||||
);
|
|
||||||
|
|
||||||
locationxhttp.send(null);
|
locationxhttp.send(null);
|
||||||
|
|
||||||
|
|
||||||
this.haveLocation = locSuc;
|
this.haveLocation = locSuc;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user