#1012 claim.action
This commit is contained in:
parent
69edf3fc43
commit
44893b57e7
|
@ -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: `${components.vnSubmit}`,
|
saveButton: `vn-client-risk-create vn-button[label="Save"]`,
|
||||||
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)'
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,9 +47,6 @@ 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,3 +13,4 @@ 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';
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
@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;
|
||||||
|
@ -14,7 +16,7 @@ vn-dialog.modal-form {
|
||||||
table {
|
table {
|
||||||
width: 100%
|
width: 100%
|
||||||
}
|
}
|
||||||
&>div{
|
& > div{
|
||||||
padding: 0!important;
|
padding: 0!important;
|
||||||
}
|
}
|
||||||
vn-textfield {
|
vn-textfield {
|
|
@ -1,44 +1,45 @@
|
||||||
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax>
|
<vn-dialog
|
||||||
<vn-watcher
|
vn-id="dialog"
|
||||||
vn-id="watcher"
|
class="modal-form">
|
||||||
data="$ctrl.receipt"
|
<tpl-body>
|
||||||
form="form"
|
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax>
|
||||||
save="post">
|
<vn-horizontal class="header">
|
||||||
</vn-watcher>
|
<h5><span translate>New payment</span></h5>
|
||||||
<form name="form" ng-submit="$ctrl.onSubmit()" compact>
|
|
||||||
<vn-card pad-large>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-date-picker vn-one
|
|
||||||
label="Date"
|
|
||||||
model="$ctrl.receipt.payed"
|
|
||||||
ini-options="{dateFormat: 'd-m-Y', time_24hr: true}">
|
|
||||||
</vn-date-picker>
|
|
||||||
<vn-autocomplete vn-one
|
|
||||||
url="/api/Companies"
|
|
||||||
label="Company"
|
|
||||||
show-field="code"
|
|
||||||
value-field="id"
|
|
||||||
field="$ctrl.receipt.companyFk">
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<div pad-medium>
|
||||||
<vn-textfield
|
<vn-horizontal>
|
||||||
vn-one
|
<vn-date-picker vn-one
|
||||||
margin-medium-right
|
label="Date"
|
||||||
label="Bank"
|
model="$ctrl.receipt.payed"
|
||||||
field="$ctrl.receipt.bankFk">
|
ini-options="{dateFormat: 'd-m-Y', time_24hr: true}">
|
||||||
</vn-textfield>
|
</vn-date-picker>
|
||||||
<vn-textfield
|
<vn-autocomplete vn-one
|
||||||
vn-one
|
url="/api/Companies"
|
||||||
margin-medium-right
|
label="Company"
|
||||||
label="Amount"
|
show-field="code"
|
||||||
field="$ctrl.receipt.amountPaid"
|
value-field="id"
|
||||||
vn-focus>
|
field="$ctrl.receipt.companyFk">
|
||||||
</vn-textfield>
|
</vn-autocomplete>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
margin-medium-right
|
||||||
|
label="Bank"
|
||||||
|
field="$ctrl.receipt.bankFk">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
margin-medium-right
|
||||||
|
label="Amount"
|
||||||
|
field="$ctrl.receipt.amountPaid"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
</div>
|
||||||
|
<vn-horizontal margin-medium class="buttons-bar">
|
||||||
|
<vn-button vn-one label="Save" ng-click="$ctrl.save()"></vn-button>
|
||||||
|
<vn-button vn-one ng-click="$ctrl.hide()" label="Cancel"></vn-button>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-card>
|
</tpl-body>
|
||||||
<vn-button-bar>
|
</vn-dialog>
|
||||||
<vn-submit label="Save"></vn-submit>
|
|
||||||
<vn-button ng-click="$ctrl.cancel($event)" label="Cancel"></vn-button>
|
|
||||||
</vn-button-bar>
|
|
||||||
</form>
|
|
|
@ -1,11 +1,13 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($scope, $state, $http, $stateParams) {
|
constructor($scope, $state, $http, vnApp, $translate) {
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.$stateParams = $stateParams;
|
this.vnApp = vnApp;
|
||||||
|
this.$translate = $translate;
|
||||||
|
|
||||||
this.receipt = {
|
this.receipt = {
|
||||||
payed: new Date(),
|
payed: new Date(),
|
||||||
|
@ -13,21 +15,26 @@ 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
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() {
|
||||||
let filter = {
|
let filter = {
|
||||||
where: {
|
where: {
|
||||||
clientFk: this.$state.params.id,
|
clientFk: this.$state.params.id,
|
||||||
|
@ -41,25 +48,34 @@ class Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
show() {
|
||||||
this.goToIndex();
|
this.$.dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
goToIndex() {
|
hide() {
|
||||||
this.$state.go('client.card.risk.index');
|
this.$.dialog.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
save() {
|
||||||
this.$.watcher.submit().then(
|
let query = `/client/api/receipts`;
|
||||||
() => {
|
this.$http.post(query, this.receipt).then(() => {
|
||||||
this.goToIndex();
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
}
|
this.hide();
|
||||||
);
|
if (this.onResponse)
|
||||||
|
this.onResponse();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$scope', '$state', '$http', '$stateParams'];
|
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
||||||
|
|
||||||
ngModule.component('vnClientRiskCreate', {
|
ngModule.component('vnClientRiskCreate', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
payed: '<?',
|
||||||
|
bankFk: '<?',
|
||||||
|
amountPaid: '<?',
|
||||||
|
onResponse: '&?',
|
||||||
|
companyFk: '<?'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
vn-horizontal.buttons-bar{
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -94,13 +94,16 @@
|
||||||
<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-float-button
|
||||||
|
vn-acl="administrative"
|
||||||
|
vn-acl-action="remove"
|
||||||
|
icon="add"
|
||||||
vn-tooltip="New payment"
|
vn-tooltip="New payment"
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
fixed-bottom-right>
|
fixed-bottom-right
|
||||||
<vn-float-button
|
ng-click="$ctrl.openCreateDialog()">
|
||||||
vn-acl="administrative"
|
</vn-float-button>
|
||||||
vn-acl-action="remove"
|
|
||||||
icon="add">
|
<vn-client-risk-create vn-id="riskCreateDialog">
|
||||||
</vn-float-button>
|
</vn-client-risk-create>
|
||||||
</a>
|
|
|
@ -31,6 +31,9 @@ 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();
|
||||||
}
|
}
|
||||||
|
@ -55,6 +58,14 @@ 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');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue