Cleaned up trainer schedule view
continuous-integration/drone/push Build is passing Details

main
Filip Borum Poulsen 3 years ago
parent 2ef1023a90
commit 75eed87037

@ -8,8 +8,10 @@
{{ timeslot.start_time.split(":").slice(0, 2).join(":") }} - {{ timeslot.start_time.split(":").slice(0, 2).join(":") }} -
{{ timeslot.end_time.split(":").slice(0, 2).join(":") }} {{ timeslot.end_time.split(":").slice(0, 2).join(":") }}
</div> </div>
<div class="addTimeslotButton"
@click="showNewInput[day.day_of_week - 1] = !showNewInput[day.day_of_week - 1]">+</div>
</div> </div>
<div class="newTimeslot"> <div class="newTimeslot" v-if="showNewInput[day.day_of_week - 1]">
<label class="startLabel" for="startHour">Start</label> <label class="startLabel" for="startHour">Start</label>
<input class="startHour" type="number" placeholder="HH" name="startHour" min="0" max="23" <input class="startHour" type="number" placeholder="HH" name="startHour" min="0" max="23"
v-model="newDayInput[day.day_of_week - 1].startHour" /> v-model="newDayInput[day.day_of_week - 1].startHour" />
@ -20,7 +22,7 @@
v-model="newDayInput[day.day_of_week - 1].endHour" /> v-model="newDayInput[day.day_of_week - 1].endHour" />
<input class="endMinute" type="number" placeholder="MM" name="endMinute" min="0" max="59" <input class="endMinute" type="number" placeholder="MM" name="endMinute" min="0" max="59"
v-model="newDayInput[day.day_of_week - 1].endMinute" /> v-model="newDayInput[day.day_of_week - 1].endMinute" />
<input class="submit" type="submit" name="submit" value="Submit" @click="addTimeslot(day.day_of_week)"> <input class="submit" type="submit" name="submit" value="Tilføj" @click="addTimeslot(day.day_of_week)">
</div> </div>
</div> </div>
</div> </div>
@ -89,6 +91,16 @@
.timeslot:hover { .timeslot:hover {
border-color: lightcoral; border-color: lightcoral;
} }
.addTimeslotButton {
justify-self: center;
align-self: center;
font-weight: 700;
font-size: 2em;
line-height: 1em;
color: steelblue;
cursor: pointer;
}
</style> </style>
<script lang="ts"> <script lang="ts">
@ -117,6 +129,7 @@ export default {
name: "TrainerSchedule", name: "TrainerSchedule",
data() { data() {
return { return {
showNewInput: Array.from({ length: 7 }, () => false) as boolean[],
newDayInput: Array.from({ length: 7 }, () => { newDayInput: Array.from({ length: 7 }, () => {
return { return {
startHour: undefined, startHour: undefined,
@ -152,7 +165,7 @@ export default {
}, },
methods: { methods: {
async addTimeslot(day_of_week: number) { async addTimeslot(day_of_week: number) {
console.log(this.newDayInput[day_of_week - 1]); this.showNewInput[day_of_week - 1] = false
const input: NewDayInput = this.newDayInput[day_of_week - 1]; const input: NewDayInput = this.newDayInput[day_of_week - 1];
const start_time = `${input.startHour}:${input.startMinute ? input.startMinute : 0}`; const start_time = `${input.startHour}:${input.startMinute ? input.startMinute : 0}`;
const end_time = `${input.endHour}:${input.endMinute ? input.endMinute : 0}`; const end_time = `${input.endHour}:${input.endMinute ? input.endMinute : 0}`;

Loading…
Cancel
Save