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 @@
-