Add button to copy last week's availability
parent
9b9b86171f
commit
ae6f5e8884
|
@ -11,7 +11,7 @@ const dateStart = computed(() => model.value.format("L"));
|
|||
const dateEnd = computed(() => model.value.clone().add(6, "days").format("L"));
|
||||
|
||||
function incrementDate(delta: number) {
|
||||
model.value = model.value.clone().add(delta, "days");
|
||||
model.value = model.value.clone().add(delta, "weeks");
|
||||
//let newDate = new Date(model.value);
|
||||
//newDate.setDate(newDate.getDate() + delta);
|
||||
//model.value = newDate;
|
||||
|
@ -20,11 +20,11 @@ function incrementDate(delta: number) {
|
|||
|
||||
<template>
|
||||
<div class="scroll-box">
|
||||
<button class="transparent eq" @click="incrementDate(-7)" :disabled="isDisabled">
|
||||
<button class="transparent eq" @click="incrementDate(-1)" :disabled="isDisabled">
|
||||
<i class="bi bi-caret-left-fill"></i>
|
||||
</button>
|
||||
<span class="date-range">{{ dateStart }} – {{ dateEnd }}</span>
|
||||
<button class="transparent eq" @click="incrementDate(7)" :disabled="isDisabled">
|
||||
<button class="transparent eq" @click="incrementDate(1)" :disabled="isDisabled">
|
||||
<i class="bi bi-caret-right-fill"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -41,6 +41,14 @@ function saveSchedule() {
|
|||
});
|
||||
}
|
||||
|
||||
function copyPreviousWeek() {
|
||||
schedule.fetchSchedule(schedule.dateStart.clone().add(-7, "days"))
|
||||
.then((response) => {
|
||||
schedule.saveSchedule();
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
teamsStore.fetchTeams()
|
||||
.then((teamsList) => {
|
||||
|
@ -111,9 +119,14 @@ onMounted(() => {
|
|||
<i class="bi bi-check-circle-fill"></i>
|
||||
</button>
|
||||
</template>
|
||||
<button v-else class="accent" @click="isEditing = true">
|
||||
<i class="bi bi-pencil-fill"></i>
|
||||
</button>
|
||||
<template v-else>
|
||||
<button @click="copyPreviousWeek">
|
||||
Copy previous week
|
||||
</button>
|
||||
<button class="accent" @click="isEditing = true">
|
||||
<i class="bi bi-pencil-fill"></i>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue