Format Timerecord related things

This commit is contained in:
Marcel Schwarz 2020-07-21 21:26:49 +02:00
parent e13d157dd6
commit 286d1c7fda
5 changed files with 317 additions and 345 deletions

View File

@ -47,9 +47,7 @@
v-on="on" v-on="on"
></v-text-field> ></v-text-field>
</template> </template>
<v-date-picker v-model="newstartdate" @input="menu = false" no-title scrollable> <v-date-picker v-model="newstartdate" @input="menu = false" no-title scrollable></v-date-picker>
</v-date-picker>
</v-menu> </v-menu>
</v-col> </v-col>
<v-col cols="12" sm="6"> <v-col cols="12" sm="6">
@ -71,9 +69,7 @@
v-on="on" v-on="on"
></v-text-field> ></v-text-field>
</template> </template>
<v-date-picker v-model="newenddate" @input="menu2 = false" no-title scrollable> <v-date-picker v-model="newenddate" @input="menu2 = false" no-title scrollable></v-date-picker>
</v-date-picker>
</v-menu> </v-menu>
</v-col> </v-col>
</v-row> </v-row>
@ -147,6 +143,7 @@
</template> </template>
<script> <script>
import {baseUri} from "../variables"; import {baseUri} from "../variables";
export default { export default {
name: "CreateTimeTrackAccount", name: "CreateTimeTrackAccount",
data: () => ({ data: () => ({
@ -186,11 +183,7 @@ export default {
false false
); );
accountxhttp.setRequestHeader("Content-Type", "application/json"); accountxhttp.setRequestHeader("Content-Type", "application/json");
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
accountxhttp.setRequestHeader(
"Authorization",
sessionStorage.getItem("jwt")
);
accountxhttp.send(null); accountxhttp.send(null);
if (this.newstartdate != "" && this.newenddate != "" && this.newdate != "" && account != "") { if (this.newstartdate != "" && this.newenddate != "" && this.newdate != "" && account != "") {
@ -231,7 +224,6 @@ export default {
if ((this.status == 200) & (this.readyState == 4)) { if ((this.status == 200) & (this.readyState == 4)) {
accounts = JSON.parse(accountsxhttp.responseText); accounts = JSON.parse(accountsxhttp.responseText);
accounts = accounts._embedded.accounts; accounts = accounts._embedded.accounts;
} }
}; };
accountsxhttp.open( accountsxhttp.open(
@ -242,16 +234,11 @@ export default {
false false
); );
accountsxhttp.setRequestHeader("Content-Type", "application/json"); accountsxhttp.setRequestHeader("Content-Type", "application/json");
accountsxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
accountsxhttp.setRequestHeader(
"Authorization",
sessionStorage.getItem("jwt")
);
accountsxhttp.send(null); accountsxhttp.send(null);
var accountnames = []; var accountnames = [];
for (let index = 0; index < accounts.length; index++) { for (let index = 0; index < accounts.length; index++) {
accountnames[index] = accounts[index].name; accountnames[index] = accounts[index].name;
} }
this.accounts = accountnames; this.accounts = accountnames;
}, },
@ -261,7 +248,6 @@ export default {
listen.addEventListener("keyup", e => { listen.addEventListener("keyup", e => {
if (e.keyCode === 13) { if (e.keyCode === 13) {
e.preventDefault(); e.preventDefault();
this.addRecord(); this.addRecord();
} }
}); });

View File

@ -58,9 +58,7 @@
v-on="on" v-on="on"
></v-text-field> ></v-text-field>
</template> </template>
<v-date-picker v-model="newenddate" @input="menu2 = false" no-title scrollable> <v-date-picker v-model="newenddate" @input="menu2 = false" no-title scrollable></v-date-picker>
</v-date-picker>
</v-menu> </v-menu>
</v-col> </v-col>
</v-row> </v-row>
@ -132,6 +130,7 @@
</v-card> </v-card>
</v-container> </v-container>
</template> </template>
<script> <script>
export default { export default {
name: "EditTimeTrackAccount", name: "EditTimeTrackAccount",
@ -194,12 +193,7 @@ export default {
record = JSON.parse(recordxhttp.responseText); record = JSON.parse(recordxhttp.responseText);
} }
}; };
recordxhttp.open( recordxhttp.open("GET", sessionStorage.getItem("timeRecordEditSelfLink"), false);
"GET",
sessionStorage.getItem("timeRecordEditSelfLink"),
false
);
recordxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt")); recordxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
recordxhttp.send(null); recordxhttp.send(null);
@ -225,7 +219,6 @@ export default {
listen.addEventListener("keyup", e => { listen.addEventListener("keyup", e => {
if (e.keyCode === 13) { if (e.keyCode === 13) {
e.preventDefault(); e.preventDefault();
this.editRecord(); this.editRecord();
} }
}); });

View File

@ -2,16 +2,14 @@
<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> <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 == '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> <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-card>
</v-col> </v-col>
<v-col></v-col> <v-col></v-col>
@ -54,7 +52,8 @@
<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._links.self.href, timeRecord.enddate)"> <v-btn fab dark small color="green"
@click="$emit('edit-timeRecord', timeRecord._links.self.href, timeRecord.enddate)">
<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._links.self.href)"> <v-btn fab dark small color="red" @click="$emit('del-timeRecord', timeRecord._links.self.href)">

View File

@ -28,7 +28,6 @@
<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>
@ -106,7 +105,6 @@ export default {
xhttp.onreadystatechange = function () { xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) { if (this.readyState == 4 && this.status == 200) {
var recordsDB = JSON.parse(xhttp.responseText); var recordsDB = JSON.parse(xhttp.responseText);
records = recordsDB._embedded.records; records = recordsDB._embedded.records;
recordLinks = recordsDB._links; recordLinks = recordsDB._links;
} }
@ -154,7 +152,6 @@ export default {
records[index].enddate = "pending"; records[index].enddate = "pending";
} }
} }
this.timeRecords = records; this.timeRecords = records;
} }
}; };

View File

@ -24,22 +24,19 @@
</v-row> </v-row>
</v-list-item-content> </v-list-item-content>
<v-list-item-action> <v-list-item-action>
<v-speed-dial <v-speed-dial v-model="fab" transition="slide-x-reverse-transition" direction="left" open-on-hover>
v-model="fab"
transition="slide-x-reverse-transition"
direction="left"
open-on-hover
>
<template v-slot:activator> <template v-slot:activator>
<v-btn v-model="fab" color="background" elevation="0" dark fab> <v-btn v-model="fab" color="background" elevation="0" dark fab>
<v-icon v-if="fab">mdi-close</v-icon> <v-icon v-if="fab">mdi-close</v-icon>
<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-timeTrackAccount', timeTrackAccount._links.self.href)"> <v-btn fab dark small color="green"
@click="$emit('edit-timeTrackAccount', timeTrackAccount._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-timeTrackAccount', timeTrackAccount._links.self.href)"> <v-btn fab dark small color="red"
@click="$emit('del-timeTrackAccount', timeTrackAccount._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>