started working on adding employees to schedule

This commit is contained in:
Sockenklaus
2021-10-06 00:05:15 +02:00
parent a7b6e7d519
commit 2057de63dd

View File

@@ -2,20 +2,36 @@
h1(v-if="isValid(startDate)") {{format(startDate, "MMMM y", {locale: de})}}
table(class='table' v-for="(row, rIndex) in dates" :key="rIndex")
table(class='table table-sm' v-for="(row, rIndex) in dates" :key="rIndex")
thead
tr
td(v-for="(day, index) in weekdays" :key="index") {{ day }}
td(style="width: 200px")
td(v-for="(day, index) in weekdays" :key="index" :class="{'text-body text-opacity-25' : row[index] === null}") {{ day }}
tr
td
td(v-for="(date, dIndex) in row" :key="dIndex")
template(v-if="date !== null") {{ format(date, "dd.MM.")}}
tbody
tr
tr()
td {{}}
td(v-for="(date, dIndex) in row" :key="dIndex")  
tr()
td(style="width: 250px")
o-autocomplete(
:keep-first="true"
:open-on-focus="true"
inputClass="form-control form-control-sm"
)
td(v-for="(date, dIndex) in row" :key="dIndex")  
</template>
<script setup lang="ts">
import { toRef, computed, ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useEmployees } from '/src/stores/employees.js'
import { addMonths, subDays, addDays, format, getISODay, isValid, eachDayOfInterval } from 'date-fns'
import { de } from 'date-fns/locale'
@@ -34,7 +50,7 @@ table(class='table' v-for="(row, rIndex) in dates" :key="rIndex")
* Local variables
*/
const weekdays : string[] = doubleWeekdays()
const employees : string[] = ['Pascal', 'Karin', 'Sandra']
const { employees } = storeToRefs(useEmployees())
const daysInMonth : Date[] = eachDayOfInterval({
start: startDate.value,
@@ -60,6 +76,10 @@ table(class='table' v-for="(row, rIndex) in dates" :key="rIndex")
start = addDays(start, 1)
i++
}
while (i < 14) {
row.push(null)
i++
}
arr.push(row)
row = []
i = 0