parent
44893b57e7
commit
48bb876bea
|
@ -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)'
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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';
|
|
||||||
|
|
|
@ -1,45 +1,44 @@
|
||||||
<vn-dialog
|
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax>
|
||||||
vn-id="dialog"
|
<vn-watcher
|
||||||
class="modal-form">
|
vn-id="watcher"
|
||||||
<tpl-body>
|
data="$ctrl.receipt"
|
||||||
<mg-ajax path="/client/api/receipts" options="vnPost"></mg-ajax>
|
form="form"
|
||||||
<vn-horizontal class="header">
|
save="post">
|
||||||
<h5><span translate>New payment</span></h5>
|
</vn-watcher>
|
||||||
|
<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>
|
||||||
<div pad-medium>
|
<vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-textfield
|
||||||
<vn-date-picker vn-one
|
vn-one
|
||||||
label="Date"
|
margin-medium-right
|
||||||
model="$ctrl.receipt.payed"
|
label="Bank"
|
||||||
ini-options="{dateFormat: 'd-m-Y', time_24hr: true}">
|
field="$ctrl.receipt.bankFk">
|
||||||
</vn-date-picker>
|
</vn-textfield>
|
||||||
<vn-autocomplete vn-one
|
<vn-textfield
|
||||||
url="/api/Companies"
|
vn-one
|
||||||
label="Company"
|
margin-medium-right
|
||||||
show-field="code"
|
label="Amount"
|
||||||
value-field="id"
|
field="$ctrl.receipt.amountPaid"
|
||||||
field="$ctrl.receipt.companyFk">
|
vn-focus>
|
||||||
</vn-autocomplete>
|
</vn-textfield>
|
||||||
</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>
|
||||||
</tpl-body>
|
</vn-card>
|
||||||
</vn-dialog>
|
<vn-button-bar>
|
||||||
|
<vn-submit label="Save"></vn-submit>
|
||||||
|
<vn-button ng-click="$ctrl.cancel($event)" label="Cancel"></vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -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: '<?'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
vn-horizontal.buttons-bar{
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
|
@ -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-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>
|
||||||
ng-click="$ctrl.openCreateDialog()">
|
<vn-float-button
|
||||||
</vn-float-button>
|
vn-acl="administrative"
|
||||||
|
vn-acl-action="remove"
|
||||||
<vn-client-risk-create vn-id="riskCreateDialog">
|
icon="add">
|
||||||
</vn-client-risk-create>
|
</vn-float-button>
|
||||||
|
</a>
|
||||||
|
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -16,7 +14,7 @@ vn-dialog.modal-form {
|
||||||
table {
|
table {
|
||||||
width: 100%
|
width: 100%
|
||||||
}
|
}
|
||||||
& > div{
|
&>div{
|
||||||
padding: 0!important;
|
padding: 0!important;
|
||||||
}
|
}
|
||||||
vn-textfield {
|
vn-textfield {
|
Loading…
Reference in New Issue