diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 0e117fb45..b53863966 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -301,7 +301,8 @@ export default {
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]',
firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)',
- firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)'
+ firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)',
+ invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span'
},
ticketsIndex: {
newTicketButton: 'vn-ticket-index > a',
@@ -326,10 +327,11 @@ export default {
},
ticketDescriptor: {
moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`,
- moreMenuAddStowaway: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`,
- moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(5)',
- moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`,
- moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(3)`,
+ moreMenuAddStowaway: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(1)`,
+ moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)',
+ moreMenuAddToTurn: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(2)`,
+ moreMenuDeleteTicket: `vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(3)`,
+ moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li:nth-child(5)',
addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)',
shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]',
shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]',
@@ -338,6 +340,7 @@ export default {
saturdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)`,
closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]',
acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]',
+ acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="invoiceMakeConfirmation"] button[response="ACCEPT"]',
acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]'
},
ticketNotes: {
diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js
index b8e610891..1044fbd7e 100644
--- a/e2e/paths/05-ticket-module/12_descriptor.spec.js
+++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js
@@ -148,4 +148,43 @@ describe('Ticket descriptor path', () => {
expect(exists).toBeFalsy();
});
});
+
+ describe('Make invoice', () => {
+ it('should login as Invoicing role then search for a ticket', async() => {
+ const invoiceableTicketId = 11;
+
+ const url = await nightmare
+ .loginAndModule('developer', 'ticket')
+ .accessToSearchResult(invoiceableTicketId)
+ .waitForURL('/summary')
+ .parsedUrl();
+
+ expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`);
+ });
+
+ it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => {
+ const result = await nightmare
+ .waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
+
+ expect(result).toEqual('-');
+ });
+
+ it('should invoice the ticket using the descriptor more menu', async() => {
+ const result = await nightmare
+ .waitToClick(selectors.ticketDescriptor.moreMenu)
+ .waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice)
+ .waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton)
+ .waitForLastSnackbar();
+
+ expect(result).toEqual('Ticket invoiced');
+ });
+
+ it(`should make sure the ticket summary have an invoiceOutFk`, async() => {
+ const result = await nightmare
+ .waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445')
+ .waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
+
+ expect(result).toEqual('T4444445');
+ });
+ });
});
diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index b323c1c36..26252d825 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -41,5 +41,6 @@
"City cannot be empty": "City cannot be empty",
"EXTENSION_INVALID_FORMAT": "Invalid extension",
"The secret can't be blank": "The secret can't be blank",
- "Invalid TIN": "Invalid Tax number"
+ "Invalid TIN": "Invalid Tax number",
+ "This ticket can't be invoiced": "This ticket can't be invoiced"
}
\ No newline at end of file
diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html
index 779ce7e53..326a72695 100644
--- a/modules/ticket/front/descriptor/index.html
+++ b/modules/ticket/front/descriptor/index.html
@@ -160,7 +160,6 @@
on-response="$ctrl.returnDialog(response)"
question="Pickup order"
message="Do you want to send it directly?">
- asd
diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js
index 0e153b8fc..5d1c6253d 100644
--- a/modules/ticket/front/descriptor/index.js
+++ b/modules/ticket/front/descriptor/index.js
@@ -21,7 +21,6 @@ class Controller {
];
}
- // Change shipped hour
showChangeShipped() {
if (!this.isEditable) {
this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified'));
@@ -84,7 +83,6 @@ class Controller {
return true;
}
- // Add Turn
showAddTurnDialog() {
this.$scope.addTurn.show();
}
@@ -97,7 +95,6 @@ class Controller {
});
}
- // Delete Ticket
showDeleteTicketDialog() {
if (!this.isEditable) {
this.vnApp.showError(this.$translate.instant('This ticket cant be deleted'));
@@ -202,7 +199,7 @@ class Controller {
*
* @param {String} response - Response result
*/
- invoiceMakeOut(response) {
+ makeInvoiceOut(response) {
if (response === 'ACCEPT') {
const query = `/ticket/api/Tickets/${this.ticket.id}/makeInvoice`;
this.$http.post(query).then(() => {