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:
commit
ea4493f955
@ -1,29 +1,34 @@
|
|||||||
<template >
|
<template >
|
||||||
<v-container id = "createRecordListen">
|
<v-container id="createRecordListen">
|
||||||
<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"
|
:items="types"
|
||||||
name="type"
|
menu-props="auto"
|
||||||
prepend-icon="mdi-currency-usd"
|
label="Type"
|
||||||
type="text"
|
hide-details
|
||||||
color="primary"
|
prepend-icon="mdi-currency-usd"
|
||||||
/>
|
single-line
|
||||||
<v-text-field
|
></v-select>
|
||||||
label="Accountname"
|
</v-col>
|
||||||
v-model="accountname"
|
<v-col cols="6">
|
||||||
name="accountname"
|
<v-select
|
||||||
prepend-icon="mdi-account-tie"
|
v-model="accountname"
|
||||||
type="text"
|
:items="accounts"
|
||||||
color="primary"
|
menu-props="auto"
|
||||||
/>
|
label="Account"
|
||||||
</v-form>
|
hide-details
|
||||||
<v-row>
|
prepend-icon="mdi-account-tie"
|
||||||
<v-col cols="12" sm="6" >
|
single-line
|
||||||
|
></v-select>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" sm="6">
|
||||||
<v-menu
|
<v-menu
|
||||||
ref="menu"
|
ref="menu"
|
||||||
v-model="menu"
|
v-model="menu"
|
||||||
@ -49,7 +54,7 @@
|
|||||||
</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">
|
||||||
<v-menu
|
<v-menu
|
||||||
ref="menu2"
|
ref="menu2"
|
||||||
v-model="menu2"
|
v-model="menu2"
|
||||||
@ -147,12 +152,14 @@ import { baseUri } from "../variables";
|
|||||||
export default {
|
export default {
|
||||||
name: "CreateTimeTrackAccount",
|
name: "CreateTimeTrackAccount",
|
||||||
data: () => ({
|
data: () => ({
|
||||||
timestart: null,
|
timestart: null,
|
||||||
menutime: false,
|
menutime: false,
|
||||||
timeend: null,
|
timeend: null,
|
||||||
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: "",
|
||||||
@ -199,8 +206,8 @@ export default {
|
|||||||
) {
|
) {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
var suc;
|
var suc;
|
||||||
this.newstartdate = this.newstartdate + "T" + this.timestart;
|
this.newstartdate = this.newstartdate + "T" + this.timestart;
|
||||||
this.newenddate = this.newenddate + "T" + this.timeend;
|
this.newenddate = this.newenddate + "T" + this.timeend;
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if ((this.status == 201) & (this.readyState == 4)) {
|
if ((this.status == 201) & (this.readyState == 4)) {
|
||||||
suc = true;
|
suc = true;
|
||||||
@ -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) {
|
||||||
|
@ -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: "",
|
||||||
|
@ -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>
|
||||||
|
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user