Use Schedule Edit Modal component in Schedule Row component.
This commit is contained in:
parent
57aa737465
commit
d1344d57b8
@ -11,8 +11,6 @@ import { ScheduleEditModalComponent } from './scheduleEditModal.component';
|
|||||||
import { ScheduleService } from './schedule.service';
|
import { ScheduleService } from './schedule.service';
|
||||||
import { Schedule } from './schedule';
|
import { Schedule } from './schedule';
|
||||||
|
|
||||||
var scheduleFormTmpl = require('./schedule.form.tmpl.html');
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tr[schedule-row]',
|
selector: 'tr[schedule-row]',
|
||||||
host: {
|
host: {
|
||||||
@ -61,7 +59,6 @@ export class ScheduleRowComponent {
|
|||||||
private scheduleService: ScheduleService,
|
private scheduleService: ScheduleService,
|
||||||
private logger: Logger,
|
private logger: Logger,
|
||||||
private toastrService: ToastrService,
|
private toastrService: ToastrService,
|
||||||
@Inject('$modal') private $modal,
|
|
||||||
private ngbModal: NgbModal
|
private ngbModal: NgbModal
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -108,26 +105,15 @@ export class ScheduleRowComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
modify() {
|
modify() {
|
||||||
// FIXME Alexis Lahouze 2017-06-15 i18n
|
const modal = this.ngbModal.open(ScheduleEditModalComponent, {
|
||||||
var title = "Modify schedule #" + this.schedule.id;
|
windowClass: 'in'
|
||||||
|
});
|
||||||
|
|
||||||
this.$modal({
|
modal.componentInstance.schedule = this.schedule;
|
||||||
templateUrl: scheduleFormTmpl,
|
|
||||||
controller: function($scope, title, schedule, $save) {
|
modal.result.then((schedule: Schedule) => {
|
||||||
$scope.title = title;
|
this.save(schedule);
|
||||||
$scope.operation = schedule;
|
}, (reason) => function(reason) {
|
||||||
$scope.$save = () => {
|
|
||||||
$scope.$hide();
|
|
||||||
$save($scope.operation);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
locals: {
|
|
||||||
title: title,
|
|
||||||
schedule: this.schedule,
|
|
||||||
$save: (operation) => {
|
|
||||||
this.save(operation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user