2018-03-27 12:26:20 +00:00
|
|
|
import ngModule from '../../module';
|
2020-03-18 07:35:59 +00:00
|
|
|
import Section from 'salix/components/section';
|
2018-03-27 12:26:20 +00:00
|
|
|
|
2020-03-18 07:35:59 +00:00
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
2018-03-27 12:26:20 +00:00
|
|
|
this.ticket = {
|
2020-03-18 07:35:59 +00:00
|
|
|
ticketFk: this.$params.id
|
2018-03-27 12:26:20 +00:00
|
|
|
};
|
2020-03-18 07:35:59 +00:00
|
|
|
this.params = {ticketFk: this.$params.id};
|
2018-03-27 12:26:20 +00:00
|
|
|
}
|
2019-01-22 09:04:42 +00:00
|
|
|
|
|
|
|
$onInit() {
|
|
|
|
this.getPickerDesignedState();
|
|
|
|
}
|
|
|
|
|
|
|
|
set stateFk(value) {
|
|
|
|
this.params.stateFk = value;
|
|
|
|
this.isPickerDesignedState = this.getIsPickerDesignedState(value);
|
2024-01-10 12:12:12 +00:00
|
|
|
this.userFk = window.localStorage.currentUserWorkerId;
|
2019-01-22 09:04:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get stateFk() {
|
|
|
|
return this.params.stateFk;
|
|
|
|
}
|
|
|
|
|
2024-01-10 12:12:12 +00:00
|
|
|
set userFk(value) {
|
|
|
|
this.params.userFk = value;
|
2019-01-22 09:04:42 +00:00
|
|
|
}
|
|
|
|
|
2024-01-10 12:12:12 +00:00
|
|
|
get userFk() {
|
|
|
|
return this.params.userFk;
|
2019-01-22 09:04:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getPickerDesignedState() {
|
|
|
|
let filter = {
|
|
|
|
where: {
|
|
|
|
code: 'PICKER_DESIGNED'
|
2018-03-27 12:26:20 +00:00
|
|
|
}
|
2019-01-22 09:04:42 +00:00
|
|
|
};
|
|
|
|
let json = encodeURIComponent(JSON.stringify(filter));
|
2019-10-24 22:53:53 +00:00
|
|
|
this.$http.get(`States?filter=${json}`).then(res => {
|
2019-01-22 09:04:42 +00:00
|
|
|
if (res && res.data)
|
|
|
|
this.pickerDesignedState = res.data[0].id;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
getIsPickerDesignedState(value) {
|
|
|
|
if (value == this.pickerDesignedState)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
onSubmit() {
|
2023-10-27 16:03:40 +00:00
|
|
|
this.$http.post(`Tickets/state`, this.params).then(() => {
|
2019-01-22 09:04:42 +00:00
|
|
|
this.$.watcher.updateOriginalData();
|
|
|
|
this.card.reload();
|
2020-07-23 14:07:08 +00:00
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
2019-01-22 09:04:42 +00:00
|
|
|
this.$state.go('ticket.card.tracking.index');
|
|
|
|
});
|
2018-03-27 12:26:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnTicketTrackingEdit', {
|
2018-05-25 08:03:45 +00:00
|
|
|
template: require('./index.html'),
|
2018-05-08 07:30:55 +00:00
|
|
|
controller: Controller,
|
|
|
|
require: {
|
|
|
|
card: '^vnTicketCard'
|
|
|
|
}
|
2018-03-27 12:26:20 +00:00
|
|
|
});
|