#1847 vnDialog refactor
This commit is contained in:
parent
0a4a22ec87
commit
c41fb1d0f4
|
@ -52,7 +52,7 @@ let actions = {
|
||||||
let logoutClicked = await this.clickIfExists('#logout');
|
let logoutClicked = await this.clickIfExists('#logout');
|
||||||
|
|
||||||
if (logoutClicked) {
|
if (logoutClicked) {
|
||||||
let buttonSelector = '.vn-dialog.shown button[response=ACCEPT]';
|
let buttonSelector = '.vn-dialog.shown button[response=accept]';
|
||||||
await this.wait(buttonSelector => {
|
await this.wait(buttonSelector => {
|
||||||
return document.querySelector(buttonSelector) != null
|
return document.querySelector(buttonSelector) != null
|
||||||
|| location.hash == '#!/login';
|
|| location.hash == '#!/login';
|
||||||
|
@ -392,7 +392,7 @@ let actions = {
|
||||||
|
|
||||||
forceReloadSection: function(sectionRoute) {
|
forceReloadSection: function(sectionRoute) {
|
||||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
||||||
.waitToClick('button[response="ACCEPT"]')
|
.waitToClick('button[response="accept"]')
|
||||||
.wait('vn-card.summary')
|
.wait('vn-card.summary')
|
||||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,7 +18,7 @@ export default {
|
||||||
userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]',
|
userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]',
|
||||||
userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]',
|
userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]',
|
||||||
userConfigThirdAutocompleteClear: '#localCompany .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: {
|
clientsIndex: {
|
||||||
searchClientInput: `vn-textfield input`,
|
searchClientInput: `vn-textfield input`,
|
||||||
|
@ -62,7 +62,7 @@ export default {
|
||||||
socialNameInput: `vn-textfield input[name="socialName"]`,
|
socialNameInput: `vn-textfield input[name="socialName"]`,
|
||||||
fiscalIdInput: `vn-textfield input[name="fi"]`,
|
fiscalIdInput: `vn-textfield input[name="fi"]`,
|
||||||
equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
|
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"]`,
|
addressInput: `vn-textfield input[name="street"]`,
|
||||||
postcodeInput: `vn-textfield input[name="postcode"]`,
|
postcodeInput: `vn-textfield input[name="postcode"]`,
|
||||||
cityInput: `vn-textfield input[name="city"]`,
|
cityInput: `vn-textfield input[name="city"]`,
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
||||||
newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input',
|
newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input',
|
||||||
newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input',
|
newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input',
|
||||||
newBankEntityCode: '.vn-dialog.shown vn-textfield[label="Entity Code"] 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]`
|
saveButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
clientAddresses: {
|
clientAddresses: {
|
||||||
|
@ -177,7 +177,7 @@ export default {
|
||||||
deleteFileButton: 'vn-client-dms-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
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',
|
firstDocWorker: 'vn-client-dms-index vn-td:nth-child(8) > span',
|
||||||
firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor',
|
firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor',
|
||||||
acceptDeleteButton: '.vn-confirm.shown button[response="ACCEPT"]'
|
acceptDeleteButton: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
itemsIndex: {
|
itemsIndex: {
|
||||||
searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]',
|
searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]',
|
||||||
|
@ -185,7 +185,7 @@ export default {
|
||||||
searchResult: 'vn-item-index a.vn-tr',
|
searchResult: 'vn-item-index a.vn-tr',
|
||||||
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
|
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
|
||||||
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
|
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',
|
searchItemInput: 'vn-searchbar vn-textfield input',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
closeItemSummaryPreview: '.vn-popup.shown',
|
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',
|
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',
|
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"]',
|
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: {
|
createTicketView: {
|
||||||
clientAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.clientFk"]',
|
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)',
|
thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)',
|
||||||
saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)',
|
saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)',
|
||||||
closeStowawayDialog: '.vn-dialog.shown button[class="close"]',
|
closeStowawayDialog: '.vn-dialog.shown button[class="close"]',
|
||||||
acceptDeleteButton: '.vn-dialog.shown button[response="ACCEPT"]',
|
acceptDeleteButton: '.vn-dialog.shown button[response="accept"]',
|
||||||
acceptChangeHourButton: '.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',
|
descriptorDeliveryDate: 'vn-ticket-descriptor > div > div.body > div.attributes > vn-label-value:nth-child(6) > section > span',
|
||||||
acceptInvoiceOutButton: '.vn-confirm.shown button[response="ACCEPT"]',
|
acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]',
|
||||||
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="ACCEPT"]'
|
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
ticketNotes: {
|
ticketNotes: {
|
||||||
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
|
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
|
||||||
|
@ -384,7 +384,7 @@ export default {
|
||||||
ticketExpedition: {
|
ticketExpedition: {
|
||||||
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
|
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"]',
|
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'
|
expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr'
|
||||||
},
|
},
|
||||||
ticketPackages: {
|
ticketPackages: {
|
||||||
|
@ -453,8 +453,8 @@ export default {
|
||||||
moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]',
|
moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]',
|
||||||
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
||||||
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
||||||
acceptDeleteLineButton: '.vn-confirm.shown button[response=ACCEPT]',
|
acceptDeleteLineButton: '.vn-confirm.shown button[response=accept]',
|
||||||
acceptDeleteTicketButton: '.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"]'
|
stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]'
|
||||||
},
|
},
|
||||||
ticketTracking: {
|
ticketTracking: {
|
||||||
|
@ -523,7 +523,7 @@ export default {
|
||||||
claimDescriptor: {
|
claimDescriptor: {
|
||||||
moreMenu: 'vn-claim-descriptor vn-icon-menu[icon=more_vert]',
|
moreMenu: 'vn-claim-descriptor vn-icon-menu[icon=more_vert]',
|
||||||
moreMenuDeleteClaim: '.vn-drop-down.shown li[name="Delete claim"]',
|
moreMenuDeleteClaim: '.vn-drop-down.shown li[name="Delete claim"]',
|
||||||
acceptDeleteClaim: '.vn-confirm.shown button[response="ACCEPT"]'
|
acceptDeleteClaim: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
claimSummary: {
|
claimSummary: {
|
||||||
header: 'vn-claim-summary > vn-card > h5',
|
header: 'vn-claim-summary > vn-card > h5',
|
||||||
|
@ -589,7 +589,7 @@ export default {
|
||||||
},
|
},
|
||||||
orderDescriptor: {
|
orderDescriptor: {
|
||||||
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
||||||
acceptNavigationButton: '.vn-confirm.shown button[response=ACCEPT]'
|
acceptNavigationButton: '.vn-confirm.shown button[response=accept]'
|
||||||
},
|
},
|
||||||
createOrderView: {
|
createOrderView: {
|
||||||
clientAutocomplete: 'vn-autocomplete[label="Client"]',
|
clientAutocomplete: 'vn-autocomplete[label="Client"]',
|
||||||
|
@ -618,13 +618,13 @@ export default {
|
||||||
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
||||||
observationInput: 'vn-textarea[label="Observation"] textarea',
|
observationInput: 'vn-textarea[label="Observation"] textarea',
|
||||||
saveButton: `button[type=submit]`,
|
saveButton: `button[type=submit]`,
|
||||||
acceptButton: '.vn-confirm.shown button[response="ACCEPT"]'
|
acceptButton: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
orderLine: {
|
orderLine: {
|
||||||
orderSubtotal: 'vn-order-line .header :first-child',
|
orderSubtotal: 'vn-order-line .header :first-child',
|
||||||
firstLineDeleteButton: 'vn-order-line vn-tbody > vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
firstLineDeleteButton: 'vn-order-line vn-tbody > vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
||||||
confirmOrder: 'vn-order-line vn-float-button',
|
confirmOrder: 'vn-order-line vn-float-button',
|
||||||
confirmButton: '.vn-confirm.shown button[response="ACCEPT"]',
|
confirmButton: '.vn-confirm.shown button[response="accept"]',
|
||||||
},
|
},
|
||||||
routeIndex: {
|
routeIndex: {
|
||||||
addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]'
|
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',
|
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check',
|
||||||
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
||||||
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
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: {
|
workerPbx: {
|
||||||
extensionInput: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"] input',
|
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"]',
|
moreMenuDeleteInvoiceOut: '.vn-drop-down.shown li[name="Delete Invoice"]',
|
||||||
moreMenuBookInvoiceOut: '.vn-drop-down.shown li[name="Book invoice"]',
|
moreMenuBookInvoiceOut: '.vn-drop-down.shown li[name="Book invoice"]',
|
||||||
moreMenuShowInvoiceOutPdf: '.vn-drop-down.shown li[name="Show invoice PDF"]',
|
moreMenuShowInvoiceOutPdf: '.vn-drop-down.shown li[name="Show invoice PDF"]',
|
||||||
acceptDeleteButton: '.vn-confirm.shown button[response="ACCEPT"]',
|
acceptDeleteButton: '.vn-confirm.shown button[response="accept"]',
|
||||||
acceptBookingButton: '.vn-confirm.shown button[response="ACCEPT"]'
|
acceptBookingButton: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
invoiceOutSummary: {
|
invoiceOutSummary: {
|
||||||
bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span'
|
bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span'
|
||||||
|
|
|
@ -110,7 +110,7 @@ describe('Client Add address path', () => {
|
||||||
it(`should go back to the addreses section by clicking the cancel button`, async() => {
|
it(`should go back to the addreses section by clicking the cancel button`, async() => {
|
||||||
const url = await nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.clientAddresses.cancelEditAddressButton)
|
.waitToClick(selectors.clientAddresses.cancelEditAddressButton)
|
||||||
.waitToClick('.vn-confirm.shown button[response="ACCEPT"]')
|
.waitToClick('.vn-confirm.shown button[response="accept"]')
|
||||||
.waitForURL('address/index')
|
.waitForURL('address/index')
|
||||||
.parsedUrl();
|
.parsedUrl();
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
vn-chip {
|
vn-chip {
|
||||||
border-radius: 16px;
|
border-radius: 1em;
|
||||||
background-color: $color-bg;
|
background-color: $color-bg;
|
||||||
margin: 0 0.5em 0.5em 0;
|
|
||||||
color: $color-font;
|
color: $color-font;
|
||||||
font-size: 14px;
|
font-size: .9rem;
|
||||||
margin: .25em;
|
margin: .25em 0;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-overflow: ellipsis;
|
height: 2em;
|
||||||
white-space: nowrap;
|
max-width: 100%;
|
||||||
height: 28px;
|
box-sizing: border-box;
|
||||||
padding: 0 .7em;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
&.colored {
|
&.colored {
|
||||||
background-color: $color-main;
|
background-color: $color-main;
|
||||||
|
@ -22,17 +19,24 @@ vn-chip {
|
||||||
& > div {
|
& > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-width: 100%;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
padding: 0 .7em;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: 2em;
|
||||||
|
|
||||||
& > vn-avatar {
|
& > vn-avatar {
|
||||||
margin-left: -0.7em;
|
margin-left: -0.7em;
|
||||||
margin-right: .4em;
|
margin-right: .3em;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 1.9em;
|
||||||
|
width: 2em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& > vn-icon {
|
& > vn-icon {
|
||||||
margin-left: .2em;
|
margin-right: .12em;
|
||||||
margin-right: -0.3em;
|
margin-left: -.12em;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
opacity: .6;
|
opacity: .6;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -47,7 +51,6 @@ vn-chip {
|
||||||
|
|
||||||
vn-avatar {
|
vn-avatar {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 28px;
|
min-width: 2em;
|
||||||
width: 28px;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
<span translate>{{::$ctrl.question}}</span>
|
<span translate>{{::$ctrl.question}}</span>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<button response="CANCEL" translate>Cancel</button>
|
<button response="cancel" translate>Cancel</button>
|
||||||
<button response="ACCEPT" translate>Accept</button>
|
<button response="accept" translate vn-focus>Accept</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</div>
|
</div>
|
|
@ -1,3 +1,8 @@
|
||||||
|
<div
|
||||||
|
ng-if="$ctrl.loading"
|
||||||
|
class="loading-overlap shown">
|
||||||
|
<vn-spinner enable="true"></vn-spinner>
|
||||||
|
</div>
|
||||||
<vn-button
|
<vn-button
|
||||||
ng-click="$ctrl.hide()"
|
ng-click="$ctrl.hide()"
|
||||||
translate-attr="{title: 'Close'}"
|
translate-attr="{title: 'Close'}"
|
||||||
|
|
|
@ -6,8 +6,10 @@ import './style.scss';
|
||||||
/**
|
/**
|
||||||
* Dialog component.
|
* Dialog component.
|
||||||
*
|
*
|
||||||
* @property {HTMLElement} body The dialog HTML body
|
* @property {Function} onResponse Handler for dialog response
|
||||||
* @property {HTMLElement} buttons The dialog HTML buttons
|
* @property {Function} onAccept Shortcut handler for accept response
|
||||||
|
* @slot body The dialog HTML body
|
||||||
|
* @slot buttons The dialog HTML buttons
|
||||||
*/
|
*/
|
||||||
export default class Dialog extends Popup {
|
export default class Dialog extends Popup {
|
||||||
constructor($element, $, $transclude) {
|
constructor($element, $, $transclude) {
|
||||||
|
@ -16,24 +18,88 @@ export default class Dialog extends Popup {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the dialog calling the response handler.
|
* Shows the dialog and optionally registers a handler for the response.
|
||||||
|
*
|
||||||
|
* @param {*} data Optional user data to pass to response handler
|
||||||
|
* @param {Function} responseHandler An optional response handler
|
||||||
|
* @return {Promise} A promise that will be resolved with response when dialog is closed
|
||||||
*/
|
*/
|
||||||
hide() {
|
show(data, responseHandler) {
|
||||||
this.fireResponse();
|
if (typeof data == 'function') {
|
||||||
|
responseHandler = data;
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.data = data;
|
||||||
|
this.showHandler = responseHandler;
|
||||||
|
super.show();
|
||||||
|
return this.$q(resolve => {
|
||||||
|
this.resolve = resolve;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the dialog.
|
||||||
|
*
|
||||||
|
* @param {String} response The response
|
||||||
|
*/
|
||||||
|
hide(response) {
|
||||||
|
this.showHandler = null;
|
||||||
super.hide();
|
super.hide();
|
||||||
|
if (this.resolve)
|
||||||
|
this.resolve(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the response handler.
|
* Calls the response handler.
|
||||||
*
|
*
|
||||||
* @param {String} response The response code
|
* @param {String} response The response code
|
||||||
* @return {Boolean} %true if response was canceled, %false otherwise
|
* @return {Boolean} The response handler return
|
||||||
*/
|
*/
|
||||||
fireResponse(response) {
|
respond(response) {
|
||||||
let cancel;
|
let handlerArgs = {
|
||||||
|
$response: response,
|
||||||
|
$data: this.data
|
||||||
|
};
|
||||||
|
let cancellers = [];
|
||||||
|
|
||||||
if (this.onResponse)
|
if (this.onResponse)
|
||||||
cancel = this.onResponse({response: response});
|
cancellers.push(this.onResponse(handlerArgs));
|
||||||
return cancel;
|
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) {
|
onButtonClick(event) {
|
||||||
|
@ -45,17 +111,7 @@ export default class Dialog extends Popup {
|
||||||
node = node.parentNode;
|
node = node.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = node.getAttribute('response');
|
this.respond(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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +122,7 @@ ngModule.vnComponent('vnDialog', {
|
||||||
buttons: '?tplButtons'
|
buttons: '?tplButtons'
|
||||||
},
|
},
|
||||||
bindings: {
|
bindings: {
|
||||||
onResponse: '&?'
|
onResponse: '&?',
|
||||||
|
onAccept: '&?'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,27 +10,21 @@ describe('Component vnDialog', () => {
|
||||||
controller.emit = jasmine.createSpy('emit');
|
controller.emit = jasmine.createSpy('emit');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('hide()', () => {
|
describe('respond()', () => {
|
||||||
describe('fireResponse()', () => {
|
|
||||||
it(`should call onResponse() if it's defined in the controller`, () => {
|
it(`should call onResponse() if it's defined in the controller`, () => {
|
||||||
controller.onResponse = () => {};
|
controller.onResponse = () => {};
|
||||||
spyOn(controller, 'onResponse');
|
spyOn(controller, 'onResponse');
|
||||||
controller.hide();
|
controller.respond();
|
||||||
|
|
||||||
expect(controller.onResponse).toHaveBeenCalledWith(jasmine.any(Object));
|
expect(controller.onResponse).toHaveBeenCalledWith(jasmine.any(Object));
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should call onResponse() with a response`, () => {
|
it(`should call onResponse() with a response`, () => {
|
||||||
let responseRes;
|
controller.onResponse = () => {};
|
||||||
controller.onResponse = response => {
|
spyOn(controller, 'onResponse');
|
||||||
responseRes = response;
|
controller.respond('answer');
|
||||||
return false;
|
|
||||||
};
|
|
||||||
let responseRet = controller.fireResponse('answer');
|
|
||||||
|
|
||||||
expect(responseRes).toEqual({response: 'answer'});
|
expect(controller.onResponse).toHaveBeenCalledWith({$response: 'answer'});
|
||||||
expect(responseRet).toEqual(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@import "effects";
|
@import "effects";
|
||||||
|
|
||||||
.vn-dialog > .window {
|
.vn-dialog > .window {
|
||||||
padding: $spacing-lg;
|
position: relative;
|
||||||
|
|
||||||
& > .close {
|
& > .close {
|
||||||
@extend %clickable;
|
@extend %clickable;
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
& > form {
|
& > form {
|
||||||
|
padding: $spacing-lg;
|
||||||
|
|
||||||
& > .body > tpl-body {
|
& > .body > tpl-body {
|
||||||
display: block;
|
display: block;
|
||||||
min-width: 16em;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
question="Are you sure exit without saving?"
|
question="Are you sure exit without saving?"
|
||||||
message="Unsaved changes will be lost"
|
message="Unsaved changes will be lost"
|
||||||
on-response="$ctrl.onConfirmResponse(response)">
|
on-response="$ctrl.onConfirmResponse($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -203,7 +203,7 @@ export default class Watcher extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onConfirmResponse(response) {
|
onConfirmResponse(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
if (this.data)
|
if (this.data)
|
||||||
Object.assign(this.data, this.orgData);
|
Object.assign(this.data, this.orgData);
|
||||||
this.$state.go(this.state);
|
this.$state.go(this.state);
|
||||||
|
|
|
@ -223,9 +223,9 @@ describe('Component vnWatcher', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe(`onConfirmResponse()`, () => {
|
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`, () => {
|
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.data = {};
|
||||||
controller.orgData = {name: 'Batman'};
|
controller.orgData = {name: 'Batman'};
|
||||||
controller.$state = {go: jasmine.createSpy('go')};
|
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`, () => {
|
it(`should set controller.state to null`, () => {
|
||||||
let response = 'anything but ACCEPT';
|
let response = 'anything but accept';
|
||||||
controller.state = 'Batman';
|
controller.state = 'Batman';
|
||||||
controller.onConfirmResponse(response);
|
controller.onConfirmResponse(response);
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,13 @@ export function focus($scope, input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
input.focus();
|
input.focus();
|
||||||
|
|
||||||
|
if (input.select) {
|
||||||
$scope.$applyAsync(() => {
|
$scope.$applyAsync(() => {
|
||||||
input.select();
|
input.select();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the focus and selects the text on the input.
|
* Sets the focus and selects the text on the input.
|
||||||
|
|
|
@ -112,5 +112,6 @@
|
||||||
"This phone already exists": "Este teléfono ya existe",
|
"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 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 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"
|
||||||
}
|
}
|
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-zone"
|
vn-id="delete-zone"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
question="Are you sure you want to delete this zone?"
|
question="Are you sure you want to delete this zone?"
|
||||||
message="This zone will be removed">
|
message="This zone will be removed">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -19,7 +19,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.delete(`Zones/${this.zone.id}`).then(() => {
|
this.$http.delete(`Zones/${this.zone.id}`).then(() => {
|
||||||
this.$state.go('zone.index');
|
this.$state.go('zone.index');
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
</vn-side-menu>
|
</vn-side-menu>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="dialog"
|
vn-id="dialog"
|
||||||
on-response="$ctrl.onSave(response)">
|
on-response="$ctrl.onIncludeResponse($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-vertical class="vn-pb-md">
|
<vn-vertical class="vn-pb-md">
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input
|
<input
|
||||||
type="button"
|
type="button"
|
||||||
response="CANCEL"
|
response="cancel"
|
||||||
translate-attr="{value: 'Cancel'}">
|
translate-attr="{value: 'Cancel'}">
|
||||||
</input>
|
</input>
|
||||||
<button
|
<button
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
translate>
|
translate>
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
<button response="ACCEPT">
|
<button response="accept">
|
||||||
<span ng-if="$ctrl.isNew" translate>Add</span>
|
<span ng-if="$ctrl.isNew" translate>Add</span>
|
||||||
<span ng-if="!$ctrl.isNew" translate>Save</span>
|
<span ng-if="!$ctrl.isNew" translate>Save</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -180,6 +180,5 @@
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This item will be deleted"
|
message="This item will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?">
|
||||||
on-response="$ctrl.delete(response)">
|
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -101,8 +101,9 @@ class Controller extends Component {
|
||||||
this.$.dialog.show();
|
this.$.dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onSave(response) {
|
onIncludeResponse(response) {
|
||||||
if (response == 'ACCEPT') {
|
switch (response) {
|
||||||
|
case 'accept': {
|
||||||
let selected = this.selected;
|
let selected = this.selected;
|
||||||
|
|
||||||
if (this.eventType == 'indefinitely') {
|
if (this.eventType == 'indefinitely') {
|
||||||
|
@ -131,17 +132,15 @@ class Controller extends Component {
|
||||||
else
|
else
|
||||||
req = this.$http.put(`${this.path}/${selected.id}`, selected);
|
req = this.$http.put(`${this.path}/${selected.id}`, selected);
|
||||||
|
|
||||||
req.then(() => {
|
return req.then(() => {
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.isNew = null;
|
this.isNew = null;
|
||||||
this.$.dialog.hide();
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return false;
|
case 'DELETE':
|
||||||
} else if (response == 'DELETE') {
|
return this.onDelete(this.selected.id)
|
||||||
this.onDelete(this.selected.id);
|
.then(response => response == 'accept');
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,19 +151,14 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDelete(id) {
|
onDelete(id) {
|
||||||
this.deleteId = id;
|
return this.$.confirm.show(
|
||||||
this.$.confirm.show();
|
response => this.onDeleteResponse(response, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(response) {
|
onDeleteResponse(response, id) {
|
||||||
if (response != 'ACCEPT') return;
|
if (response != 'accept' || !id) return;
|
||||||
if (!this.deleteId) return;
|
return this.$http.delete(`${this.path}/${id}`)
|
||||||
this.$http.delete(`${this.path}/${this.deleteId}`)
|
.then(() => this.refresh());
|
||||||
.then(() => {
|
|
||||||
this.refresh();
|
|
||||||
this.deleteId = null;
|
|
||||||
this.$.dialog.hide();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusionCreate(days) {
|
exclusionCreate(days) {
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</vn-popup>
|
</vn-popup>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="clone"
|
vn-id="clone"
|
||||||
on-response="$ctrl.onCloneAccept(response)"
|
on-response="$ctrl.onCloneAccept($response)"
|
||||||
question="Do you want to clone this zone?"
|
question="Do you want to clone this zone?"
|
||||||
message="All it's properties will be copied">
|
message="All it's properties will be copied">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -39,10 +39,10 @@ export default class Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone response callback
|
* Clone response callback
|
||||||
* @param {String} response - Response string (['ACCEPT', 'CANCEL'])
|
* @param {String} response - Response string (['accept', 'cancel'])
|
||||||
*/
|
*/
|
||||||
onCloneAccept(response) {
|
onCloneAccept(response) {
|
||||||
if (!(response == 'ACCEPT' && this.selectedZone)) return;
|
if (!(response == 'accept' && this.selectedZone)) return;
|
||||||
const query = `Zones/${this.selectedZone.id}/clone`;
|
const query = `Zones/${this.selectedZone.id}/clone`;
|
||||||
this.$http.post(query).then(res => {
|
this.$http.post(query).then(res => {
|
||||||
if (res && res.data)
|
if (res && res.data)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</vn-float-button>
|
</vn-float-button>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="dialog"
|
vn-id="dialog"
|
||||||
on-response="$ctrl.onSave(response)">
|
on-response="$ctrl.onSave($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
@ -41,13 +41,13 @@
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Save</button>
|
<button response="accept" translate>Save</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This item will be deleted"
|
message="This item will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.delete(response)">
|
on-response="$ctrl.delete($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSave(response) {
|
onSave(response) {
|
||||||
if (response != 'ACCEPT') return;
|
if (response != 'accept') return;
|
||||||
|
|
||||||
this.$http.post(this.path, this.selected)
|
this.$http.post(this.path, this.selected)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -40,7 +40,7 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(response) {
|
delete(response) {
|
||||||
if (response != 'ACCEPT') return;
|
if (response != 'accept') return;
|
||||||
let id = this.$.data[this.deleteIndex].id;
|
let id = this.$.data[this.deleteIndex].id;
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
this.$http.delete(`${this.path}/${id}`)
|
this.$http.delete(`${this.path}/${id}`)
|
||||||
|
|
|
@ -201,5 +201,5 @@
|
||||||
vn-id="update-greuge"
|
vn-id="update-greuge"
|
||||||
question="Insert greuges on client card"
|
question="Insert greuges on client card"
|
||||||
message="Do you want to insert greuges?"
|
message="Do you want to insert greuges?"
|
||||||
on-response="$ctrl.onUpdateGreugeResponse(response)">
|
on-response="$ctrl.onUpdateGreugeResponse($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -133,7 +133,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateGreugeResponse(response) {
|
onUpdateGreugeResponse(response) {
|
||||||
if (response !== 'ACCEPT')
|
if (response !== 'accept')
|
||||||
return;
|
return;
|
||||||
let greugeTypeFreight = 7;
|
let greugeTypeFreight = 7;
|
||||||
let query = `Greuges/`;
|
let query = `Greuges/`;
|
||||||
|
|
|
@ -154,7 +154,7 @@ describe('claim', () => {
|
||||||
spyOn(controller.card, 'reload');
|
spyOn(controller.card, 'reload');
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
controller.onUpdateGreugeResponse('CANCEL');
|
controller.onUpdateGreugeResponse('cancel');
|
||||||
|
|
||||||
expect(controller.$http.post).not.toHaveBeenCalledWith();
|
expect(controller.$http.post).not.toHaveBeenCalledWith();
|
||||||
expect(controller.card.reload).not.toHaveBeenCalledWith();
|
expect(controller.card.reload).not.toHaveBeenCalledWith();
|
||||||
|
@ -174,7 +174,7 @@ describe('claim', () => {
|
||||||
ticketFk: controller.claim.ticketFk
|
ticketFk: controller.claim.ticketFk
|
||||||
};
|
};
|
||||||
$httpBackend.expect('POST', `Greuges/`, data).respond();
|
$httpBackend.expect('POST', `Greuges/`, data).respond();
|
||||||
controller.onUpdateGreugeResponse('ACCEPT');
|
controller.onUpdateGreugeResponse('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.card.reload).toHaveBeenCalledWith();
|
expect(controller.card.reload).toHaveBeenCalledWith();
|
||||||
|
|
|
@ -49,13 +49,13 @@
|
||||||
</div>
|
</div>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm-pickup-order"
|
vn-id="confirm-pickup-order"
|
||||||
on-response="$ctrl.sendPickupOrder(response)"
|
on-response="$ctrl.sendPickupOrder($response)"
|
||||||
question="Send Pickup order"
|
question="Send Pickup order"
|
||||||
message="Are you sure you want to send it?">
|
message="Are you sure you want to send it?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm-delete-claim"
|
vn-id="confirm-delete-claim"
|
||||||
on-response="$ctrl.deleteClaim(response)"
|
on-response="$ctrl.deleteClaim($response)"
|
||||||
question="Delete claim"
|
question="Delete claim"
|
||||||
message="Are you sure you want to delete this claim?">
|
message="Are you sure you want to delete this claim?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPickupOrder(response) {
|
sendPickupOrder(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.post(`email/claim-pickup-order`, {claimFk: this.claim.id}).then(
|
this.$http.post(`email/claim-pickup-order`, {claimFk: this.claim.id}).then(
|
||||||
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
||||||
);
|
);
|
||||||
|
@ -81,7 +81,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteClaim(response) {
|
deleteClaim(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.delete(`Claims/${this.claim.id}`).then(() => {
|
this.$http.delete(`Claims/${this.claim.id}`).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Claim deleted!'));
|
this.vnApp.showSuccess(this.$translate.instant('Claim deleted!'));
|
||||||
this.$state.go('claim.index');
|
this.$state.go('claim.index');
|
||||||
|
|
|
@ -35,12 +35,12 @@ describe('Item Component vnClaimDescriptor', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('sendPickupOrder(response)', () => {
|
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');
|
spyOn(controller.vnApp, 'showMessage');
|
||||||
|
|
||||||
$httpBackend.when('POST', `email/claim-pickup-order`, {claimFk: 2}).respond();
|
$httpBackend.when('POST', `email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||||
$httpBackend.expect('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();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Notification sent!');
|
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Notification sent!');
|
||||||
|
@ -60,8 +60,8 @@ describe('Item Component vnClaimDescriptor', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deleteClaime(response)', () => {
|
describe('deleteClaime(response)', () => {
|
||||||
it('should perform a query and call showSuccess if the response is ACCEPT', () => {
|
it('should perform a query and call showSuccess if the response is accept', () => {
|
||||||
let response = 'ACCEPT';
|
let response = 'accept';
|
||||||
controller.claim = {id: 2};
|
controller.claim = {id: 2};
|
||||||
|
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
|
@ -37,5 +37,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms(response)">
|
on-response="$ctrl.deleteDms($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -26,7 +26,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteDms(response) {
|
deleteDms(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const dmsFk = this.photos[this.dmsIndex].dmsFk;
|
const dmsFk = this.photos[this.dmsIndex].dmsFk;
|
||||||
const query = `claimDms/${dmsFk}/removeFile`;
|
const query = `claimDms/${dmsFk}/removeFile`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe('Claim', () => {
|
||||||
|
|
||||||
$httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({});
|
$httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({});
|
||||||
$httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`);
|
$httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`);
|
||||||
controller.deleteDms('ACCEPT');
|
controller.deleteDms('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
|
|
|
@ -128,5 +128,5 @@
|
||||||
|
|
||||||
<!-- New postcode dialog -->
|
<!-- New postcode dialog -->
|
||||||
<vn-client-postcode vn-id="postcode"
|
<vn-client-postcode vn-id="postcode"
|
||||||
on-response="$ctrl.onResponse(response)">
|
on-response="$ctrl.onResponse($response)">
|
||||||
</vn-client-postcode>
|
</vn-client-postcode>
|
||||||
|
|
|
@ -174,6 +174,6 @@
|
||||||
|
|
||||||
<!-- New postcode dialog -->
|
<!-- New postcode dialog -->
|
||||||
<vn-client-postcode vn-id="postcode"
|
<vn-client-postcode vn-id="postcode"
|
||||||
on-response="$ctrl.onResponse(response)">
|
on-response="$ctrl.onResponse($response)">
|
||||||
</vn-client-postcode>
|
</vn-client-postcode>
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="bankEntityDialog"
|
vn-id="bankEntityDialog"
|
||||||
on-open="$ctrl.onBankEntityOpen()"
|
on-open="$ctrl.onBankEntityOpen()"
|
||||||
on-response="$ctrl.onBankEntityResponse(response)">
|
on-response="$ctrl.onBankEntityResponse($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<h5 class="vn-py-sm" translate>New bank entity</h5>
|
<h5 class="vn-py-sm" translate>New bank entity</h5>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Create</button>
|
<button response="accept" translate>Create</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
|
@ -55,7 +55,7 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBankEntityResponse(response) {
|
onBankEntityResponse(response) {
|
||||||
if (response == 'ACCEPT') {
|
if (response == 'accept') {
|
||||||
try {
|
try {
|
||||||
if (!this.newBankEntity.name)
|
if (!this.newBankEntity.name)
|
||||||
throw new Error(`Name can't be empty`);
|
throw new Error(`Name can't be empty`);
|
||||||
|
|
|
@ -53,7 +53,7 @@ describe('Client', () => {
|
||||||
countryFk: 1,
|
countryFk: 1,
|
||||||
id: 999
|
id: 999
|
||||||
};
|
};
|
||||||
controller.onBankEntityResponse('ACCEPT');
|
controller.onBankEntityResponse('accept');
|
||||||
|
|
||||||
expect(vnApp.showError).toHaveBeenCalledWith(`Name can't be empty`);
|
expect(vnApp.showError).toHaveBeenCalledWith(`Name can't be empty`);
|
||||||
});
|
});
|
||||||
|
@ -65,7 +65,7 @@ describe('Client', () => {
|
||||||
countryFk: 1,
|
countryFk: 1,
|
||||||
id: 999
|
id: 999
|
||||||
};
|
};
|
||||||
controller.onBankEntityResponse('ACCEPT');
|
controller.onBankEntityResponse('accept');
|
||||||
|
|
||||||
expect(vnApp.showError).toHaveBeenCalledWith(`Swift / BIC can't be empty`);
|
expect(vnApp.showError).toHaveBeenCalledWith(`Swift / BIC can't be empty`);
|
||||||
});
|
});
|
||||||
|
@ -80,7 +80,7 @@ describe('Client', () => {
|
||||||
controller.newBankEntity = newBankEntity;
|
controller.newBankEntity = newBankEntity;
|
||||||
$httpBackend.when('POST', 'BankEntities').respond('done');
|
$httpBackend.when('POST', 'BankEntities').respond('done');
|
||||||
$httpBackend.expectPOST('BankEntities', newBankEntity);
|
$httpBackend.expectPOST('BankEntities', newBankEntity);
|
||||||
controller.onBankEntityResponse('ACCEPT');
|
controller.onBankEntityResponse('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -149,6 +149,6 @@
|
||||||
|
|
||||||
<!-- New postcode dialog -->
|
<!-- New postcode dialog -->
|
||||||
<vn-client-postcode vn-id="postcode"
|
<vn-client-postcode vn-id="postcode"
|
||||||
on-response="$ctrl.onResponse(response)">
|
on-response="$ctrl.onResponse($response)">
|
||||||
</vn-client-postcode>
|
</vn-client-postcode>
|
||||||
</div>
|
</div>
|
|
@ -60,7 +60,7 @@
|
||||||
</vn-float-button>
|
</vn-float-button>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="close-contract"
|
vn-id="close-contract"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
question="Close contract"
|
question="Close contract"
|
||||||
message="Are you sure you want to close this contract?">
|
message="Are you sure you want to close this contract?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -56,7 +56,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
let params = {finished: Date.now()};
|
let params = {finished: Date.now()};
|
||||||
this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => {
|
this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => {
|
||||||
this._getClassifications(this.client.id);
|
this._getClassifications(this.client.id);
|
||||||
|
|
|
@ -76,7 +76,7 @@ describe('Client', () => {
|
||||||
controller.classificationId = 1;
|
controller.classificationId = 1;
|
||||||
$httpBackend.when('PATCH', `CreditClassifications/1`).respond(200);
|
$httpBackend.when('PATCH', `CreditClassifications/1`).respond(200);
|
||||||
$httpBackend.expect('PATCH', `CreditClassifications/1`);
|
$httpBackend.expect('PATCH', `CreditClassifications/1`);
|
||||||
controller.returnDialog('ACCEPT');
|
controller.returnDialog('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller._getClassifications).toHaveBeenCalledWith(101);
|
expect(controller._getClassifications).toHaveBeenCalledWith(101);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</form>
|
</form>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirmation"
|
vn-id="confirmation"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
question="Esta modificación retrasará el plazo del próximo recobro"
|
question="Esta modificación retrasará el plazo del próximo recobro"
|
||||||
message="¿Desea continuar?">
|
message="¿Desea continuar?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
if (response === 'ACCEPT')
|
if (response === 'accept')
|
||||||
this.addCredit();
|
this.addCredit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,9 +72,9 @@ describe('Client', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('returnDialog()', () => {
|
describe('returnDialog()', () => {
|
||||||
it('should call addCredit() when is called with ACCEPT', () => {
|
it('should call addCredit() when is called with accept', () => {
|
||||||
spyOn(controller, 'addCredit');
|
spyOn(controller, 'addCredit');
|
||||||
controller.returnDialog('ACCEPT');
|
controller.returnDialog('accept');
|
||||||
|
|
||||||
expect(controller.addCredit).toHaveBeenCalledWith();
|
expect(controller.addCredit).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
|
|
|
@ -113,5 +113,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms(response)">
|
on-response="$ctrl.deleteDms($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -60,7 +60,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteDms(response) {
|
deleteDms(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const dmsFk = this.clientDms[this.dmsIndex].dmsFk;
|
const dmsFk = this.clientDms[this.dmsIndex].dmsFk;
|
||||||
const query = `clientDms/${dmsFk}/removeFile`;
|
const query = `clientDms/${dmsFk}/removeFile`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('Client', () => {
|
||||||
|
|
||||||
$httpBackend.when('POST', `clientDms/${dmsId}/removeFile`).respond({});
|
$httpBackend.when('POST', `clientDms/${dmsId}/removeFile`).respond({});
|
||||||
$httpBackend.expect('POST', `clientDms/${dmsId}/removeFile`);
|
$httpBackend.expect('POST', `clientDms/${dmsId}/removeFile`);
|
||||||
controller.deleteDms('ACCEPT');
|
controller.deleteDms('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
|
|
|
@ -148,5 +148,5 @@
|
||||||
vn-id="propagate-isEqualizated"
|
vn-id="propagate-isEqualizated"
|
||||||
question="You changed the equalization tax"
|
question="You changed the equalization tax"
|
||||||
message="Do you want to spread the change?"
|
message="Do you want to spread the change?"
|
||||||
on-response="$ctrl.returnDialogEt(response)">
|
on-response="$ctrl.returnDialogEt($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -41,13 +41,13 @@ export default class Controller {
|
||||||
if (!equals && !this.oldHasToInvoiceByAddress)
|
if (!equals && !this.oldHasToInvoiceByAddress)
|
||||||
this.$.propagateIsEqualizated.show();
|
this.$.propagateIsEqualizated.show();
|
||||||
else if (!equals)
|
else if (!equals)
|
||||||
this.returnDialogEt('ACCEPT');
|
this.returnDialogEt('accept');
|
||||||
|
|
||||||
delete this.oldHasToInvoiceByAddress;
|
delete this.oldHasToInvoiceByAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnDialogEt(response) {
|
returnDialogEt(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.patch(`Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then(
|
this.$http.patch(`Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then(
|
||||||
res => {
|
res => {
|
||||||
if (res.data)
|
if (res.data)
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe('Client', () => {
|
||||||
controller.client = {id: 123, isEqualizated: false};
|
controller.client = {id: 123, isEqualizated: false};
|
||||||
$httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done');
|
$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});
|
$httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated});
|
||||||
controller.returnDialogEt('ACCEPT');
|
controller.returnDialogEt('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="postcodeDialog"
|
vn-id="postcodeDialog"
|
||||||
on-open="$ctrl.onOpen()"
|
on-open="$ctrl.onOpen()"
|
||||||
on-response="$ctrl.onResponse(response)">
|
on-response="$ctrl.onResponse($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<h5 class="vn-py-sm" translate>New postcode</h5>
|
<h5 class="vn-py-sm" translate>New postcode</h5>
|
||||||
<p translate>Please, ensure you put the correct data!</p>
|
<p translate>Please, ensure you put the correct data!</p>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Save</button>
|
<button response="accept" translate>Save</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
|
@ -36,7 +36,7 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onResponse(response) {
|
onResponse(response) {
|
||||||
if (response == 'ACCEPT') {
|
if (response == 'accept') {
|
||||||
try {
|
try {
|
||||||
if (!this.data.code)
|
if (!this.data.code)
|
||||||
throw new Error(`The postcode can't be empty`);
|
throw new Error(`The postcode can't be empty`);
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('Client', () => {
|
||||||
$httpBackend.when('PATCH', `postcodes`, params).respond(200, params);
|
$httpBackend.when('PATCH', `postcodes`, params).respond(200, params);
|
||||||
$httpBackend.expect('PATCH', `postcodes`, params).respond(params);
|
$httpBackend.expect('PATCH', `postcodes`, params).respond(params);
|
||||||
|
|
||||||
controller.onResponse('ACCEPT');
|
controller.onResponse('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The postcode has been saved');
|
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The postcode has been saved');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="SMSDialog"
|
vn-id="SMSDialog"
|
||||||
on-response="$ctrl.onResponse(response)">
|
on-response="$ctrl.onResponse($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<h5 class="vn-py-sm" translate>Send SMS</h5>
|
<h5 class="vn-py-sm" translate>Send SMS</h5>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Send</button>
|
<button response="accept" translate>Send</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
|
@ -17,7 +17,7 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onResponse(response) {
|
onResponse(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.post(`Sms/send`, this.sms).then(res => {
|
this.$http.post(`Sms/send`, this.sms).then(res => {
|
||||||
this.vnApp.showMessage(this.$translate.instant('SMS sent!'));
|
this.vnApp.showMessage(this.$translate.instant('SMS sent!'));
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('Client', () => {
|
||||||
$httpBackend.when('POST', `Sms/send`, params).respond(200, params);
|
$httpBackend.when('POST', `Sms/send`, params).respond(200, params);
|
||||||
$httpBackend.expect('POST', `Sms/send`, params).respond(params);
|
$httpBackend.expect('POST', `Sms/send`, params).respond(params);
|
||||||
|
|
||||||
controller.onResponse('ACCEPT');
|
controller.onResponse('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!');
|
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!');
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="change-pass"
|
vn-id="change-pass"
|
||||||
on-open="$ctrl.onPassOpen()"
|
on-open="$ctrl.onPassOpen()"
|
||||||
on-response="$ctrl.onPassChange(response)">
|
on-response="$ctrl.onPassChange($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
type="password"
|
type="password"
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Change password</button>
|
<button response="accept" translate>Change password</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPassChange(response) {
|
onPassChange(response) {
|
||||||
if (response == 'ACCEPT') {
|
if (response == 'accept') {
|
||||||
try {
|
try {
|
||||||
if (!this.newPassword)
|
if (!this.newPassword)
|
||||||
throw new Error(`You must enter a new password`);
|
throw new Error(`You must enter a new password`);
|
||||||
|
|
|
@ -73,7 +73,7 @@ describe('Component VnClientWebAccess', () => {
|
||||||
controller.canChangePassword = true;
|
controller.canChangePassword = true;
|
||||||
$httpBackend.when('PATCH', 'Accounts/1234').respond('done');
|
$httpBackend.when('PATCH', 'Accounts/1234').respond('done');
|
||||||
$httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'});
|
$httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'});
|
||||||
controller.onPassChange('ACCEPT');
|
controller.onPassChange('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ describe('Component VnClientWebAccess', () => {
|
||||||
controller.client = {id: '1234'};
|
controller.client = {id: '1234'};
|
||||||
controller.newPassword = '';
|
controller.newPassword = '';
|
||||||
controller.canChangePassword = true;
|
controller.canChangePassword = true;
|
||||||
controller.onPassChange('ACCEPT');
|
controller.onPassChange('accept');
|
||||||
|
|
||||||
expect(vnApp.showError).toHaveBeenCalledWith(`You must enter a new password`);
|
expect(vnApp.showError).toHaveBeenCalledWith(`You must enter a new password`);
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,7 @@ describe('Component VnClientWebAccess', () => {
|
||||||
controller.newPassword = 'm24x8';
|
controller.newPassword = 'm24x8';
|
||||||
controller.canChangePassword = true;
|
controller.canChangePassword = true;
|
||||||
controller.repeatPassword = 'notMatchingPassword';
|
controller.repeatPassword = 'notMatchingPassword';
|
||||||
controller.onPassChange('ACCEPT');
|
controller.onPassChange('accept');
|
||||||
|
|
||||||
expect(vnApp.showError).toHaveBeenCalledWith(`Passwords don't match`);
|
expect(vnApp.showError).toHaveBeenCalledWith(`Passwords don't match`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,11 +40,11 @@
|
||||||
</div>
|
</div>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="deleteConfirmation"
|
vn-id="deleteConfirmation"
|
||||||
on-response="$ctrl.deleteInvoiceOut(response)"
|
on-response="$ctrl.deleteInvoiceOut($response)"
|
||||||
question="Are you sure you want to delete this invoice?">
|
question="Are you sure you want to delete this invoice?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="bookConfirmation"
|
vn-id="bookConfirmation"
|
||||||
on-response="$ctrl.bookInvoiceOut(response)"
|
on-response="$ctrl.bookInvoiceOut($response)"
|
||||||
question="Are you sure you want to book this invoice?">
|
question="Are you sure you want to book this invoice?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -66,7 +66,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteInvoiceOut(response) {
|
deleteInvoiceOut(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const query = `InvoiceOuts/${this.invoiceOut.id}/delete`;
|
const query = `InvoiceOuts/${this.invoiceOut.id}/delete`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('InvoiceOut deleted'));
|
this.vnApp.showSuccess(this.$translate.instant('InvoiceOut deleted'));
|
||||||
|
@ -76,7 +76,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
bookInvoiceOut(response) {
|
bookInvoiceOut(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const query = `InvoiceOuts/${this.invoiceOut.ref}/book`;
|
const query = `InvoiceOuts/${this.invoiceOut.ref}/book`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked'));
|
this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked'));
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="regularize"
|
vn-id="regularize"
|
||||||
on-open="$ctrl.clearRegularizeDialog()"
|
on-open="$ctrl.clearRegularizeDialog()"
|
||||||
on-response="$ctrl.saveRegularize(response)">
|
on-response="$ctrl.saveRegularize($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<div>
|
<div>
|
||||||
<h5 style="text-align: center">
|
<h5 style="text-align: center">
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
</div>
|
</div>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Save</button>
|
<button response="accept" translate>Save</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
|
@ -76,7 +76,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveRegularize(response) {
|
saveRegularize(response) {
|
||||||
if (response == 'ACCEPT') {
|
if (response == 'accept') {
|
||||||
this.$http.post(`Items/regularize`, {
|
this.$http.post(`Items/regularize`, {
|
||||||
itemFk: this.item.id,
|
itemFk: this.item.id,
|
||||||
quantity: this.quantity,
|
quantity: this.quantity,
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
</vn-popup>
|
</vn-popup>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="clone"
|
vn-id="clone"
|
||||||
on-response="$ctrl.onCloneAccept(response)"
|
on-response="$ctrl.onCloneAccept($response)"
|
||||||
question="Do you want to clone this item?"
|
question="Do you want to clone this item?"
|
||||||
message="All it's properties will be copied">
|
message="All it's properties will be copied">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onCloneAccept(response) {
|
onCloneAccept(response) {
|
||||||
if (!(response == 'ACCEPT' && this.itemSelected))
|
if (!(response == 'accept' && this.itemSelected))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.$http.post(`Items/${this.itemSelected.id}/clone`).then(res => {
|
this.$http.post(`Items/${this.itemSelected.id}/clone`).then(res => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('Item', () => {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('onCloneAccept()', () => {
|
describe('onCloneAccept()', () => {
|
||||||
it('should do nothing if response is not ACCEPT', () => {
|
it('should do nothing if response is not accept', () => {
|
||||||
spyOn(controller.$state, 'go');
|
spyOn(controller.$state, 'go');
|
||||||
|
|
||||||
let response = 'ERROR!';
|
let response = 'ERROR!';
|
||||||
|
@ -27,10 +27,10 @@ describe('Item', () => {
|
||||||
expect(controller.itemSelected).toEqual('check me');
|
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');
|
spyOn(controller.$state, 'go');
|
||||||
|
|
||||||
let response = 'ACCEPT';
|
let response = 'accept';
|
||||||
controller.itemSelected = undefined;
|
controller.itemSelected = undefined;
|
||||||
|
|
||||||
controller.onCloneAccept(response);
|
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', () => {
|
it('should perform a post query and then call go() then update itemSelected in the controller', () => {
|
||||||
spyOn(controller.$state, 'go');
|
spyOn(controller.$state, 'go');
|
||||||
|
|
||||||
let response = 'ACCEPT';
|
let response = 'accept';
|
||||||
controller.itemSelected = {id: 1};
|
controller.itemSelected = {id: 1};
|
||||||
|
|
||||||
$httpBackend.when('POST', `Items/1/clone`).respond({id: 99});
|
$httpBackend.when('POST', `Items/1/clone`).respond({id: 99});
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="denyReason"
|
vn-id="denyReason"
|
||||||
on-response="$ctrl.denyRequest(response)">
|
on-response="$ctrl.denyRequest($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<h5 class="vn-pa-md" translate>Specify the reasons to deny this request</h5>
|
<h5 class="vn-pa-md" translate>Specify the reasons to deny this request</h5>
|
||||||
<vn-horizontal class="vn-pa-md">
|
<vn-horizontal class="vn-pa-md">
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Save</button>
|
<button response="accept" translate>Save</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
|
@ -104,7 +104,7 @@ export default class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
denyRequest(response) {
|
denyRequest(response) {
|
||||||
if (response !== 'ACCEPT') return;
|
if (response !== 'accept') return;
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
observation: this.denyObservation
|
observation: this.denyObservation
|
||||||
|
|
|
@ -122,7 +122,7 @@ describe('Item', () => {
|
||||||
|
|
||||||
$httpBackend.when('POST', `TicketRequests/${request.id}/deny`).respond(expectedResult);
|
$httpBackend.when('POST', `TicketRequests/${request.id}/deny`).respond(expectedResult);
|
||||||
$httpBackend.expect('POST', `TicketRequests/${request.id}/deny`).respond(expectedResult);
|
$httpBackend.expect('POST', `TicketRequests/${request.id}/deny`).respond(expectedResult);
|
||||||
controller.denyRequest('ACCEPT');
|
controller.denyRequest('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
</div>
|
</div>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="deleteOrderConfirmation"
|
vn-id="deleteOrderConfirmation"
|
||||||
on-response="$ctrl.deleteOrder(response)"
|
on-response="$ctrl.deleteOrder($response)"
|
||||||
message="You are going to delete this order"
|
message="You are going to delete this order"
|
||||||
question="continue anyway?">
|
question="continue anyway?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -44,7 +44,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteOrder(response) {
|
deleteOrder(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const params = {id: this.order.id};
|
const params = {id: this.order.id};
|
||||||
this.$http.delete(`Orders/${params.id}`).then(() => {
|
this.$http.delete(`Orders/${params.id}`).then(() => {
|
||||||
this.$state.go('order.index');
|
this.$state.go('order.index');
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe('Order Component vnOrderDescriptor', () => {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('deleteOrder()', () => {
|
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!';
|
let response = 'WAGH!';
|
||||||
|
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
@ -24,8 +24,8 @@ describe('Order Component vnOrderDescriptor', () => {
|
||||||
expect(controller.$state.go).not.toHaveBeenCalledWith('order.index');
|
expect(controller.$state.go).not.toHaveBeenCalledWith('order.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should perform a DELETE query if the response was ACCEPT`, () => {
|
it(`should perform a DELETE query if the response was accept`, () => {
|
||||||
let response = 'ACCEPT';
|
let response = 'accept';
|
||||||
|
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
spyOn(controller.$state, 'go');
|
spyOn(controller.$state, 'go');
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-row"
|
vn-id="delete-row"
|
||||||
on-response="$ctrl.deleteRow(response)"
|
on-response="$ctrl.deleteRow($response)"
|
||||||
question="Delete row"
|
question="Delete row"
|
||||||
message="Are you sure you want to delete this row?">
|
message="Are you sure you want to delete this row?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -58,7 +58,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteRow(response) {
|
deleteRow(response) {
|
||||||
if (response == 'ACCEPT') {
|
if (response == 'accept') {
|
||||||
let [lineRemoved] = this.rows.splice(this.lineIdToRemove, 1);
|
let [lineRemoved] = this.rows.splice(this.lineIdToRemove, 1);
|
||||||
this.idsToRemove.push(lineRemoved.id);
|
this.idsToRemove.push(lineRemoved.id);
|
||||||
let params = {
|
let params = {
|
||||||
|
|
|
@ -48,12 +48,12 @@ describe('Order', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deleteRow()', () => {
|
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);
|
expect(controller.rows.length).toBe(1);
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
spyOn(controller, 'getVAT');
|
spyOn(controller, 'getVAT');
|
||||||
spyOn(controller.card, 'reload');
|
spyOn(controller.card, 'reload');
|
||||||
controller.deleteRow('ACCEPT');
|
controller.deleteRow('accept');
|
||||||
|
|
||||||
$httpBackend.expectPOST(`OrderRows/removes`).respond();
|
$httpBackend.expectPOST(`OrderRows/removes`).respond();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
|
@ -53,6 +53,6 @@
|
||||||
</div>
|
</div>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="updateVolumeConfirmation"
|
vn-id="updateVolumeConfirmation"
|
||||||
on-response="$ctrl.updateVolume(response)"
|
on-response="$ctrl.updateVolume($response)"
|
||||||
question="Are you sure you want to update the volume?">
|
question="Are you sure you want to update the volume?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -52,7 +52,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateVolume(response) {
|
updateVolume(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
let url = `Routes/${this.route.id}/updateVolume`;
|
let url = `Routes/${this.route.id}/updateVolume`;
|
||||||
this.$http.post(url).then(() => {
|
this.$http.post(url).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Volume updated'));
|
this.vnApp.showSuccess(this.$translate.instant('Volume updated'));
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
question="Delete ticket from route?"
|
question="Delete ticket from route?"
|
||||||
on-response="$ctrl.removeTicketFromRoute(response)">
|
on-response="$ctrl.removeTicketFromRoute($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="possibleTicketsModel"
|
vn-id="possibleTicketsModel"
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="possibleTicketsDialog"
|
vn-id="possibleTicketsDialog"
|
||||||
on-response="$ctrl.setTicketsRoute(response)">
|
on-response="$ctrl.setTicketsRoute($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<section class="header vn-pa-md">
|
<section class="header vn-pa-md">
|
||||||
<h5><span translate>Tickets to add</span></h5>
|
<h5><span translate>Tickets to add</span></h5>
|
||||||
|
@ -166,8 +166,8 @@
|
||||||
</vn-data-viewer>
|
</vn-data-viewer>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Add</button>
|
<button response="accept" translate>Add</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
<vn-float-button
|
<vn-float-button
|
||||||
|
|
|
@ -105,7 +105,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTicketFromRoute(response) {
|
removeTicketFromRoute(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
let params = {routeFk: null};
|
let params = {routeFk: null};
|
||||||
let query = `Tickets/${this.selectedTicket}/`;
|
let query = `Tickets/${this.selectedTicket}/`;
|
||||||
this.$http.patch(query, params).then(() => {
|
this.$http.patch(query, params).then(() => {
|
||||||
|
@ -151,7 +151,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
setTicketsRoute(response) {
|
setTicketsRoute(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
let tickets = this.getSelectedItems(this.possibleTickets);
|
let tickets = this.getSelectedItems(this.possibleTickets);
|
||||||
|
|
||||||
for (let i = 0; i < tickets.length; i++) {
|
for (let i = 0; i < tickets.length; i++) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ describe('Route', () => {
|
||||||
controller.selectedTicket = ticketId;
|
controller.selectedTicket = ticketId;
|
||||||
|
|
||||||
$httpBackend.expectPATCH(`Tickets/${ticketId}/`).respond('ok');
|
$httpBackend.expectPATCH(`Tickets/${ticketId}/`).respond('ok');
|
||||||
controller.removeTicketFromRoute('ACCEPT');
|
controller.removeTicketFromRoute('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket removed from route');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket removed from route');
|
||||||
|
@ -273,14 +273,14 @@ describe('Route', () => {
|
||||||
{id: 5, routeFk: 111}
|
{id: 5, routeFk: 111}
|
||||||
];
|
];
|
||||||
|
|
||||||
controller.setTicketsRoute('ACCEPT').then(() => {
|
controller.setTicketsRoute('accept').then(() => {
|
||||||
expect(controller.$.model.data).toEqual(expectedResult);
|
expect(controller.$.model.data).toEqual(expectedResult);
|
||||||
done();
|
done();
|
||||||
}).catch(done.fail);
|
}).catch(done.fail);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should just return a promise', () => {
|
it('should just return a promise', () => {
|
||||||
expect(controller.setTicketsRoute('CANCEL')).toEqual(jasmine.any(Promise));
|
expect(controller.setTicketsRoute('cancel')).toEqual(jasmine.any(Promise));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
</vn-popup>
|
</vn-popup>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="deleteConfirmation"
|
vn-id="deleteConfirmation"
|
||||||
on-response="$ctrl.deleteTicket(response)"
|
on-response="$ctrl.deleteTicket($response)"
|
||||||
question="You are going to delete this ticket"
|
question="You are going to delete this ticket"
|
||||||
message="This ticket will be removed from current route! Continue anyway?">
|
message="This ticket will be removed from current route! Continue anyway?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
@ -146,13 +146,13 @@
|
||||||
</vn-remove-stowaway>
|
</vn-remove-stowaway>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm-dialog"
|
vn-id="confirm-dialog"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
question="Pickup order"
|
question="Pickup order"
|
||||||
message="Do you want to send it directly?">
|
message="Do you want to send it directly?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="changeShippedDialog"
|
vn-id="changeShippedDialog"
|
||||||
on-response="$ctrl.changeShipped(response)">
|
on-response="$ctrl.changeShipped($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<div>
|
<div>
|
||||||
<h5 style="text-align: center">
|
<h5 style="text-align: center">
|
||||||
|
@ -168,15 +168,15 @@
|
||||||
</div>
|
</div>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Save</button>
|
<button response="accept" translate>Save</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
|
|
||||||
<!-- Make invoice dialog -->
|
<!-- Make invoice dialog -->
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="makeInvoiceConfirmation"
|
vn-id="makeInvoiceConfirmation"
|
||||||
on-response="$ctrl.makeInvoice(response)"
|
on-response="$ctrl.makeInvoice($response)"
|
||||||
question="You are going to invoice this ticket"
|
question="You are going to invoice this ticket"
|
||||||
message="Are you sure you want to invoice this ticket?">
|
message="Are you sure you want to invoice this ticket?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
<!-- Regenerate invoice dialog -->
|
<!-- Regenerate invoice dialog -->
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="regenerateInvoiceConfirmation"
|
vn-id="regenerateInvoiceConfirmation"
|
||||||
on-response="$ctrl.regenerateInvoice(response)"
|
on-response="$ctrl.regenerateInvoice($response)"
|
||||||
question="You are going to regenerate the invoice"
|
question="You are going to regenerate the invoice"
|
||||||
message="Are you sure you want to regenerate the invoice?">
|
message="Are you sure you want to regenerate the invoice?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
@ -197,7 +197,7 @@
|
||||||
|
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm-delivery-note"
|
vn-id="confirm-delivery-note"
|
||||||
on-response="$ctrl.sendDeliveryNote(response)"
|
on-response="$ctrl.sendDeliveryNote($response)"
|
||||||
question="Send Delivery Note"
|
question="Send Delivery Note"
|
||||||
message="Are you sure you want to send it?">
|
message="Are you sure you want to send it?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -50,7 +50,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeShipped(response) {
|
changeShipped(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
let data = {shipped: this.newShipped};
|
let data = {shipped: this.newShipped};
|
||||||
let query = `Tickets/${this.ticket.id}/updateEditableTicket`;
|
let query = `Tickets/${this.ticket.id}/updateEditableTicket`;
|
||||||
this.$http.post(query, data).then(() => {
|
this.$http.post(query, data).then(() => {
|
||||||
|
@ -137,7 +137,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTicket(response) {
|
deleteTicket(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const query = `Tickets/${this.ticket.id}/setDeleted`;
|
const query = `Tickets/${this.ticket.id}/setDeleted`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
this.$state.go('ticket.index');
|
this.$state.go('ticket.index');
|
||||||
|
@ -229,7 +229,7 @@ class Controller {
|
||||||
* @param {String} response - Response result
|
* @param {String} response - Response result
|
||||||
*/
|
*/
|
||||||
makeInvoice(response) {
|
makeInvoice(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const query = `Tickets/${this.ticket.id}/makeInvoice`;
|
const query = `Tickets/${this.ticket.id}/makeInvoice`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Ticket invoiced'));
|
this.vnApp.showSuccess(this.$translate.instant('Ticket invoiced'));
|
||||||
|
@ -252,7 +252,7 @@ class Controller {
|
||||||
* @param {String} response - Response result
|
* @param {String} response - Response result
|
||||||
*/
|
*/
|
||||||
regenerateInvoice(response) {
|
regenerateInvoice(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const invoiceId = this.ticket.invoiceOut.id;
|
const invoiceId = this.ticket.invoiceOut.id;
|
||||||
const query = `InvoiceOuts/${invoiceId}/regenerate`;
|
const query = `InvoiceOuts/${invoiceId}/regenerate`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
|
@ -277,7 +277,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendDeliveryNote(response) {
|
sendDeliveryNote(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.post(`email/delivery-note`, {ticketFk: this.ticket.id}).then(
|
this.$http.post(`email/delivery-note`, {ticketFk: this.ticket.id}).then(
|
||||||
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
||||||
);
|
);
|
||||||
|
|
|
@ -66,12 +66,12 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deleteTicket()', () => {
|
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.$state, 'go');
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
$httpBackend.expectPOST(`Tickets/2/setDeleted`).respond();
|
$httpBackend.expectPOST(`Tickets/2/setDeleted`).respond();
|
||||||
controller.deleteTicket('ACCEPT');
|
controller.deleteTicket('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$state.go).toHaveBeenCalledWith('ticket.index');
|
expect(controller.$state.go).toHaveBeenCalledWith('ticket.index');
|
||||||
|
@ -90,13 +90,13 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('makeInvoice()', () => {
|
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.$state, 'reload');
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
$httpBackend.when('POST', 'Tickets/2/makeInvoice').respond();
|
$httpBackend.when('POST', 'Tickets/2/makeInvoice').respond();
|
||||||
$httpBackend.expect('POST', 'Tickets/2/makeInvoice').respond();
|
$httpBackend.expect('POST', 'Tickets/2/makeInvoice').respond();
|
||||||
controller.makeInvoice('ACCEPT');
|
controller.makeInvoice('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket invoiced');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket invoiced');
|
||||||
|
@ -105,12 +105,12 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('regenerateInvoice()', () => {
|
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');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
$httpBackend.when('POST', 'InvoiceOuts/1/regenerate').respond();
|
$httpBackend.when('POST', 'InvoiceOuts/1/regenerate').respond();
|
||||||
$httpBackend.expect('POST', 'InvoiceOuts/1/regenerate').respond();
|
$httpBackend.expect('POST', 'InvoiceOuts/1/regenerate').respond();
|
||||||
controller.regenerateInvoice('ACCEPT');
|
controller.regenerateInvoice('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Invoice sent for a regeneration, will be available in a few minutes');
|
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()', () => {
|
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;
|
controller.ticket.id = 12;
|
||||||
spyOn(controller.vnApp, 'showSuccess');
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
spyOn(controller, 'cardReload');
|
spyOn(controller, 'cardReload');
|
||||||
|
|
||||||
$httpBackend.when('POST', 'Tickets/12/updateEditableTicket').respond();
|
$httpBackend.when('POST', 'Tickets/12/updateEditableTicket').respond();
|
||||||
$httpBackend.expect('POST', 'Tickets/12/updateEditableTicket').respond();
|
$httpBackend.expect('POST', 'Tickets/12/updateEditableTicket').respond();
|
||||||
controller.changeShipped('ACCEPT');
|
controller.changeShipped('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Shipped hour updated');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Shipped hour updated');
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirmation-dialog"
|
vn-id="confirmation-dialog"
|
||||||
on-response="$ctrl.deleteStowaway(response)"
|
on-response="$ctrl.deleteStowaway($response)"
|
||||||
question="Delete stowaway"
|
question="Delete stowaway"
|
||||||
message="Are you sure you want to delete this stowaway?">
|
message="Are you sure you want to delete this stowaway?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -44,7 +44,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteStowaway(response) {
|
deleteStowaway(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.delete(`Stowaways/${this.stowawayToDelete.id}`).then(res => {
|
this.$http.delete(`Stowaways/${this.stowawayToDelete.id}`).then(res => {
|
||||||
this.cardReload();
|
this.cardReload();
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
|
|
|
@ -111,5 +111,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms(response)">
|
on-response="$ctrl.deleteDms($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -60,7 +60,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteDms(response) {
|
deleteDms(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
const dmsFk = this.ticketDms[this.dmsIndex].dmsFk;
|
const dmsFk = this.ticketDms[this.dmsIndex].dmsFk;
|
||||||
const query = `ticketDms/${dmsFk}/removeFile`;
|
const query = `ticketDms/${dmsFk}/removeFile`;
|
||||||
this.$http.post(query).then(() => {
|
this.$http.post(query).then(() => {
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
$httpBackend.when('POST', `ticketDms/${dmsId}/removeFile`).respond({});
|
$httpBackend.when('POST', `ticketDms/${dmsId}/removeFile`).respond({});
|
||||||
$httpBackend.expect('POST', `ticketDms/${dmsId}/removeFile`);
|
$httpBackend.expect('POST', `ticketDms/${dmsId}/removeFile`);
|
||||||
controller.deleteDms('ACCEPT');
|
controller.deleteDms('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-expedition"
|
vn-id="delete-expedition"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
question="Delete expedition"
|
question="Delete expedition"
|
||||||
message="Are you sure you want to delete this expedition?">
|
message="Are you sure you want to delete this expedition?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -13,7 +13,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.delete(`Expeditions/${this.expeditionId}`).then(
|
this.$http.delete(`Expeditions/${this.expeditionId}`).then(
|
||||||
() => this.$.model.refresh()
|
() => this.$.model.refresh()
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('Ticket', () => {
|
||||||
it('should perform a DELETE query', () => {
|
it('should perform a DELETE query', () => {
|
||||||
spyOn($scope.model, 'refresh');
|
spyOn($scope.model, 'refresh');
|
||||||
|
|
||||||
let response = 'ACCEPT';
|
let response = 'accept';
|
||||||
controller.expeditionId = 1;
|
controller.expeditionId = 1;
|
||||||
|
|
||||||
$httpBackend.when('DELETE', `Expeditions/1`).respond(200);
|
$httpBackend.when('DELETE', `Expeditions/1`).respond(200);
|
||||||
|
|
|
@ -380,12 +380,12 @@
|
||||||
vn-id="delete-lines"
|
vn-id="delete-lines"
|
||||||
question="You are going to delete lines of the ticket"
|
question="You are going to delete lines of the ticket"
|
||||||
message="Continue anyway?"
|
message="Continue anyway?"
|
||||||
on-response="$ctrl.onRemoveLinesClick(response)">
|
on-response="$ctrl.onRemoveLinesClick($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-ticket"
|
vn-id="delete-ticket"
|
||||||
question="Do you want to delete it?"
|
question="Do you want to delete it?"
|
||||||
message="This ticket is now empty"
|
message="This ticket is now empty"
|
||||||
on-response="$ctrl.transferSales($ctrl.transfer.ticketId, response)">
|
on-response="$ctrl.transferSales($ctrl.transfer.ticketId, $response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -214,7 +214,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveLinesClick(response) {
|
onRemoveLinesClick(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
let sales = this.checkedLines();
|
let sales = this.checkedLines();
|
||||||
|
|
||||||
// Remove unsaved instances
|
// Remove unsaved instances
|
||||||
|
|
|
@ -140,7 +140,7 @@ describe('Ticket', () => {
|
||||||
$httpBackend.whenGET(`Tickets/1/subtotal`).respond(200, 227.5);
|
$httpBackend.whenGET(`Tickets/1/subtotal`).respond(200, 227.5);
|
||||||
$httpBackend.whenGET(`Tickets/1/getVAT`).respond(200, 10.5);
|
$httpBackend.whenGET(`Tickets/1/getVAT`).respond(200, 10.5);
|
||||||
$httpBackend.whenGET(`Tickets/1/isEditable`).respond();
|
$httpBackend.whenGET(`Tickets/1/isEditable`).respond();
|
||||||
controller.onRemoveLinesClick('ACCEPT');
|
controller.onRemoveLinesClick('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.sales.length).toEqual(1);
|
expect(controller.sales.length).toEqual(1);
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="createServiceTypeDialog"
|
vn-id="createServiceTypeDialog"
|
||||||
on-open="$ctrl.onNewServiceTypeOpen()"
|
on-open="$ctrl.onNewServiceTypeOpen()"
|
||||||
on-response="$ctrl.onNewServiceTypeResponse(response)">
|
on-response="$ctrl.onNewServiceTypeResponse($response)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<h5 class="vn-py-sm" translate>New service type</h5>
|
<h5 class="vn-py-sm" translate>New service type</h5>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="ACCEPT" translate>Create</button>
|
<button response="accept" translate>Create</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
|
@ -51,7 +51,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewServiceTypeResponse(response) {
|
onNewServiceTypeResponse(response) {
|
||||||
if (response == 'ACCEPT') {
|
if (response == 'accept') {
|
||||||
if (!this.newServiceType.name)
|
if (!this.newServiceType.name)
|
||||||
throw new UserError(`Name can't be empty`);
|
throw new UserError(`Name can't be empty`);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe('Ticket component vnTicketService', () => {
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
try {
|
try {
|
||||||
controller.onNewServiceTypeResponse('ACCEPT');
|
controller.onNewServiceTypeResponse('accept');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e.message;
|
error = e.message;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ describe('Ticket component vnTicketService', () => {
|
||||||
controller.currentServiceIndex = 0;
|
controller.currentServiceIndex = 0;
|
||||||
|
|
||||||
$httpBackend.when('POST', 'TicketServiceTypes').respond({id: 4001, name: 'great service!'});
|
$httpBackend.when('POST', 'TicketServiceTypes').respond({id: 4001, name: 'great service!'});
|
||||||
controller.onNewServiceTypeResponse('ACCEPT');
|
controller.onNewServiceTypeResponse('accept');
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.services[0].description).toEqual('great service!');
|
expect(controller.services[0].description).toEqual('great service!');
|
||||||
|
|
|
@ -66,6 +66,6 @@
|
||||||
|
|
||||||
<!-- New postcode dialog -->
|
<!-- New postcode dialog -->
|
||||||
<vn-client-postcode vn-id="postcode"
|
<vn-client-postcode vn-id="postcode"
|
||||||
on-response="$ctrl.onResponse(response)">
|
on-response="$ctrl.onResponse($response)">
|
||||||
</vn-client-postcode>
|
</vn-client-postcode>
|
||||||
</div>
|
</div>
|
|
@ -93,7 +93,7 @@
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="deleteWeekly"
|
vn-id="deleteWeekly"
|
||||||
on-response="$ctrl.returnDialog(response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
question="This ticket will be removed from weekly tickets! Continue anyway?"
|
question="This ticket will be removed from weekly tickets! Continue anyway?"
|
||||||
message="You are going to delete this weekly ticket">
|
message="You are going to delete this weekly ticket">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
|
@ -76,7 +76,7 @@ export default class Controller {
|
||||||
|
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
const ticket = this.$.model.data[this.ticketIndex];
|
const ticket = this.$.model.data[this.ticketIndex];
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'accept') {
|
||||||
this.$http.delete(`TicketWeeklies/${ticket.ticketFk}`).then(() => {
|
this.$http.delete(`TicketWeeklies/${ticket.ticketFk}`).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
this.$.model.remove(this.ticketIndex);
|
this.$.model.remove(this.ticketIndex);
|
||||||
|
|
|
@ -27,13 +27,19 @@
|
||||||
{{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}}
|
{{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="vn-pt-md">
|
<div class="vn-pt-md" style="overflow: hidden;">
|
||||||
<vn-chip ng-repeat="absenceType in absenceTypes">
|
<vn-chip ng-repeat="absenceType in absenceTypes">
|
||||||
<vn-avatar
|
<vn-avatar
|
||||||
ng-style="{backgroundColor: absenceType.rgb}">
|
ng-style="{backgroundColor: absenceType.rgb}">
|
||||||
</vn-avatar>
|
</vn-avatar>
|
||||||
{{absenceType.name}}
|
{{absenceType.name}}
|
||||||
</vn-chip>
|
</vn-chip>
|
||||||
|
<vn-chip>
|
||||||
|
<vn-avatar
|
||||||
|
ng-style="{backgroundColor: 'orange'}">
|
||||||
|
</vn-avatar>
|
||||||
|
My longer overflowing absence type in chip
|
||||||
|
</vn-chip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</vn-side-menu>
|
</vn-side-menu>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue