Revert "#1012 claim.action"

This reverts commit 44893b57e7.
This commit is contained in:
Gerard 2019-02-05 16:42:28 +01:00
parent 44893b57e7
commit 48bb876bea
10 changed files with 83 additions and 116 deletions

View File

@ -164,7 +164,7 @@ export default {
newPaymentButton: `${components.vnFloatButton}`, newPaymentButton: `${components.vnFloatButton}`,
newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`,
newPaymentAmountInput: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.amountPaid"] 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)' firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
}, },

View File

@ -47,6 +47,9 @@ export default class Dialog extends Component {
if (this.onOpen) if (this.onOpen)
this.onOpen(); this.onOpen();
let firstFocusable = this.element.querySelector('input, textarea');
if (firstFocusable) firstFocusable.focus();
} }
/** /**

View File

@ -13,4 +13,3 @@ import './effects.scss';
import './order-product.scss'; import './order-product.scss';
import './summary.scss'; import './summary.scss';
import './descriptor.scss'; import './descriptor.scss';
import './modal-form.scss';

View File

@ -1,12 +1,12 @@
<vn-dialog
vn-id="dialog"
class="modal-form">
<tpl-body>
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax> <mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax>
<vn-horizontal class="header"> <vn-watcher
<h5><span translate>New payment</span></h5> vn-id="watcher"
</vn-horizontal> data="$ctrl.receipt"
<div pad-medium> form="form"
save="post">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" compact>
<vn-card pad-large>
<vn-horizontal> <vn-horizontal>
<vn-date-picker vn-one <vn-date-picker vn-one
label="Date" label="Date"
@ -36,10 +36,9 @@
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
</div> </vn-card>
<vn-horizontal margin-medium class="buttons-bar"> <vn-button-bar>
<vn-button vn-one label="Save" ng-click="$ctrl.save()"></vn-button> <vn-submit label="Save"></vn-submit>
<vn-button vn-one ng-click="$ctrl.hide()" label="Cancel"></vn-button> <vn-button ng-click="$ctrl.cancel($event)" label="Cancel"></vn-button>
</vn-horizontal> </vn-button-bar>
</tpl-body> </form>
</vn-dialog>

View File

@ -1,13 +1,11 @@
import ngModule from '../../module'; import ngModule from '../../module';
import './style.scss';
class Controller { class Controller {
constructor($scope, $state, $http, vnApp, $translate) { constructor($scope, $state, $http, $stateParams) {
this.$http = $http; this.$http = $http;
this.$ = $scope; this.$ = $scope;
this.$state = $state; this.$state = $state;
this.vnApp = vnApp; this.$stateParams = $stateParams;
this.$translate = $translate;
this.receipt = { this.receipt = {
payed: new Date(), payed: new Date(),
@ -15,26 +13,21 @@ class Controller {
companyFk: window.localStorage.defaultCompanyFk, companyFk: window.localStorage.defaultCompanyFk,
bankFk: window.localStorage.defaultBankFk 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) { $onInit() {
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() {
let filter = { let filter = {
where: { where: {
clientFk: this.$state.params.id, clientFk: this.$state.params.id,
@ -48,34 +41,25 @@ class Controller {
}); });
} }
show() { cancel() {
this.$.dialog.show(); this.goToIndex();
} }
hide() { goToIndex() {
this.$.dialog.hide(); this.$state.go('client.card.risk.index');
} }
save() { onSubmit() {
let query = `/client/api/receipts`; this.$.watcher.submit().then(
this.$http.post(query, this.receipt).then(() => { () => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.goToIndex();
this.hide(); }
if (this.onResponse) );
this.onResponse();
});
} }
} }
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; Controller.$inject = ['$scope', '$state', '$http', '$stateParams'];
ngModule.component('vnClientRiskCreate', { ngModule.component('vnClientRiskCreate', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller
bindings: {
payed: '<?',
bankFk: '<?',
amountPaid: '<?',
onResponse: '&?',
companyFk: '<?'
}
}); });

View File

@ -1,3 +0,0 @@
vn-horizontal.buttons-bar{
text-align: center;
}

View File

@ -94,16 +94,13 @@
<vn-pagination model="model"></vn-pagination> <vn-pagination model="model"></vn-pagination>
</vn-card> </vn-card>
</vn-vertical> </vn-vertical>
<a ui-sref="client.card.risk.create"
vn-tooltip="New payment"
vn-bind="+"
fixed-bottom-right>
<vn-float-button <vn-float-button
vn-acl="administrative" vn-acl="administrative"
vn-acl-action="remove" vn-acl-action="remove"
icon="add" icon="add">
vn-tooltip="New payment"
vn-bind="+"
fixed-bottom-right
ng-click="$ctrl.openCreateDialog()">
</vn-float-button> </vn-float-button>
</a>
<vn-client-risk-create vn-id="riskCreateDialog">
</vn-client-risk-create>

View File

@ -31,9 +31,6 @@ class Controller {
setOrder(value) { setOrder(value) {
this.params.params.companyFk = value; this.params.params.companyFk = value;
this.filter.where.companyFk = value; this.filter.where.companyFk = value;
}
refresh() {
this.$.model.refresh(); this.$.model.refresh();
this.$.riskModel.refresh(); this.$.riskModel.refresh();
} }
@ -58,14 +55,6 @@ class Controller {
return this._risks; return this._risks;
} }
openCreateDialog() {
this.$.riskCreateDialog.companyFk = this.companyFk;
this.$.riskCreateDialog.onResponse = () => {
this.refresh();
};
this.$.riskCreateDialog.show();
}
onDownload() { onDownload() {
alert('Not implemented yet'); alert('Not implemented yet');
} }

View File

@ -1,4 +1,5 @@
import ngModule from '../module'; import ngModule from '../module';
import './style.scss';
class Controller { class Controller {
constructor($state, $scope, $http, vnApp, $translate) { constructor($state, $scope, $http, vnApp, $translate) {

View File

@ -1,9 +1,7 @@
@import 'colors'; @import 'colors';
@import "./padding";
vn-dialog.modal-form { vn-dialog.modal-form {
vn-horizontal.header{ vn-horizontal.header{
@extend .pad-small;
background-color: $main-01; background-color: $main-01;
h5{ h5{
color: white; color: white;