78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
|
|
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
export default class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
|
|
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'}
|
|
];
|
|
|
|
this.smartTableOptions = {
|
|
activeButtons: {
|
|
search: true,
|
|
shownColumns: true,
|
|
},
|
|
columns: [
|
|
{
|
|
field: 'ticketFk',
|
|
searchable: false
|
|
},
|
|
{
|
|
field: 'clientName',
|
|
},
|
|
{
|
|
field: 'weekDay',
|
|
searchable: false,
|
|
},
|
|
{
|
|
field: 'agencyModeFk',
|
|
searchable: false,
|
|
},
|
|
{
|
|
field: 'warehouseFk',
|
|
searchable: false,
|
|
},
|
|
{
|
|
field: 'nickname',
|
|
},
|
|
]
|
|
};
|
|
}
|
|
|
|
exprBuilder(param, value) {
|
|
switch (param) {
|
|
case 'clientName': return {'c.name': value};
|
|
case 'nickName': return {'u.name': value};
|
|
}
|
|
}
|
|
|
|
onUpdate(ticketFk, field, value) {
|
|
const params = {ticketFk, [field]: value};
|
|
this.$http.patch('TicketWeeklies', params)
|
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
|
}
|
|
|
|
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);
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnTicketWeeklyIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|