2018-11-21 07:58:34 +00:00
|
|
|
import ngModule from '../../module';
|
2020-03-18 07:35:59 +00:00
|
|
|
import Section from 'salix/components/section';
|
2018-11-21 07:58:34 +00:00
|
|
|
|
2020-03-18 07:35:59 +00:00
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
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
|
|
|
}
|
|
|
|
}
|
2020-04-28 12:26:02 +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
|
|
|
}
|
|
|
|
}
|
2020-04-28 12:26:02 +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-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
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnTicketRequestIndex', {
|
2018-11-21 07:58:34 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|