From c41fb1d0f4f4ae28dca969f4a7009d487ff83e2a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 30 Oct 2019 16:57:14 +0100 Subject: [PATCH] #1847 vnDialog refactor --- e2e/helpers/extensions.js | 4 +- e2e/helpers/selectors.js | 40 +++---- .../02-client-module/05_add_address.spec.js | 2 +- front/core/components/chip/style.scss | 33 +++--- front/core/components/confirm/confirm.html | 4 +- front/core/components/dialog/index.html | 5 + front/core/components/dialog/index.js | 101 ++++++++++++++---- front/core/components/dialog/index.spec.js | 30 +++--- front/core/components/dialog/style.scss | 20 +++- front/core/components/watcher/watcher.html | 2 +- front/core/components/watcher/watcher.js | 2 +- front/core/components/watcher/watcher.spec.js | 8 +- front/core/directives/focus.js | 9 +- loopback/locale/es.json | 3 +- modules/agency/front/descriptor/index.html | 2 +- modules/agency/front/descriptor/index.js | 2 +- modules/agency/front/events/index.html | 9 +- modules/agency/front/events/index.js | 34 +++--- modules/agency/front/index/index.html | 2 +- modules/agency/front/index/index.js | 4 +- modules/agency/front/warehouses/index.html | 8 +- modules/agency/front/warehouses/index.js | 4 +- modules/claim/front/action/index.html | 2 +- modules/claim/front/action/index.js | 2 +- modules/claim/front/action/index.spec.js | 4 +- modules/claim/front/descriptor/index.html | 4 +- modules/claim/front/descriptor/index.js | 4 +- modules/claim/front/descriptor/index.spec.js | 8 +- modules/claim/front/dms/index/index.html | 2 +- modules/claim/front/dms/index/index.js | 2 +- modules/claim/front/dms/index/index.spec.js | 2 +- .../client/front/address/create/index.html | 2 +- modules/client/front/address/edit/index.html | 2 +- modules/client/front/billing-data/index.html | 6 +- modules/client/front/billing-data/index.js | 2 +- .../client/front/billing-data/index.spec.js | 6 +- modules/client/front/create/index.html | 2 +- .../front/credit-insurance/index/index.html | 2 +- .../front/credit-insurance/index/index.js | 2 +- .../credit-insurance/index/index.spec.js | 2 +- modules/client/front/credit/create/index.html | 2 +- modules/client/front/credit/create/index.js | 2 +- .../client/front/credit/create/index.spec.js | 4 +- modules/client/front/dms/index/index.html | 2 +- modules/client/front/dms/index/index.js | 2 +- modules/client/front/dms/index/index.spec.js | 2 +- modules/client/front/fiscal-data/index.html | 2 +- modules/client/front/fiscal-data/index.js | 4 +- .../client/front/fiscal-data/index.spec.js | 2 +- modules/client/front/postcode/index.html | 6 +- modules/client/front/postcode/index.js | 2 +- modules/client/front/postcode/index.spec.js | 2 +- modules/client/front/sms/index.html | 6 +- modules/client/front/sms/index.js | 2 +- modules/client/front/sms/index.spec.js | 2 +- modules/client/front/web-access/index.html | 6 +- modules/client/front/web-access/index.js | 2 +- modules/client/front/web-access/index.spec.js | 6 +- .../invoiceOut/front/descriptor/index.html | 4 +- modules/invoiceOut/front/descriptor/index.js | 4 +- modules/item/front/descriptor/index.html | 6 +- modules/item/front/descriptor/index.js | 2 +- modules/item/front/index/index.html | 2 +- modules/item/front/index/index.js | 2 +- modules/item/front/index/index.spec.js | 8 +- modules/item/front/request/index.html | 6 +- modules/item/front/request/index.js | 2 +- modules/item/front/request/index.spec.js | 2 +- modules/order/front/descriptor/index.html | 2 +- modules/order/front/descriptor/index.js | 2 +- modules/order/front/descriptor/index.spec.js | 6 +- modules/order/front/line/index.html | 2 +- modules/order/front/line/index.js | 2 +- modules/order/front/line/index.spec.js | 4 +- modules/route/front/descriptor/index.html | 2 +- modules/route/front/descriptor/index.js | 2 +- modules/route/front/tickets/index.html | 8 +- modules/route/front/tickets/index.js | 4 +- modules/route/front/tickets/index.spec.js | 6 +- modules/ticket/front/descriptor/index.html | 16 +-- modules/ticket/front/descriptor/index.js | 10 +- modules/ticket/front/descriptor/index.spec.js | 16 +-- .../front/descriptor/removeStowaway.html | 2 +- .../ticket/front/descriptor/removeStowaway.js | 2 +- modules/ticket/front/dms/index/index.html | 2 +- modules/ticket/front/dms/index/index.js | 2 +- modules/ticket/front/dms/index/index.spec.js | 2 +- modules/ticket/front/expedition/index.html | 2 +- modules/ticket/front/expedition/index.js | 2 +- modules/ticket/front/expedition/index.spec.js | 2 +- modules/ticket/front/sale/index.html | 4 +- modules/ticket/front/sale/index.js | 2 +- modules/ticket/front/sale/specs/index.spec.js | 2 +- modules/ticket/front/services/index.html | 6 +- modules/ticket/front/services/index.js | 2 +- modules/ticket/front/services/index.spec.js | 4 +- modules/ticket/front/weekly/create/index.html | 2 +- modules/ticket/front/weekly/index/index.html | 2 +- modules/ticket/front/weekly/index/index.js | 2 +- modules/worker/front/calendar/index.html | 8 +- modules/worker/front/department/index.html | 8 +- modules/worker/front/department/index.js | 4 +- modules/worker/front/time-control/index.html | 6 +- modules/worker/front/time-control/index.js | 2 +- 104 files changed, 355 insertions(+), 275 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index bd9790ee2..46c43a254 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -52,7 +52,7 @@ let actions = { let logoutClicked = await this.clickIfExists('#logout'); if (logoutClicked) { - let buttonSelector = '.vn-dialog.shown button[response=ACCEPT]'; + let buttonSelector = '.vn-dialog.shown button[response=accept]'; await this.wait(buttonSelector => { return document.querySelector(buttonSelector) != null || location.hash == '#!/login'; @@ -392,7 +392,7 @@ let actions = { forceReloadSection: function(sectionRoute) { return this.waitToClick('vn-icon[icon="desktop_windows"]') - .waitToClick('button[response="ACCEPT"]') + .waitToClick('button[response="accept"]') .wait('vn-card.summary') .waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`); }, diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 13b87f349..dc6083b39 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -18,7 +18,7 @@ export default { userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]', userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]', userConfigThirdAutocompleteClear: '#localCompany .icons > vn-icon[icon=clear]', - acceptButton: '.vn-confirm.shown button[response=ACCEPT]' + acceptButton: '.vn-confirm.shown button[response=accept]' }, clientsIndex: { searchClientInput: `vn-textfield input`, @@ -62,7 +62,7 @@ export default { socialNameInput: `vn-textfield input[name="socialName"]`, fiscalIdInput: `vn-textfield input[name="fi"]`, equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]', - acceptPropagationButton: '.vn-confirm.shown button[response=ACCEPT]', + acceptPropagationButton: '.vn-confirm.shown button[response=accept]', addressInput: `vn-textfield input[name="street"]`, postcodeInput: `vn-textfield input[name="postcode"]`, cityInput: `vn-textfield input[name="city"]`, @@ -90,7 +90,7 @@ export default { newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input', newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input', newBankEntityCode: '.vn-dialog.shown vn-textfield[label="Entity Code"] input', - acceptBankEntityButton: '.vn-dialog.shown button[response="ACCEPT"]', + acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]', saveButton: `button[type=submit]` }, clientAddresses: { @@ -177,7 +177,7 @@ export default { deleteFileButton: 'vn-client-dms-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', firstDocWorker: 'vn-client-dms-index vn-td:nth-child(8) > span', firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor', - acceptDeleteButton: '.vn-confirm.shown button[response="ACCEPT"]' + acceptDeleteButton: '.vn-confirm.shown button[response="accept"]' }, itemsIndex: { searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]', @@ -185,7 +185,7 @@ export default { searchResult: 'vn-item-index a.vn-tr', searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]', searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]', - acceptClonationAlertButton: '.vn-confirm.shown [response="ACCEPT"]', + acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]', searchItemInput: 'vn-searchbar vn-textfield input', searchButton: 'vn-searchbar vn-icon[icon="search"]', closeItemSummaryPreview: '.vn-popup.shown', @@ -340,7 +340,7 @@ export default { sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[ng-model="weekly.weekDay"] input', weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr', firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', - acceptDeleteTurn: '.vn-confirm.shown button[response="ACCEPT"]' + acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]' }, createTicketView: { clientAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.clientFk"]', @@ -368,11 +368,11 @@ export default { thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)', saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)', closeStowawayDialog: '.vn-dialog.shown button[class="close"]', - acceptDeleteButton: '.vn-dialog.shown button[response="ACCEPT"]', - acceptChangeHourButton: '.vn-dialog.shown button[response="ACCEPT"]', + acceptDeleteButton: '.vn-dialog.shown button[response="accept"]', + acceptChangeHourButton: '.vn-dialog.shown button[response="accept"]', descriptorDeliveryDate: 'vn-ticket-descriptor > div > div.body > div.attributes > vn-label-value:nth-child(6) > section > span', - acceptInvoiceOutButton: '.vn-confirm.shown button[response="ACCEPT"]', - acceptDeleteStowawayButton: '.vn-dialog.shown button[response="ACCEPT"]' + acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]', + acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]' }, ticketNotes: { firstNoteRemoveButton: 'vn-icon[icon="delete"]', @@ -384,7 +384,7 @@ export default { ticketExpedition: { expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]', secondExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]', - acceptDeleteRowButton: '.vn-confirm.shown button[response=ACCEPT]', + acceptDeleteRowButton: '.vn-confirm.shown button[response=accept]', expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr' }, ticketPackages: { @@ -453,8 +453,8 @@ export default { moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]', moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]', moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]', - acceptDeleteLineButton: '.vn-confirm.shown button[response=ACCEPT]', - acceptDeleteTicketButton: '.vn-confirm.shown button[response=ACCEPT]', + acceptDeleteLineButton: '.vn-confirm.shown button[response=accept]', + acceptDeleteTicketButton: '.vn-confirm.shown button[response=accept]', stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]' }, ticketTracking: { @@ -523,7 +523,7 @@ export default { claimDescriptor: { moreMenu: 'vn-claim-descriptor vn-icon-menu[icon=more_vert]', moreMenuDeleteClaim: '.vn-drop-down.shown li[name="Delete claim"]', - acceptDeleteClaim: '.vn-confirm.shown button[response="ACCEPT"]' + acceptDeleteClaim: '.vn-confirm.shown button[response="accept"]' }, claimSummary: { header: 'vn-claim-summary > vn-card > h5', @@ -589,7 +589,7 @@ export default { }, orderDescriptor: { returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]', - acceptNavigationButton: '.vn-confirm.shown button[response=ACCEPT]' + acceptNavigationButton: '.vn-confirm.shown button[response=accept]' }, createOrderView: { clientAutocomplete: 'vn-autocomplete[label="Client"]', @@ -618,13 +618,13 @@ export default { agencyAutocomplete: 'vn-autocomplete[label="Agency"]', observationInput: 'vn-textarea[label="Observation"] textarea', saveButton: `button[type=submit]`, - acceptButton: '.vn-confirm.shown button[response="ACCEPT"]' + acceptButton: '.vn-confirm.shown button[response="accept"]' }, orderLine: { orderSubtotal: 'vn-order-line .header :first-child', firstLineDeleteButton: 'vn-order-line vn-tbody > vn-tr:nth-child(1) vn-icon[icon="delete"]', confirmOrder: 'vn-order-line vn-float-button', - confirmButton: '.vn-confirm.shown button[response="ACCEPT"]', + confirmButton: '.vn-confirm.shown button[response="accept"]', }, routeIndex: { addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]' @@ -663,7 +663,7 @@ export default { firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check', buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]', firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', - confirmButton: '.vn-confirm.shown button[response="ACCEPT"]' + confirmButton: '.vn-confirm.shown button[response="accept"]' }, workerPbx: { extensionInput: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"] input', @@ -729,8 +729,8 @@ export default { moreMenuDeleteInvoiceOut: '.vn-drop-down.shown li[name="Delete Invoice"]', moreMenuBookInvoiceOut: '.vn-drop-down.shown li[name="Book invoice"]', moreMenuShowInvoiceOutPdf: '.vn-drop-down.shown li[name="Show invoice PDF"]', - acceptDeleteButton: '.vn-confirm.shown button[response="ACCEPT"]', - acceptBookingButton: '.vn-confirm.shown button[response="ACCEPT"]' + acceptDeleteButton: '.vn-confirm.shown button[response="accept"]', + acceptBookingButton: '.vn-confirm.shown button[response="accept"]' }, invoiceOutSummary: { bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span' diff --git a/e2e/paths/02-client-module/05_add_address.spec.js b/e2e/paths/02-client-module/05_add_address.spec.js index 9134642a8..fd11e3915 100644 --- a/e2e/paths/02-client-module/05_add_address.spec.js +++ b/e2e/paths/02-client-module/05_add_address.spec.js @@ -110,7 +110,7 @@ describe('Client Add address path', () => { it(`should go back to the addreses section by clicking the cancel button`, async() => { const url = await nightmare .waitToClick(selectors.clientAddresses.cancelEditAddressButton) - .waitToClick('.vn-confirm.shown button[response="ACCEPT"]') + .waitToClick('.vn-confirm.shown button[response="accept"]') .waitForURL('address/index') .parsedUrl(); diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss index ee7f46848..f0266c3d5 100644 --- a/front/core/components/chip/style.scss +++ b/front/core/components/chip/style.scss @@ -1,19 +1,16 @@ @import "variables"; vn-chip { - border-radius: 16px; + border-radius: 1em; background-color: $color-bg; - margin: 0 0.5em 0.5em 0; color: $color-font; - font-size: 14px; - margin: .25em; + font-size: .9rem; + margin: .25em 0; display: inline-flex; align-items: center; - text-overflow: ellipsis; - white-space: nowrap; - height: 28px; - padding: 0 .7em; - overflow: hidden; + height: 2em; + max-width: 100%; + box-sizing: border-box; &.colored { background-color: $color-main; @@ -22,17 +19,24 @@ vn-chip { & > div { display: flex; align-items: center; - max-width: 100%; height: 100%; + padding: 0 .7em; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + line-height: 2em; & > vn-avatar { margin-left: -0.7em; - margin-right: .4em; + margin-right: .3em; + vertical-align: middle; + height: 1.9em; + width: 2em; } } & > vn-icon { - margin-left: .2em; - margin-right: -0.3em; + margin-right: .12em; + margin-left: -.12em; vertical-align: middle; opacity: .6; cursor: pointer; @@ -47,7 +51,6 @@ vn-chip { vn-avatar { display: inline-block; - height: 28px; - width: 28px; + min-width: 2em; border-radius: 50%; } \ No newline at end of file diff --git a/front/core/components/confirm/confirm.html b/front/core/components/confirm/confirm.html index 2b659ba61..5ef8fde75 100644 --- a/front/core/components/confirm/confirm.html +++ b/front/core/components/confirm/confirm.html @@ -4,7 +4,7 @@ {{::$ctrl.question}} - - + + \ No newline at end of file diff --git a/front/core/components/dialog/index.html b/front/core/components/dialog/index.html index 066449aaf..c213042e1 100644 --- a/front/core/components/dialog/index.html +++ b/front/core/components/dialog/index.html @@ -1,3 +1,8 @@ +
+ +
{ + this.resolve = resolve; + }); + } + + /** + * Hides the dialog. + * + * @param {String} response The response + */ + hide(response) { + this.showHandler = null; super.hide(); + if (this.resolve) + this.resolve(response); } /** * Calls the response handler. * * @param {String} response The response code - * @return {Boolean} %true if response was canceled, %false otherwise + * @return {Boolean} The response handler return */ - fireResponse(response) { - let cancel; + respond(response) { + let handlerArgs = { + $response: response, + $data: this.data + }; + let cancellers = []; + if (this.onResponse) - cancel = this.onResponse({response: response}); - return cancel; + cancellers.push(this.onResponse(handlerArgs)); + if (response == 'accept' && this.onAccept) + cancellers.push(this.onAccept(handlerArgs)); + if (this.showHandler) + cancellers.push(this.showHandler(response, this.data)); + + let promises = []; + let resolvedCancellers = []; + + for (let canceller of cancellers) { + if (canceller instanceof Object && canceller.then) + promises.push(canceller); + else + resolvedCancellers.push(canceller); + } + + let close = () => { + if (resolvedCancellers.indexOf(false) == -1) + this.hide(response); + else + return false; + }; + + if (promises.length) { + this.loading = true; + + return this.$q.all(promises) + .then(res => { + resolvedCancellers = resolvedCancellers.concat(res); + return close(); + }) + .finally(() => { + this.loading = false; + }); + } else + return this.$q.resolve(close()); } onButtonClick(event) { @@ -45,17 +111,7 @@ export default class Dialog extends Popup { node = node.parentNode; } - let response = node.getAttribute('response'); - let cancel = this.fireResponse(response); - - let close = res => { - if (res !== false) super.hide(); - }; - - if (cancel instanceof Object && cancel.then) - cancel.then(close); - else - close(cancel); + this.respond(node.getAttribute('response')); } } @@ -66,6 +122,7 @@ ngModule.vnComponent('vnDialog', { buttons: '?tplButtons' }, bindings: { - onResponse: '&?' + onResponse: '&?', + onAccept: '&?' } }); diff --git a/front/core/components/dialog/index.spec.js b/front/core/components/dialog/index.spec.js index ce7582399..472e818e4 100644 --- a/front/core/components/dialog/index.spec.js +++ b/front/core/components/dialog/index.spec.js @@ -10,27 +10,21 @@ describe('Component vnDialog', () => { controller.emit = jasmine.createSpy('emit'); })); - describe('hide()', () => { - describe('fireResponse()', () => { - it(`should call onResponse() if it's defined in the controller`, () => { - controller.onResponse = () => {}; - spyOn(controller, 'onResponse'); - controller.hide(); + describe('respond()', () => { + it(`should call onResponse() if it's defined in the controller`, () => { + controller.onResponse = () => {}; + spyOn(controller, 'onResponse'); + controller.respond(); - expect(controller.onResponse).toHaveBeenCalledWith(jasmine.any(Object)); - }); + expect(controller.onResponse).toHaveBeenCalledWith(jasmine.any(Object)); + }); - it(`should call onResponse() with a response`, () => { - let responseRes; - controller.onResponse = response => { - responseRes = response; - return false; - }; - let responseRet = controller.fireResponse('answer'); + it(`should call onResponse() with a response`, () => { + controller.onResponse = () => {}; + spyOn(controller, 'onResponse'); + controller.respond('answer'); - expect(responseRes).toEqual({response: 'answer'}); - expect(responseRet).toEqual(false); - }); + expect(controller.onResponse).toHaveBeenCalledWith({$response: 'answer'}); }); }); }); diff --git a/front/core/components/dialog/style.scss b/front/core/components/dialog/style.scss index 18def2243..9461a0063 100644 --- a/front/core/components/dialog/style.scss +++ b/front/core/components/dialog/style.scss @@ -1,7 +1,7 @@ @import "effects"; .vn-dialog > .window { - padding: $spacing-lg; + position: relative; & > .close { @extend %clickable; @@ -16,6 +16,8 @@ color: #666; } & > form { + padding: $spacing-lg; + & > .body > tpl-body { display: block; min-width: 16em; @@ -42,4 +44,20 @@ } } } + & > .loading-overlap { + position: absolute; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, .2); + display: flex; + align-items: center; + justify-content: center; + z-index: 1; + opacity: 0; + transition: opacity 200ms ease-in-out; + + &.shown { + opacity: 1; + } + } } diff --git a/front/core/components/watcher/watcher.html b/front/core/components/watcher/watcher.html index 76315ece8..c3c54a65d 100644 --- a/front/core/components/watcher/watcher.html +++ b/front/core/components/watcher/watcher.html @@ -2,5 +2,5 @@ vn-id="confirm" question="Are you sure exit without saving?" message="Unsaved changes will be lost" - on-response="$ctrl.onConfirmResponse(response)"> + on-response="$ctrl.onConfirmResponse($response)"> \ No newline at end of file diff --git a/front/core/components/watcher/watcher.js b/front/core/components/watcher/watcher.js index 0709e209e..ddef745fd 100644 --- a/front/core/components/watcher/watcher.js +++ b/front/core/components/watcher/watcher.js @@ -203,7 +203,7 @@ export default class Watcher extends Component { } onConfirmResponse(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { if (this.data) Object.assign(this.data, this.orgData); this.$state.go(this.state); diff --git a/front/core/components/watcher/watcher.spec.js b/front/core/components/watcher/watcher.spec.js index 0be4cc975..2f7be4704 100644 --- a/front/core/components/watcher/watcher.spec.js +++ b/front/core/components/watcher/watcher.spec.js @@ -223,9 +223,9 @@ describe('Component vnWatcher', () => { }); describe(`onConfirmResponse()`, () => { - describe(`when response is ACCEPT`, () => { + describe(`when response is accept`, () => { it(`should call Object.assing on controlle.data with controller.orgData then call go() on state`, () => { - let response = 'ACCEPT'; + let response = 'accept'; controller.data = {}; controller.orgData = {name: 'Batman'}; controller.$state = {go: jasmine.createSpy('go')}; @@ -237,9 +237,9 @@ describe('Component vnWatcher', () => { }); }); - describe(`when response is not ACCEPT`, () => { + describe(`when response is not accept`, () => { it(`should set controller.state to null`, () => { - let response = 'anything but ACCEPT'; + let response = 'anything but accept'; controller.state = 'Batman'; controller.onConfirmResponse(response); diff --git a/front/core/directives/focus.js b/front/core/directives/focus.js index 28535430a..869e9a7f0 100644 --- a/front/core/directives/focus.js +++ b/front/core/directives/focus.js @@ -21,9 +21,12 @@ export function focus($scope, input) { } input.focus(); - $scope.$applyAsync(() => { - input.select(); - }); + + if (input.select) { + $scope.$applyAsync(() => { + input.select(); + }); + } } /** diff --git a/loopback/locale/es.json b/loopback/locale/es.json index dffa15af6..381814039 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -112,5 +112,6 @@ "This phone already exists": "Este teléfono ya existe", "You cannot move a parent to any of its sons": "You cannot move a parent to any of its sons", "You cannot move a parent to its own sons": "You cannot move a parent to its own sons", - "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado" + "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", + "AMOUNT_NOT_MATCH_GROUPING": "AMOUNT_NOT_MATCH_GROUPING" } \ No newline at end of file diff --git a/modules/agency/front/descriptor/index.html b/modules/agency/front/descriptor/index.html index ffed14551..58441d10d 100644 --- a/modules/agency/front/descriptor/index.html +++ b/modules/agency/front/descriptor/index.html @@ -47,7 +47,7 @@ \ No newline at end of file diff --git a/modules/agency/front/descriptor/index.js b/modules/agency/front/descriptor/index.js index 9a0513855..736d8dd31 100644 --- a/modules/agency/front/descriptor/index.js +++ b/modules/agency/front/descriptor/index.js @@ -19,7 +19,7 @@ class Controller { } returnDialog(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.delete(`Zones/${this.zone.id}`).then(() => { this.$state.go('zone.index'); }); diff --git a/modules/agency/front/events/index.html b/modules/agency/front/events/index.html index 97ebb28fd..4764ded3c 100644 --- a/modules/agency/front/events/index.html +++ b/modules/agency/front/events/index.html @@ -94,7 +94,7 @@ + on-response="$ctrl.onIncludeResponse($response)"> @@ -162,7 +162,7 @@ - @@ -180,6 +180,5 @@ + question="Are you sure you want to continue?"> diff --git a/modules/agency/front/events/index.js b/modules/agency/front/events/index.js index 2f9f8d60e..f7e689afe 100644 --- a/modules/agency/front/events/index.js +++ b/modules/agency/front/events/index.js @@ -101,8 +101,9 @@ class Controller extends Component { this.$.dialog.show(); } - onSave(response) { - if (response == 'ACCEPT') { + onIncludeResponse(response) { + switch (response) { + case 'accept': { let selected = this.selected; if (this.eventType == 'indefinitely') { @@ -131,17 +132,15 @@ class Controller extends Component { else req = this.$http.put(`${this.path}/${selected.id}`, selected); - req.then(() => { + return req.then(() => { this.selected = null; this.isNew = null; - this.$.dialog.hide(); this.refresh(); }); - - return false; - } else if (response == 'DELETE') { - this.onDelete(this.selected.id); - return false; + } + case 'DELETE': + return this.onDelete(this.selected.id) + .then(response => response == 'accept'); } } @@ -152,19 +151,14 @@ class Controller extends Component { } onDelete(id) { - this.deleteId = id; - this.$.confirm.show(); + return this.$.confirm.show( + response => this.onDeleteResponse(response, id)); } - delete(response) { - if (response != 'ACCEPT') return; - if (!this.deleteId) return; - this.$http.delete(`${this.path}/${this.deleteId}`) - .then(() => { - this.refresh(); - this.deleteId = null; - this.$.dialog.hide(); - }); + onDeleteResponse(response, id) { + if (response != 'accept' || !id) return; + return this.$http.delete(`${this.path}/${id}`) + .then(() => this.refresh()); } exclusionCreate(days) { diff --git a/modules/agency/front/index/index.html b/modules/agency/front/index/index.html index 1e6d22727..18229cd34 100644 --- a/modules/agency/front/index/index.html +++ b/modules/agency/front/index/index.html @@ -68,7 +68,7 @@ diff --git a/modules/agency/front/index/index.js b/modules/agency/front/index/index.js index 9dd4138b9..4ee44ada0 100644 --- a/modules/agency/front/index/index.js +++ b/modules/agency/front/index/index.js @@ -39,10 +39,10 @@ export default class Controller { /** * Clone response callback - * @param {String} response - Response string (['ACCEPT', 'CANCEL']) + * @param {String} response - Response string (['accept', 'cancel']) */ onCloneAccept(response) { - if (!(response == 'ACCEPT' && this.selectedZone)) return; + if (!(response == 'accept' && this.selectedZone)) return; const query = `Zones/${this.selectedZone.id}/clone`; this.$http.post(query).then(res => { if (res && res.data) diff --git a/modules/agency/front/warehouses/index.html b/modules/agency/front/warehouses/index.html index 84481083b..1a9fee32e 100644 --- a/modules/agency/front/warehouses/index.html +++ b/modules/agency/front/warehouses/index.html @@ -28,7 +28,7 @@ + on-response="$ctrl.onSave($response)"> - - + + + on-response="$ctrl.delete($response)"> diff --git a/modules/agency/front/warehouses/index.js b/modules/agency/front/warehouses/index.js index 69d2b506c..fa99c505a 100644 --- a/modules/agency/front/warehouses/index.js +++ b/modules/agency/front/warehouses/index.js @@ -21,7 +21,7 @@ class Controller extends Component { } onSave(response) { - if (response != 'ACCEPT') return; + if (response != 'accept') return; this.$http.post(this.path, this.selected) .then(() => { @@ -40,7 +40,7 @@ class Controller extends Component { } delete(response) { - if (response != 'ACCEPT') return; + if (response != 'accept') return; let id = this.$.data[this.deleteIndex].id; if (!id) return; this.$http.delete(`${this.path}/${id}`) diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 5ec60dcf2..7c663eacd 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -201,5 +201,5 @@ vn-id="update-greuge" question="Insert greuges on client card" message="Do you want to insert greuges?" - on-response="$ctrl.onUpdateGreugeResponse(response)"> + on-response="$ctrl.onUpdateGreugeResponse($response)"> \ No newline at end of file diff --git a/modules/claim/front/action/index.js b/modules/claim/front/action/index.js index 6354ea374..7d67d58c9 100644 --- a/modules/claim/front/action/index.js +++ b/modules/claim/front/action/index.js @@ -133,7 +133,7 @@ class Controller { } onUpdateGreugeResponse(response) { - if (response !== 'ACCEPT') + if (response !== 'accept') return; let greugeTypeFreight = 7; let query = `Greuges/`; diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index f808f0b21..56597fd2f 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -154,7 +154,7 @@ describe('claim', () => { spyOn(controller.card, 'reload'); spyOn(controller.vnApp, 'showSuccess'); - controller.onUpdateGreugeResponse('CANCEL'); + controller.onUpdateGreugeResponse('cancel'); expect(controller.$http.post).not.toHaveBeenCalledWith(); expect(controller.card.reload).not.toHaveBeenCalledWith(); @@ -174,7 +174,7 @@ describe('claim', () => { ticketFk: controller.claim.ticketFk }; $httpBackend.expect('POST', `Greuges/`, data).respond(); - controller.onUpdateGreugeResponse('ACCEPT'); + controller.onUpdateGreugeResponse('accept'); $httpBackend.flush(); expect(controller.card.reload).toHaveBeenCalledWith(); diff --git a/modules/claim/front/descriptor/index.html b/modules/claim/front/descriptor/index.html index 313cf1b94..789df37d6 100644 --- a/modules/claim/front/descriptor/index.html +++ b/modules/claim/front/descriptor/index.html @@ -49,13 +49,13 @@ diff --git a/modules/claim/front/descriptor/index.js b/modules/claim/front/descriptor/index.js index ed6a44808..0328d954c 100644 --- a/modules/claim/front/descriptor/index.js +++ b/modules/claim/front/descriptor/index.js @@ -69,7 +69,7 @@ class Controller { } sendPickupOrder(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.post(`email/claim-pickup-order`, {claimFk: this.claim.id}).then( () => this.vnApp.showMessage(this.$translate.instant('Notification sent!')) ); @@ -81,7 +81,7 @@ class Controller { } deleteClaim(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.delete(`Claims/${this.claim.id}`).then(() => { this.vnApp.showSuccess(this.$translate.instant('Claim deleted!')); this.$state.go('claim.index'); diff --git a/modules/claim/front/descriptor/index.spec.js b/modules/claim/front/descriptor/index.spec.js index 47a64299e..8cf8d1ea8 100644 --- a/modules/claim/front/descriptor/index.spec.js +++ b/modules/claim/front/descriptor/index.spec.js @@ -35,12 +35,12 @@ describe('Item Component vnClaimDescriptor', () => { }); describe('sendPickupOrder(response)', () => { - it('should make a query and call vnApp.showMessage() if the response is ACCEPT', () => { + it('should make a query and call vnApp.showMessage() if the response is accept', () => { spyOn(controller.vnApp, 'showMessage'); $httpBackend.when('POST', `email/claim-pickup-order`, {claimFk: 2}).respond(); $httpBackend.expect('POST', `email/claim-pickup-order`, {claimFk: 2}).respond(); - controller.sendPickupOrder('ACCEPT'); + controller.sendPickupOrder('accept'); $httpBackend.flush(); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Notification sent!'); @@ -60,8 +60,8 @@ describe('Item Component vnClaimDescriptor', () => { }); describe('deleteClaime(response)', () => { - it('should perform a query and call showSuccess if the response is ACCEPT', () => { - let response = 'ACCEPT'; + it('should perform a query and call showSuccess if the response is accept', () => { + let response = 'accept'; controller.claim = {id: 2}; spyOn(controller.vnApp, 'showSuccess'); diff --git a/modules/claim/front/dms/index/index.html b/modules/claim/front/dms/index/index.html index b6c5ddf5e..ca12c2a05 100644 --- a/modules/claim/front/dms/index/index.html +++ b/modules/claim/front/dms/index/index.html @@ -37,5 +37,5 @@ vn-id="confirm" message="This file will be deleted" question="Are you sure you want to continue?" - on-response="$ctrl.deleteDms(response)"> + on-response="$ctrl.deleteDms($response)"> \ No newline at end of file diff --git a/modules/claim/front/dms/index/index.js b/modules/claim/front/dms/index/index.js index 8409d2185..022c7c3ab 100644 --- a/modules/claim/front/dms/index/index.js +++ b/modules/claim/front/dms/index/index.js @@ -26,7 +26,7 @@ class Controller { } deleteDms(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const dmsFk = this.photos[this.dmsIndex].dmsFk; const query = `claimDms/${dmsFk}/removeFile`; this.$http.post(query).then(() => { diff --git a/modules/claim/front/dms/index/index.spec.js b/modules/claim/front/dms/index/index.spec.js index a3d27c3f4..cbb24ac75 100644 --- a/modules/claim/front/dms/index/index.spec.js +++ b/modules/claim/front/dms/index/index.spec.js @@ -35,7 +35,7 @@ describe('Claim', () => { $httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({}); $httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`); - controller.deleteDms('ACCEPT'); + controller.deleteDms('accept'); $httpBackend.flush(); expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex); diff --git a/modules/client/front/address/create/index.html b/modules/client/front/address/create/index.html index 3b39f8c5d..3e9c4ab41 100644 --- a/modules/client/front/address/create/index.html +++ b/modules/client/front/address/create/index.html @@ -128,5 +128,5 @@ + on-response="$ctrl.onResponse($response)"> diff --git a/modules/client/front/address/edit/index.html b/modules/client/front/address/edit/index.html index 3e9972319..15e3237dd 100644 --- a/modules/client/front/address/edit/index.html +++ b/modules/client/front/address/edit/index.html @@ -174,6 +174,6 @@ + on-response="$ctrl.onResponse($response)"> diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html index a7140197a..6fb4b4a96 100644 --- a/modules/client/front/billing-data/index.html +++ b/modules/client/front/billing-data/index.html @@ -99,7 +99,7 @@ + on-response="$ctrl.onBankEntityResponse($response)">
New bank entity
@@ -141,7 +141,7 @@
- - + +
\ No newline at end of file diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js index e728c4e2d..9eaabe0dc 100644 --- a/modules/client/front/billing-data/index.js +++ b/modules/client/front/billing-data/index.js @@ -55,7 +55,7 @@ export default class Controller { } onBankEntityResponse(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { try { if (!this.newBankEntity.name) throw new Error(`Name can't be empty`); diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js index 5fca4ba45..0416a6b8f 100644 --- a/modules/client/front/billing-data/index.spec.js +++ b/modules/client/front/billing-data/index.spec.js @@ -53,7 +53,7 @@ describe('Client', () => { countryFk: 1, id: 999 }; - controller.onBankEntityResponse('ACCEPT'); + controller.onBankEntityResponse('accept'); expect(vnApp.showError).toHaveBeenCalledWith(`Name can't be empty`); }); @@ -65,7 +65,7 @@ describe('Client', () => { countryFk: 1, id: 999 }; - controller.onBankEntityResponse('ACCEPT'); + controller.onBankEntityResponse('accept'); expect(vnApp.showError).toHaveBeenCalledWith(`Swift / BIC can't be empty`); }); @@ -80,7 +80,7 @@ describe('Client', () => { controller.newBankEntity = newBankEntity; $httpBackend.when('POST', 'BankEntities').respond('done'); $httpBackend.expectPOST('BankEntities', newBankEntity); - controller.onBankEntityResponse('ACCEPT'); + controller.onBankEntityResponse('accept'); $httpBackend.flush(); }); }); diff --git a/modules/client/front/create/index.html b/modules/client/front/create/index.html index d85db0305..6a290d41a 100644 --- a/modules/client/front/create/index.html +++ b/modules/client/front/create/index.html @@ -149,6 +149,6 @@ + on-response="$ctrl.onResponse($response)"> \ No newline at end of file diff --git a/modules/client/front/credit-insurance/index/index.html b/modules/client/front/credit-insurance/index/index.html index 192af4671..d2bf1fef6 100644 --- a/modules/client/front/credit-insurance/index/index.html +++ b/modules/client/front/credit-insurance/index/index.html @@ -60,7 +60,7 @@ \ No newline at end of file diff --git a/modules/client/front/credit-insurance/index/index.js b/modules/client/front/credit-insurance/index/index.js index 0b4907876..accdc8c5d 100644 --- a/modules/client/front/credit-insurance/index/index.js +++ b/modules/client/front/credit-insurance/index/index.js @@ -56,7 +56,7 @@ class Controller { } returnDialog(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { let params = {finished: Date.now()}; this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => { this._getClassifications(this.client.id); diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js index f6f23b99a..733936bf2 100644 --- a/modules/client/front/credit-insurance/index/index.spec.js +++ b/modules/client/front/credit-insurance/index/index.spec.js @@ -76,7 +76,7 @@ describe('Client', () => { controller.classificationId = 1; $httpBackend.when('PATCH', `CreditClassifications/1`).respond(200); $httpBackend.expect('PATCH', `CreditClassifications/1`); - controller.returnDialog('ACCEPT'); + controller.returnDialog('accept'); $httpBackend.flush(); expect(controller._getClassifications).toHaveBeenCalledWith(101); diff --git a/modules/client/front/credit/create/index.html b/modules/client/front/credit/create/index.html index 7ae253456..d639f510a 100644 --- a/modules/client/front/credit/create/index.html +++ b/modules/client/front/credit/create/index.html @@ -25,7 +25,7 @@ diff --git a/modules/client/front/credit/create/index.js b/modules/client/front/credit/create/index.js index c6f5dd6bf..7493073b6 100644 --- a/modules/client/front/credit/create/index.js +++ b/modules/client/front/credit/create/index.js @@ -22,7 +22,7 @@ class Controller { } returnDialog(response) { - if (response === 'ACCEPT') + if (response === 'accept') this.addCredit(); } diff --git a/modules/client/front/credit/create/index.spec.js b/modules/client/front/credit/create/index.spec.js index 1c468eef5..3dd96aaa1 100644 --- a/modules/client/front/credit/create/index.spec.js +++ b/modules/client/front/credit/create/index.spec.js @@ -72,9 +72,9 @@ describe('Client', () => { }); describe('returnDialog()', () => { - it('should call addCredit() when is called with ACCEPT', () => { + it('should call addCredit() when is called with accept', () => { spyOn(controller, 'addCredit'); - controller.returnDialog('ACCEPT'); + controller.returnDialog('accept'); expect(controller.addCredit).toHaveBeenCalledWith(); }); diff --git a/modules/client/front/dms/index/index.html b/modules/client/front/dms/index/index.html index 020daa18a..e45821a4a 100644 --- a/modules/client/front/dms/index/index.html +++ b/modules/client/front/dms/index/index.html @@ -113,5 +113,5 @@ vn-id="confirm" message="This file will be deleted" question="Are you sure you want to continue?" - on-response="$ctrl.deleteDms(response)"> + on-response="$ctrl.deleteDms($response)"> \ No newline at end of file diff --git a/modules/client/front/dms/index/index.js b/modules/client/front/dms/index/index.js index fe999bffe..0f1c8a2dc 100644 --- a/modules/client/front/dms/index/index.js +++ b/modules/client/front/dms/index/index.js @@ -60,7 +60,7 @@ class Controller { } deleteDms(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const dmsFk = this.clientDms[this.dmsIndex].dmsFk; const query = `clientDms/${dmsFk}/removeFile`; this.$http.post(query).then(() => { diff --git a/modules/client/front/dms/index/index.spec.js b/modules/client/front/dms/index/index.spec.js index 1d724a097..16190177b 100644 --- a/modules/client/front/dms/index/index.spec.js +++ b/modules/client/front/dms/index/index.spec.js @@ -29,7 +29,7 @@ describe('Client', () => { $httpBackend.when('POST', `clientDms/${dmsId}/removeFile`).respond({}); $httpBackend.expect('POST', `clientDms/${dmsId}/removeFile`); - controller.deleteDms('ACCEPT'); + controller.deleteDms('accept'); $httpBackend.flush(); expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 41d3c4014..4f2685fb2 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -148,5 +148,5 @@ vn-id="propagate-isEqualizated" question="You changed the equalization tax" message="Do you want to spread the change?" - on-response="$ctrl.returnDialogEt(response)"> + on-response="$ctrl.returnDialogEt($response)"> diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index d9778532e..f32002ebf 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -41,13 +41,13 @@ export default class Controller { if (!equals && !this.oldHasToInvoiceByAddress) this.$.propagateIsEqualizated.show(); else if (!equals) - this.returnDialogEt('ACCEPT'); + this.returnDialogEt('accept'); delete this.oldHasToInvoiceByAddress; } returnDialogEt(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.patch(`Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then( res => { if (res.data) diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js index f679504c8..5b5c5eab8 100644 --- a/modules/client/front/fiscal-data/index.spec.js +++ b/modules/client/front/fiscal-data/index.spec.js @@ -20,7 +20,7 @@ describe('Client', () => { controller.client = {id: 123, isEqualizated: false}; $httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}); - controller.returnDialogEt('ACCEPT'); + controller.returnDialogEt('accept'); $httpBackend.flush(); }); }); diff --git a/modules/client/front/postcode/index.html b/modules/client/front/postcode/index.html index 62c819175..55990281c 100644 --- a/modules/client/front/postcode/index.html +++ b/modules/client/front/postcode/index.html @@ -1,7 +1,7 @@ + on-response="$ctrl.onResponse($response)">
New postcode

Please, ensure you put the correct data!

@@ -44,7 +44,7 @@
- - + +
\ No newline at end of file diff --git a/modules/client/front/postcode/index.js b/modules/client/front/postcode/index.js index 0088d08b7..bbf0b1953 100644 --- a/modules/client/front/postcode/index.js +++ b/modules/client/front/postcode/index.js @@ -36,7 +36,7 @@ class Controller extends Component { } onResponse(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { try { if (!this.data.code) throw new Error(`The postcode can't be empty`); diff --git a/modules/client/front/postcode/index.spec.js b/modules/client/front/postcode/index.spec.js index 02fa6b6c6..2ca3f8c7b 100644 --- a/modules/client/front/postcode/index.spec.js +++ b/modules/client/front/postcode/index.spec.js @@ -24,7 +24,7 @@ describe('Client', () => { $httpBackend.when('PATCH', `postcodes`, params).respond(200, params); $httpBackend.expect('PATCH', `postcodes`, params).respond(params); - controller.onResponse('ACCEPT'); + controller.onResponse('accept'); $httpBackend.flush(); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The postcode has been saved'); diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index 85a96f7ac..501558512 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -1,6 +1,6 @@ + on-response="$ctrl.onResponse($response)">
Send SMS
@@ -20,7 +20,7 @@
- - + +
\ No newline at end of file diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 19937fe6d..580a02d27 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -17,7 +17,7 @@ class Controller extends Component { } onResponse(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.post(`Sms/send`, this.sms).then(res => { this.vnApp.showMessage(this.$translate.instant('SMS sent!')); diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index 0ad1460ee..bda1cc013 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -24,7 +24,7 @@ describe('Client', () => { $httpBackend.when('POST', `Sms/send`, params).respond(200, params); $httpBackend.expect('POST', `Sms/send`, params).respond(params); - controller.onResponse('ACCEPT'); + controller.onResponse('accept'); $httpBackend.flush(); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html index 1eecc1cc5..2d2fa7f8f 100644 --- a/modules/client/front/web-access/index.html +++ b/modules/client/front/web-access/index.html @@ -34,7 +34,7 @@ + on-response="$ctrl.onPassChange($response)"> - - + + diff --git a/modules/client/front/web-access/index.js b/modules/client/front/web-access/index.js index 6bac2740a..bdd5375a3 100644 --- a/modules/client/front/web-access/index.js +++ b/modules/client/front/web-access/index.js @@ -41,7 +41,7 @@ export default class Controller { } onPassChange(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { try { if (!this.newPassword) throw new Error(`You must enter a new password`); diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index e3b9e2a1b..f8eb7b2ef 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -73,7 +73,7 @@ describe('Component VnClientWebAccess', () => { controller.canChangePassword = true; $httpBackend.when('PATCH', 'Accounts/1234').respond('done'); $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'}); - controller.onPassChange('ACCEPT'); + controller.onPassChange('accept'); $httpBackend.flush(); }); @@ -82,7 +82,7 @@ describe('Component VnClientWebAccess', () => { controller.client = {id: '1234'}; controller.newPassword = ''; controller.canChangePassword = true; - controller.onPassChange('ACCEPT'); + controller.onPassChange('accept'); expect(vnApp.showError).toHaveBeenCalledWith(`You must enter a new password`); }); @@ -94,7 +94,7 @@ describe('Component VnClientWebAccess', () => { controller.newPassword = 'm24x8'; controller.canChangePassword = true; controller.repeatPassword = 'notMatchingPassword'; - controller.onPassChange('ACCEPT'); + controller.onPassChange('accept'); expect(vnApp.showError).toHaveBeenCalledWith(`Passwords don't match`); }); diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index f84b90d41..981c23e34 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -40,11 +40,11 @@ \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 3ab787283..100f27c1f 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -66,7 +66,7 @@ class Controller { } deleteInvoiceOut(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const query = `InvoiceOuts/${this.invoiceOut.id}/delete`; this.$http.post(query).then(() => { this.vnApp.showSuccess(this.$translate.instant('InvoiceOut deleted')); @@ -76,7 +76,7 @@ class Controller { } bookInvoiceOut(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const query = `InvoiceOuts/${this.invoiceOut.ref}/book`; this.$http.post(query).then(() => { this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked')); diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 584e00243..2ee454c0d 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -72,7 +72,7 @@ + on-response="$ctrl.saveRegularize($response)">
@@ -98,7 +98,7 @@
- - + +
\ No newline at end of file diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 0e95f79e3..c4e66dfe3 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -76,7 +76,7 @@ class Controller { } saveRegularize(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { this.$http.post(`Items/regularize`, { itemFk: this.item.id, quantity: this.quantity, diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 5f91ccf82..bc34f1213 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -136,7 +136,7 @@ diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index d9b7e57d7..93a83c6be 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -74,7 +74,7 @@ class Controller { } onCloneAccept(response) { - if (!(response == 'ACCEPT' && this.itemSelected)) + if (!(response == 'accept' && this.itemSelected)) return; this.$http.post(`Items/${this.itemSelected.id}/clone`).then(res => { diff --git a/modules/item/front/index/index.spec.js b/modules/item/front/index/index.spec.js index aa7cd8d75..0de80323e 100644 --- a/modules/item/front/index/index.spec.js +++ b/modules/item/front/index/index.spec.js @@ -15,7 +15,7 @@ describe('Item', () => { })); describe('onCloneAccept()', () => { - it('should do nothing if response is not ACCEPT', () => { + it('should do nothing if response is not accept', () => { spyOn(controller.$state, 'go'); let response = 'ERROR!'; @@ -27,10 +27,10 @@ describe('Item', () => { expect(controller.itemSelected).toEqual('check me'); }); - it('should do nothing if response is ACCEPT but itemSelected is not defined in the controller', () => { + it('should do nothing if response is accept but itemSelected is not defined in the controller', () => { spyOn(controller.$state, 'go'); - let response = 'ACCEPT'; + let response = 'accept'; controller.itemSelected = undefined; controller.onCloneAccept(response); @@ -42,7 +42,7 @@ describe('Item', () => { it('should perform a post query and then call go() then update itemSelected in the controller', () => { spyOn(controller.$state, 'go'); - let response = 'ACCEPT'; + let response = 'accept'; controller.itemSelected = {id: 1}; $httpBackend.when('POST', `Items/1/clone`).respond({id: 99}); diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html index 69256108b..65582b3ce 100644 --- a/modules/item/front/request/index.html +++ b/modules/item/front/request/index.html @@ -124,7 +124,7 @@ + on-response="$ctrl.denyRequest($response)">
Specify the reasons to deny this request
@@ -134,7 +134,7 @@
- - + +
\ No newline at end of file diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index fe0daf3b4..b56df41a8 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -104,7 +104,7 @@ export default class Controller extends Component { } denyRequest(response) { - if (response !== 'ACCEPT') return; + if (response !== 'accept') return; let params = { observation: this.denyObservation diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js index e636e90b1..4c1e31634 100644 --- a/modules/item/front/request/index.spec.js +++ b/modules/item/front/request/index.spec.js @@ -122,7 +122,7 @@ describe('Item', () => { $httpBackend.when('POST', `TicketRequests/${request.id}/deny`).respond(expectedResult); $httpBackend.expect('POST', `TicketRequests/${request.id}/deny`).respond(expectedResult); - controller.denyRequest('ACCEPT'); + controller.denyRequest('accept'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); diff --git a/modules/order/front/descriptor/index.html b/modules/order/front/descriptor/index.html index fd83d5c71..0a9e2ee38 100644 --- a/modules/order/front/descriptor/index.html +++ b/modules/order/front/descriptor/index.html @@ -53,7 +53,7 @@ \ No newline at end of file diff --git a/modules/order/front/descriptor/index.js b/modules/order/front/descriptor/index.js index 96cee0bbd..ec65d3b4c 100644 --- a/modules/order/front/descriptor/index.js +++ b/modules/order/front/descriptor/index.js @@ -44,7 +44,7 @@ class Controller { } deleteOrder(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const params = {id: this.order.id}; this.$http.delete(`Orders/${params.id}`).then(() => { this.$state.go('order.index'); diff --git a/modules/order/front/descriptor/index.spec.js b/modules/order/front/descriptor/index.spec.js index 1e594828f..a0818ebe7 100644 --- a/modules/order/front/descriptor/index.spec.js +++ b/modules/order/front/descriptor/index.spec.js @@ -13,7 +13,7 @@ describe('Order Component vnOrderDescriptor', () => { })); describe('deleteOrder()', () => { - it(`should do nothing if the response isn't ACCEPT`, () => { + it(`should do nothing if the response isn't accept`, () => { let response = 'WAGH!'; spyOn(controller.vnApp, 'showSuccess'); @@ -24,8 +24,8 @@ describe('Order Component vnOrderDescriptor', () => { expect(controller.$state.go).not.toHaveBeenCalledWith('order.index'); }); - it(`should perform a DELETE query if the response was ACCEPT`, () => { - let response = 'ACCEPT'; + it(`should perform a DELETE query if the response was accept`, () => { + let response = 'accept'; spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.$state, 'go'); diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html index 9204f3215..dddeade46 100644 --- a/modules/order/front/line/index.html +++ b/modules/order/front/line/index.html @@ -84,7 +84,7 @@ \ No newline at end of file diff --git a/modules/order/front/line/index.js b/modules/order/front/line/index.js index 577006717..14e29c5c5 100644 --- a/modules/order/front/line/index.js +++ b/modules/order/front/line/index.js @@ -58,7 +58,7 @@ class Controller { } deleteRow(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { let [lineRemoved] = this.rows.splice(this.lineIdToRemove, 1); this.idsToRemove.push(lineRemoved.id); let params = { diff --git a/modules/order/front/line/index.spec.js b/modules/order/front/line/index.spec.js index 1026878c8..c3a01bbe0 100644 --- a/modules/order/front/line/index.spec.js +++ b/modules/order/front/line/index.spec.js @@ -48,12 +48,12 @@ describe('Order', () => { }); describe('deleteRow()', () => { - it('should remove a row from rows and add save the data if the response is ACCEPT', () => { + it('should remove a row from rows and add save the data if the response is accept', () => { expect(controller.rows.length).toBe(1); spyOn(controller.vnApp, 'showSuccess'); spyOn(controller, 'getVAT'); spyOn(controller.card, 'reload'); - controller.deleteRow('ACCEPT'); + controller.deleteRow('accept'); $httpBackend.expectPOST(`OrderRows/removes`).respond(); $httpBackend.flush(); diff --git a/modules/route/front/descriptor/index.html b/modules/route/front/descriptor/index.html index 312985cb4..f04632244 100644 --- a/modules/route/front/descriptor/index.html +++ b/modules/route/front/descriptor/index.html @@ -53,6 +53,6 @@ \ No newline at end of file diff --git a/modules/route/front/descriptor/index.js b/modules/route/front/descriptor/index.js index 442e6c6f6..438a2dda9 100644 --- a/modules/route/front/descriptor/index.js +++ b/modules/route/front/descriptor/index.js @@ -52,7 +52,7 @@ class Controller { } updateVolume(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { let url = `Routes/${this.route.id}/updateVolume`; this.$http.post(url).then(() => { this.vnApp.showSuccess(this.$translate.instant('Volume updated')); diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 889808105..534a39a38 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -109,7 +109,7 @@ + on-response="$ctrl.removeTicketFromRoute($response)"> + on-response="$ctrl.setTicketsRoute($response)">
Tickets to add
@@ -166,8 +166,8 @@ - - + + { @@ -151,7 +151,7 @@ class Controller { } setTicketsRoute(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { let tickets = this.getSelectedItems(this.possibleTickets); for (let i = 0; i < tickets.length; i++) { diff --git a/modules/route/front/tickets/index.spec.js b/modules/route/front/tickets/index.spec.js index 8dcc12d32..fbd33e906 100644 --- a/modules/route/front/tickets/index.spec.js +++ b/modules/route/front/tickets/index.spec.js @@ -160,7 +160,7 @@ describe('Route', () => { controller.selectedTicket = ticketId; $httpBackend.expectPATCH(`Tickets/${ticketId}/`).respond('ok'); - controller.removeTicketFromRoute('ACCEPT'); + controller.removeTicketFromRoute('accept'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket removed from route'); @@ -273,14 +273,14 @@ describe('Route', () => { {id: 5, routeFk: 111} ]; - controller.setTicketsRoute('ACCEPT').then(() => { + controller.setTicketsRoute('accept').then(() => { expect(controller.$.model.data).toEqual(expectedResult); done(); }).catch(done.fail); }); it('should just return a promise', () => { - expect(controller.setTicketsRoute('CANCEL')).toEqual(jasmine.any(Promise)); + expect(controller.setTicketsRoute('cancel')).toEqual(jasmine.any(Promise)); }); }); }); diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index a2bc8ca30..7ad509633 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -130,7 +130,7 @@ @@ -146,13 +146,13 @@ + on-response="$ctrl.changeShipped($response)">
@@ -168,15 +168,15 @@
- - + +
@@ -185,7 +185,7 @@ @@ -197,7 +197,7 @@ \ No newline at end of file diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index e77f469fe..4d8df2d1f 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -50,7 +50,7 @@ class Controller { } changeShipped(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { let data = {shipped: this.newShipped}; let query = `Tickets/${this.ticket.id}/updateEditableTicket`; this.$http.post(query, data).then(() => { @@ -137,7 +137,7 @@ class Controller { } deleteTicket(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const query = `Tickets/${this.ticket.id}/setDeleted`; this.$http.post(query).then(() => { this.$state.go('ticket.index'); @@ -229,7 +229,7 @@ class Controller { * @param {String} response - Response result */ makeInvoice(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const query = `Tickets/${this.ticket.id}/makeInvoice`; this.$http.post(query).then(() => { this.vnApp.showSuccess(this.$translate.instant('Ticket invoiced')); @@ -252,7 +252,7 @@ class Controller { * @param {String} response - Response result */ regenerateInvoice(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const invoiceId = this.ticket.invoiceOut.id; const query = `InvoiceOuts/${invoiceId}/regenerate`; this.$http.post(query).then(() => { @@ -277,7 +277,7 @@ class Controller { } sendDeliveryNote(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.post(`email/delivery-note`, {ticketFk: this.ticket.id}).then( () => this.vnApp.showMessage(this.$translate.instant('Notification sent!')) ); diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 6011f6c90..cca3045c3 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -66,12 +66,12 @@ describe('Ticket Component vnTicketDescriptor', () => { }); describe('deleteTicket()', () => { - it('should make a query and call vnApp.showSuccess() if the response is ACCEPT', () => { + it('should make a query and call vnApp.showSuccess() if the response is accept', () => { spyOn(controller.$state, 'go'); spyOn(controller.vnApp, 'showSuccess'); $httpBackend.expectPOST(`Tickets/2/setDeleted`).respond(); - controller.deleteTicket('ACCEPT'); + controller.deleteTicket('accept'); $httpBackend.flush(); expect(controller.$state.go).toHaveBeenCalledWith('ticket.index'); @@ -90,13 +90,13 @@ describe('Ticket Component vnTicketDescriptor', () => { }); describe('makeInvoice()', () => { - it('should make a query and call $state.reload() method if the response is ACCEPT', () => { + it('should make a query and call $state.reload() method if the response is accept', () => { spyOn(controller.$state, 'reload'); spyOn(controller.vnApp, 'showSuccess'); $httpBackend.when('POST', 'Tickets/2/makeInvoice').respond(); $httpBackend.expect('POST', 'Tickets/2/makeInvoice').respond(); - controller.makeInvoice('ACCEPT'); + controller.makeInvoice('accept'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket invoiced'); @@ -105,12 +105,12 @@ describe('Ticket Component vnTicketDescriptor', () => { }); describe('regenerateInvoice()', () => { - it('should make a query and show a success snackbar if the response is ACCEPT', () => { + it('should make a query and show a success snackbar if the response is accept', () => { spyOn(controller.vnApp, 'showSuccess'); $httpBackend.when('POST', 'InvoiceOuts/1/regenerate').respond(); $httpBackend.expect('POST', 'InvoiceOuts/1/regenerate').respond(); - controller.regenerateInvoice('ACCEPT'); + controller.regenerateInvoice('accept'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Invoice sent for a regeneration, will be available in a few minutes'); @@ -118,14 +118,14 @@ describe('Ticket Component vnTicketDescriptor', () => { }); describe('changeShipped()', () => { - it('should make a query and change the shipped hour if the response is ACCEPT', () => { + it('should make a query and change the shipped hour if the response is accept', () => { controller.ticket.id = 12; spyOn(controller.vnApp, 'showSuccess'); spyOn(controller, 'cardReload'); $httpBackend.when('POST', 'Tickets/12/updateEditableTicket').respond(); $httpBackend.expect('POST', 'Tickets/12/updateEditableTicket').respond(); - controller.changeShipped('ACCEPT'); + controller.changeShipped('accept'); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Shipped hour updated'); diff --git a/modules/ticket/front/descriptor/removeStowaway.html b/modules/ticket/front/descriptor/removeStowaway.html index e517206b3..891329b7e 100644 --- a/modules/ticket/front/descriptor/removeStowaway.html +++ b/modules/ticket/front/descriptor/removeStowaway.html @@ -32,7 +32,7 @@ \ No newline at end of file diff --git a/modules/ticket/front/descriptor/removeStowaway.js b/modules/ticket/front/descriptor/removeStowaway.js index 96ba23fa7..05ace7d9e 100644 --- a/modules/ticket/front/descriptor/removeStowaway.js +++ b/modules/ticket/front/descriptor/removeStowaway.js @@ -44,7 +44,7 @@ class Controller { } deleteStowaway(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.delete(`Stowaways/${this.stowawayToDelete.id}`).then(res => { this.cardReload(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); diff --git a/modules/ticket/front/dms/index/index.html b/modules/ticket/front/dms/index/index.html index 8af9a63ad..278427338 100644 --- a/modules/ticket/front/dms/index/index.html +++ b/modules/ticket/front/dms/index/index.html @@ -111,5 +111,5 @@ vn-id="confirm" message="This file will be deleted" question="Are you sure you want to continue?" - on-response="$ctrl.deleteDms(response)"> + on-response="$ctrl.deleteDms($response)"> \ No newline at end of file diff --git a/modules/ticket/front/dms/index/index.js b/modules/ticket/front/dms/index/index.js index 0b7175056..c6ceb6b0d 100644 --- a/modules/ticket/front/dms/index/index.js +++ b/modules/ticket/front/dms/index/index.js @@ -60,7 +60,7 @@ class Controller { } deleteDms(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const dmsFk = this.ticketDms[this.dmsIndex].dmsFk; const query = `ticketDms/${dmsFk}/removeFile`; this.$http.post(query).then(() => { diff --git a/modules/ticket/front/dms/index/index.spec.js b/modules/ticket/front/dms/index/index.spec.js index bcae8d2b2..ab28d750d 100644 --- a/modules/ticket/front/dms/index/index.spec.js +++ b/modules/ticket/front/dms/index/index.spec.js @@ -29,7 +29,7 @@ describe('Ticket', () => { $httpBackend.when('POST', `ticketDms/${dmsId}/removeFile`).respond({}); $httpBackend.expect('POST', `ticketDms/${dmsId}/removeFile`); - controller.deleteDms('ACCEPT'); + controller.deleteDms('accept'); $httpBackend.flush(); expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex); diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 4014ede7d..b2e859970 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -68,7 +68,7 @@ \ No newline at end of file diff --git a/modules/ticket/front/expedition/index.js b/modules/ticket/front/expedition/index.js index 922d691e9..5b8a71581 100644 --- a/modules/ticket/front/expedition/index.js +++ b/modules/ticket/front/expedition/index.js @@ -13,7 +13,7 @@ class Controller { } returnDialog(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.delete(`Expeditions/${this.expeditionId}`).then( () => this.$.model.refresh() ); diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js index c1e70da45..843c4fff3 100644 --- a/modules/ticket/front/expedition/index.spec.js +++ b/modules/ticket/front/expedition/index.spec.js @@ -23,7 +23,7 @@ describe('Ticket', () => { it('should perform a DELETE query', () => { spyOn($scope.model, 'refresh'); - let response = 'ACCEPT'; + let response = 'accept'; controller.expeditionId = 1; $httpBackend.when('DELETE', `Expeditions/1`).respond(200); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index b158e3e9a..10fed7e92 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -380,12 +380,12 @@ vn-id="delete-lines" question="You are going to delete lines of the ticket" message="Continue anyway?" - on-response="$ctrl.onRemoveLinesClick(response)"> + on-response="$ctrl.onRemoveLinesClick($response)"> + on-response="$ctrl.transferSales($ctrl.transfer.ticketId, $response)"> \ No newline at end of file diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 4b0ccd42f..6df328d88 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -214,7 +214,7 @@ class Controller { } onRemoveLinesClick(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { let sales = this.checkedLines(); // Remove unsaved instances diff --git a/modules/ticket/front/sale/specs/index.spec.js b/modules/ticket/front/sale/specs/index.spec.js index 08eb74b69..cd0e322a5 100644 --- a/modules/ticket/front/sale/specs/index.spec.js +++ b/modules/ticket/front/sale/specs/index.spec.js @@ -140,7 +140,7 @@ describe('Ticket', () => { $httpBackend.whenGET(`Tickets/1/subtotal`).respond(200, 227.5); $httpBackend.whenGET(`Tickets/1/getVAT`).respond(200, 10.5); $httpBackend.whenGET(`Tickets/1/isEditable`).respond(); - controller.onRemoveLinesClick('ACCEPT'); + controller.onRemoveLinesClick('accept'); $httpBackend.flush(); expect(controller.sales.length).toEqual(1); diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 17b7eaeba..6d42ba9d9 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -75,7 +75,7 @@ + on-response="$ctrl.onNewServiceTypeResponse($response)">
New service type
@@ -88,7 +88,7 @@
- - + +
\ No newline at end of file diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index 3082878a6..76f8ac61a 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -51,7 +51,7 @@ class Controller { } onNewServiceTypeResponse(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { if (!this.newServiceType.name) throw new UserError(`Name can't be empty`); diff --git a/modules/ticket/front/services/index.spec.js b/modules/ticket/front/services/index.spec.js index 03b1d9d42..b3c4adba5 100644 --- a/modules/ticket/front/services/index.spec.js +++ b/modules/ticket/front/services/index.spec.js @@ -43,7 +43,7 @@ describe('Ticket component vnTicketService', () => { let error; try { - controller.onNewServiceTypeResponse('ACCEPT'); + controller.onNewServiceTypeResponse('accept'); } catch (e) { error = e.message; } @@ -60,7 +60,7 @@ describe('Ticket component vnTicketService', () => { controller.currentServiceIndex = 0; $httpBackend.when('POST', 'TicketServiceTypes').respond({id: 4001, name: 'great service!'}); - controller.onNewServiceTypeResponse('ACCEPT'); + controller.onNewServiceTypeResponse('accept'); $httpBackend.flush(); expect(controller.services[0].description).toEqual('great service!'); diff --git a/modules/ticket/front/weekly/create/index.html b/modules/ticket/front/weekly/create/index.html index eb515b07f..01929f66e 100644 --- a/modules/ticket/front/weekly/create/index.html +++ b/modules/ticket/front/weekly/create/index.html @@ -66,6 +66,6 @@ + on-response="$ctrl.onResponse($response)"> \ No newline at end of file diff --git a/modules/ticket/front/weekly/index/index.html b/modules/ticket/front/weekly/index/index.html index be33ee5f3..585b14207 100644 --- a/modules/ticket/front/weekly/index/index.html +++ b/modules/ticket/front/weekly/index/index.html @@ -93,7 +93,7 @@ diff --git a/modules/ticket/front/weekly/index/index.js b/modules/ticket/front/weekly/index/index.js index 60aec8396..d5d8a1aea 100644 --- a/modules/ticket/front/weekly/index/index.js +++ b/modules/ticket/front/weekly/index/index.js @@ -76,7 +76,7 @@ export default class Controller { returnDialog(response) { const ticket = this.$.model.data[this.ticketIndex]; - if (response === 'ACCEPT') { + if (response === 'accept') { this.$http.delete(`TicketWeeklies/${ticket.ticketFk}`).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.$.model.remove(this.ticketIndex); diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index 1b8bb65de..bcf4c44f2 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -27,13 +27,19 @@ {{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}} -
+
{{absenceType.name}} + + + + My longer overflowing absence type in chip +
\ No newline at end of file diff --git a/modules/worker/front/department/index.html b/modules/worker/front/department/index.html index 70cb033ea..a464d59e0 100644 --- a/modules/worker/front/department/index.html +++ b/modules/worker/front/department/index.html @@ -24,7 +24,7 @@ @@ -33,7 +33,7 @@ + on-response="$ctrl.onCreateResponse($response)">
New department
@@ -45,7 +45,7 @@
- - + +
diff --git a/modules/worker/front/department/index.js b/modules/worker/front/department/index.js index a568546cc..28c2cfa99 100644 --- a/modules/worker/front/department/index.js +++ b/modules/worker/front/department/index.js @@ -45,7 +45,7 @@ class Controller { } onCreateResponse(response) { - if (response == 'ACCEPT') { + if (response == 'accept') { try { if (!this.newChild.name) throw new Error(`Name can't be empty`); @@ -77,7 +77,7 @@ class Controller { } onRemoveResponse(response) { - if (response === 'ACCEPT') { + if (response === 'accept') { const childId = this.removedChild.id; const path = `departments/${childId}/removeChild`; this.$http.post(path).then(() => { diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index fd68c25f6..fd3281122 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -68,7 +68,7 @@ + on-response="$ctrl.addTime($response)">
@@ -83,7 +83,7 @@
- - + +
\ No newline at end of file diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 953079b87..cc45a823d 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -150,7 +150,7 @@ class Controller { } addTime(response) { - if (response !== 'ACCEPT') return; + if (response !== 'accept') return; let data = { workerFk: this.$stateParams.id, timed: this.newTime