fixed ctrl click functionality to Schedule.vue

This commit is contained in:
Sockenklaus
2021-10-11 11:57:11 +02:00
parent 9d8b3c27a2
commit d2d689af17

View File

@@ -34,7 +34,7 @@ AddEmployeeModal(
:key="dIndex" :key="dIndex"
:class="{'bg-secondary bg-opacity-10' : row.dates[dIndex] === null, 'selected' : isSelected({mIndex, rIndex, eIndex, dIndex})}" :class="{'bg-secondary bg-opacity-10' : row.dates[dIndex] === null, 'selected' : isSelected({mIndex, rIndex, eIndex, dIndex})}"
@click="select({mIndex, rIndex, eIndex, dIndex}, $event)" @click="select({mIndex, rIndex, eIndex, dIndex}, $event)"
)   ) m={{mIndex}}, r={{rIndex}}, e={{eIndex}}, d={{dIndex}}
tr() tr()
td.text-end td.text-end
button( button(
@@ -185,9 +185,11 @@ AddEmployeeModal(
} }
function isSelected(c : Coordinates) : boolean { function isSelected(c : Coordinates) : boolean {
return selected.value.some(el => { let temp : boolean = selected.value.some(el => {
return el.mIndex === c.mIndex && el.rIndex === c.rIndex && el.eIndex === c.rIndex && el.dIndex === c.dIndex return el.mIndex === c.mIndex && el.rIndex === c.rIndex && el.eIndex === c.eIndex && el.dIndex === c.dIndex
}) })
return temp
} }
/** /**
@@ -201,15 +203,18 @@ AddEmployeeModal(
} }
function select(coord : Coordinates, e : MouseEvent) { function select(coord : Coordinates, e : MouseEvent) {
if(e.ctrlKey){ if(e.ctrlKey){
selected.value.push(coord) selected.value.push(coord)
} }
else { else {
if(selected.value.length > 1 || !isSelected(coord)) {
selected.value = [] selected.value = []
selected.value.push(coord) selected.value.push(coord)
} }
else {
selected.value = []
}
}
} }
/** /**
@@ -225,6 +230,9 @@ AddEmployeeModal(
table { table {
table-layout: fixed table-layout: fixed
} }
table td {
cursor: pointer;
}
.o-acp__item.list-group-item:hover { .o-acp__item.list-group-item:hover {
background-color: aliceblue !important; background-color: aliceblue !important;