2019-11-12 13:48:03 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-18 07:35:59 +00:00
|
|
|
import Section from 'salix/components/section';
|
2018-10-30 13:57:22 +00:00
|
|
|
|
2020-03-18 07:35:59 +00:00
|
|
|
export default class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
2018-11-02 14:44:27 +00:00
|
|
|
|
2018-10-30 13:57:22 +00:00
|
|
|
this.ticketSelected = null;
|
|
|
|
this.weekdays = [
|
|
|
|
{id: 0, name: 'Monday'},
|
|
|
|
{id: 1, name: 'Tuesday'},
|
|
|
|
{id: 2, name: 'Wednesday'},
|
|
|
|
{id: 3, name: 'Thursday'},
|
|
|
|
{id: 4, name: 'Friday'},
|
|
|
|
{id: 5, name: 'Saturday'},
|
|
|
|
{id: 6, name: 'Sunday'}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2020-04-08 10:33:36 +00:00
|
|
|
onUpdate(ticketFk, field, value) {
|
|
|
|
const params = {ticketFk, [field]: value};
|
2020-04-25 09:50:04 +00:00
|
|
|
this.$http.patch('TicketWeeklies', params)
|
|
|
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
2018-10-30 13:57:22 +00:00
|
|
|
}
|
|
|
|
|
2020-04-08 10:33:36 +00:00
|
|
|
onDeleteWeeklyAccept(ticketFk) {
|
|
|
|
return this.$http.delete(`TicketWeeklies/${ticketFk}`).then(() => {
|
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
|
|
const ticketIndex = this.$.model.data.findIndex(e => e.ticketFk == ticketFk);
|
|
|
|
this.$.model.remove(ticketIndex);
|
|
|
|
});
|
2018-10-30 13:57:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnTicketWeeklyIndex', {
|
2018-10-30 13:57:22 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|