Skip to content

Commit

Permalink
fix: only show the weekdays in the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander de Jong committed Feb 1, 2024
1 parent 7bd543f commit 9053ece
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions components/records/weekly-timesheet-row-leave.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nl:
</b-col>

<b-col
v-for="(day) in workscheme"
v-for="(day) in workschemeDays"
:key="day.date"
cols="1"
class="weekly-timesheet-row__date-column"
Expand All @@ -60,25 +60,6 @@ nl:
</span>
</b-col>

<template v-if="showWeekends">
<b-col cols="1" class="weekly-timesheet-row__date-column">
<b-form-input
class="weekly-timesheet-row__value-input"
type="text"
disabled
placeholder="0"
/>
</b-col>
<b-col cols="1" class="weekly-timesheet-row__date-column">
<b-form-input
class="weekly-timesheet-row__value-input"
type="text"
disabled
placeholder="0"
/>
</b-col>
</template>

<b-col cols="1" class="weekly-timesheet-row__total-column">
{{ totalValue }}
</b-col>
Expand Down Expand Up @@ -110,7 +91,7 @@ export default defineComponent({
}
},
emits: ['refresh'],
setup(props: { workscheme: WorkScheme[], status: TimesheetStatus }) {
setup(props: { workscheme: WorkScheme[], status: TimesheetStatus, showWeekends: boolean }) {
const totalValue = computed(() => {
const total = props.workscheme.reduce((prev: number, curr: WorkScheme) => prev + curr.absenceHours, 0);
return hoursToHHmm(total)
Expand All @@ -120,9 +101,14 @@ export default defineComponent({
return props.status === (recordStatus.NEW as TimesheetStatus);
})
const workschemeDays = computed(() => {
return props.showWeekends ? props.workscheme : props.workscheme.slice(0, 5)
})
return {
totalValue,
allowRefresh,
workschemeDays
};
},
});
Expand Down

0 comments on commit 9053ece

Please sign in to comment.