From e3a2b2af0b4b579830e88534b7fc414f6c6f4ddd Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 14 Nov 2018 14:31:56 +0100 Subject: [PATCH 1/3] #797 ticket.sale boton mas bajo derecha --- client/ticket/src/sale/index.html | 10 +++++++++- client/ticket/src/sale/index.js | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/client/ticket/src/sale/index.html b/client/ticket/src/sale/index.html index efb27cb65..5d4ee9dd0 100644 --- a/client/ticket/src/sale/index.html +++ b/client/ticket/src/sale/index.html @@ -274,4 +274,12 @@ question="You are going to delete lines of the ticket" message="Continue anyway?" on-response="$ctrl.onRemoveLinesClick(response)"> - \ No newline at end of file + + + \ No newline at end of file diff --git a/client/ticket/src/sale/index.js b/client/ticket/src/sale/index.js index 9d8e3389b..6cc012b4e 100644 --- a/client/ticket/src/sale/index.js +++ b/client/ticket/src/sale/index.js @@ -68,7 +68,7 @@ class Controller { get isEditable() { try { - return !this.ticket.tracking.state.alertLevel; + return !this.ticket.state.state.alertLevel; } catch (e) {} return true; @@ -324,6 +324,13 @@ class Controller { this.$scope.model.refresh(); }); } + + newOrderFromTicket() { + this.$http.post(`/api/Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => { + this.$state.go('order.card.catalog', {id: res.data}); + this.vnApp.showSuccess(this.$translate.instant('Order created')); + }); + } } Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; From 08fed03282cf50be0a130e7cd4d2545939bd0b53 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 14 Nov 2018 14:33:25 +0100 Subject: [PATCH 2/3] #812 el estado de un ticket que se muestra en el indice es erroneo --- client/ticket/src/card/index.js | 9 +- services/loopback/common/models/ticket.json | 183 ++++++++++---------- 2 files changed, 98 insertions(+), 94 deletions(-) diff --git a/client/ticket/src/card/index.js b/client/ticket/src/card/index.js index 9bd74db44..7f5d7e06d 100644 --- a/client/ticket/src/card/index.js +++ b/client/ticket/src/card/index.js @@ -19,14 +19,13 @@ class Controller { }, }, { - relation: 'tracking', + relation: 'state', scope: { fields: ['stateFk'], include: { relation: 'state', - fields: ['name'], - }, - order: 'created DESC' + fields: ['id', 'name'], + } }, }, ], @@ -55,5 +54,5 @@ Controller.$inject = ['$http', '$state']; ngModule.component('vnTicketCard', { template: require('./index.html'), - controller: Controller, + controller: Controller }); diff --git a/services/loopback/common/models/ticket.json b/services/loopback/common/models/ticket.json index 1ca2d1855..3fb866cc0 100644 --- a/services/loopback/common/models/ticket.json +++ b/services/loopback/common/models/ticket.json @@ -2,98 +2,103 @@ "name": "Ticket", "base": "VnModel", "options": { - "mysql": { + "mysql": { "table": "ticket" - } + } }, "properties": { - "id": { - "id": true, - "type": "Number", - "description": "Identifier" - }, - "shipped": { - "type": "date", - "required": true - }, - "landed": { - "type": "date" - }, - "nickname": { - "type": "String" - }, - "location": { - "type": "String" - }, - "solution": { - "type": "String" - }, - "packages": { - "type": "Number" - }, - "created": { - "type": "date" - }, - "isDeleted": { - "type": "boolean" - } + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "shipped": { + "type": "date", + "required": true + }, + "landed": { + "type": "date" + }, + "nickname": { + "type": "String" + }, + "location": { + "type": "String" + }, + "solution": { + "type": "String" + }, + "packages": { + "type": "Number" + }, + "created": { + "type": "date" + }, + "isDeleted": { + "type": "boolean" + } }, "relations": { - "client": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "clientFk" - }, - "warehouse": { - "type": "belongsTo", - "model": "Warehouse", - "foreignKey": "warehouseFk" - }, - "invoiceOut": { - "type": "belongsTo", - "model": "InvoiceOut", - "foreignKey": "refFk" - }, - "address": { - "type": "belongsTo", - "model": "Address", - "foreignKey": "addressFk" - }, - "route": { - "type": "belongsTo", - "model": "Route", - "foreignKey": "routeFk" - }, - "company": { - "type": "belongsTo", - "model": "Company", - "foreignKey": "companyFk" - }, - "agencyMode": { - "type": "belongsTo", - "model": "AgencyMode", - "foreignKey": "agencyModeFk", - "required": true - }, - "packages": { - "type": "hasMany", - "model": "TicketPackaging", - "foreignKey": "ticketFk" - }, - "tracking": { - "type": "hasOne", - "model": "TicketTracking", - "foreignKey": "ticketFk" - }, - "notes": { - "type": "hasMany", - "model": "TicketObservation", - "foreignKey": "ticketFk" - }, - "alertLevel": { - "type": "hasOne", - "model": "TicketState", - "foreignKey": "ticketFk" - } + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "invoiceOut": { + "type": "belongsTo", + "model": "InvoiceOut", + "foreignKey": "refFk" + }, + "address": { + "type": "belongsTo", + "model": "Address", + "foreignKey": "addressFk" + }, + "route": { + "type": "belongsTo", + "model": "Route", + "foreignKey": "routeFk" + }, + "company": { + "type": "belongsTo", + "model": "Company", + "foreignKey": "companyFk" + }, + "agencyMode": { + "type": "belongsTo", + "model": "AgencyMode", + "foreignKey": "agencyModeFk", + "required": true + }, + "packages": { + "type": "hasMany", + "model": "TicketPackaging", + "foreignKey": "ticketFk" + }, + "tracking": { + "type": "hasMany", + "model": "TicketTracking", + "foreignKey": "ticketFk" + }, + "notes": { + "type": "hasMany", + "model": "TicketObservation", + "foreignKey": "ticketFk" + }, + "alertLevel": { + "type": "hasOne", + "model": "TicketState", + "foreignKey": "ticketFk" + }, + "state": { + "type": "hasOne", + "model": "TicketState", + "foreignKey": "ticketFk" + } } - } \ No newline at end of file +} \ No newline at end of file From 43b0ed202ea457d28c5a0f88b1b8bbffba133f02 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 14 Nov 2018 15:12:09 +0100 Subject: [PATCH 3/3] #812 fix e2e --- e2e/paths/ticket-module/07_edit_sale.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 5df15fbbe..ad20b977d 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -615,6 +615,17 @@ describe('Ticket Edit sale path', () => { expect(result).toEqual(1); }); + + it(`should click on the search result to access to the ticket Sale`, async () => { + const url = await nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketSales.saleButton) + .waitForURL('/sale') + .url(); + + expect(url).toContain('/sale'); + }); }); describe('when state is preparation and loged as salesPerson', () => {