implement originator filter

This commit is contained in:
Vri 🌈 2023-06-16 15:30:38 +02:00
parent 9bbb1f3e03
commit 0ce9cbaeee
Signed by: vrifox
GPG key ID: D40098E5B60B2197
2 changed files with 23 additions and 2 deletions

View file

@ -100,5 +100,19 @@ export default {
> >
</button> </button>
</fieldset> </fieldset>
<fieldset class="flex flex-row mb-4">
<legend>Einreicher</legend>
<select
class="w-40 p-2 bg-background-100 rounded-lg"
v-model="paperFilter.originator">
<option v-for="(originator, i) of paperOriginators" :key="i">{{ originator }}</option>
</select>
<button
class="pl-2"
@click.prevent="paperFilter.originator = ''"
title="zurücksetzen"
>
</button>
</fieldset>
</form> </form>
</template> </template>

View file

@ -42,6 +42,11 @@ export default {
return paper.reference.includes(this.paperFilter?.type.key) && paper.paper_type.includes(this.paperFilter?.type.value) return paper.reference.includes(this.paperFilter?.type.key) && paper.paper_type.includes(this.paperFilter?.type.value)
}) })
} }
if (this.paperFilter?.originator !== '') {
filteredPapers = filteredPapers.filter((paper) => {
return paper.originator.includes(this.paperFilter?.originator)
})
}
return filteredPapers return filteredPapers
} }
}, },
@ -55,8 +60,10 @@ export default {
</script> </script>
<template> <template>
{{ paperFilter }} <ul
<ul v-if="filteredData.length"> v-if="filteredData.length"
class="w-full"
>
<li v-for="(paper, i) in filteredData" :key="i"> <li v-for="(paper, i) in filteredData" :key="i">
<article <article
class="my-4 p-2 border border-solid border-amber-300 rounded-md" class="my-4 p-2 border border-solid border-amber-300 rounded-md"