Merge pull request '2597-2593-autcomplete_translations_and_index_anchors' (#453) from 2597-2593-autcomplete_translations_and_index_anchors into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #453
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Javi Gallego 2020-11-12 15:41:20 +00:00
commit 5633ea9295
9 changed files with 133 additions and 68 deletions

View File

@ -613,7 +613,7 @@ export default {
isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]' isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]'
}, },
ordersIndex: { ordersIndex: {
secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr:nth-child(2) vn-td:nth-child(9)', secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody .vn-tr:nth-child(2) vn-td:nth-child(9)',
advancedSearchButton: 'vn-order-search-panel vn-submit[label="Search"]', advancedSearchButton: 'vn-order-search-panel vn-submit[label="Search"]',
openAdvancedSearch: 'vn-searchbar vn-icon[icon="arrow_drop_down"]', openAdvancedSearch: 'vn-searchbar vn-icon[icon="arrow_drop_down"]',
advancedSearchShowEmptyCheckbox: 'vn-order-search-panel vn-check[label="Show empty"]', advancedSearchShowEmptyCheckbox: 'vn-order-search-panel vn-check[label="Show empty"]',

View File

@ -21,9 +21,9 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr <a
ng-repeat="order in model.data" ng-repeat="order in model.data"
class="clickable search-result" class="clickable search-result vn-tr"
ui-sref="order.card.summary({id: {{::order.id}}})"> ui-sref="order.card.summary({id: {{::order.id}}})">
<vn-td number>{{::order.id}}</vn-td> <vn-td number>{{::order.id}}</vn-td>
<vn-td expand> <vn-td expand>
@ -62,7 +62,7 @@
vn-tooltip="Preview"> vn-tooltip="Preview">
</vn-icon-button> </vn-icon-button>
</vn-td> </vn-td>
</vn-tr> </a>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
</vn-card> </vn-card>

View File

@ -1,61 +1,61 @@
<vn-auto-search <vn-auto-search
model="model"> model="model">
</vn-auto-search> </vn-auto-search>
<vn-data-viewer <vn-data-viewer
model="model" model="model"
class="vn-w-sm"> class="vn-w-sm">
<vn-card> <vn-card>
<div class="vn-list separated"> <div class="vn-list separated">
<a <a
ng-repeat="supplier in model.data track by supplier.id" ng-repeat="supplier in model.data track by supplier.id"
ui-sref="supplier.card.summary(::{id: supplier.id})" ui-sref="supplier.card.summary(::{id: supplier.id})"
translate-attr="{title: 'View supplier'}" translate-attr="{title: 'View supplier'}"
class="vn-item search-result"> class="vn-item search-result">
<vn-item-section> <vn-item-section>
<h6>{{::supplier.socialName}}</h6> <h6>{{::supplier.socialName}}</h6>
<vn-label-value <vn-label-value
label="Id" label="Id"
value="{{::supplier.id}}"> value="{{::supplier.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Tax number" label="Tax number"
value="{{::supplier.nif}}"> value="{{::supplier.nif}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Alias" label="Alias"
value="{{::supplier.alias}}"> value="{{::supplier.alias}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Pay method" label="Pay method"
value="{{::supplier.payMethod}}"> value="{{::supplier.payMethod}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Payment deadline" label="Payment deadline"
value="{{::supplier.payDem}}"> value="{{::supplier.payDem}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Pay day" label="Pay day"
value="{{::supplier.payDay}}"> value="{{::supplier.payDay}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Account" label="Account"
value="{{::supplier.account}}"> value="{{::supplier.account}}">
</vn-label-value> </vn-label-value>
</vn-item-section> </vn-item-section>
<vn-item-section side> <vn-item-section side>
<vn-icon-button <vn-icon-button
ng-click="$ctrl.openSummary(supplier, $event)" ng-click="$ctrl.openSummary(supplier, $event)"
vn-tooltip="Preview" vn-tooltip="Preview"
icon="desktop_windows"> icon="desktop_windows">
</vn-icon-button> </vn-icon-button>
</vn-item-section> </vn-item-section>
</a> </a>
</div> </div>
</vn-card> </vn-card>
</vn-data-viewer> </vn-data-viewer>
<vn-popup vn-id="dialog-summary-client"> <vn-popup vn-id="dialog-summary-client">
<vn-supplier-summary <vn-supplier-summary
supplier="$ctrl.supplierSelected"> supplier="$ctrl.supplierSelected">
</vn-supplier-summary> </vn-supplier-summary>
</vn-popup> </vn-popup>

View File

@ -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>

View File

@ -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
}); });

View File

@ -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'
}]);
});
});
});

View File

@ -0,0 +1,4 @@
FREE: Free
DELIVERED: Delivered
ON_PREPARATION: On preparation
PACKED: Packed

View File

@ -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

View File

@ -17,10 +17,10 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr <a
ng-repeat="zone in model.data" ng-repeat="zone in model.data"
ui-sref="zone.card.summary({id: zone.id})" ui-sref="zone.card.summary({id: zone.id})"
class="clickable search-result"> class="clickable n-tr search-result">
<vn-td number>{{::zone.id}}</vn-td> <vn-td number>{{::zone.id}}</vn-td>
<vn-td expand>{{::zone.name}}</vn-td> <vn-td expand>{{::zone.name}}</vn-td>
<vn-td expand>{{::zone.agencyMode.name}}</vn-td> <vn-td expand>{{::zone.agencyMode.name}}</vn-td>
@ -42,7 +42,7 @@
</vn-icon-button> </vn-icon-button>
</vn-horizontal> </vn-horizontal>
</vn-td> </vn-td>
</vn-tr> </a>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
</vn-card> </vn-card>