Merge pull request '2540-entry_descriptorPopover' (#428) from 2540-entry_descriptorPopover into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #428
Reviewed-by: Carlos Jimenez <carlosjr@verdnatura.es>
This commit is contained in:
Joan Sanchez 2020-10-27 13:41:05 +00:00
commit faea343e41
9 changed files with 57 additions and 14 deletions

View File

@ -73,6 +73,7 @@
"I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})",
"I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})",
"Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"The grade must be similar to the last one": "The grade must be similar to the last one",
"agencyModeFk": "Agency",
"clientFk": "Client",
"zoneFk": "Zone",

View File

@ -55,8 +55,8 @@
</span>
</vn-td>
<vn-td number>
<span ng-class="::{link: sale.isTicket}"
ng-click="$ctrl.showTicketDescriptor($event, sale)"
<span class="link"
ng-click="$ctrl.showDescriptor($event, sale)"
name="origin">
{{::sale.origin | dashIfEmpty}}
</span>
@ -94,3 +94,7 @@
<vn-client-descriptor-popover
vn-id="clientDescriptor">
</vn-client-descriptor-popover>
<vn-entry-descriptor-popover
vn-id="entryDescriptor">
</vn-entry-descriptor-popover>

View File

@ -58,10 +58,12 @@ class Controller extends Section {
this.$anchorScroll();
}
showTicketDescriptor(event, sale) {
if (!sale.isTicket) return;
showDescriptor(event, sale) {
let descriptor = 'entryDescriptor';
if (sale.isTicket)
descriptor = 'ticketDescriptor';
this.$.ticketDescriptor.show(event.target, sale.origin);
this.$[descriptor].show(event.target, sale.origin);
}
}

View File

@ -60,6 +60,34 @@ describe('Item', () => {
expect(controller.$anchorScroll).toHaveBeenCalledWith();
});
});
describe('showDescriptor ()', () => {
it('should call to the entryDescriptor show() method', () => {
controller.$.entryDescriptor = {};
controller.$.entryDescriptor.show = jest.fn();
const $event = new Event('click');
const target = document.createElement('div');
target.dispatchEvent($event);
const data = {id: 1, origin: 1};
controller.showDescriptor($event, data);
expect(controller.$.entryDescriptor.show).toHaveBeenCalledWith($event.target, data.origin);
});
it('should call to the ticketDescriptor show() method', () => {
controller.$.ticketDescriptor = {};
controller.$.ticketDescriptor.show = jest.fn();
const $event = new Event('click');
const target = document.createElement('div');
target.dispatchEvent($event);
const data = {id: 1, origin: 1, isTicket: true};
controller.showDescriptor($event, data);
expect(controller.$.ticketDescriptor.show).toHaveBeenCalledWith($event.target, data.origin);
});
});
});
});

View File

@ -3,7 +3,7 @@
"name": "Items",
"icon": "icon-item",
"validations" : true,
"dependencies": ["worker", "client", "ticket"],
"dependencies": ["worker", "client", "ticket", "entry"],
"menus": {
"main": [
{"state": "item.index", "icon": "icon-item"},

View File

@ -3,7 +3,7 @@
"name": "Travels",
"icon": "local_airport",
"validations": true,
"dependencies": ["worker"],
"dependencies": ["worker", "entry"],
"menus": {
"main": [
{"state": "travel.index", "icon": "local_airport"}

View File

@ -41,7 +41,7 @@
value="{{$ctrl.travelData.ref}}">
</vn-label-value>
<vn-label-value
label="m3"
label="m³"
value="{{$ctrl.travelData.m3}}">
</vn-label-value>
<vn-label-value
@ -63,7 +63,7 @@
<vn-th shrink>Package</vn-th>
<vn-th shrink>CC</vn-th>
<vn-th shrink>Pallet</vn-th>
<vn-th shrink>m3</vn-th>
<vn-th shrink>m³</vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
@ -75,7 +75,12 @@
disabled="true">
</vn-check>
</vn-td>
<vn-td shrink>{{entry.id}} </vn-td>
<vn-td shrink>
<span class="link"
vn-click-stop="entryDescriptor.show($event, entry.id)">
{{entry.id}}
</span>
</vn-td>
<vn-td expand>{{entry.supplierName}}</vn-td>
<vn-td shrink>{{entry.ref}}</vn-td>
<vn-td shrink>{{entry.hb}}</vn-td>
@ -141,4 +146,7 @@
</vn-table>
</vn-auto>
</vn-horizontal>
</vn-card>
</vn-card>
<vn-entry-descriptor-popover
vn-id="entryDescriptor">
</vn-entry-descriptor-popover>

View File

@ -9,7 +9,7 @@ Received: Recibida
Agency: Agencia
Entries: Entradas
Confirmed: Confirmada
Entry Id: Entrada Id
Entry Id: Id entrada
Supplier: Proveedor
Pallet: Pallet
Freight: Porte

View File

@ -73,7 +73,7 @@
value="{{::row.bonus | currency:'EUR':2}}">
</vn-label-value>
<vn-label-value
label="Max m3"
label="Max m³"
value="{{::row.m3Max}}">
</vn-label-value>
</vn-item-section>
@ -166,7 +166,7 @@
</vn-input-number>
</vn-horizontal>
<vn-input-number
label="Max m3"
label="Max m³"
ng-model="$ctrl.selected.m3Max"
min="0"
step="0.01">