Merge branch '92-time-reccord-data-from-backend' into 'master'
Resolve "Time Reccord data from Backend" Closes #92 See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!73
This commit is contained in:
commit
8e2a8208f3
@ -14,7 +14,8 @@ import EditUser from "../views/EditUser.vue";
|
|||||||
import TimeTrackAccounts from "../views/TimeTrackAccounts.vue";
|
import TimeTrackAccounts from "../views/TimeTrackAccounts.vue";
|
||||||
import EditTimeTrackAccount from "../views/EditTimeTrackAccount.vue"
|
import EditTimeTrackAccount from "../views/EditTimeTrackAccount.vue"
|
||||||
import CreateTimeTrackAccount from "../views/CreateTimeTrackAccount.vue"
|
import CreateTimeTrackAccount from "../views/CreateTimeTrackAccount.vue"
|
||||||
|
import EditTimerecord from "../views/EditTimerecord.vue"
|
||||||
|
import CreateTimerecord from "../views/CreateTimerecord.vue"
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
@ -90,6 +91,16 @@ const routes = [
|
|||||||
name: "Create TimeTrack Account",
|
name: "Create TimeTrack Account",
|
||||||
component: CreateTimeTrackAccount
|
component: CreateTimeTrackAccount
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/edittimerecord",
|
||||||
|
name: "EditTimerecord",
|
||||||
|
component: EditTimerecord
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/createtimerecord",
|
||||||
|
name: "CreateTimerecord",
|
||||||
|
component: CreateTimerecord
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '*',
|
path: '*',
|
||||||
component: missing
|
component: missing
|
||||||
|
@ -1,2 +1 @@
|
|||||||
export const baseUri = 'http://plesk.icaotix.de:5000'
|
export const baseUri = 'http://plesk.icaotix.de:5000'
|
||||||
export const selfUri = 'http://plesk.icaotix.de:8080'
|
|
@ -37,7 +37,7 @@
|
|||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { baseUri, selfUri } from "../variables";
|
import { baseUri } from "../variables";
|
||||||
export default {
|
export default {
|
||||||
name: "CreateTimeTrackAccount",
|
name: "CreateTimeTrackAccount",
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@ -51,13 +51,13 @@ export default {
|
|||||||
addAccount() {
|
addAccount() {
|
||||||
if (this.newname != "" || this.newrevenue != "" || this.newdescription != "") {
|
if (this.newname != "" || this.newrevenue != "" || this.newdescription != "") {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
|
var suc;
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if ((this.status == 201) & (this.readyState == 4)) {
|
if ((this.status == 201) & (this.readyState == 4)) {
|
||||||
window.location.href = selfUri + "/timetrackaccounts";
|
suc = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttp.open("POST", baseUri + "/accounts", true);
|
xhttp.open("POST", baseUri + "/accounts", false);
|
||||||
xhttp.setRequestHeader("Content-Type", "application/json");
|
xhttp.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
@ -73,6 +73,9 @@ export default {
|
|||||||
this.newdescription +
|
this.newdescription +
|
||||||
'"}'
|
'"}'
|
||||||
);
|
);
|
||||||
|
if (suc == true ) {
|
||||||
|
this.$router.push("/timetrackaccounts");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
118
frontend/src/views/CreateTimerecord.vue
Normal file
118
frontend/src/views/CreateTimerecord.vue
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<template >
|
||||||
|
<v-container>
|
||||||
|
<v-card align-center>
|
||||||
|
<h3 class="text-center display-2 logowhite--text">Details</h3>
|
||||||
|
|
||||||
|
<v-form>
|
||||||
|
<v-text-field
|
||||||
|
label="startdate"
|
||||||
|
v-model="newstartdate"
|
||||||
|
name="startdate"
|
||||||
|
prepend-icon="mdi-clock-outline"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
<v-text-field
|
||||||
|
label="enddate"
|
||||||
|
v-model="newenddate"
|
||||||
|
name="enddate"
|
||||||
|
prepend-icon="mdi-clock-outline"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
<v-text-field
|
||||||
|
label="type"
|
||||||
|
v-model="newtype"
|
||||||
|
name="type"
|
||||||
|
prepend-icon="mdi-currency-usd"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
<v-text-field
|
||||||
|
label="Accountname"
|
||||||
|
v-model="accountname"
|
||||||
|
name="accountname"
|
||||||
|
prepend-icon="mdi-account-tie"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</v-form>
|
||||||
|
|
||||||
|
<div class="text-center ma-3">
|
||||||
|
<v-btn rounded color="logowhite" outlined dark v-on:click="addRecord()">Add</v-btn>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { baseUri} from "../variables";
|
||||||
|
export default {
|
||||||
|
name: "CreateTimeTrackAccount",
|
||||||
|
data: () => ({
|
||||||
|
user: sessionStorage.getItem("timeTrackAccountListUserId"),
|
||||||
|
newstartdate: "",
|
||||||
|
newenddate: "",
|
||||||
|
newtype: "",
|
||||||
|
accountname: ""
|
||||||
|
}),
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addRecord() {
|
||||||
|
var account ="";
|
||||||
|
var accountxhttp = new XMLHttpRequest();
|
||||||
|
|
||||||
|
|
||||||
|
accountxhttp.onreadystatechange = function() {
|
||||||
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
|
|
||||||
|
//account =
|
||||||
|
|
||||||
|
account =JSON.parse(accountxhttp.responseText)
|
||||||
|
|
||||||
|
|
||||||
|
account = account._links.self.href;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
accountxhttp.open("GET", baseUri + "/accounts/search/findByUsernameAndName?username=" + sessionStorage.getItem("username")+ "&account=" +this.accountname, false);
|
||||||
|
accountxhttp.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
accountxhttp.send( null );
|
||||||
|
|
||||||
|
|
||||||
|
if (this.newstartdate != "" && this.newenddate != "" && this.newdate != "" && account != "" ) {
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
var suc;
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if ((this.status == 201) & (this.readyState == 4)) {
|
||||||
|
suc = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhttp.open("POST", baseUri + "/records", false);
|
||||||
|
xhttp.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
xhttp.send(
|
||||||
|
"{" +
|
||||||
|
'"startdate": "' +
|
||||||
|
this.newstartdate +
|
||||||
|
'", "enddate": "' +
|
||||||
|
this.newenddate +
|
||||||
|
'", "type": "' +
|
||||||
|
this.newtype +
|
||||||
|
'", "account": "' +
|
||||||
|
account +
|
||||||
|
'"}'
|
||||||
|
);
|
||||||
|
if(suc == true){
|
||||||
|
this.$router.push( "/timerecords");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -44,7 +44,7 @@
|
|||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { selfUri } from "../variables";
|
|
||||||
export default {
|
export default {
|
||||||
name: "EditTimeTrackAccount",
|
name: "EditTimeTrackAccount",
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@ -63,13 +63,13 @@ export default {
|
|||||||
|
|
||||||
if (this.newname != this.name || this.newrevenue != this.revenue || this.newdescription != this.description) {
|
if (this.newname != this.name || this.newrevenue != this.revenue || this.newdescription != this.description) {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
|
var suc;
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if ((this.status == 200) & (this.readyState == 4)) {
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
window.location.href = selfUri + "/timetrackaccounts";
|
suc =true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttp.open("PATCH", link, true);
|
xhttp.open("PATCH", link, false);
|
||||||
xhttp.setRequestHeader("Content-Type", "application/json");
|
xhttp.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
@ -83,6 +83,9 @@ export default {
|
|||||||
this.newdescription +
|
this.newdescription +
|
||||||
'"}'
|
'"}'
|
||||||
);
|
);
|
||||||
|
if(suc ==true){
|
||||||
|
this.$router.push( "/timetrackaccounts");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
116
frontend/src/views/EditTimerecord.vue
Normal file
116
frontend/src/views/EditTimerecord.vue
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<template >
|
||||||
|
<v-container>
|
||||||
|
|
||||||
|
|
||||||
|
<v-card align-center>
|
||||||
|
<h3 class="text-center display-2 logowhite--text">Details</h3>
|
||||||
|
|
||||||
|
<v-form>
|
||||||
|
<v-text-field
|
||||||
|
label="type"
|
||||||
|
v-model="newtype"
|
||||||
|
name="type"
|
||||||
|
prepend-icon="mdi-currency-usd"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
<v-text-field
|
||||||
|
label="startdate"
|
||||||
|
v-model="newstartdate"
|
||||||
|
name="startdate"
|
||||||
|
prepend-icon="mdi-clock-outline"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
<v-text-field
|
||||||
|
label="enddate"
|
||||||
|
v-model="newenddate"
|
||||||
|
name="enddate"
|
||||||
|
prepend-icon="mdi-clock-outline"
|
||||||
|
type="text"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</v-form>
|
||||||
|
|
||||||
|
<div class="text-center ma-3">
|
||||||
|
<v-btn rounded color="logowhite" outlined dark v-on:click="editRecord()">Edit</v-btn>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "EditTimeTrackAccount",
|
||||||
|
data: () => ({
|
||||||
|
type: "",
|
||||||
|
stardate: "",
|
||||||
|
enddate: "",
|
||||||
|
|
||||||
|
newtype: "",
|
||||||
|
newstartdate: "",
|
||||||
|
newenddate: "",
|
||||||
|
}),
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
editRecord() {
|
||||||
|
var link = sessionStorage.getItem("timeRecordEditSelfLink");
|
||||||
|
|
||||||
|
if (this.newname != this.name || this.newstartdate != this.startdate || this.newenddate != this.enddate) {
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
var suc;
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
|
suc= true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhttp.open("PATCH", link, false);
|
||||||
|
xhttp.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
xhttp.send(
|
||||||
|
"{" +
|
||||||
|
|
||||||
|
' "startdate": "' +
|
||||||
|
this.newstartdate +
|
||||||
|
'", "enddate": "' +
|
||||||
|
this.newenddate +
|
||||||
|
'", "type": "' +
|
||||||
|
this.newtype +
|
||||||
|
'"}'
|
||||||
|
);
|
||||||
|
if(suc == true){
|
||||||
|
this.$router.push( "/timerecords");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
var userxhttp = new XMLHttpRequest();
|
||||||
|
var record;
|
||||||
|
|
||||||
|
userxhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
record = JSON.parse(userxhttp.responseText);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
userxhttp.open(
|
||||||
|
"GET",
|
||||||
|
sessionStorage.getItem("timeRecordEditSelfLink"),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
userxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
|
||||||
|
userxhttp.send(null);
|
||||||
|
this.type = record.type;
|
||||||
|
this.startdate = record.startdatte;
|
||||||
|
this.enddate = record.enddate;
|
||||||
|
|
||||||
|
this.newtype = record.type;
|
||||||
|
this.newstartdate = record.startdate;
|
||||||
|
this.newenddate = record.enddate;
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -73,7 +73,7 @@
|
|||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { baseUri,selfUri } from "../variables";
|
import { baseUri} from "../variables";
|
||||||
export default {
|
export default {
|
||||||
name: "Edituser",
|
name: "Edituser",
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@ -89,15 +89,16 @@ export default {
|
|||||||
editUserInformation() {
|
editUserInformation() {
|
||||||
var link = sessionStorage.getItem("edituser");
|
var link = sessionStorage.getItem("edituser");
|
||||||
document.getElementById("noudata").innerHTML = "";
|
document.getElementById("noudata").innerHTML = "";
|
||||||
|
var suc;
|
||||||
if (this.firstname != "" && this.lastname != "") {
|
if (this.firstname != "" && this.lastname != "") {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
|
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if ((this.status == 200) & (this.readyState == 4)) {
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
window.location.href = selfUri + "/users";
|
suc= true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttp.open("PATCH", link, true);
|
xhttp.open("PATCH", link, false);
|
||||||
xhttp.setRequestHeader("Content-Type", "application/json");
|
xhttp.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
@ -109,36 +110,45 @@ export default {
|
|||||||
this.lastname +
|
this.lastname +
|
||||||
'"}'
|
'"}'
|
||||||
);
|
);
|
||||||
|
if(suc == true ){
|
||||||
|
this.$router.push("/users");
|
||||||
|
}
|
||||||
} else if (this.firstname != "") {
|
} else if (this.firstname != "") {
|
||||||
var xhttpfirst = new XMLHttpRequest();
|
var xhttpfirst = new XMLHttpRequest();
|
||||||
|
|
||||||
xhttpfirst.onreadystatechange = function() {
|
xhttpfirst.onreadystatechange = function() {
|
||||||
if ((this.status == 200) & (this.readyState == 4)) {
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
window.location.href = selfUri + "/users";
|
suc = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttpfirst.open("PATCH", link, true);
|
xhttpfirst.open("PATCH", link, false);
|
||||||
xhttpfirst.setRequestHeader("Content-Type", "application/json");
|
xhttpfirst.setRequestHeader("Content-Type", "application/json");
|
||||||
xhttpfirst.setRequestHeader(
|
xhttpfirst.setRequestHeader(
|
||||||
"Authorization",
|
"Authorization",
|
||||||
sessionStorage.getItem("jwt")
|
sessionStorage.getItem("jwt")
|
||||||
);
|
);
|
||||||
xhttpfirst.send("{" + '"firstname": "' + this.firstname + '"}');
|
xhttpfirst.send("{" + '"firstname": "' + this.firstname + '"}');
|
||||||
|
if(suc == true ){
|
||||||
|
this.$router.push("/users");
|
||||||
|
}
|
||||||
} else if (this.lastname != "") {
|
} else if (this.lastname != "") {
|
||||||
var xhttplast = new XMLHttpRequest();
|
var xhttplast = new XMLHttpRequest();
|
||||||
|
|
||||||
xhttplast.onreadystatechange = function() {
|
xhttplast.onreadystatechange = function() {
|
||||||
if ((this.status == 200) & (this.readyState == 4)) {
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
window.location.href = selfUri + "/users";
|
suc = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttplast.open("PATCH", link, true);
|
xhttplast.open("PATCH", link, false);
|
||||||
xhttplast.setRequestHeader("Content-Type", "application/json");
|
xhttplast.setRequestHeader("Content-Type", "application/json");
|
||||||
xhttplast.setRequestHeader(
|
xhttplast.setRequestHeader(
|
||||||
"Authorization",
|
"Authorization",
|
||||||
sessionStorage.getItem("jwt")
|
sessionStorage.getItem("jwt")
|
||||||
);
|
);
|
||||||
xhttplast.send("{" + '"lastname": "' + this.lastname + '"}');
|
xhttplast.send("{" + '"lastname": "' + this.lastname + '"}');
|
||||||
|
if(suc == true ){
|
||||||
|
this.$router.push("/users");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("noudata").innerHTML = "please fill out at lest one field";
|
document.getElementById("noudata").innerHTML = "please fill out at lest one field";
|
||||||
}
|
}
|
||||||
@ -179,13 +189,13 @@ export default {
|
|||||||
if (numericerror == false) {
|
if (numericerror == false) {
|
||||||
|
|
||||||
var xhttpadd = new XMLHttpRequest();
|
var xhttpadd = new XMLHttpRequest();
|
||||||
|
var suc;
|
||||||
xhttpadd.onreadystatechange = function() {
|
xhttpadd.onreadystatechange = function() {
|
||||||
if ((this.status == 200) & (this.readyState == 4)) {
|
if ((this.status == 200) & (this.readyState == 4)) {
|
||||||
window.location.href = selfUri + "/users";
|
suc = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhttpadd.open("PATCH", link, true);
|
xhttpadd.open("PATCH", link, false);
|
||||||
xhttpadd.setRequestHeader("Content-Type", "application/json");
|
xhttpadd.setRequestHeader("Content-Type", "application/json");
|
||||||
xhttpadd.setRequestHeader(
|
xhttpadd.setRequestHeader(
|
||||||
"Authorization",
|
"Authorization",
|
||||||
@ -197,6 +207,9 @@ export default {
|
|||||||
sessionStorage.getItem("locationlink") +
|
sessionStorage.getItem("locationlink") +
|
||||||
'"}'
|
'"}'
|
||||||
);
|
);
|
||||||
|
if (suc == true) {
|
||||||
|
this.$router.push("/users");
|
||||||
|
}
|
||||||
document.getElementById("locationnotcomplete").innerHTML = "";
|
document.getElementById("locationnotcomplete").innerHTML = "";
|
||||||
sessionStorage.removeItem("locationlink");
|
sessionStorage.removeItem("locationlink");
|
||||||
}
|
}
|
||||||
|
@ -2,28 +2,40 @@
|
|||||||
<v-card outlined>
|
<v-card outlined>
|
||||||
<v-list-item class="main_accent">
|
<v-list-item class="main_accent">
|
||||||
<v-list-item-content>
|
<v-list-item-content>
|
||||||
|
<!-- <v-col cols="2" >
|
||||||
|
<v-card color="background" elevation="0">
|
||||||
|
<pre><v-icon color="primary">mdi-calendar-range</v-icon>{{" " + timeRecord.date}}</pre>
|
||||||
|
</v-card>
|
||||||
|
</v-col> -->
|
||||||
|
<h3 justify-center>{{timeRecord.date}}</h3>
|
||||||
<v-row no-gutters align="center">
|
<v-row no-gutters align="center">
|
||||||
<v-col cols="2">
|
<v-col cols="2">
|
||||||
<v-card color="background" elevation="0">
|
<v-card color="background" elevation="0">
|
||||||
<pre><v-icon color="green" v-bind:class="{'d-none':timeRecord.type == 'Lunch'}">mdi-currency-usd</v-icon><v-icon color="red" v-bind:class="{'d-none':timeRecord.type == 'Paid'}">mdi-currency-usd-off</v-icon>{{" " + timeRecord.type}}</pre>
|
<pre><v-icon color="green" v-bind:class="{'d-none':timeRecord.type == 'BREAK'}">mdi-currency-usd</v-icon><v-icon color="red" v-bind:class="{'d-none':timeRecord.type == 'PAID'}">mdi-currency-usd-off</v-icon>{{" " + timeRecord.type}}</pre>
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
<v-col></v-col>
|
|
||||||
<v-col cols="3">
|
|
||||||
<v-card color="background" elevation="0">
|
|
||||||
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" " + timeRecord.start}}</pre>
|
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
<v-col></v-col>
|
|
||||||
<v-col cols="3">
|
|
||||||
<v-card color="background" elevation="0">
|
|
||||||
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" " + timeRecord.end}}</pre>
|
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col></v-col>
|
<v-col></v-col>
|
||||||
<v-col cols="2">
|
<v-col cols="2">
|
||||||
<v-card color="background" elevation="0">
|
<v-card color="background" elevation="0">
|
||||||
<pre><v-icon color="primary">mdi-timer</v-icon>{{" " + timeRecord.time}}</pre>
|
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" Start " + timeRecord.startdate}}</pre>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col></v-col>
|
||||||
|
<v-col cols="2">
|
||||||
|
<v-card color="background" elevation="0">
|
||||||
|
<pre><v-icon color="primary">mdi-clock-outline</v-icon>{{" End " + timeRecord.enddate}}</pre>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col></v-col>
|
||||||
|
<v-col cols="2">
|
||||||
|
<v-card color="background" elevation="0">
|
||||||
|
<pre><v-icon color="primary">mdi-timer</v-icon>{{" " + timeRecord.duration}}</pre>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col></v-col>
|
||||||
|
<v-col cols="2">
|
||||||
|
<v-card color="background" elevation="0">
|
||||||
|
<pre><v-icon color="primary">mdi-account-tie</v-icon>{{" " + timeRecord.accountname}}</pre>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col></v-col>
|
<v-col></v-col>
|
||||||
@ -42,10 +54,10 @@
|
|||||||
<v-icon v-else>mdi-pencil</v-icon>
|
<v-icon v-else>mdi-pencil</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<v-btn fab dark small color="green" @click="$emit('edit-timeRecord', timeRecord.id)">
|
<v-btn fab dark small color="green" @click="$emit('edit-timeRecord', timeRecord._links.self.href)">
|
||||||
<v-icon>mdi-file-document-edit</v-icon>
|
<v-icon>mdi-file-document-edit</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn fab dark small color="red" @click="$emit('del-timeRecord', timeRecord.id)">
|
<v-btn fab dark small color="red" @click="$emit('del-timeRecord', timeRecord._links.self.href)">
|
||||||
<v-icon>mdi-delete</v-icon>
|
<v-icon>mdi-delete</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-speed-dial>
|
</v-speed-dial>
|
||||||
|
@ -1,26 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container fluid>
|
<v-container fluid>
|
||||||
<div v-bind:key="timeRecord.id" v-for="timeRecord in timeRecords">
|
<div v-bind:key="timeRecord._links.self.href" v-for="timeRecord in timeRecords">
|
||||||
<TimeRecordItem
|
<TimeRecordItem
|
||||||
v-bind:timeRecord="timeRecord"
|
v-bind:timeRecord="timeRecord"
|
||||||
v-on:del-timeRecord="deleteTimeRecord"
|
v-on:del-timeRecord="deleteTimeRecord"
|
||||||
v-on:edit-timeRecord="editTimeRecord"
|
v-on:edit-timeRecord="editTimeRecord"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="6"></v-col>
|
<v-col cols="6"></v-col>
|
||||||
<v-col cols="1">
|
<v-col cols="1">
|
||||||
<v-btn fab color="primary" @click="createTimeRecord()">
|
<v-btn fab color="primary" @click="createTimeRecord()">
|
||||||
<v-icon>mdi-plus</v-icon>
|
<v-icon>mdi-plus</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="5"></v-col>
|
<v-col cols="5"></v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TimeRecordItem from "./TimeRecordItem.vue";
|
import TimeRecordItem from "./TimeRecordItem.vue";
|
||||||
|
import { baseUri } from "../variables.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TimeRecords",
|
name: "TimeRecords",
|
||||||
@ -29,85 +30,97 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
timeRecords: [
|
timeRecords: ""
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
start: "25.04.2020 / 8:00",
|
|
||||||
end: "25.04.2020 / 13:00",
|
|
||||||
time: "5:00",
|
|
||||||
type: "Paid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
start: "25.04.2020 / 13:00",
|
|
||||||
end: "25.04.2020 / 14:00",
|
|
||||||
time: "1:00",
|
|
||||||
type: "Lunch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
start: "25.04.2020 / 14:00 ",
|
|
||||||
end: "25.04.2020 / 16:30",
|
|
||||||
time: "2:30",
|
|
||||||
type: "Paid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
start: "25.04.2020 / 8:00",
|
|
||||||
end: "25.04.2020 / 13:00",
|
|
||||||
time: "10:00",
|
|
||||||
type: "Paid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
start: "25.04.2020 / 13:00",
|
|
||||||
end: "25.04.2020 / 14:00",
|
|
||||||
time: "1:00",
|
|
||||||
type: "Lunch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
start: "25.04.2020 / 14:00 ",
|
|
||||||
end: "25.04.2020 / 16:30",
|
|
||||||
time: "2:30",
|
|
||||||
type: "Paid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 7,
|
|
||||||
start: "25.04.2020 / 8:00",
|
|
||||||
end: "25.04.2020 / 13:00",
|
|
||||||
time: "5:00",
|
|
||||||
type: "Paid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 8,
|
|
||||||
start: "25.04.2020 / 13:00",
|
|
||||||
end: "25.04.2020 / 14:00",
|
|
||||||
time: "1:00",
|
|
||||||
type: "Lunch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 9,
|
|
||||||
start: "25.04.2020 / 14:00 ",
|
|
||||||
end: "25.04.2020 / 16:30",
|
|
||||||
time: "2:30",
|
|
||||||
type: "Paid"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
deleteTimeRecord(id) {
|
deleteTimeRecord(selfLink) {
|
||||||
this.timeRecords = this.timeRecords.filter(
|
var userxhttp = new XMLHttpRequest();
|
||||||
timeRecord => timeRecord.id !== id
|
userxhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 204) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
userxhttp.open("DELETE", selfLink, false);
|
||||||
|
|
||||||
|
userxhttp.setRequestHeader(
|
||||||
|
"Authorization",
|
||||||
|
sessionStorage.getItem("jwt")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
userxhttp.send(null);
|
||||||
},
|
},
|
||||||
editTimeRecord(id) {
|
editTimeRecord(selfLink) {
|
||||||
alert("Not implemented yet. TimeRecordId: " + id);
|
sessionStorage.setItem("timeRecordEditSelfLink", selfLink);
|
||||||
|
|
||||||
|
this.$router.push( "/edittimerecord");
|
||||||
},
|
},
|
||||||
createTimeRecord() {
|
createTimeRecord(selfLink) {
|
||||||
alert("Not implemented yet.")
|
sessionStorage.setItem("timeRecordEditSelfLink", selfLink);
|
||||||
|
|
||||||
|
this.$router.push( "/createtimerecord");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
var records;
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
var recordsDB = JSON.parse(xhttp.responseText);
|
||||||
|
|
||||||
|
records = recordsDB._embedded.records;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhttp.open(
|
||||||
|
"GET",
|
||||||
|
baseUri +
|
||||||
|
"/records/search/allForUser?username=" +
|
||||||
|
sessionStorage.getItem("username"),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
|
||||||
|
xhttp.send(null);
|
||||||
|
//duration
|
||||||
|
for (let index = 0; index < records.length; index++) {
|
||||||
|
var record = records[index];
|
||||||
|
var time = record.duration;
|
||||||
|
var hours = time / 60;
|
||||||
|
hours = Math.floor(hours);
|
||||||
|
|
||||||
|
var min = time % 60;
|
||||||
|
record.duration = hours + "h " + min + "min";
|
||||||
|
|
||||||
|
var accxhttp = new XMLHttpRequest();
|
||||||
|
var acc = "";
|
||||||
|
accxhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
acc = JSON.parse(accxhttp.responseText);
|
||||||
|
|
||||||
|
acc = acc.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
accxhttp.open("GET", records[index]._links.self.href + "/account", false);
|
||||||
|
|
||||||
|
accxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
||||||
|
|
||||||
|
accxhttp.send(null);
|
||||||
|
records[index].accountname = acc;
|
||||||
|
|
||||||
|
var start = record.startdate;
|
||||||
|
|
||||||
|
start = start.split("T");
|
||||||
|
records[index].startdate = start[1];
|
||||||
|
records[index].date = start[0];
|
||||||
|
|
||||||
|
var end = record.enddate;
|
||||||
|
|
||||||
|
end = end.split("T");
|
||||||
|
records[index].enddate = end[1];
|
||||||
|
}
|
||||||
|
this.timeRecords = records;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { baseUri, selfUri } from "../variables.js";
|
import { baseUri} from "../variables.js";
|
||||||
import TimeTrackAccountItem from "./TimeTrackAccountItem.vue";
|
import TimeTrackAccountItem from "./TimeTrackAccountItem.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -53,10 +53,10 @@ export default {
|
|||||||
editTimeTrackAccount(selfLink) {
|
editTimeTrackAccount(selfLink) {
|
||||||
sessionStorage.setItem("timeTrackAccountEditSelfLink", selfLink);
|
sessionStorage.setItem("timeTrackAccountEditSelfLink", selfLink);
|
||||||
|
|
||||||
window.location.href = selfUri + "/edittimetrackaccount";
|
this.$router.push( "/edittimetrackaccount");
|
||||||
},
|
},
|
||||||
createTimeTrackAccount() {
|
createTimeTrackAccount() {
|
||||||
window.location.href = selfUri + "/createtimetrackaccount";
|
this.$router.push( "/createtimetrackaccount");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { baseUri,selfUri } from "../variables.js";
|
import { baseUri} from "../variables.js";
|
||||||
import UsersItems from "./UsersItems.vue";
|
import UsersItems from "./UsersItems.vue";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -22,7 +22,7 @@ export default {
|
|||||||
|
|
||||||
sessionStorage.setItem("edituser", userlink);
|
sessionStorage.setItem("edituser", userlink);
|
||||||
|
|
||||||
window.location.href = selfUri + "/edituser";
|
this.$router.push( "/edituser");
|
||||||
},
|
},
|
||||||
deluser(selfLink){
|
deluser(selfLink){
|
||||||
var userxhttp = new XMLHttpRequest();
|
var userxhttp = new XMLHttpRequest();
|
||||||
@ -44,7 +44,7 @@ export default {
|
|||||||
sessionStorage.setItem("timeTrackAccountListUser", username);
|
sessionStorage.setItem("timeTrackAccountListUser", username);
|
||||||
sessionStorage.setItem("timeTrackAccountListUserId", uid);
|
sessionStorage.setItem("timeTrackAccountListUserId", uid);
|
||||||
|
|
||||||
window.location.href = selfUri + "/timetrackaccounts";
|
this.$router.push("/timetrackaccounts");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
Loading…
Reference in New Issue
Block a user