78 lines
1.9 KiB
JavaScript
78 lines
1.9 KiB
JavaScript
import ngModule from '../../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
this.filter = {
|
|
include: [
|
|
{
|
|
relation: 'atender',
|
|
scope: {
|
|
include: {
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['nickname']
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
relation: 'requester',
|
|
scope: {
|
|
include: {
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['nickname']
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
relation: 'sale'
|
|
}
|
|
]
|
|
};
|
|
}
|
|
|
|
removeLine(index) {
|
|
this.$.model.remove(index);
|
|
this.$.watcher.check();
|
|
this.$.model.save().then(() => {
|
|
this.$.watcher.notifySaved();
|
|
this.$.watcher.updateOriginalData();
|
|
});
|
|
}
|
|
|
|
getRequestState(state) {
|
|
switch (state) {
|
|
case null:
|
|
return 'New';
|
|
case false:
|
|
return 'Denied';
|
|
case true:
|
|
return 'Acepted';
|
|
}
|
|
}
|
|
|
|
updateData() {
|
|
this.$.model.save().then(() => {
|
|
this.$.watcher.notifySaved();
|
|
this.$.watcher.updateOriginalData();
|
|
});
|
|
}
|
|
|
|
isEditable(isOk) {
|
|
if (isOk != null)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnTicketRequestIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
ticket: '<'
|
|
}
|
|
});
|