Merge branch 'dev' into 2479-factura-ticket

This commit is contained in:
Javi Gallego 2021-01-22 14:31:28 +01:00
commit 228a642634
19 changed files with 165 additions and 62 deletions

View File

@ -770,25 +770,25 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
(05080000, 'Coral y materiales similares', 2, 2), (05080000, 'Coral y materiales similares', 2, 2),
(06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1); (06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`, `minPrice`) INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`, `minPrice`, `stars`)
VALUES VALUES
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '1', 1, NULL, 0), (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '1', 1, NULL, 0, 1),
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '2', 1, NULL, 0), (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '2', 1, NULL, 0, 2),
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '3', 1, NULL, 0), (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '3', 1, NULL, 0, 5),
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, '4', 2, NULL, 0), (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, '4', 2, NULL, 0, 3),
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '5', 2, NULL, 0), (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '5', 2, NULL, 0, 3),
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '6', 2, NULL, 0), (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '6', 2, NULL, 0, 4),
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '7', 2, NULL, 0), (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '7', 2, NULL, 0, 4),
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '8', 1, NULL, 0), (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '8', 1, NULL, 0, 5),
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '9', 1, NULL, 0), (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '9', 1, NULL, 0, 4),
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '10', 1, NULL, 0), (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '10', 1, NULL, 0, 4),
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, '11', 2, NULL, 0), (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, '11', 2, NULL, 0, 4),
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '12', 2, NULL, 0), (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '12', 2, NULL, 0, 3),
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '13', 2, NULL, 0), (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '13', 2, NULL, 0, 2),
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 4),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 0),
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 0),
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, '', 2, NULL, 0); (71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 0);
INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`) INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`)
VALUES VALUES

View File

@ -20,6 +20,7 @@ describe('Travel extra community path', () => {
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter); await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
await page.waitForSpinnerLoad(); await page.waitForSpinnerLoad();
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
await page.waitForSpinnerLoad();
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500'); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
}); });

View File

@ -51,3 +51,4 @@ import './treeview';
import './wday-picker'; import './wday-picker';
import './datalist'; import './datalist';
import './contextmenu'; import './contextmenu';
import './rating';

View File

@ -0,0 +1,5 @@
<div>
<vn-icon ng-repeat="star in ::$ctrl.stars" ng-class="::{active: star.isActive}"
icon="star_rate">
</vn-icon>
</div>

View File

@ -0,0 +1,39 @@
import ngModule from '../../module';
import FormInput from '../form-input';
import './style.scss';
export default class Rating extends FormInput {
constructor($element, $scope) {
super($element, $scope);
this.maxStars = 5;
this.stars = [];
}
get field() {
return super.field;
}
set field(value) {
super.field = value;
this.populateStars();
}
populateStars() {
for (let i = 0; i < this.maxStars; i++) {
const star = {isActive: false};
if (i < this.field)
star.isActive = true;
this.stars.push(star);
}
}
}
ngModule.vnComponent('vnRating', {
template: require('./index.html'),
controller: Rating,
bindings: {
maxStars: '<?',
}
});

View File

@ -0,0 +1,38 @@
describe('Component vnRating', () => {
let $element;
let $ctrl;
beforeEach(ngModule('vnCore'));
beforeEach(inject(($compile, $rootScope) => {
$element = $compile(`<vn-rating ng-model="$ctrl.stars"></vn-rating>`)($rootScope);
$ctrl = $element.controller('vnRating');
}));
afterEach(() => {
$element.remove();
});
describe('field() setter', () => {
it(`should change field value and then call the populateStars() method`, () => {
jest.spyOn($ctrl, 'populateStars');
$ctrl.field = 5;
expect($ctrl.populateStars).toHaveBeenCalledWith();
expect($ctrl.stars.length).toEqual(5);
});
});
describe('populateStars()', () => {
it(`should populate the stars array and mark four of them as active`, () => {
jest.spyOn($ctrl, 'populateStars');
$ctrl.field = 4;
const activeStars = $ctrl.stars.filter(star => star.isActive);
expect(activeStars.length).toEqual(4);
});
});
});

View File

@ -0,0 +1,11 @@
@import "variables";
vn-rating {
vn-icon {
color: $color-primary-light
}
vn-icon.active {
color: $color-primary
}
}

View File

@ -61,6 +61,8 @@ $color-hover-cd: rgba(0, 0, 0, .1);
$color-hover-dc: .7; $color-hover-dc: .7;
$color-disabled: .6; $color-disabled: .6;
$color-primary-medium: lighten($color-primary, 20%);
$color-primary-light: lighten($color-primary, 35%);
$color-font-link-medium: lighten($color-font-link, 20%); $color-font-link-medium: lighten($color-font-link, 20%);
$color-font-link-light: lighten($color-font-link, 35%); $color-font-link-light: lighten($color-font-link, 35%);
$color-main-medium: lighten($color-main, 20%); $color-main-medium: lighten($color-main, 20%);

View File

@ -11,8 +11,8 @@ vn-descriptor-content {
& > img[ng-src] { & > img[ng-src] {
min-height: 16em; min-height: 16em;
display: block; display: block;
height: 100%; width: 256px;
width: 100%; height: 256px;
} }
vn-float-button { vn-float-button {

View File

@ -54,13 +54,15 @@
flex: 1; flex: 1;
} }
& > .tags { & > .tags {
padding-bottom: 3px;
height: 48px; height: 48px;
& > vn-label-value { & > vn-label-value {
font-size: .75rem; font-size: .75rem;
} }
} }
vn-rating vn-icon {
font-size: 1rem
}
} }
.footer { .footer {
font-size: .8rem; font-size: .8rem;

View File

@ -9,7 +9,7 @@
{"state": "item.index", "icon": "icon-item"}, {"state": "item.index", "icon": "icon-item"},
{"state": "item.request", "icon": "pan_tool"}, {"state": "item.request", "icon": "pan_tool"},
{"state": "item.waste", "icon": "icon-claims"}, {"state": "item.waste", "icon": "icon-claims"},
{"state": "item.fixedPrice", "icon": ""} {"state": "item.fixedPrice", "icon": "contact_support"}
], ],
"card": [ "card": [
{"state": "item.card.basicData", "icon": "settings"}, {"state": "item.card.basicData", "icon": "settings"},

View File

@ -108,6 +108,7 @@ module.exports = Self => {
i.value7, i.value7,
i.tag8, i.tag8,
i.value8, i.value8,
i.stars,
tci.price, tci.price,
tci.available, tci.available,
w.lastName AS lastName, w.lastName AS lastName,

View File

@ -155,7 +155,8 @@ module.exports = Self => {
co.code companyCode, co.code companyCode,
zed.zoneFk, zed.zoneFk,
zed.hourTheoretical, zed.hourTheoretical,
zed.hourEffective zed.hourEffective,
am.name AS agencyName
FROM hedera.order o FROM hedera.order o
LEFT JOIN address a ON a.id = o.address_id LEFT JOIN address a ON a.id = o.address_id
LEFT JOIN agencyMode am ON am.id = o.agency_id LEFT JOIN agencyMode am ON am.id = o.agency_id

View File

@ -36,6 +36,9 @@
value="{{::item.value7}}"> value="{{::item.value7}}">
</vn-label-value> </vn-label-value>
</div> </div>
<vn-rating ng-if="::item.stars"
ng-model="::item.stars">
</vn-rating>
<div class="footer"> <div class="footer">
<div class="price"> <div class="price">
<vn-one> <vn-one>

View File

@ -2,11 +2,9 @@ import ngModule from '../module';
import Component from 'core/lib/component'; import Component from 'core/lib/component';
import './style.scss'; import './style.scss';
class Controller extends Component {}
ngModule.vnComponent('vnOrderCatalogView', { ngModule.vnComponent('vnOrderCatalogView', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Component,
bindings: { bindings: {
order: '<', order: '<',
model: '<' model: '<'

View File

@ -15,8 +15,8 @@
<vn-th field="isConfirmed" center>Confirmed</vn-th> <vn-th field="isConfirmed" center>Confirmed</vn-th>
<vn-th field="created" center expand>Created</vn-th> <vn-th field="created" center expand>Created</vn-th>
<vn-th field="landed" default-order="DESC" center expand>Landed</vn-th> <vn-th field="landed" default-order="DESC" center expand>Landed</vn-th>
<vn-th field="created" center translate-attr="{title: 'Theoretical hour'}">T. Hour</vn-th> <vn-th field="created" center>Hour</vn-th>
<vn-th field="created" center>Real hour</vn-th> <vn-th field="agencyName" center>Agency</vn-th>
<vn-th center>Total</vn-th> <vn-th center>Total</vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
@ -52,8 +52,11 @@
{{::order.landed | date:'dd/MM/yyyy'}} {{::order.landed | date:'dd/MM/yyyy'}}
</span> </span>
</vn-td> </vn-td>
<vn-td shrink>{{::order.hourTheoretical | date: 'HH:mm' | dashIfEmpty}}</vn-td> <vn-td shrink>{{::(order.hourTheoretical
<vn-td shrink>{{::ticket.hourEffective | date: 'HH:mm' | dashIfEmpty}}</vn-td> ? order.hourTheoretical
: order.hourEffective) | dashIfEmpty
}}</vn-td>
<vn-td expand>{{::order.agencyName}}</vn-td>
<vn-td number>{{::order.total | currency: 'EUR': 2 | dashIfEmpty}}</vn-td> <vn-td number>{{::order.total | currency: 'EUR': 2 | dashIfEmpty}}</vn-td>
<vn-td shrink> <vn-td shrink>
<vn-icon-button <vn-icon-button

View File

@ -60,7 +60,8 @@ class Controller extends Section {
} }
}, },
{relation: 'ship'}, {relation: 'ship'},
{relation: 'stowaway'}] {relation: 'stowaway'},
{relation: 'invoiceOut'}]
}; };
return this.$http.get(`Tickets/${this.ticketId}`, {filter}) return this.$http.get(`Tickets/${this.ticketId}`, {filter})

View File

@ -39,28 +39,25 @@
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Shipped from" label="Shipped from"
ng-model="filter.shippedFrom" ng-model="$ctrl.shippedFrom">
on-change="$ctrl.shippedFrom = value">
</vn-date-picker> </vn-date-picker>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Shipped to" label="Landed from"
ng-model="filter.shippedTo" ng-model="$ctrl.landedFrom">
on-change="$ctrl.shippedTo = value">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Landed from" label="Shipped to"
ng-model="filter.landedFrom" ng-model="$ctrl.shippedTo">
on-change="$ctrl.landedFrom = value">
</vn-date-picker> </vn-date-picker>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Landed to" label="Landed to"
ng-model="filter.landedTo" ng-model="$ctrl.landedTo">
on-change="$ctrl.landedTo = value">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -9,47 +9,47 @@ class Controller extends SearchPanel {
} }
get shippedFrom() { get shippedFrom() {
return this._shippedFrom; return this.filter.shippedFrom;
} }
set shippedFrom(value) { set shippedFrom(value) {
this._shippedFrom = value; this.filter.shippedFrom = value;
if (!this.filter.shippedTo) if (!this.filter.landedFrom)
this.filter.shippedTo = value; this.filter.landedFrom = value;
} }
get shippedTo() { get shippedTo() {
return this._shippedTo; return this.filter.shippedTo;
} }
set shippedTo(value) { set shippedTo(value) {
this._shippedTo = value; this.filter.shippedTo = value;
if (!this.filter.shippedFrom)
this.filter.shippedFrom = value;
}
get landedFrom() {
return this._landedFrom;
}
set landedFrom(value) {
this._landedFrom = value;
if (!this.filter.landedTo) if (!this.filter.landedTo)
this.filter.landedTo = value; this.filter.landedTo = value;
} }
get landedFrom() {
return this.filter.landedFrom;
}
set landedFrom(value) {
this.filter.landedFrom = value;
if (!this.filter.shippedFrom)
this.filter.shippedFrom = value;
}
get landedTo() { get landedTo() {
return this._landedTo; return this.filter.landedTo;
} }
set landedTo(value) { set landedTo(value) {
this._landedTo = value; this.filter.landedTo = value;
if (!this.filter.landedFrom) if (!this.filter.shippedTo)
this.filter.landedFrom = value; this.filter.shippedTo = value;
} }
} }