addFilter
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-02-07 12:30:30 +01:00
parent 7af9aa46e9
commit 9f2ff4e4b7
4 changed files with 17 additions and 17 deletions

View File

@ -63,6 +63,6 @@ describe('Ticket index payout path', () => {
const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
expect(count).toEqual(4);
expect(reference).toContain('Cash, Albaran: 7, 8Payment');
expect(reference).toContain('Cash,Albaran: 7, 8Payment');
});
});

View File

@ -40,7 +40,7 @@
ng-model="$ctrl.filter.typeFk"
fields="['categoryFk']"
include="'category'"
on-change="$ctrl.applyFilters()">
on-change="$ctrl.addFilters()">
<tpl-item>
<div>{{name}}</div>
<div class="text-caption text-secondary">
@ -60,7 +60,7 @@
value-field="id"
where="{role: {inq: ['logistic', 'buyer']}}"
label="Buyer"
on-change="$ctrl.applyFilters()">
on-change="$ctrl.addFilters()">
</vn-autocomplete>
<vn-autocomplete
vn-id="supplier"
@ -71,7 +71,7 @@
search-function="{or: [{nickname: {like: '%'+ $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
show-field="name"
value-field="id"
on-change="$ctrl.applyFilters()">
on-change="$ctrl.addFilters()">
<tpl-item>{{name}}: {{nickname}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
@ -79,12 +79,12 @@
<vn-date-picker
label="From"
ng-model="$ctrl.filter.from"
on-change="$ctrl.applyFilters()">
on-change="$ctrl.addFilters()">
</vn-date-picker>
<vn-date-picker
label="To"
ng-model="$ctrl.filter.to"
on-change="$ctrl.applyFilters()">
on-change="$ctrl.addFilters()">
</vn-date-picker>
</vn-vertical>
<vn-horizontal class="checks">
@ -92,19 +92,19 @@
label="Is active"
ng-model="$ctrl.filter.active"
triple-state="true"
ng-click="$ctrl.applyFilters()">
ng-click="$ctrl.addFilters()">
</vn-check>
<vn-check
label="Is visible"
ng-model="$ctrl.filter.visible"
triple-state="true"
ng-click="$ctrl.applyFilters()">
ng-click="$ctrl.addFilters()">
</vn-check>
<vn-check
label="Is floramondo"
ng-model="$ctrl.filter.floramondo"
triple-state="true"
ng-click="$ctrl.applyFilters()">
ng-click="$ctrl.addFilters()">
</vn-check>
</vn-horizontal>
<vn-horizontal class="tags">
@ -139,7 +139,7 @@
ng-model="itemTag.value"
show-field="value"
value-field="value"
on-change="$ctrl.applyFilters()">
on-change="$ctrl.addFilters()">
</vn-autocomplete>
<vn-icon-button
vn-none

View File

@ -17,33 +17,33 @@ class Controller extends SearchPanel {
changeCategory(id) {
if (this.filter.categoryFk != id) {
this.filter.categoryFk = id;
this.applyFilters();
this.addFilters();
}
}
removeItemFilter(param) {
this.filter[param] = null;
if (param == 'categoryFk') this.filter['typeFk'] = null;
this.applyFilters();
this.addFilters();
}
removeTag(tag) {
const index = this.filter.tags.indexOf(tag);
if (index > -1) this.filter.tags.splice(index, 1);
this.applyFilters();
this.addFilters();
}
onKeyPress($event) {
if ($event.key === 'Enter')
this.applyFilters();
this.addFilters();
}
applyFilters() {
addFilters() {
for (let i = 0; i < this.filter.tags.length; i++) {
if (!this.filter.tags[i].value)
this.filter.tags.splice(i, 1);
}
return this.model.applyFilter({}, this.filter);
return this.model.addFilter({}, this.filter);
}
showTagInfo(itemTag) {

View File

@ -10,7 +10,7 @@ describe('Entry', () => {
beforeEach(angular.mock.inject($componentController => {
$element = angular.element(`<vn-latest-buys-search-panel></vn-latest-buys-search-panel>`);
controller = $componentController('vnLatestBuysSearchPanel', {$element});
controller.model = {applyFilter: () => {}};
controller.model = {addFilter: () => {}};
}));
describe('removeItemFilter()', () => {