diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html
index b4f45e7b48..6d4bb202d0 100644
--- a/modules/route/front/index/index.html
+++ b/modules/route/front/index/index.html
@@ -70,11 +70,11 @@
route="$ctrl.routeSelected">
-
-
-
-
+
+
+
diff --git a/modules/route/front/ticket-popup/index.html b/modules/route/front/ticket-popup/index.html
index 2f2971efc5..33684a4330 100644
--- a/modules/route/front/ticket-popup/index.html
+++ b/modules/route/front/ticket-popup/index.html
@@ -1,84 +1,79 @@
-
-
-
-
-
- Tickets to add
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Ticket
- Client
- Province
-
-
- Population
-
-
- PC
- Address
- Warehouse
-
-
-
-
-
-
-
-
-
-
- {{::ticket.id}}
-
-
-
-
- {{::ticket.nickname}}
-
-
- {{::ticket.address.province.name}}
- {{::ticket.address.city}}
- {{::ticket.address.postalCode}}
- {{::ticket.address.street}}
-
- {{::ticket.zone.name}}
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+ Tickets to add
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ticket
+ Client
+ Province
+
+
+ Population
+
+
+ PC
+ Address
+ Warehouse
+
+
+
+
+
+
+
+
+
+
+ {{::ticket.id}}
+
+
+
+
+ {{::ticket.nickname}}
+
+
+ {{::ticket.address.province.name}}
+ {{::ticket.address.city}}
+ {{::ticket.address.postalCode}}
+ {{::ticket.address.street}}
+
+ {{::ticket.zone.name}}
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/route/front/ticket-popup/index.js b/modules/route/front/ticket-popup/index.js
index f2a9d1b556..8fd7b5d715 100644
--- a/modules/route/front/ticket-popup/index.js
+++ b/modules/route/front/ticket-popup/index.js
@@ -1,10 +1,10 @@
import ngModule from '../module';
-import Component from 'core/lib/component';
+import Dialog from 'core/components/dialog';
import './style.scss';
-export default class Controller extends Component {
- constructor($element, $scope) {
- super($element, $scope);
+class Controller extends Dialog {
+ constructor($element, $, $transclude) {
+ super($element, $, $transclude);
}
getSelectedTickets(tickets) {
@@ -29,7 +29,7 @@ export default class Controller extends Component {
}
setTicketsRoute() {
- let tickets = this.getSelectedTickets(this.possibleTickets);
+ const tickets = this.getSelectedTickets(this.possibleTickets);
if (tickets.length === 0) return;
const updates = [];
@@ -49,6 +49,7 @@ export default class Controller extends Component {
.then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.updateVolume();
+ this.hide();
});
}
@@ -62,12 +63,14 @@ export default class Controller extends Component {
this.$http.post(query, params).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.refresh();
+ this.hide();
});
}
}
+Controller.$inject = ['$element', '$scope', '$transclude'];
ngModule.vnComponent('vnRouteTicketPopup', {
- template: require('./index.html'),
+ slotTemplate: require('./index.html'),
controller: Controller,
bindings: {
route: '<',
diff --git a/modules/route/front/ticket-popup/index.spec.js b/modules/route/front/ticket-popup/index.spec.js
index 0ab9393e39..b4313024b5 100644
--- a/modules/route/front/ticket-popup/index.spec.js
+++ b/modules/route/front/ticket-popup/index.spec.js
@@ -12,7 +12,12 @@ describe('Route', () => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element('');
- controller = $componentController('vnRouteTicketPopup', {$element, $scope});
+ const $transclude = {
+ $$boundTransclude: {
+ $$slots: []
+ }
+ };
+ controller = $componentController('vnRouteTicketPopup', {$element, $scope, $transclude});
controller.route = {id: 1};
controller.$.model = {
refresh: () => {},
@@ -25,6 +30,7 @@ describe('Route', () => {
it('should call the route unlink endpoint with the agency and zone ids', () => {
controller.$.model = {refresh: jest.fn()};
jest.spyOn(controller.vnApp, 'showSuccess');
+ jest.spyOn(controller, 'hide');
controller.route = {
agencyModeFk: 1
@@ -43,6 +49,7 @@ describe('Route', () => {
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
+ expect(controller.hide).toHaveBeenCalled();
expect(controller.$.model.refresh).toHaveBeenCalledWith();
});
});
@@ -50,11 +57,8 @@ describe('Route', () => {
describe('setTicketsRoute()', () => {
it('should perform a POST query to add tickets to the route', () => {
controller.$.model = {refresh: jest.fn()};
-
- controller.route = {id: 1101};
- controller.$.model.data = [{id: 1, checked: false}];
-
- const existingTicket = controller.$.model.data[0];
+ jest.spyOn(controller.vnApp, 'showSuccess');
+ jest.spyOn(controller, 'hide');
controller.route = {id: 111};
@@ -65,19 +69,14 @@ describe('Route', () => {
{id: 5, checked: true},
];
- let expectedResult = [
- existingTicket,
- {id: 3},
- {id: 5}
- ];
-
- $httpBackend.expectPOST(`Routes/${controller.route.id}/updateVolume`).respond(200);
- $httpBackend.whenPOST('Tickets/crud').respond();
+ $httpBackend.whenPOST(`Routes/${controller.route.id}/updateVolume`).respond(200);
+ $httpBackend.expectPOST('Tickets/crud').respond();
controller.setTicketsRoute();
$httpBackend.flush();
- expect(controller.$.model.data).toEqual(expectedResult);
- // expect(controller.$.possibleTicketsDialog.hide).toHaveBeenCalledWith();
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
+ expect(controller.hide).toHaveBeenCalled();
+ expect(controller.$.model.refresh).toHaveBeenCalledWith();
});
});
});
diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html
index 83960d47d5..e029692190 100644
--- a/modules/route/front/tickets/index.html
+++ b/modules/route/front/tickets/index.html
@@ -116,12 +116,11 @@
on-accept="$ctrl.removeTicketFromRoute($index)">
-
-
-
-
+
+