better usability on AddEmployeeModal and some styling on Schedule
This commit is contained in:
@@ -35,7 +35,7 @@ div.modal.fade(
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, onMounted } from 'vue'
|
import { computed, ref, watch, onMounted } from 'vue'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,17 +70,16 @@ div.modal.fade(
|
|||||||
suggestions.value = props.searchData.filter((el: { name: string }) => {
|
suggestions.value = props.searchData.filter((el: { name: string }) => {
|
||||||
return el.name.toLowerCase().search(query.toLowerCase()) > -1
|
return el.name.toLowerCase().search(query.toLowerCase()) > -1
|
||||||
})
|
})
|
||||||
|
if(selected.value >= suggestions.value.length){
|
||||||
|
selected.value = suggestions.value.length - 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setResult(pResult : Employee) {
|
function setResult(pResult : Employee) {
|
||||||
result.value = pResult
|
result.value = pResult
|
||||||
console.log("new result: "+result.value)
|
|
||||||
query.value = pResult.name
|
query.value = pResult.name
|
||||||
console.log("new query-string: "+query.value)
|
|
||||||
isOpenSuggestions.value = false
|
isOpenSuggestions.value = false
|
||||||
console.log("is suggestions open? "+ isOpenSuggestions.value)
|
|
||||||
selected.value = 0
|
selected.value = 0
|
||||||
console.log("whats selected? "+selected.value)
|
|
||||||
suggestions.value = []
|
suggestions.value = []
|
||||||
emit('emitResult', result.value)
|
emit('emitResult', result.value)
|
||||||
}
|
}
|
||||||
@@ -93,7 +92,6 @@ div.modal.fade(
|
|||||||
*/
|
*/
|
||||||
function onChange(){
|
function onChange(){
|
||||||
if(query.value.length >= (props.minQueryLength ?? 1)) {
|
if(query.value.length >= (props.minQueryLength ?? 1)) {
|
||||||
console.log(query.value)
|
|
||||||
filterResults(query.value)
|
filterResults(query.value)
|
||||||
isOpenSuggestions.value = true
|
isOpenSuggestions.value = true
|
||||||
}
|
}
|
||||||
@@ -105,6 +103,7 @@ div.modal.fade(
|
|||||||
function onModalHide() {
|
function onModalHide() {
|
||||||
query.value = ''
|
query.value = ''
|
||||||
result.value = undefined
|
result.value = undefined
|
||||||
|
selected.value = 0
|
||||||
suggestions.value = []
|
suggestions.value = []
|
||||||
isOpenSuggestions.value = false
|
isOpenSuggestions.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ AddEmployeeModal(
|
|||||||
table(class='table table-bordered table-sm' v-for="(row, rIndex) in scheduleData" :key="rIndex")
|
table(class='table table-bordered table-sm' v-for="(row, rIndex) in scheduleData" :key="rIndex")
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
td(style="width: 100px" class="fw-bold") {{ format(startDate, "MMMM", {locale: de}) }}
|
td(style="width: 150px" class="fw-bold") {{ format(startDate, "MMMM", {locale: de}) }}
|
||||||
td(v-for="(day, index) in weekdays" :key="index" :class="{'text-body text-opacity-50 bg-secondary bg-opacity-10' : row.dates[index] === null}") {{ day }}
|
td(v-for="(day, index) in weekdays" :key="index" :class="{'text-body text-opacity-50 bg-secondary bg-opacity-10' : row.dates[index] === null}") {{ day }}
|
||||||
tr
|
tr
|
||||||
td.fw-bold {{ format(startDate, "y") }}
|
td.fw-bold {{ format(startDate, "y") }}
|
||||||
@@ -21,16 +21,17 @@ table(class='table table-bordered table-sm' v-for="(row, rIndex) in scheduleData
|
|||||||
template(v-if="date !== null") {{ format(date, "dd.MM.")}}
|
template(v-if="date !== null") {{ format(date, "dd.MM.")}}
|
||||||
tbody
|
tbody
|
||||||
tr(v-for="(employee, eIndex) in row.employees" :key="eIndex")
|
tr(v-for="(employee, eIndex) in row.employees" :key="eIndex")
|
||||||
td {{employee.handle}}
|
td.text-start
|
||||||
button.btn.btn-outline-secondary.btn-sm(
|
button.btn(
|
||||||
@click="removeEmployee(rIndex, employee)"
|
@click="removeEmployee(rIndex, employee)"
|
||||||
)
|
)
|
||||||
i.bi.bi-trash
|
i.bi-x-lg.me-2
|
||||||
|
| {{employee.handle}}
|
||||||
td(v-for="(date, dIndex) in row.dates" :key="dIndex" :class="{'bg-secondary bg-opacity-10' : row.dates[dIndex] === null}")
|
td(v-for="(date, dIndex) in row.dates" :key="dIndex" :class="{'bg-secondary bg-opacity-10' : row.dates[dIndex] === null}")
|
||||||
tr()
|
tr()
|
||||||
td(style="width: 250px")
|
td.text-start(style="width: 250px")
|
||||||
button(
|
button(
|
||||||
class="btn btn-outline-secondary btn-sm"
|
class="btn"
|
||||||
@click="addEmployeeRow = rIndex"
|
@click="addEmployeeRow = rIndex"
|
||||||
data-bs-toggle="modal"
|
data-bs-toggle="modal"
|
||||||
:data-bs-target="'#'+modalId"
|
:data-bs-target="'#'+modalId"
|
||||||
@@ -119,10 +120,7 @@ table(class='table table-bordered table-sm' v-for="(row, rIndex) in scheduleData
|
|||||||
|
|
||||||
function addEmployee(param : Employee){
|
function addEmployee(param : Employee){
|
||||||
if (addEmployeeRow.value !== undefined && param !== null) {
|
if (addEmployeeRow.value !== undefined && param !== null) {
|
||||||
console.log("addEmployee fired!")
|
|
||||||
console.log("addEmployeeRow: "+addEmployeeRow.value)
|
|
||||||
scheduleData.value[addEmployeeRow.value].employees.push(param)
|
scheduleData.value[addEmployeeRow.value].employees.push(param)
|
||||||
console.log(scheduleData.value)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
MonthPicker(:selectedMonth="selectedMonth" :selectedYear="selectedYear" @getMonth="selectedMonth = $event" @getYear="selectedYear = $event")
|
MonthPicker(:selectedMonth="selectedMonth" :selectedYear="selectedYear" @getMonth="selectedMonth = $event" @getYear="selectedYear = $event")
|
||||||
|
|
||||||
//- div(class="mt-5" v-for="(month, index) in months" :key="index")
|
div(class="mt-5" v-for="(month, index) in months" :key="index")
|
||||||
Schedule( :startDate="months[0]" :initialOffset="iOffsets[0]")
|
Schedule( :startDate="months[index]" :initialOffset="iOffsets[index]")
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user