diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bc0135e40..b3b937f48 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -164,7 +164,7 @@ export default { newPaymentButton: `${components.vnFloatButton}`, newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentAmountInput: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `vn-client-risk-create vn-button[label="Save"]`, + saveButton: `${components.vnSubmit}`, firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, diff --git a/front/core/components/dialog/dialog.js b/front/core/components/dialog/dialog.js index 7ea588a27..fb904f2f0 100644 --- a/front/core/components/dialog/dialog.js +++ b/front/core/components/dialog/dialog.js @@ -47,6 +47,9 @@ export default class Dialog extends Component { if (this.onOpen) this.onOpen(); + + let firstFocusable = this.element.querySelector('input, textarea'); + if (firstFocusable) firstFocusable.focus(); } /** diff --git a/front/salix/styles/index.js b/front/salix/styles/index.js index 7f919436a..6149668b8 100644 --- a/front/salix/styles/index.js +++ b/front/salix/styles/index.js @@ -13,4 +13,3 @@ import './effects.scss'; import './order-product.scss'; import './summary.scss'; import './descriptor.scss'; -import './modal-form.scss'; diff --git a/modules/client/front/risk/create/index.html b/modules/client/front/risk/create/index.html index 950d54a52..095d16986 100644 --- a/modules/client/front/risk/create/index.html +++ b/modules/client/front/risk/create/index.html @@ -1,45 +1,44 @@ - - - - -
New payment
+ + + +
+ + + + + + -
- - - - - - - - - - - - -
- - - + + + + + - - \ No newline at end of file +
+ + + + +
\ No newline at end of file diff --git a/modules/client/front/risk/create/index.js b/modules/client/front/risk/create/index.js index 11e701791..a828d7264 100644 --- a/modules/client/front/risk/create/index.js +++ b/modules/client/front/risk/create/index.js @@ -1,13 +1,11 @@ import ngModule from '../../module'; -import './style.scss'; class Controller { - constructor($scope, $state, $http, vnApp, $translate) { + constructor($scope, $state, $http, $stateParams) { this.$http = $http; this.$ = $scope; this.$state = $state; - this.vnApp = vnApp; - this.$translate = $translate; + this.$stateParams = $stateParams; this.receipt = { payed: new Date(), @@ -15,26 +13,21 @@ class Controller { companyFk: window.localStorage.defaultCompanyFk, bankFk: window.localStorage.defaultBankFk }; + + if (this.$stateParams.payed) + this.receipt.payed = this.$stateParams.payed; + + if (this.$stateParams.bankFk) + this.receipt.bankFk = this.$stateParams.bankFk; + + if (this.$stateParams.amountPaid) + this.receipt.amountPaid = this.$stateParams.amountPaid; + + if (this.$stateParams.companyFk) + this.receipt.companyFk = this.$stateParams.companyFk; } - set payed(value) { - this.receipt.payed = value; - } - - set bankFk(value) { - this.receipt.bankFk = value; - } - - set amountPaid(value) { - this.receipt.amountPaid = value; - } - - set companyFk(value) { - this.receipt.companyFk = value; - this.getAmountPaid(); - } - - getAmountPaid() { + $onInit() { let filter = { where: { clientFk: this.$state.params.id, @@ -48,34 +41,25 @@ class Controller { }); } - show() { - this.$.dialog.show(); + cancel() { + this.goToIndex(); } - hide() { - this.$.dialog.hide(); + goToIndex() { + this.$state.go('client.card.risk.index'); } - save() { - let query = `/client/api/receipts`; - this.$http.post(query, this.receipt).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - this.hide(); - if (this.onResponse) - this.onResponse(); - }); + onSubmit() { + this.$.watcher.submit().then( + () => { + this.goToIndex(); + } + ); } } -Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; +Controller.$inject = ['$scope', '$state', '$http', '$stateParams']; ngModule.component('vnClientRiskCreate', { template: require('./index.html'), - controller: Controller, - bindings: { - payed: ' - - - - - - \ No newline at end of file + fixed-bottom-right> + + + diff --git a/modules/client/front/risk/index/index.js b/modules/client/front/risk/index/index.js index 6feea8b96..14c1be3b7 100644 --- a/modules/client/front/risk/index/index.js +++ b/modules/client/front/risk/index/index.js @@ -31,9 +31,6 @@ class Controller { setOrder(value) { this.params.params.companyFk = value; this.filter.where.companyFk = value; - } - - refresh() { this.$.model.refresh(); this.$.riskModel.refresh(); } @@ -58,14 +55,6 @@ class Controller { return this._risks; } - openCreateDialog() { - this.$.riskCreateDialog.companyFk = this.companyFk; - this.$.riskCreateDialog.onResponse = () => { - this.refresh(); - }; - this.$.riskCreateDialog.show(); - } - onDownload() { alert('Not implemented yet'); } diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 53f13eb1a..948994701 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -1,4 +1,5 @@ import ngModule from '../module'; +import './style.scss'; class Controller { constructor($state, $scope, $http, vnApp, $translate) { diff --git a/front/salix/styles/modal-form.scss b/modules/item/front/ticket-descriptor/style.scss similarity index 90% rename from front/salix/styles/modal-form.scss rename to modules/item/front/ticket-descriptor/style.scss index e353833e6..7c1a448d0 100644 --- a/front/salix/styles/modal-form.scss +++ b/modules/item/front/ticket-descriptor/style.scss @@ -1,9 +1,7 @@ @import 'colors'; -@import "./padding"; vn-dialog.modal-form { vn-horizontal.header{ - @extend .pad-small; background-color: $main-01; h5{ color: white; @@ -16,7 +14,7 @@ vn-dialog.modal-form { table { width: 100% } - & > div{ + &>div{ padding: 0!important; } vn-textfield {