ticket advanced search grouped state translations
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
f0aedf549e
commit
b9e3db61db
|
@ -76,13 +76,15 @@
|
||||||
ng-model="filter.stateFk"
|
ng-model="filter.stateFk"
|
||||||
url="States">
|
url="States">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete vn-one
|
||||||
vn-one
|
data="$ctrl.groupedStates"
|
||||||
label="Grouped States"
|
label="Grouped States"
|
||||||
value-field="alertLevel"
|
value-field="alertLevel"
|
||||||
show-field="code"
|
show-field="name"
|
||||||
ng-model="filter.alertLevel"
|
ng-model="filter.alertLevel">
|
||||||
url="AlertLevels">
|
<tpl-item>
|
||||||
|
{{name}}
|
||||||
|
</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||||
|
class Controller extends SearchPanel {
|
||||||
|
constructor($, $element) {
|
||||||
|
super($, $element);
|
||||||
|
this.getGroupedStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
getGroupedStates() {
|
||||||
|
let groupedStates = [];
|
||||||
|
this.$http.get('AlertLevels').then(res => {
|
||||||
|
for (let state of res.data) {
|
||||||
|
groupedStates.push({
|
||||||
|
alertLevel: state.alertLevel,
|
||||||
|
code: state.code,
|
||||||
|
name: this.$t(state.code)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.groupedStates = groupedStates;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnTicketSearchPanel', {
|
ngModule.vnComponent('vnTicketSearchPanel', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: SearchPanel
|
controller: Controller
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import './index';
|
||||||
|
|
||||||
|
describe('Ticket Component vnTicketSearchPanel', () => {
|
||||||
|
let $httpBackend;
|
||||||
|
let controller;
|
||||||
|
|
||||||
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
controller = $componentController('vnTicketSearchPanel', {$element: null});
|
||||||
|
controller.$t = () => {};
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('getGroupedStates()', () => {
|
||||||
|
it('should set an array of groupedStates with the aditionof a name translation', () => {
|
||||||
|
jest.spyOn(controller, '$t').mockReturnValue('miCodigo');
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
alertLevel: 9999,
|
||||||
|
code: 'myCode'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
$httpBackend.whenGET('AlertLevels').respond(data);
|
||||||
|
controller.getGroupedStates();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.groupedStates).toEqual([{
|
||||||
|
alertLevel: 9999,
|
||||||
|
code: 'myCode',
|
||||||
|
name: 'miCodigo'
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,4 @@
|
||||||
|
FREE: Free
|
||||||
|
DELIVERED: Delivered
|
||||||
|
ON_PREPARATION: On preparation
|
||||||
|
PACKED: Packed
|
|
@ -12,4 +12,8 @@ Order id: Id cesta
|
||||||
Grouped States: Estado agrupado
|
Grouped States: Estado agrupado
|
||||||
Days onward: Días adelante
|
Days onward: Días adelante
|
||||||
With problems: Con problemas
|
With problems: Con problemas
|
||||||
Pending: Pendiente
|
Pending: Pendiente
|
||||||
|
FREE: Libre
|
||||||
|
DELIVERED: Servido
|
||||||
|
ON_PREPARATION: En preparacion
|
||||||
|
PACKED: Encajado
|
Loading…
Reference in New Issue