#1039 ticket.summary
This commit is contained in:
parent
e368e2021b
commit
d1d11233ad
|
@ -15,9 +15,8 @@ export default class Button extends Input {
|
|||
}
|
||||
|
||||
$onInit() {
|
||||
if (!this.type) {
|
||||
if (!this.type)
|
||||
this.type = 'button';
|
||||
}
|
||||
}
|
||||
}
|
||||
Button.$inject = ['$element'];
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<vn-card class="summary">
|
||||
<h5 >{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} - {{$ctrl.summary.nickname}}</h5>
|
||||
<h5 >{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} - {{$ctrl.summary.nickname}}
|
||||
<vn-button
|
||||
disabled="!$ctrl.isEditable"
|
||||
label="poner OK"
|
||||
ng-click="$ctrl.setOkState()"
|
||||
vn-tooltip="Change ticket state to 'Ok'">
|
||||
</vn-button>
|
||||
</h5>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-label-value label="State"
|
||||
|
|
|
@ -2,9 +2,12 @@ import ngModule from '../module';
|
|||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $http) {
|
||||
constructor($scope, $state, $http, vnApp, $translate) {
|
||||
this.$scope = $scope;
|
||||
this.vnApp = vnApp;
|
||||
this.$translate = $translate;
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
}
|
||||
|
||||
get ticket() {
|
||||
|
@ -51,14 +54,48 @@ class Controller {
|
|||
onDescriptorLoad() {
|
||||
this.$scope.popover.relocate();
|
||||
}
|
||||
|
||||
get isEditable() {
|
||||
try {
|
||||
return !this.ticket.state.state.alertLevel;
|
||||
} catch (e) {}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
setOkState() {
|
||||
let filter = {where: {code: 'OK'}, fields: ['id']};
|
||||
let json = encodeURIComponent(JSON.stringify(filter));
|
||||
this.$http.get(`/ticket/api/States?filter=${json}`).then(res => {
|
||||
this.changeTicketState(res.data[0].id);
|
||||
});
|
||||
}
|
||||
|
||||
changeTicketState(value) {
|
||||
let params;
|
||||
|
||||
if (this.$state.params.id)
|
||||
params = {ticketFk: this.$state.params.id, stateFk: value};
|
||||
|
||||
if (!this.$state.params.id)
|
||||
params = {ticketFk: this.ticket.id, stateFk: value};
|
||||
|
||||
this.$http.post(`/ticket/api/TicketTrackings/changeState`, params).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
if (this.card) this.card.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$http'];
|
||||
Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate'];
|
||||
|
||||
ngModule.component('vnTicketSummary', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
},
|
||||
require: {
|
||||
card: '?^vnTicketCard'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,6 +3,19 @@
|
|||
vn-ticket-summary .summary {
|
||||
max-width: $width-large;
|
||||
|
||||
vn-button {
|
||||
max-height: 27px;
|
||||
float: right;
|
||||
button {
|
||||
box-shadow: none;
|
||||
height: inherit;
|
||||
line-height: inherit;
|
||||
&:active, &:focus {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
& > div > vn-horizontal > vn-one {
|
||||
min-width: 10em;
|
||||
|
||||
|
|
Loading…
Reference in New Issue