Format TimetrackAccount related things

This commit is contained in:
Marcel Schwarz 2020-07-21 21:59:44 +02:00
parent 286d1c7fda
commit ebd5493e46
3 changed files with 162 additions and 168 deletions

View File

@ -1,5 +1,5 @@
<template >
<v-container id = "createAccountListen">
<template>
<v-container id="createAccountListen">
<v-card align-center>
<p class="text-center logowhite--text" style="font-size:30pt">Details</p>
@ -37,8 +37,9 @@
</v-container>
</template>
<script>
import { baseUri } from "../variables";
export default {
import {baseUri} from "../variables";
export default {
name: "CreateTimeTrackAccount",
data: () => ({
user: sessionStorage.getItem("timeTrackAccountListUserId"),
@ -52,7 +53,7 @@ export default {
if (this.newname != "" || this.newrevenue != "" || this.newdescription != "") {
var xhttp = new XMLHttpRequest();
var suc;
xhttp.onreadystatechange = function() {
xhttp.onreadystatechange = function () {
if ((this.status == 201) & (this.readyState == 4)) {
suc = true;
}
@ -73,7 +74,7 @@ export default {
this.newdescription +
'"}'
);
if (suc == true ) {
if (suc == true) {
this.$router.push("/timetrackaccounts");
}
}
@ -89,5 +90,5 @@ export default {
}
});
}
};
};
</script>

View File

@ -1,5 +1,5 @@
<template >
<v-container id = "editAccountListen">
<template>
<v-container id="editAccountListen">
<v-card align-center>
<div class="text-center ma-3">
<p class="text-center logowhite--text" style="font-size:30pt">Account to edit:</p>
@ -45,7 +45,7 @@
</template>
<script>
export default {
export default {
name: "EditTimeTrackAccount",
data: () => ({
name: "",
@ -63,9 +63,9 @@ export default {
if (this.newname != this.name || this.newrevenue != this.revenue || this.newdescription != this.description) {
var xhttp = new XMLHttpRequest();
var suc;
xhttp.onreadystatechange = function() {
xhttp.onreadystatechange = function () {
if ((this.status == 200) & (this.readyState == 4)) {
suc =true;
suc = true;
}
};
xhttp.open("PATCH", link, false);
@ -82,8 +82,8 @@ export default {
this.newdescription +
'"}'
);
if(suc ==true){
this.$router.push( "/timetrackaccounts");
if (suc == true) {
this.$router.push("/timetrackaccounts");
}
}
},
@ -92,7 +92,7 @@ export default {
var accountxhttp = new XMLHttpRequest();
var account;
accountxhttp.onreadystatechange = function() {
accountxhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
account = JSON.parse(accountxhttp.responseText);
}
@ -125,5 +125,5 @@ export default {
}
});
}
};
};
</script>

View File

@ -20,10 +20,10 @@
</template>
<script>
import { baseUri} from "../variables.js";
import TimeTrackAccountItem from "./TimeTrackAccountItem.vue";
import {baseUri} from "../variables.js";
import TimeTrackAccountItem from "./TimeTrackAccountItem.vue";
export default {
export default {
name: "TimeTrackAccounts",
components: {
TimeTrackAccountItem
@ -37,27 +37,21 @@ export default {
methods: {
deleteTimeTrackAccount(selfLink) {
var accountxhttp = new XMLHttpRequest();
accountxhttp.onreadystatechange = function() {
accountxhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 204) {
location.reload();
}
};
accountxhttp.open("DELETE", selfLink , false);
accountxhttp.setRequestHeader(
"Authorization",
sessionStorage.getItem("jwt")
);
accountxhttp.open("DELETE", selfLink, false);
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
accountxhttp.send(null);
},
editTimeTrackAccount(selfLink) {
sessionStorage.setItem("timeTrackAccountEditSelfLink", selfLink);
this.$router.push( "/edittimetrackaccount");
this.$router.push("/edittimetrackaccount");
},
createTimeTrackAccount() {
this.$router.push( "/createtimetrackaccount");
this.$router.push("/createtimetrackaccount");
}
},
@ -65,7 +59,7 @@ export default {
var accounts;
var timeTrackAccountsTMP;
var accountxhttp = new XMLHttpRequest();
accountxhttp.onreadystatechange = function() {
accountxhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
accounts = JSON.parse(accountxhttp.responseText);
timeTrackAccountsTMP = accounts._embedded.accounts;
@ -80,12 +74,11 @@ export default {
);
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
accountxhttp.send(null);
this.timeTrackAccounts = timeTrackAccountsTMP;
}
};
};
</script>
<style scoped>