This commit is contained in:
parent
2901ad2022
commit
7fd6c850d7
|
@ -90,7 +90,7 @@ export default {
|
||||||
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
|
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
|
||||||
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
|
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
|
||||||
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
|
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
|
||||||
newBankEntityCode: 'vn-client-billing-data > vn-dialog vn-textfield[label="Code"] input',
|
newBankEntityCode: 'vn-client-billing-data > vn-dialog vn-textfield[label="Entity Code"] input',
|
||||||
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
|
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
|
||||||
saveButton: `${components.vnSubmit}`
|
saveButton: `${components.vnSubmit}`
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
|
import Input from '../../lib/input';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller extends Input {
|
||||||
constructor($element) {
|
constructor($element, $scope) {
|
||||||
|
super($element, $scope);
|
||||||
this.$element = $element;
|
this.$element = $element;
|
||||||
this.input = $element[0].querySelector('input');
|
this.input = $element[0].querySelector('input');
|
||||||
}
|
}
|
||||||
|
@ -11,7 +13,7 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element'];
|
Controller.$inject = ['$element', '$scope'];
|
||||||
|
|
||||||
ngModule.component('vnSubmit', {
|
ngModule.component('vnSubmit', {
|
||||||
template: require('./submit.html'),
|
template: require('./submit.html'),
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables a clicked element while request is being processed
|
||||||
|
* Enables again when promise ends
|
||||||
|
*
|
||||||
|
* @param {Object} $parse
|
||||||
|
* @return {Object} The directive
|
||||||
|
*/
|
||||||
|
export function directive($parse) {
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
link: function($scope, $element, $attrs) {
|
||||||
|
const cb = $parse($attrs.vnHttpClick);
|
||||||
|
const element = $element[0];
|
||||||
|
$element.on('click', () => {
|
||||||
|
element.$ctrl.disabled = true;
|
||||||
|
|
||||||
|
cb($scope).finally(() => {
|
||||||
|
element.$ctrl.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
directive.$inject = ['$parse'];
|
||||||
|
|
||||||
|
ngModule.directive('vnHttpClick', directive);
|
|
@ -0,0 +1,37 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables a submitted form while request is being processed
|
||||||
|
* Enables again when promise ends
|
||||||
|
*
|
||||||
|
* @param {Object} $parse
|
||||||
|
* @return {Object} The directive
|
||||||
|
*/
|
||||||
|
export function directive($parse) {
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
link: function($scope, $element, $attrs) {
|
||||||
|
const cb = $parse($attrs.vnHttpSubmit);
|
||||||
|
const element = $element[0];
|
||||||
|
$element.on('submit', () => {
|
||||||
|
const selector = 'vn-textfield, vn-autocomplete, vn-submit';
|
||||||
|
const elements = element.querySelectorAll(selector);
|
||||||
|
const fields = angular.element(elements);
|
||||||
|
|
||||||
|
angular.forEach(fields, field => {
|
||||||
|
field.$ctrl.disabled = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
cb($scope).finally(() => {
|
||||||
|
angular.forEach(fields, field => {
|
||||||
|
field.$ctrl.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
directive.$inject = ['$parse'];
|
||||||
|
|
||||||
|
ngModule.directive('vnHttpSubmit', directive);
|
|
@ -13,3 +13,5 @@ import './title';
|
||||||
import './uvc';
|
import './uvc';
|
||||||
import './draggable';
|
import './draggable';
|
||||||
import './droppable';
|
import './droppable';
|
||||||
|
import './http-click';
|
||||||
|
import './http-submit';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
save="post">
|
save="post">
|
||||||
</vn-watcher>
|
</vn-watcher>
|
||||||
<div class="content-block">
|
<div class="content-block">
|
||||||
<form name="form" ng-submit="$ctrl.onSubmit()" compact>
|
<form name="form" vn-http-submit="$ctrl.onSubmit()" compact>
|
||||||
<vn-card pad-large>
|
<vn-card pad-large>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-two vn-focus
|
<vn-textfield vn-two vn-focus
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$scope.watcher.submit().then(res => {
|
return this.$scope.watcher.submit().then(res => {
|
||||||
this.$state.go('zone.card.location', {id: res.data.id});
|
this.$state.go('zone.card.location', {id: res.data.id});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<vn-tool-bar margin-medium-bottom>
|
<vn-tool-bar margin-medium-bottom>
|
||||||
<vn-button
|
<vn-button
|
||||||
label="Import claim"
|
label="Import claim"
|
||||||
ng-click="$ctrl.importToNewRefundTicket()"
|
vn-http-click="$ctrl.importToNewRefundTicket()"
|
||||||
vn-tooltip="Imports claim details">
|
vn-tooltip="Imports claim details">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
<vn-button
|
<vn-button
|
||||||
|
@ -115,11 +115,10 @@
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
{{$ctrl.resolvedStateText}}
|
|
||||||
<vn-button
|
<vn-button
|
||||||
label="Regularize"
|
label="Regularize"
|
||||||
ng-click="$ctrl.regularize()"
|
disabled="$ctrl.claim.claimStateFk == $ctrl.resolvedState"
|
||||||
disabled="$ctrl.claim.claimStateFk == $ctrl.resolvedState">
|
vn-http-click="$ctrl.regularize()">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
<!-- WIP
|
<!-- WIP
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Controller {
|
||||||
|
|
||||||
importToNewRefundTicket() {
|
importToNewRefundTicket() {
|
||||||
let query = `claim/api/ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`;
|
let query = `claim/api/ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`;
|
||||||
this.$http.post(query).then(() => {
|
return this.$http.post(query).then(() => {
|
||||||
this.$.model.refresh();
|
this.$.model.refresh();
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
});
|
});
|
||||||
|
@ -133,7 +133,7 @@ class Controller {
|
||||||
regularize() {
|
regularize() {
|
||||||
let data = {claimFk: this.$stateParams.id};
|
let data = {claimFk: this.$stateParams.id};
|
||||||
let query = `/claim/api/Claims/regularizeClaim`;
|
let query = `/claim/api/Claims/regularizeClaim`;
|
||||||
this.$http.post(query, data).then(() => {
|
return this.$http.post(query, data).then(() => {
|
||||||
this.card.reload();
|
this.card.reload();
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
if (this.claim.responsibility >= Math.ceil(this.maxResponsibility) / 2)
|
if (this.claim.responsibility >= Math.ceil(this.maxResponsibility) / 2)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<vn-vertical compact>
|
<vn-vertical compact>
|
||||||
<vn-card pad-large>
|
<vn-card pad-large>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<form name="form" ng-submit="$ctrl.onSubmit()">
|
<form name="form">
|
||||||
<vn-horizontal ng-repeat="claimDevelopment in claimDevelopments">
|
<vn-horizontal ng-repeat="claimDevelopment in claimDevelopments">
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-one
|
vn-one
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
form="form"
|
form="form"
|
||||||
save="patch">
|
save="patch">
|
||||||
</vn-watcher>
|
</vn-watcher>
|
||||||
<form name="form" ng-submit="watcher.submit()" compact>
|
<form name="form" vn-http-submit="watcher.submit()" compact>
|
||||||
|
<fieldset>
|
||||||
<vn-card pad-large>
|
<vn-card pad-large>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
|
@ -64,4 +65,5 @@
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit label="Save"></vn-submit>
|
<vn-submit label="Save"></vn-submit>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<vn-button
|
<vn-button
|
||||||
disabled="!$ctrl.isEditable"
|
disabled="!$ctrl.isEditable"
|
||||||
label="Ok"
|
label="Ok"
|
||||||
ng-click="$ctrl.onStateOkClick()"
|
vn-http-click="$ctrl.onStateOkClick()"
|
||||||
vn-tooltip="Change ticket state to 'Ok'">
|
vn-tooltip="Change ticket state to 'Ok'">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
<vn-button-menu
|
<vn-button-menu
|
||||||
|
|
|
@ -115,7 +115,7 @@ class Controller {
|
||||||
onStateOkClick() {
|
onStateOkClick() {
|
||||||
let filter = {where: {code: 'OK'}, fields: ['id']};
|
let filter = {where: {code: 'OK'}, fields: ['id']};
|
||||||
let json = encodeURIComponent(JSON.stringify(filter));
|
let json = encodeURIComponent(JSON.stringify(filter));
|
||||||
this.$http.get(`/api/States?filter=${json}`).then(res => {
|
return this.$http.get(`/api/States?filter=${json}`).then(res => {
|
||||||
this.onStateChange(res.data[0].id);
|
this.onStateChange(res.data[0].id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue