diff --git a/db/changes/10002-lent/00-ticketServiceType.sql b/db/changes/10002-lent/00-ticketServiceType.sql new file mode 100644 index 000000000..5f887a10f --- /dev/null +++ b/db/changes/10002-lent/00-ticketServiceType.sql @@ -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'); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 1dd6587df..c7663af4d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -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"]', diff --git a/e2e/paths/login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js similarity index 100% rename from e2e/paths/login/01_login.spec.js rename to e2e/paths/01-login/01_login.spec.js diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js similarity index 100% rename from e2e/paths/client-module/01_create_client.spec.js rename to e2e/paths/02-client-module/01_create_client.spec.js diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client-module/02_edit_basic_data.spec.js similarity index 100% rename from e2e/paths/client-module/02_edit_basic_data.spec.js rename to e2e/paths/02-client-module/02_edit_basic_data.spec.js diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js similarity index 100% rename from e2e/paths/client-module/03_edit_fiscal_data.spec.js rename to e2e/paths/02-client-module/03_edit_fiscal_data.spec.js diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/02-client-module/04_edit_pay_method.spec.js similarity index 100% rename from e2e/paths/client-module/04_edit_pay_method.spec.js rename to e2e/paths/02-client-module/04_edit_pay_method.spec.js diff --git a/e2e/paths/client-module/05_add_address.spec.js b/e2e/paths/02-client-module/05_add_address.spec.js similarity index 100% rename from e2e/paths/client-module/05_add_address.spec.js rename to e2e/paths/02-client-module/05_add_address.spec.js diff --git a/e2e/paths/client-module/06_add_address_notes.spec.js b/e2e/paths/02-client-module/06_add_address_notes.spec.js similarity index 100% rename from e2e/paths/client-module/06_add_address_notes.spec.js rename to e2e/paths/02-client-module/06_add_address_notes.spec.js diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/02-client-module/07_edit_web_access.spec.js similarity index 100% rename from e2e/paths/client-module/07_edit_web_access.spec.js rename to e2e/paths/02-client-module/07_edit_web_access.spec.js diff --git a/e2e/paths/client-module/08_add_notes.spec.js b/e2e/paths/02-client-module/08_add_notes.spec.js similarity index 100% rename from e2e/paths/client-module/08_add_notes.spec.js rename to e2e/paths/02-client-module/08_add_notes.spec.js diff --git a/e2e/paths/client-module/09_add_credit.spec.js b/e2e/paths/02-client-module/09_add_credit.spec.js similarity index 100% rename from e2e/paths/client-module/09_add_credit.spec.js rename to e2e/paths/02-client-module/09_add_credit.spec.js diff --git a/e2e/paths/client-module/10_add_greuge.spec.js b/e2e/paths/02-client-module/10_add_greuge.spec.js similarity index 100% rename from e2e/paths/client-module/10_add_greuge.spec.js rename to e2e/paths/02-client-module/10_add_greuge.spec.js diff --git a/e2e/paths/client-module/11_mandate.spec.js b/e2e/paths/02-client-module/11_mandate.spec.js similarity index 100% rename from e2e/paths/client-module/11_mandate.spec.js rename to e2e/paths/02-client-module/11_mandate.spec.js diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js similarity index 100% rename from e2e/paths/client-module/12_lock_of_verified_data.spec.js rename to e2e/paths/02-client-module/12_lock_of_verified_data.spec.js diff --git a/e2e/paths/client-module/13_log.spec.js b/e2e/paths/02-client-module/13_log.spec.js similarity index 100% rename from e2e/paths/client-module/13_log.spec.js rename to e2e/paths/02-client-module/13_log.spec.js diff --git a/e2e/paths/client-module/14_risk.spec.js b/e2e/paths/02-client-module/14_risk.spec.js similarity index 100% rename from e2e/paths/client-module/14_risk.spec.js rename to e2e/paths/02-client-module/14_risk.spec.js diff --git a/e2e/paths/client-module/15_user_config.spec.js b/e2e/paths/02-client-module/15_user_config.spec.js similarity index 100% rename from e2e/paths/client-module/15_user_config.spec.js rename to e2e/paths/02-client-module/15_user_config.spec.js diff --git a/e2e/paths/client-module/16_web_payment.spec.js b/e2e/paths/02-client-module/16_web_payment.spec.js similarity index 100% rename from e2e/paths/client-module/16_web_payment.spec.js rename to e2e/paths/02-client-module/16_web_payment.spec.js diff --git a/e2e/paths/worker-module/01_pbx.spec.js b/e2e/paths/02-worker-module/01_pbx.spec.js similarity index 100% rename from e2e/paths/worker-module/01_pbx.spec.js rename to e2e/paths/02-worker-module/01_pbx.spec.js diff --git a/e2e/paths/item-module/01_summary.spec.js b/e2e/paths/03-item-module/01_summary.spec.js similarity index 100% rename from e2e/paths/item-module/01_summary.spec.js rename to e2e/paths/03-item-module/01_summary.spec.js diff --git a/e2e/paths/item-module/02_basic_data.spec.js b/e2e/paths/03-item-module/02_basic_data.spec.js similarity index 100% rename from e2e/paths/item-module/02_basic_data.spec.js rename to e2e/paths/03-item-module/02_basic_data.spec.js diff --git a/e2e/paths/item-module/03_tax.spec.js b/e2e/paths/03-item-module/03_tax.spec.js similarity index 100% rename from e2e/paths/item-module/03_tax.spec.js rename to e2e/paths/03-item-module/03_tax.spec.js diff --git a/e2e/paths/item-module/04_tags.spec.js b/e2e/paths/03-item-module/04_tags.spec.js similarity index 100% rename from e2e/paths/item-module/04_tags.spec.js rename to e2e/paths/03-item-module/04_tags.spec.js diff --git a/e2e/paths/item-module/05_niche.spec.js b/e2e/paths/03-item-module/05_niche.spec.js similarity index 100% rename from e2e/paths/item-module/05_niche.spec.js rename to e2e/paths/03-item-module/05_niche.spec.js diff --git a/e2e/paths/item-module/06_botanical.spec.js b/e2e/paths/03-item-module/06_botanical.spec.js similarity index 100% rename from e2e/paths/item-module/06_botanical.spec.js rename to e2e/paths/03-item-module/06_botanical.spec.js diff --git a/e2e/paths/item-module/07_barcode.spec.js b/e2e/paths/03-item-module/07_barcode.spec.js similarity index 100% rename from e2e/paths/item-module/07_barcode.spec.js rename to e2e/paths/03-item-module/07_barcode.spec.js diff --git a/e2e/paths/item-module/08_create_and_clone.spec.js b/e2e/paths/03-item-module/08_create_and_clone.spec.js similarity index 100% rename from e2e/paths/item-module/08_create_and_clone.spec.js rename to e2e/paths/03-item-module/08_create_and_clone.spec.js diff --git a/e2e/paths/item-module/09_regularize.spec.js b/e2e/paths/03-item-module/09_regularize.spec.js similarity index 100% rename from e2e/paths/item-module/09_regularize.spec.js rename to e2e/paths/03-item-module/09_regularize.spec.js diff --git a/e2e/paths/item-module/10_item_index.spec.js b/e2e/paths/03-item-module/10_item_index.spec.js similarity index 100% rename from e2e/paths/item-module/10_item_index.spec.js rename to e2e/paths/03-item-module/10_item_index.spec.js diff --git a/e2e/paths/item-module/11_item_log.spec.js b/e2e/paths/03-item-module/11_item_log.spec.js similarity index 100% rename from e2e/paths/item-module/11_item_log.spec.js rename to e2e/paths/03-item-module/11_item_log.spec.js diff --git a/e2e/paths/item-module/12_descriptor.spec.js b/e2e/paths/03-item-module/12_descriptor.spec.js similarity index 100% rename from e2e/paths/item-module/12_descriptor.spec.js rename to e2e/paths/03-item-module/12_descriptor.spec.js diff --git a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js b/e2e/paths/04-ticket-module/01_create_ticket_observations.spec.js similarity index 100% rename from e2e/paths/ticket-module/01_create_ticket_observations.spec.js rename to e2e/paths/04-ticket-module/01_create_ticket_observations.spec.js diff --git a/e2e/paths/ticket-module/02_ticket_expeditions_and_log.spec.js b/e2e/paths/04-ticket-module/02_ticket_expeditions_and_log.spec.js similarity index 100% rename from e2e/paths/ticket-module/02_ticket_expeditions_and_log.spec.js rename to e2e/paths/04-ticket-module/02_ticket_expeditions_and_log.spec.js diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/04-ticket-module/03_list_sale.spec.js similarity index 100% rename from e2e/paths/ticket-module/03_list_sale.spec.js rename to e2e/paths/04-ticket-module/03_list_sale.spec.js diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/04-ticket-module/04_create_ticket_packages.spec.js similarity index 100% rename from e2e/paths/ticket-module/04_create_ticket_packages.spec.js rename to e2e/paths/04-ticket-module/04_create_ticket_packages.spec.js diff --git a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/04-ticket-module/05_create_new_tracking_state.spec.js similarity index 100% rename from e2e/paths/ticket-module/05_create_new_tracking_state.spec.js rename to e2e/paths/04-ticket-module/05_create_new_tracking_state.spec.js diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/04-ticket-module/06_edit_basic_data_steps.spec.js similarity index 100% rename from e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js rename to e2e/paths/04-ticket-module/06_edit_basic_data_steps.spec.js diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/04-ticket-module/07_edit_sale.spec.js similarity index 100% rename from e2e/paths/ticket-module/07_edit_sale.spec.js rename to e2e/paths/04-ticket-module/07_edit_sale.spec.js diff --git a/e2e/paths/ticket-module/08_list_components.spec.js b/e2e/paths/04-ticket-module/08_list_components.spec.js similarity index 100% rename from e2e/paths/ticket-module/08_list_components.spec.js rename to e2e/paths/04-ticket-module/08_list_components.spec.js diff --git a/e2e/paths/ticket-module/09_ticket_weekly.spec.js b/e2e/paths/04-ticket-module/09_ticket_weekly.spec.js similarity index 100% rename from e2e/paths/ticket-module/09_ticket_weekly.spec.js rename to e2e/paths/04-ticket-module/09_ticket_weekly.spec.js diff --git a/e2e/paths/ticket-module/10_ticket_request.spec.js b/e2e/paths/04-ticket-module/10_ticket_request.spec.js similarity index 100% rename from e2e/paths/ticket-module/10_ticket_request.spec.js rename to e2e/paths/04-ticket-module/10_ticket_request.spec.js diff --git a/e2e/paths/ticket-module/11_ticket_diary.spec.js b/e2e/paths/04-ticket-module/11_ticket_diary.spec.js similarity index 100% rename from e2e/paths/ticket-module/11_ticket_diary.spec.js rename to e2e/paths/04-ticket-module/11_ticket_diary.spec.js diff --git a/e2e/paths/ticket-module/12_descriptor.spec.js b/e2e/paths/04-ticket-module/12_descriptor.spec.js similarity index 100% rename from e2e/paths/ticket-module/12_descriptor.spec.js rename to e2e/paths/04-ticket-module/12_descriptor.spec.js diff --git a/e2e/paths/ticket-module/13_create_ticket_services.spec.js b/e2e/paths/04-ticket-module/13_create_ticket_services.spec.js similarity index 98% rename from e2e/paths/ticket-module/13_create_ticket_services.spec.js rename to e2e/paths/04-ticket-module/13_create_ticket_services.spec.js index 0b1c08463..34bd22a6c 100644 --- a/e2e/paths/ticket-module/13_create_ticket_services.spec.js +++ b/e2e/paths/04-ticket-module/13_create_ticket_services.spec.js @@ -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) diff --git a/e2e/paths/ticket-module/14_create_ticket.spec.js b/e2e/paths/04-ticket-module/14_create_ticket.spec.js similarity index 100% rename from e2e/paths/ticket-module/14_create_ticket.spec.js rename to e2e/paths/04-ticket-module/14_create_ticket.spec.js diff --git a/e2e/paths/ticket-module/15_create_ticket_from_client.spec.js b/e2e/paths/04-ticket-module/15_create_ticket_from_client.spec.js similarity index 100% rename from e2e/paths/ticket-module/15_create_ticket_from_client.spec.js rename to e2e/paths/04-ticket-module/15_create_ticket_from_client.spec.js diff --git a/e2e/paths/claim-module/01_edit_basic_data.spec.js b/e2e/paths/05-claim-module/01_edit_basic_data.spec.js similarity index 100% rename from e2e/paths/claim-module/01_edit_basic_data.spec.js rename to e2e/paths/05-claim-module/01_edit_basic_data.spec.js diff --git a/e2e/paths/claim-module/02_create_development.spec.js b/e2e/paths/05-claim-module/02_create_development.spec.js similarity index 100% rename from e2e/paths/claim-module/02_create_development.spec.js rename to e2e/paths/05-claim-module/02_create_development.spec.js diff --git a/e2e/paths/claim-module/03_detail.spec.js b/e2e/paths/05-claim-module/03_detail.spec.js similarity index 100% rename from e2e/paths/claim-module/03_detail.spec.js rename to e2e/paths/05-claim-module/03_detail.spec.js diff --git a/e2e/paths/claim-module/04_claim_action.spec.js b/e2e/paths/05-claim-module/04_claim_action.spec.js similarity index 100% rename from e2e/paths/claim-module/04_claim_action.spec.js rename to e2e/paths/05-claim-module/04_claim_action.spec.js diff --git a/e2e/paths/order-module/01_edit_basic_data.spec.js b/e2e/paths/06-order-module/01_edit_basic_data.spec.js similarity index 100% rename from e2e/paths/order-module/01_edit_basic_data.spec.js rename to e2e/paths/06-order-module/01_edit_basic_data.spec.js diff --git a/e2e/paths/order-module/02_lines.spec.js b/e2e/paths/06-order-module/02_lines.spec.js similarity index 100% rename from e2e/paths/order-module/02_lines.spec.js rename to e2e/paths/06-order-module/02_lines.spec.js diff --git a/e2e/paths/route-module/01_create.spec.js b/e2e/paths/07-route-module/01_create.spec.js similarity index 100% rename from e2e/paths/route-module/01_create.spec.js rename to e2e/paths/07-route-module/01_create.spec.js diff --git a/e2e/paths/route-module/02_basic_data.spec.js b/e2e/paths/07-route-module/02_basic_data.spec.js similarity index 100% rename from e2e/paths/route-module/02_basic_data.spec.js rename to e2e/paths/07-route-module/02_basic_data.spec.js diff --git a/e2e/paths/route-module/03_tickets.spec.js b/e2e/paths/07-route-module/03_tickets.spec.js similarity index 87% rename from e2e/paths/route-module/03_tickets.spec.js rename to e2e/paths/07-route-module/03_tickets.spec.js index 3b36bce82..0ae3fe0ad 100644 --- a/e2e/paths/route-module/03_tickets.spec.js +++ b/e2e/paths/07-route-module/03_tickets.spec.js @@ -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); }); }); diff --git a/front/core/components/popover/popover.js b/front/core/components/popover/popover.js index 804d0383b..f6f2dcb96 100644 --- a/front/core/components/popover/popover.js +++ b/front/core/components/popover/popover.js @@ -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) { diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index 06ba9bd45..a919827b4 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -56,6 +56,9 @@ "TicketService":{ "dataSource": "vn" }, + "TicketServiceType":{ + "dataSource": "vn" + }, "TicketTracking": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/ticket-service-type.json b/modules/ticket/back/models/ticket-service-type.json new file mode 100644 index 000000000..a17431644 --- /dev/null +++ b/modules/ticket/back/models/ticket-service-type.json @@ -0,0 +1,19 @@ +{ + "name": "TicketServiceType", + "options": { + "mysql": { + "table": "ticketServiceType" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "String", + "required": true + } + } +} \ No newline at end of file diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index a4229b435..9f943b7a4 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -14,13 +14,14 @@ - - + show-field="name" + value-field="name" + field="service.description"> +