refactor(UI): removed duplicate add filter button

This commit is contained in:
Giulio Ganci 2021-10-18 19:15:37 +02:00
parent f9ee7d0450
commit 968a67ce3d
1 changed files with 10 additions and 12 deletions

View File

@ -44,13 +44,6 @@
class="form-input ml-2 input-sm" class="form-input ml-2 input-sm"
> >
</div> </div>
<button
class="btn btn-sm btn-dark mr-0 ml-2"
type="button"
@click="addRow"
>
<i class="mdi mdi-plus-circle-outline" />
</button>
<button <button
class="btn btn-sm btn-dark mr-0 ml-2" class="btn btn-sm btn-dark mr-0 ml-2"
type="button" type="button"
@ -66,6 +59,13 @@
> >
{{ $t('word.filter') }} {{ $t('word.filter') }}
</button> </button>
<button
class="btn btn-sm btn-dark mr-0 ml-2"
type="button"
@click="addRow"
>
<i class="mdi mdi-plus-circle-outline" />
</button>
</div> </div>
</form> </form>
</template> </template>
@ -89,13 +89,11 @@ export default {
methods: { methods: {
addRow () { addRow () {
this.rows.push({ active: true, field: this.fields[0].name, op: '=', value: '', value2: '' }); this.rows.push({ active: true, field: this.fields[0].name, op: '=', value: '', value2: '' });
this.$emit('filter-change'); this.$emit('filter-change', this.rows);
}, },
removeRow (i) { removeRow (i) {
if (this.rows.length >= 2) {
this.rows = this.rows.filter((_, idx) => idx !== i); this.rows = this.rows.filter((_, idx) => idx !== i);
this.$emit('filter-change'); this.$emit('filter-change', this.rows);
}
}, },
doFilter () { doFilter () {
const clausoles = this.rows.filter(el => el.active).map(el => this.createClausole(el)); const clausoles = this.rows.filter(el => el.active).map(el => this.createClausole(el));