2276-travel_summary - e2e in progress #457
|
@ -815,6 +815,10 @@ export default {
|
|||
ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)',
|
||||
ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)'
|
||||
},
|
||||
travelIndex: {
|
||||
anySearchResult: 'vn-travel-index vn-tbody > a',
|
||||
firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)'
|
||||
},
|
||||
travelBasicDada: {
|
||||
reference: 'vn-travel-basic-data vn-textfield[ng-model="$ctrl.travel.ref"]',
|
||||
agency: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]',
|
||||
|
@ -841,6 +845,11 @@ export default {
|
|||
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
||||
upload: 'vn-travel-thermograph-create button[type=submit]'
|
||||
},
|
||||
travelDescriptor: {
|
||||
filterByAgencyButton: 'vn-descriptor-content .quicklinks > div:nth-child(1) > vn-quick-link > a[vn-tooltip="All travels with current agency"]',
|
||||
dotMenu: 'vn-travel-descriptor vn-icon-button[icon="more_vert"]',
|
||||
dotMenuClone: '#clone'
|
||||
},
|
||||
zoneIndex: {
|
||||
searchResult: 'vn-zone-index a.vn-tr',
|
||||
},
|
||||
|
|
|
@ -41,7 +41,6 @@ describe('Client balance path', () => {
|
|||
it('should click the new payment button', async() => {
|
||||
await page.closePopup();
|
||||
await page.reloadSection('client.card.balance.index');
|
||||
await page.waitForState('client.card.balance.index');
|
||||
});
|
||||
|
||||
it('should create a new payment that clears the debt', async() => {
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Travel descriptor path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'travel');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.waitForState('travel.card.summary');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should click the descriptor button to navigate to the travel index showing all travels with current agency', async() => {
|
||||
await page.waitToClick(selectors.travelDescriptor.filterByAgencyButton);
|
||||
await page.waitForState('travel.index');
|
||||
const result = await page.countElement(selectors.travelIndex.anySearchResult);
|
||||
|
||||
expect(result).toBeGreaterThanOrEqual(7);
|
||||
});
|
||||
|
||||
it('should navigate to the first search result', async() => {
|
||||
await page.waitToClick(selectors.travelIndex.firstSearchResult);
|
||||
await page.waitForState('travel.card.summary');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('travel.card.summary');
|
||||
});
|
||||
|
||||
it('should be redirected to the create travel when using the clone option of the dot menu', async() => {
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenu);
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenuClone);
|
||||
await page.respondToDialog('accept');
|
||||
await page.waitForState('travel.create');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('travel.create');
|
||||
});
|
||||
});
|
|
@ -50,7 +50,13 @@
|
|||
</vn-td>
|
||||
<vn-td title="{{::entry.warehouse| dashIfEmpty}}">{{::entry.warehouse| dashIfEmpty}}</vn-td>
|
||||
<vn-td expand>{{::entry.landed | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td number>{{::entry.entryFk | dashIfEmpty}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<span
|
||||
vn-click-stop="entryDescriptor.show($event, entry.entryFk)"
|
||||
class="link">
|
||||
{{::entry.entryFk | dashIfEmpty}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td number>{{::entry.price2 | dashIfEmpty}}</vn-td>
|
||||
<vn-td number>{{::entry.price3 | dashIfEmpty}}</vn-td>
|
||||
<vn-td number class="expendable">{{entry.stickers | dashIfEmpty}}</vn-td>
|
||||
|
@ -77,6 +83,10 @@
|
|||
</vn-card>
|
||||
</vn-data-viewer>
|
||||
|
||||
<vn-entry-descriptor-popover
|
||||
vn-id="entryDescriptor">
|
||||
</vn-entry-descriptor-popover>
|
||||
|
||||
<vn-contextmenu vn-id="contextmenu" targets="['vn-data-viewer']" model="model"
|
||||
expr-builder="$ctrl.exprBuilder(param, value)">
|
||||
<slot-menu>
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
"m3": {
|
||||
"type": "Number"
|
||||
},
|
||||
"cargoSupplierFk": {
|
||||
"type": "Number"
|
||||
},
|
||||
"agencyModeFk": {
|
||||
"type": "Number",
|
||||
"mysql": {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<vn-icon-button
|
||||
icon="more_vert"
|
||||
vn-popover="menu">
|
||||
</vn-icon-button>
|
||||
<vn-menu vn-id="menu">
|
||||
<vn-list>
|
||||
<vn-item
|
||||
id="clone"
|
||||
ng-click="clone.show()"
|
||||
translate>
|
||||
Clone travel
|
||||
</vn-item>
|
||||
</vn-list>
|
||||
</vn-menu>
|
||||
|
||||
<!-- Clone travel popup -->
|
||||
<vn-confirm
|
||||
vn-id="clone"
|
||||
on-accept="$ctrl.onCloneAccept()"
|
||||
question="Do you want to clone this travel?"
|
||||
message="All it's properties will be copied">
|
||||
</vn-confirm>
|
|
@ -0,0 +1,72 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
}
|
||||
|
||||
get travelId() {
|
||||
return this._travelId;
|
||||
}
|
||||
|
||||
set travelId(value) {
|
||||
this._travelId = value;
|
||||
|
||||
if (value) this.loadData();
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
fields: [
|
||||
'id',
|
||||
'ref',
|
||||
'shipped',
|
||||
'landed',
|
||||
'totalEntries',
|
||||
'agencyFk',
|
||||
'warehouseInFk',
|
||||
'warehouseOutFk',
|
||||
'cargoSupplierFk'
|
||||
],
|
||||
include: [
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}, {
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
return this.$http.get(`Travels/${this.travelId}`, {filter})
|
||||
.then(res => this.travel = res.data);
|
||||
}
|
||||
|
||||
onCloneAccept() {
|
||||
const params = JSON.stringify({
|
||||
ref: this.travel.ref,
|
||||
agencyModeFk: this.travel.agencyFk,
|
||||
shipped: this.travel.shipped,
|
||||
landed: this.travel.landed,
|
||||
warehouseInFk: this.travel.warehouseInFk,
|
||||
warehouseOutFk: this.travel.warehouseOutFk
|
||||
});
|
||||
this.$state.go('travel.create', {q: params});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.vnComponent('vnTravelDescriptorMenu', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
travelId: '<',
|
||||
}
|
||||
});
|
|
@ -0,0 +1,39 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Travel Component vnTravelDescriptorMenu', () => {
|
||||
let controller;
|
||||
beforeEach(ngModule('travel'));
|
||||
|
||||
beforeEach(inject(($componentController, $state,) => {
|
||||
const $element = angular.element('<vn-travel-descriptor-menu></vn-travel-descriptor-menu>');
|
||||
controller = $componentController('vnTravelDescriptorMenu', {$element});
|
||||
}));
|
||||
|
||||
describe('onCloneAccept()', () => {
|
||||
it('should call state.go with the travel data', () => {
|
||||
jest.spyOn(controller.$state, 'go').mockReturnValue('ok');
|
||||
|
||||
controller.travel = {
|
||||
ref: 'the ref',
|
||||
agencyFk: 'the agency',
|
||||
shipped: 'the shipped date',
|
||||
landed: 'the landing date',
|
||||
warehouseInFk: 'the receiver warehouse',
|
||||
warehouseOutFk: 'the sender warehouse'
|
||||
};
|
||||
|
||||
controller.onCloneAccept();
|
||||
|
||||
const params = JSON.stringify({
|
||||
ref: controller.travel.ref,
|
||||
agencyModeFk: controller.travel.agencyFk,
|
||||
shipped: controller.travel.shipped,
|
||||
landed: controller.travel.landed,
|
||||
warehouseInFk: controller.travel.warehouseInFk,
|
||||
warehouseOutFk: controller.travel.warehouseOutFk
|
||||
});
|
||||
|
||||
expect(controller.$state.go).toHaveBeenCalledWith('travel.create', {'q': params});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
Clone travel: Clonar envío
|
|
@ -0,0 +1,24 @@
|
|||
@import "./effects";
|
||||
@import "variables";
|
||||
|
||||
vn-travel-descriptor-menu {
|
||||
& > vn-icon-button[icon="more_vert"] {
|
||||
display: flex;
|
||||
min-width: 45px;
|
||||
height: 45px;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
& > vn-icon-button[icon="more_vert"] {
|
||||
@extend %clickable;
|
||||
color: inherit;
|
||||
|
||||
& > vn-icon {
|
||||
padding: 10px;
|
||||
}
|
||||
vn-icon {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
<vn-descriptor-content
|
||||
module="travel"
|
||||
description="$ctrl.travel.ref">
|
||||
<slot-dot-menu>
|
||||
<vn-travel-descriptor-menu travel-id="$ctrl.travel.id"/>
|
||||
</slot-dot-menu>
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
<vn-label-value
|
||||
|
@ -24,5 +27,18 @@
|
|||
value="{{$ctrl.travel.totalEntries}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
<div class="quicklinks">
|
||||
<div ng-transclude="btnOne">
|
||||
<vn-quick-link
|
||||
tooltip="All travels with current agency"
|
||||
state="['travel.index', {q: $ctrl.travelFilter}]"
|
||||
icon="local_airport">
|
||||
</vn-quick-link>
|
||||
</div>
|
||||
<div ng-transclude="btnTwo">
|
||||
</div>
|
||||
<div ng-transclude="btnThree">
|
||||
</div>
|
||||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
|
|
|
@ -10,6 +10,18 @@ class Controller extends Descriptor {
|
|||
this.entity = value;
|
||||
}
|
||||
|
||||
get travelFilter() {
|
||||
let travelFilter;
|
||||
const travel = this.travel;
|
||||
|
||||
if (travel && travel.agencyFk) {
|
||||
travelFilter = this.travel && JSON.stringify({
|
||||
agencyFk: this.travel.agencyFk
|
||||
});
|
||||
}
|
||||
return travelFilter;
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
fields: [
|
||||
|
@ -19,7 +31,8 @@ class Controller extends Descriptor {
|
|||
'landed',
|
||||
'totalEntries',
|
||||
'warehouseInFk',
|
||||
'warehouseOutFk'
|
||||
'warehouseOutFk',
|
||||
'cargoSupplierFk'
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
|
|
@ -13,3 +13,4 @@ import './thermograph/index/';
|
|||
import './thermograph/create/';
|
||||
import './thermograph/edit/';
|
||||
import './descriptor-popover';
|
||||
import './descriptor-menu';
|
||||
|
|
Loading…
Reference in New Issue