2018-11-21 07:58:34 +00:00
|
|
|
import ngModule from '../../module';
|
|
|
|
|
|
|
|
class Controller {
|
2019-02-15 11:39:21 +00:00
|
|
|
constructor($scope, $stateParams) {
|
2018-11-21 07:58:34 +00:00
|
|
|
this.$stateParams = $stateParams;
|
2019-02-15 11:39:21 +00:00
|
|
|
this.$ = $scope;
|
2018-11-21 07:58:34 +00:00
|
|
|
this.filter = {
|
|
|
|
include: [
|
2019-01-31 13:14:39 +00:00
|
|
|
{
|
|
|
|
relation: 'atender',
|
2018-12-21 11:35:34 +00:00
|
|
|
scope: {
|
|
|
|
include: {
|
2019-01-31 13:14:39 +00:00
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['nickname']
|
|
|
|
}
|
2018-12-21 11:35:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-01-31 13:14:39 +00:00
|
|
|
{
|
|
|
|
relation: 'requester',
|
2018-12-21 11:35:34 +00:00
|
|
|
scope: {
|
|
|
|
include: {
|
2019-01-31 13:14:39 +00:00
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['nickname']
|
|
|
|
}
|
2018-12-21 11:35:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-01-31 13:14:39 +00:00
|
|
|
{
|
|
|
|
relation: 'sale'
|
|
|
|
}
|
2018-11-21 07:58:34 +00:00
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
removeLine(index) {
|
2019-02-15 11:39:21 +00:00
|
|
|
this.$.model.remove(index);
|
|
|
|
this.$.watcher.check();
|
|
|
|
this.$.model.save().then(() => {
|
|
|
|
this.$.watcher.notifySaved();
|
|
|
|
this.$.watcher.updateOriginalData();
|
2018-11-21 07:58:34 +00:00
|
|
|
});
|
|
|
|
}
|
2019-02-15 11:39:21 +00:00
|
|
|
|
2019-02-20 17:46:30 +00:00
|
|
|
showItemDescriptor(event, itemFk) {
|
2018-11-21 07:58:34 +00:00
|
|
|
this.quicklinks = {
|
|
|
|
btnThree: {
|
|
|
|
icon: 'icon-transaction',
|
|
|
|
state: `item.card.diary({
|
2019-02-20 17:46:30 +00:00
|
|
|
id: ${itemFk},
|
2018-11-21 07:58:34 +00:00
|
|
|
ticketFk: ${this.$stateParams.id}
|
|
|
|
})`,
|
|
|
|
tooltip: 'Item diary'
|
|
|
|
}
|
|
|
|
};
|
2019-02-20 17:46:30 +00:00
|
|
|
this.$.itemDescriptor.itemFk = itemFk;
|
2019-02-15 11:39:21 +00:00
|
|
|
this.$.itemDescriptor.parent = event.target;
|
|
|
|
this.$.itemDescriptor.show();
|
|
|
|
}
|
|
|
|
|
2019-04-25 12:24:02 +00:00
|
|
|
showWorkerDescriptor(event, workerFk) {
|
2019-02-15 11:39:21 +00:00
|
|
|
event.preventDefault();
|
|
|
|
event.stopImmediatePropagation();
|
2019-04-25 12:24:02 +00:00
|
|
|
this.selectedWorker = workerFk;
|
2019-02-15 11:39:21 +00:00
|
|
|
this.$.workerDescriptor.parent = event.target;
|
|
|
|
this.$.workerDescriptor.show();
|
2018-11-21 07:58:34 +00:00
|
|
|
}
|
2019-05-09 12:40:59 +00:00
|
|
|
|
|
|
|
getRequestState(state) {
|
|
|
|
switch (state) {
|
|
|
|
case null:
|
|
|
|
return 'New';
|
|
|
|
case false:
|
|
|
|
return 'Denied';
|
|
|
|
case true:
|
|
|
|
return 'Acepted';
|
|
|
|
}
|
|
|
|
}
|
2020-01-28 08:05:01 +00:00
|
|
|
|
|
|
|
updateData() {
|
|
|
|
this.$.model.save().then(() => {
|
|
|
|
this.$.watcher.notifySaved();
|
|
|
|
this.$.watcher.updateOriginalData();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
isEditable(isOk) {
|
|
|
|
if (isOk != null)
|
|
|
|
return true;
|
2020-02-06 13:59:00 +00:00
|
|
|
|
|
|
|
return false;
|
2020-01-28 08:05:01 +00:00
|
|
|
}
|
2018-11-21 07:58:34 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 11:39:21 +00:00
|
|
|
Controller.$inject = ['$scope', '$stateParams'];
|
2018-11-21 07:58:34 +00:00
|
|
|
|
|
|
|
ngModule.component('vnTicketRequestIndex', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|