Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-04-11 07:29:43 +02:00
commit 3d71165682
60 changed files with 65 additions and 41 deletions

View File

@ -0,0 +1,13 @@
DROP TABLE IF EXISTS `vn`.`ticketServiceType`;
CREATE TABLE vn.`ticketServiceType` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de los posibles servicios a elegir';
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Porte Agencia');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Portes Retorno');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Porte Carry');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Cargo FITOSANITARIO');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Documentos');

View File

@ -455,7 +455,7 @@ export default {
},
ticketService: {
addServiceButton: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(3) > vn-icon-button > button > vn-icon',
firstDescriptionInput: 'vn-ticket-service vn-textfield[label="Description"] input',
firstDescriptionInput: 'vn-ticket-service vn-autocomplete[label="Documentos"]',
firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input',
firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input',
firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
@ -582,7 +582,6 @@ export default {
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[model="ticket.priority"] input',
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[model="ticket.priority"] input',
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[model="ticket.priority"] input',
fifthTicketPriority: 'vn-route-tickets vn-tr:nth-child(5) vn-textfield[model="ticket.priority"] input',
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check md-checkbox',
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',

View File

@ -55,7 +55,7 @@ describe('Ticket services path', () => {
expect(result).toEqual('General VAT');
});
it('should delete the service', async() => {
fit('should delete the service', async() => {
const result = await nightmare
.waitToClick(selectors.ticketService.fistDeleteServiceButton)
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)

View File

@ -7,19 +7,10 @@ describe('Route basic Data path', () => {
beforeAll(() => {
nightmare
.loginAndModule('delivery', 'route')
.accessToSearchResult(1)
.accessToSearchResult(2)
.accessToSection('route.card.tickets');
});
it('should modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 5)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should now modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 4)
@ -85,13 +76,6 @@ describe('Route basic Data path', () => {
expect(result).toEqual('4');
});
it('should confirm the fifth ticket priority', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeTickets.fifthTicketPriority, 'value');
expect(result).toEqual('5');
});
it('should confirm the buscamanButton is disabled', async() => {
const result = await nightmare
.evaluate(selector => {
@ -115,7 +99,7 @@ describe('Route basic Data path', () => {
const result = await nightmare
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
expect(result).toEqual(5);
expect(result).toEqual(4);
});
it('should delete the first ticket in route', async() => {
@ -131,6 +115,6 @@ describe('Route basic Data path', () => {
const result = await nightmare
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
expect(result).toEqual(4);
expect(result).toEqual(3);
});
});

View File

@ -118,7 +118,9 @@ export default class Popover extends Component {
*/
relocate() {
if (!(this.parent && this._shown)) return;
let margin = 10;
let scrollbarSize = 10;
let style = this.popover.style;
style.width = '';
@ -131,37 +133,40 @@ export default class Popover extends Component {
let parentRect = this.parent.getBoundingClientRect();
let popoverRect = this.popover.getBoundingClientRect();
let arrowRect = this.arrow.getBoundingClientRect();
let clamp = (value, min, max) => Math.min(Math.max(value, min), max);
let arrowHeight = Math.sqrt(Math.pow(arrowRect.height, 2) * 2) / 2;
let endMargin = margin + scrollbarSize;
let maxRight = window.innerWidth - endMargin;
let maxBottom = window.innerHeight - endMargin;
let maxWith = maxRight - margin;
let maxHeight = maxBottom - margin - arrowHeight;
let width = clamp(popoverRect.width, parentRect.width, maxWith);
let height = popoverRect.height;
let width = Math.max(popoverRect.width, parentRect.width);
let left = parentRect.left + parentRect.width / 2 - width / 2;
left = clamp(left, margin, maxRight - width);
let top = parentRect.top + parentRect.height + arrowHeight;
let left = Math.max(parentRect.left + parentRect.width / 2 - width / 2, margin);
let showTop = top + height + margin > window.innerHeight;
if (showTop)
top = Math.max(parentRect.top - height - arrowHeight, margin);
if (left + width + margin > window.innerWidth)
left = window.innerWidth - width - margin;
let showTop = top + height > maxBottom;
if (showTop) top = parentRect.top - height - arrowHeight;
top = Math.max(top, margin);
if (showTop)
arrowStyle.bottom = `0`;
else
arrowStyle.top = `0`;
let arrowMargin = margin + 10;
let arrowLeft = (parentRect.left - left) + parentRect.width / 2;
arrowLeft = Math.max(Math.min(arrowLeft, width - arrowMargin), arrowMargin);
arrowLeft = clamp(arrowLeft, arrowHeight, width - arrowHeight);
arrowStyle.left = `${arrowLeft}px`;
style.top = `${top}px`;
style.left = `${left}px`;
style.width = `${width}px`;
if (height + margin * 2 + arrowHeight > window.innerHeight)
style.height = `${window.innerHeight - margin * 2 - arrowHeight}px`;
if (height > maxHeight) style.height = `${maxHeight}px`;
}
onDocKeyDown(event) {

View File

@ -56,6 +56,9 @@
"TicketService":{
"dataSource": "vn"
},
"TicketServiceType":{
"dataSource": "vn"
},
"TicketTracking": {
"dataSource": "vn"
},

View File

@ -0,0 +1,19 @@
{
"name": "TicketServiceType",
"options": {
"mysql": {
"table": "ticketServiceType"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "String",
"required": true
}
}
}

View File

@ -14,13 +14,14 @@
<vn-card pad-large>
<vn-one>
<vn-horizontal ng-repeat="service in services track by $index">
<vn-textfield
vn-one
<vn-autocomplete vn-one
vn-focus
url="/api/TicketServiceTypes"
label="Description"
model="service.description"
rule="TicketService.description">
</vn-textfield>
show-field="name"
value-field="name"
field="service.description">
</vn-autocomplete>
<vn-input-number vn-one min="0" step="1"
label="Quantity"
model="service.quantity"