salix/modules/ticket/front/request/index/index.js

78 lines
1.9 KiB
JavaScript
Raw Normal View History

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: [
{
relation: 'atender',
2018-12-21 11:35:34 +00:00
scope: {
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
2018-12-21 11:35:34 +00:00
}
}
}, {
relation: 'requester',
2018-12-21 11:35:34 +00:00
scope: {
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
2018-12-21 11:35:34 +00:00
}
}
}, {
relation: 'sale'
}
2018-11-21 07:58:34 +00:00
]
};
}
removeLine(index) {
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
});
}
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
}
ngModule.vnComponent('vnTicketRequestIndex', {
2018-11-21 07:58:34 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
ticket: '<'
}
2018-11-21 07:58:34 +00:00
});