Merge branch '105-dropdown-edit-create-timetrack' into 'master'

Resolve "Dropdown edit create timetrack"

Closes #105

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!83
This commit is contained in:
Tim Zieger 2020-05-30 09:11:06 +00:00
commit ea4493f955
4 changed files with 81 additions and 57 deletions

View File

@ -3,25 +3,30 @@
<v-card align-center> <v-card align-center>
<h3 class="text-center display-2 logowhite--text">Details</h3> <h3 class="text-center display-2 logowhite--text">Details</h3>
<v-form> <v-row>
<v-col cols="6">
<v-text-field <v-select
label="type"
v-model="newtype" v-model="newtype"
name="type" :items="types"
menu-props="auto"
label="Type"
hide-details
prepend-icon="mdi-currency-usd" prepend-icon="mdi-currency-usd"
type="text" single-line
color="primary" ></v-select>
/> </v-col>
<v-text-field <v-col cols="6">
label="Accountname" <v-select
v-model="accountname" v-model="accountname"
name="accountname" :items="accounts"
menu-props="auto"
label="Account"
hide-details
prepend-icon="mdi-account-tie" prepend-icon="mdi-account-tie"
type="text" single-line
color="primary" ></v-select>
/> </v-col>
</v-form> </v-row>
<v-row> <v-row>
<v-col cols="12" sm="6"> <v-col cols="12" sm="6">
<v-menu <v-menu
@ -153,6 +158,8 @@ export default {
menutime2: false, menutime2: false,
menu: false, menu: false,
menu2: false, menu2: false,
types: [ "PAID" ,"BREAK"],
accounts: "",
user: sessionStorage.getItem("timeTrackAccountListUserId"), user: sessionStorage.getItem("timeTrackAccountListUserId"),
newstartdate: "", newstartdate: "",
newenddate: "", newenddate: "",
@ -228,8 +235,39 @@ export default {
} }
} }
}, },
created (){
var accountsxhttp = new XMLHttpRequest();
var accounts;
accountsxhttp.onreadystatechange = function() {
if ((this.status == 200) & (this.readyState == 4)) {
accounts = JSON.parse(accountsxhttp.responseText);
accounts = accounts._embedded.accounts;
}
};
accountsxhttp.open(
"GET",
baseUri +
"/accounts/search/findByUsername?username=" +
sessionStorage.getItem("username") ,
false
);
accountsxhttp.setRequestHeader("Content-Type", "application/json");
accountsxhttp.setRequestHeader(
"Authorization",
sessionStorage.getItem("jwt")
);
accountsxhttp.send(null);
var accountnames =[];
for (let index = 0; index < accounts.length; index++) {
accountnames[index] = accounts[index].name;
}
this.accounts =accountnames;
},
mounted() { mounted() {
var listen = document.getElementById('createRecordListen'); var listen = document.getElementById("createRecordListen");
listen.addEventListener("keyup", e => { listen.addEventListener("keyup", e => {
if (e.keyCode === 13) { if (e.keyCode === 13) {

View File

@ -3,16 +3,17 @@
<v-card align-center> <v-card align-center>
<h3 class="text-center display-2 logowhite--text">Details</h3> <h3 class="text-center display-2 logowhite--text">Details</h3>
<v-form> <v-col cols="6">
<v-text-field <v-select
label="type"
v-model="newtype" v-model="newtype"
name="type" :items="types"
menu-props="auto"
label="Type"
hide-details
prepend-icon="mdi-currency-usd" prepend-icon="mdi-currency-usd"
type="text" single-line
color="primary" ></v-select>
/> </v-col>
</v-form>
<v-row> <v-row>
<v-col cols="12" sm="6" > <v-col cols="12" sm="6" >
<v-menu <v-menu
@ -143,6 +144,7 @@ export default {
menutime2: false, menutime2: false,
menu: false, menu: false,
menu2: false, menu2: false,
types: [ "PAID" ,"BREAK"],
type: "", type: "",
stardate: "", stardate: "",
enddate: "", enddate: "",

View File

@ -35,7 +35,7 @@
<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-account-tie</v-icon>{{" " + timeRecord.accountname}}</pre> <pre><v-icon color="primary">mdi-account-tie</v-icon>{{" " + timeRecord.account}}</pre>
</v-card> </v-card>
</v-col> </v-col>
<v-col></v-col> <v-col></v-col>

View File

@ -79,14 +79,15 @@ export default {
"GET", "GET",
baseUri + baseUri +
"/records/search/allForUser?username=" + "/records/search/allForUser?username=" +
sessionStorage.getItem("username"), sessionStorage.getItem("username") +
"&projection=overview",
false false
); );
xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt")); xhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
xhttp.send(null); xhttp.send(null);
//duration
for (let index = 0; index < records.length; index++) { for (let index = 0; index < records.length; index++) {
var record = records[index]; var record = records[index];
var time = record.duration; var time = record.duration;
@ -95,23 +96,6 @@ export default {
var min = time % 60; var min = time % 60;
record.duration = hours + "h " + min + "min"; 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; var start = record.startdate;
start = start.split("T"); start = start.split("T");