Rebuild Times in Projects
Added Icons Rebuild Time Duration
This commit is contained in:
@@ -49,7 +49,8 @@ const navLinks = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Artikel",
|
label: "Artikel",
|
||||||
to: "/products"
|
to: "/products",
|
||||||
|
icon: "i-heroicons-puzzle-piece"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Dokumente",
|
label: "Dokumente",
|
||||||
@@ -58,7 +59,8 @@ const navLinks = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Inventar",
|
label: "Inventar",
|
||||||
to: "/inventory"
|
to: "/inventory",
|
||||||
|
icon: "i-heroicons-square-3-stack-3d"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ const calendarOptions = reactive({
|
|||||||
newEventData.value.end = info.endStr
|
newEventData.value.end = info.endStr
|
||||||
openNewEventModal.value = true
|
openNewEventModal.value = true
|
||||||
},
|
},
|
||||||
|
eventClick: function (info){
|
||||||
|
console.log(info)
|
||||||
|
},
|
||||||
resourceGroupField: "type",
|
resourceGroupField: "type",
|
||||||
resources: resources,
|
resources: resources,
|
||||||
nowIndicator:true
|
nowIndicator:true
|
||||||
|
|||||||
@@ -6,12 +6,11 @@ definePageMeta({
|
|||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const {getProjectById, getFormSubmitsWithLabelProp} = useDataStore()
|
const {getProjectById, getFormSubmitsWithLabelProp, getTimesByProjectId} = useDataStore()
|
||||||
const {forms, formSubmits} = storeToRefs(useDataStore())
|
const {forms, formSubmits, times} = storeToRefs(useDataStore())
|
||||||
|
|
||||||
const currentProject = getProjectById(Number(route.params.id))
|
const currentProject = getProjectById(Number(route.params.id))
|
||||||
|
|
||||||
|
|
||||||
const formSubmissionsComposed = getFormSubmitsWithLabelProp
|
const formSubmissionsComposed = getFormSubmitsWithLabelProp
|
||||||
const formModalOpen = ref(false)
|
const formModalOpen = ref(false)
|
||||||
const newFormSubmissionData = ref({
|
const newFormSubmissionData = ref({
|
||||||
@@ -20,6 +19,28 @@ const newFormSubmissionData = ref({
|
|||||||
submitted: false
|
submitted: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const timeTableRows = [
|
||||||
|
{
|
||||||
|
key:"user",
|
||||||
|
label: "Benutzer"
|
||||||
|
},{
|
||||||
|
key:"start",
|
||||||
|
label: "Start"
|
||||||
|
},{
|
||||||
|
key:"end",
|
||||||
|
label:"Ende"
|
||||||
|
},{
|
||||||
|
key:"duration",
|
||||||
|
label: "Dauer"
|
||||||
|
},{
|
||||||
|
key: "type",
|
||||||
|
label: "Typ"
|
||||||
|
},{
|
||||||
|
key:"notes",
|
||||||
|
label: "Notizen"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
const addNewFormSubmission = async () => {
|
const addNewFormSubmission = async () => {
|
||||||
//Add Form Submission
|
//Add Form Submission
|
||||||
const {data:insertData,error:insertError} = await supabase
|
const {data:insertData,error:insertError} = await supabase
|
||||||
@@ -227,7 +248,11 @@ const phaseInfo = ref({
|
|||||||
<client-only><editor-js v-model="newProjectDescription" /></client-only>
|
<client-only><editor-js v-model="newProjectDescription" /></client-only>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.key === 'timetracking'" class="space-y-3">
|
<div v-else-if="item.key === 'timetracking'" class="space-y-3">
|
||||||
<p>Hier wird aktuell noch gearbeitet</p>
|
Projekt Zeit: {{currentProject.projectHours.toString().replace(".",":")}} Stunden
|
||||||
|
<UTable
|
||||||
|
:rows="getTimesByProjectId(currentProject.id)"
|
||||||
|
:columns="timeTableRows"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.key === 'material'" class="space-y-3">
|
<div v-else-if="item.key === 'material'" class="space-y-3">
|
||||||
<p>Hier wird aktuell noch gearbeitet</p>
|
<p>Hier wird aktuell noch gearbeitet</p>
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div id="left">
|
|
||||||
<!-- TODO: Projekt Auflistung überarbeiten, Rechte Seite wird nicht genutzt -->
|
<UTable
|
||||||
|
:rows="projects"
|
||||||
|
:columns="projectColumns"
|
||||||
|
@select="selectProject"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div id="left">
|
||||||
<UButton @click="showCreateProject = true">+ Projekt</UButton>
|
<UButton @click="showCreateProject = true">+ Projekt</UButton>
|
||||||
<UModal v-model="showCreateProject">
|
<UModal v-model="showCreateProject">
|
||||||
<UCard>
|
<UCard>
|
||||||
@@ -46,11 +55,18 @@
|
|||||||
</UCard>
|
</UCard>
|
||||||
</UModal>
|
</UModal>
|
||||||
|
|
||||||
<router-link v-for="item in projects" :to="`/projects/${item.id}`">
|
<UTable
|
||||||
|
:rows="projects"
|
||||||
|
@select="selectCustomer"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<!– <router-link v-for="item in projects" :to="`/projects/${item.id}`">
|
||||||
<UCard class="listItem">
|
<UCard class="listItem">
|
||||||
<UBadge>{{item.id}}</UBadge> {{item.name}}
|
<UBadge>{{item.id}}</UBadge> {{item.name}}
|
||||||
</UCard>
|
</UCard>
|
||||||
</router-link>
|
</router-link>–>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -67,15 +83,15 @@
|
|||||||
Notizen: <br>
|
Notizen: <br>
|
||||||
{{selectedItem.notes}}
|
{{selectedItem.notes}}
|
||||||
|
|
||||||
<!-- Lieferantenrechnungen: <br>
|
<!– Lieferantenrechnungen: <br>
|
||||||
<UTable :rows="dataStore.getVendorInvoicesByProjectId(selectedItem.id)"></UTable>
|
<UTable :rows="dataStore.getVendorInvoicesByProjectId(selectedItem.id)"></UTable>
|
||||||
{{dataStore.getVendorInvoicesByProjectId(selectedItem.id)}}-->
|
{{dataStore.getVendorInvoicesByProjectId(selectedItem.id)}}–>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</UCard>
|
</UCard>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -88,10 +104,33 @@ definePageMeta({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
|
const router = useRouter()
|
||||||
const {projects,customers} = storeToRefs(useDataStore())
|
const {projects,customers} = storeToRefs(useDataStore())
|
||||||
const {fetchProjects} = useDataStore()
|
const {fetchProjects} = useDataStore()
|
||||||
|
|
||||||
|
const projectColumns = [
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
label: "Name.",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "customer",
|
||||||
|
label: "Kundennummer",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "notes",
|
||||||
|
label: "Notizen",
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const selectProject = (project) => {
|
||||||
|
router.push(`/projects/${project.id} `)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//const projects = (await supabase.from("projects").select()).data
|
//const projects = (await supabase.from("projects").select()).data
|
||||||
//const customers = (await supabase.from("customers").select()).data
|
//const customers = (await supabase.from("customers").select()).data
|
||||||
|
|
||||||
@@ -125,7 +164,7 @@ const createProject = async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
#main {
|
/*#main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
@@ -136,5 +175,5 @@ const createProject = async () => {
|
|||||||
#right {
|
#right {
|
||||||
width: 60vw;
|
width: 60vw;
|
||||||
padding-left: 3vw;
|
padding-left: 3vw;
|
||||||
}
|
}*/
|
||||||
</style>
|
</style>
|
||||||
@@ -52,6 +52,11 @@ const stopStartedTime = async () => {
|
|||||||
|
|
||||||
runningTimeInfo.value.end = new Date().toISOString()
|
runningTimeInfo.value.end = new Date().toISOString()
|
||||||
|
|
||||||
|
const mapNumRange = (num, inMin, inMax, outMin, outMax) =>
|
||||||
|
((num - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
|
||||||
|
|
||||||
|
runningTimeInfo.value.duration = Math.round(mapNumRange(Math.abs(new Date(runningTimeInfo.value.end) - new Date(runningTimeInfo.value.start))/1000/60,0,60,0,1)*100)/100
|
||||||
|
|
||||||
const {data,error} = await supabase
|
const {data,error} = await supabase
|
||||||
.from("times")
|
.from("times")
|
||||||
.update(runningTimeInfo.value)
|
.update(runningTimeInfo.value)
|
||||||
|
|||||||
@@ -122,8 +122,35 @@ export const useDataStore = defineStore('data', {
|
|||||||
getOpenTasksCount: (state) => state.tasks.filter(task => task.categorie != "Erledigt").length,
|
getOpenTasksCount: (state) => state.tasks.filter(task => task.categorie != "Erledigt").length,
|
||||||
movementsBySpace: (state) => (spaceId:number) => state.movements.filter(move => move.spaceId === spaceId),
|
movementsBySpace: (state) => (spaceId:number) => state.movements.filter(move => move.spaceId === spaceId),
|
||||||
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
|
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
|
||||||
getProjectById: (state) => (projectId:number) => state.projects.find(project => project.id === projectId),
|
getProjectById: (state) => (projectId:number) => {
|
||||||
|
let project = state.projects.find(project => project.id === projectId)
|
||||||
|
|
||||||
|
let projectHours = 0
|
||||||
|
|
||||||
|
let projectTimes = state.times.filter(time => time.projectId === projectId)
|
||||||
|
projectTimes.forEach(time => projectHours += time.duration)
|
||||||
|
|
||||||
|
project.projectHours = projectHours
|
||||||
|
|
||||||
|
return project
|
||||||
|
|
||||||
|
},
|
||||||
getCustomerById: (state) => (customerId:number) => state.customers.find(customer => customer.id === customerId),
|
getCustomerById: (state) => (customerId:number) => state.customers.find(customer => customer.id === customerId),
|
||||||
|
getTimesByProjectId: (state) => (projectId:number) => {
|
||||||
|
let times = state.times.filter(time => time.projectId === projectId)
|
||||||
|
console.log(times.length)
|
||||||
|
|
||||||
|
/*const mapNumRange = (num, inMin, inMax, outMin, outMax) =>
|
||||||
|
((num - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
|
||||||
|
|
||||||
|
times.forEach((time,index) => {
|
||||||
|
times[index].duration = Math.round(mapNumRange(Math.abs(new Date(time.end) - new Date(time.start))/1000/60,0,60,0,1)*100)/100
|
||||||
|
|
||||||
|
})*/
|
||||||
|
|
||||||
|
return times
|
||||||
|
|
||||||
|
},
|
||||||
getFormSubmitsWithLabelProp: (state) => (state.formSubmits.map(submit => {return{...submit, label: submit.id}})),
|
getFormSubmitsWithLabelProp: (state) => (state.formSubmits.map(submit => {return{...submit, label: submit.id}})),
|
||||||
getResources: (state) => {
|
getResources: (state) => {
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user