Changes in times and Dashboard

This commit is contained in:
2024-03-19 12:26:16 +01:00
parent edf1de189b
commit 66ee33cdde
6 changed files with 183 additions and 20 deletions

View File

@@ -12,4 +12,4 @@ ENV NUXT_PORT=3000
EXPOSE 3000
ENTRYPOINT ["node", ".output/server/index.mjs"]
ENTRYPOINT ["node", ".output/server/index.js"]

View File

@@ -28,15 +28,11 @@
</UDashboardToolbar>-->
<UDashboardPanelContent>
<!-- ~/components/home/HomeChart.vue -->
<!-- <HomeChart :period="period" :range="range" />
<UDashboardCard
>
<p v-for="time in dataStore.getStartedWorkingTimes()"><UIcon name="i-heroicons-check"/>{{dataStore.getProfileById(time.profile).fullName}}</p>
</UDashboardCard>
<div class="grid lg:grid-cols-2 lg:items-start gap-8 mt-8">
&lt;!&ndash; ~/components/home/HomeSales.vue &ndash;&gt;
<HomeSales />
&lt;!&ndash; ~/components/home/HomeCountries.vue &ndash;&gt;
<HomeCountries />
</div>-->
</UDashboardPanelContent>
</UDashboardPanel>
</UDashboardPage>
@@ -47,6 +43,8 @@ definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const { isNotificationsSlideoverOpen } = useDashboard()
const items = [[{
label: 'Aufgabe',

View File

@@ -47,8 +47,8 @@ const changeRange = () => {
subtract = 1
}
selectedStartDay.value = dayjs().subtract(subtract,selector).startOf(selector).format("YYYY-MM-DD")
selectedEndDay.value = dayjs().subtract(subtract,selector).endOf(selector).format("YYYY-MM-DD")
selectedStartDay.value = dayjs().subtract(subtract,selector === "isoWeek" ? "week" : selector).startOf(selector).format("YYYY-MM-DD")
selectedEndDay.value = dayjs().subtract(subtract,selector === "isoWeek" ? "week" : selector).endOf(selector).format("YYYY-MM-DD")
}
@@ -57,7 +57,7 @@ const workingTimeInfo = computed(() => {
let times = dataStore.getWorkingTimesByProfileId(itemInfo.value.id)
times = times.filter(i => dayjs(i.date).isBetween(selectedStartDay.value,selectedEndDay.value,'day') && i.end)
times = times.filter(i => dayjs(i.date).isBetween(dayjs(selectedStartDay.value).subtract(1,"days"),selectedEndDay.value,'day') && i.end)
@@ -68,27 +68,24 @@ const workingTimeInfo = computed(() => {
//Eingreicht
let sumWorkingMinutesEingereicht = 0
times.filter(i => !i.approved).forEach(time => {
console.log(time)
const minutes = dayjs(time.end, "HH:mm:ss").diff(dayjs(time.start, "HH:mm:ss"),'minutes')
console.log(minutes)
sumWorkingMinutesEingereicht = sumWorkingMinutesEingereicht + minutes
})
//Bestätigt
let sumWorkingMinutesApproved = 0
times.filter(i => i.approved).forEach(time => {
const minutes = Math.floor(dayjs(time.end, "HH:mm:ss").diff(dayjs(time.start, "HH:mm:ss"),'minutes'))
const minutes = dayjs(time.end, "HH:mm:ss").diff(dayjs(time.start, "HH:mm:ss"),'minutes')
sumWorkingMinutesApproved = sumWorkingMinutesApproved + minutes
})
//console.log(times.filter(i => i.approved).length)
//console.log(sumWorkingMinutesApproved)
//Saldo
let saldo = (sumWorkingMinutesApproved / 60).toFixed(2) - monthlyWorkingHours
let saldoInOfficial = ((sumWorkingMinutesApproved + sumWorkingMinutesEingereicht) / 60).toFixed(2) - monthlyWorkingHours
return {
monthlyWorkingHours,
sumWorkingMinutesEingereicht,
@@ -211,7 +208,6 @@ changeRange()
@change="changeRange"
/>
</UFormGroup>
<UFormGroup label="Start:" >
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
@@ -247,8 +243,11 @@ changeRange()
<p>Saldo: {{workingTimeInfo.saldo}} h</p>
</div>
<UDivider class="my-3"/>
<UTable
:rows="dataStore.getWorkingTimesByProfileId(dataStore.activeProfile.id)"
:rows="dataStore.getWorkingTimesByProfileId(itemInfo.id)"
class="h-80"
:columns="[
{
key: 'state',

View File

@@ -319,6 +319,9 @@ const setState = async (newState) => {
/>
</template>
</UPopover>
<UInput
/>
</UFormGroup>
<!-- <UFormGroup
label="Start:"

View File

@@ -853,6 +853,10 @@ export const useDataStore = defineStore('data', () => {
return workingtimes.value.filter(i => i.profile === profileId)
})
const getStartedWorkingTimes = computed(() => () => {
return workingtimes.value.filter(i => !i.end)
})
const getStockByProductId = computed(() => (productId) => {
let productMovements = movements.value.filter(movement => movement.productId === productId)
@@ -1254,6 +1258,7 @@ export const useDataStore = defineStore('data', () => {
getTextTemplatesByDocumentType,
getCreatedDocumentsByProject,
getWorkingTimesByProfileId,
getStartedWorkingTimes,
getStockByProductId,
getIncomingInvoicesByVehicleId,
getEventTypes,