|
|
@ -8,22 +8,24 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<HistoryForTracker/> |
|
|
|
<TasksForTracker/> |
|
|
|
<TasksForTracker/> |
|
|
|
<History/> |
|
|
|
<History/> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import moment from 'moment' |
|
|
|
import moment from 'moment' |
|
|
|
import iziToast from 'izitoast' |
|
|
|
|
|
|
|
import axios from 'axios' |
|
|
|
|
|
|
|
import bootstrap from 'bootstrap' |
|
|
|
import bootstrap from 'bootstrap' |
|
|
|
|
|
|
|
import iziToast from "izitoast"; |
|
|
|
import Menu from "./views/Menu"; |
|
|
|
import Menu from "./views/Menu"; |
|
|
|
import History from "./views/History"; |
|
|
|
import History from "./views/History"; |
|
|
|
import TasksForTracker from "./views/TasksForTracker"; |
|
|
|
import TasksForTracker from "./views/TasksForTracker"; |
|
|
|
|
|
|
|
import HistoryForTracker from "./views/HistoryForTracker"; |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
el: '#root', |
|
|
|
el: '#root', |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
|
|
|
|
HistoryForTracker, |
|
|
|
TasksForTracker, |
|
|
|
TasksForTracker, |
|
|
|
History, |
|
|
|
History, |
|
|
|
Menu |
|
|
|
Menu |
|
|
@ -70,7 +72,7 @@ export default { |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
loadTooltips() { |
|
|
|
loadTooltips() { |
|
|
|
let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) |
|
|
|
let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) |
|
|
|
tooltipTriggerList.map(function (tooltipTriggerEl) { |
|
|
|
tooltipTriggerList.map((tooltipTriggerEl) => { |
|
|
|
return new bootstrap.Tooltip(tooltipTriggerEl) |
|
|
|
return new bootstrap.Tooltip(tooltipTriggerEl) |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -103,7 +105,7 @@ export default { |
|
|
|
stopActiveTracker() { |
|
|
|
stopActiveTracker() { |
|
|
|
let component = this; |
|
|
|
let component = this; |
|
|
|
|
|
|
|
|
|
|
|
component.trackers.forEach(function (tracker) { |
|
|
|
component.trackers.forEach((tracker) => { |
|
|
|
if (tracker.tracking === true) { |
|
|
|
if (tracker.tracking === true) { |
|
|
|
component.stopTracking(tracker); |
|
|
|
component.stopTracking(tracker); |
|
|
|
} |
|
|
|
} |
|
|
@ -112,119 +114,6 @@ export default { |
|
|
|
getTrackingStartTime(tracker) { |
|
|
|
getTrackingStartTime(tracker) { |
|
|
|
return moment(tracker.trackingStarted).format('LT'); |
|
|
|
return moment(tracker.trackingStarted).format('LT'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
deleteTracker(index, archive = false) { |
|
|
|
|
|
|
|
let component = this; |
|
|
|
|
|
|
|
let message = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (archive) { |
|
|
|
|
|
|
|
Object.assign(this.trashed, this.archive[index]); |
|
|
|
|
|
|
|
let name = this.archive[index].number; |
|
|
|
|
|
|
|
message = 'Tracker "' + name + '" wurde gelöscht'; |
|
|
|
|
|
|
|
this.archive.splice(index, 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Object.assign(this.trashed, this.trackers[index]); |
|
|
|
|
|
|
|
let name = this.trackers[index].number; |
|
|
|
|
|
|
|
message = 'Tracker "' + name + '" wurde gelöscht'; |
|
|
|
|
|
|
|
this.trackers.splice(index, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iziToast.show({ |
|
|
|
|
|
|
|
message: message, |
|
|
|
|
|
|
|
color: 'blue', |
|
|
|
|
|
|
|
buttons: [ |
|
|
|
|
|
|
|
['<button><i class="fas fa-undo"></i></button>', function (instance, toast) { |
|
|
|
|
|
|
|
instance.hide({ |
|
|
|
|
|
|
|
transitionOut: 'fadeOutUp', |
|
|
|
|
|
|
|
onClosing: function(){ |
|
|
|
|
|
|
|
component.restoreTrashed(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, toast, 'buttonName'); |
|
|
|
|
|
|
|
}, true] |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
deleteHistoryEntry(trackerIndex, historyIndex) { |
|
|
|
|
|
|
|
if (trackerIndex) { |
|
|
|
|
|
|
|
this.trackers[trackerIndex].history.splice(historyIndex, 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.selectedTracker.history.splice(historyIndex, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
bookTimeManually(tracker, minutes) { |
|
|
|
|
|
|
|
tracker.history.pushToBeginning({ |
|
|
|
|
|
|
|
trackingStarted: moment(), |
|
|
|
|
|
|
|
trackingStopped: moment(), |
|
|
|
|
|
|
|
manually: true, |
|
|
|
|
|
|
|
minutes: Math.round(minutes) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
showCustomBookingForTracker(tracker) { |
|
|
|
|
|
|
|
this.selectedTracker = tracker; |
|
|
|
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
let customBookingModal = new bootstrap.Modal(document.getElementById('customBookingModal')); |
|
|
|
|
|
|
|
customBookingModal.toggle(); |
|
|
|
|
|
|
|
}, 50); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
makeCustomBooking(subtract = false) { |
|
|
|
|
|
|
|
if (subtract) { |
|
|
|
|
|
|
|
this.customBookingValue -= (this.customBookingValue * 2) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iziToast.show({ |
|
|
|
|
|
|
|
message: 'Buchung erfolgreich', |
|
|
|
|
|
|
|
color: 'green' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.bookTimeManually(this.selectedTracker, this.customBookingValue); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getPortalLink (test = false) { |
|
|
|
|
|
|
|
let finalPortalName = this.portal.replaceAll('_', '-'); |
|
|
|
|
|
|
|
finalPortalName.replaceAll('-test', ''); |
|
|
|
|
|
|
|
finalPortalName += test ? '-test' : ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'https://' + finalPortalName + '.vemap.com'; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
sendPortalChangeRequest() { |
|
|
|
|
|
|
|
let component = this; |
|
|
|
|
|
|
|
let publicDBParam = this.publicDB ? '&publicDB=1' : ''; |
|
|
|
|
|
|
|
axios.get( |
|
|
|
|
|
|
|
'https://settings.vemap.docker/?portal2change=' + component.portal + publicDBParam |
|
|
|
|
|
|
|
).then((response) => { |
|
|
|
|
|
|
|
console.log(response) |
|
|
|
|
|
|
|
}).catch((error) => { |
|
|
|
|
|
|
|
console.log(error); |
|
|
|
|
|
|
|
// An error is expected here due to apache restarting |
|
|
|
|
|
|
|
iziToast.show({ |
|
|
|
|
|
|
|
message: 'Portal-Wechsel erfolgreich', |
|
|
|
|
|
|
|
color: 'green' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (component.fun) { |
|
|
|
|
|
|
|
playSound(oneOf(component.sounds.animals)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
component.updateStorage(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
importPortalsJson() { |
|
|
|
|
|
|
|
if (this.importStringForPortals !== '') { |
|
|
|
|
|
|
|
this.portals = JSON.parse(this.importStringForPortals); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.importStringForPortals = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iziToast.show({ |
|
|
|
|
|
|
|
message: 'Portalnamen importiert', |
|
|
|
|
|
|
|
color: 'green' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
checkTimeBoxes() { |
|
|
|
checkTimeBoxes() { |
|
|
|
let component = this; |
|
|
|
let component = this; |
|
|
|
|
|
|
|
|
|
|
@ -254,7 +143,7 @@ export default { |
|
|
|
let totalTime = 0; |
|
|
|
let totalTime = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (tracker.history.length > 0) { |
|
|
|
if (tracker.history.length > 0) { |
|
|
|
tracker.history.forEach(function (historyEntry) { |
|
|
|
tracker.history.forEach((historyEntry) => { |
|
|
|
totalTime += Math.round(historyEntry.minutes); |
|
|
|
totalTime += Math.round(historyEntry.minutes); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -301,11 +190,6 @@ export default { |
|
|
|
theme() { |
|
|
|
theme() { |
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
this.$forceUpdate(); |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
|
|
|
|
fun() { |
|
|
|
|
|
|
|
this.fun = this.validateBooleans(this.fun) |
|
|
|
|
|
|
|
this.$store.commit('saveTrackers'); |
|
|
|
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -320,15 +204,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function oneOf(collection) { |
|
|
|
|
|
|
|
return collection[Math.floor(Math.random()*collection.length)]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function playSound(sound, extension = null) { |
|
|
|
|
|
|
|
let audio = new Audio('/timetrack/assets/audio/' + sound + (extension ?? '.mp3')); |
|
|
|
|
|
|
|
audio.play(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style> |
|
|
|
<style> |
|
|
|