class BasicController {
    constructor(model) {
        this.model = model;
    }

    clickApply() {
        this.model.persistData();
    }

    clickCancel(e) {
        window.location.href = $('#atp-header').find('#' + $(e.target).parents('section').last().attr('data-heading')).attr('href');
    }

    clickOK(e) {
        this.model.persistData().done(function() {
            window.location.href = $('#atp-header').find('#' + $(e.target).parents('section').last().attr('data-heading')).attr('href');
        });
    }

    toggleHold(e) {
        this.fieldDaemon.isPaused = !this.fieldDaemon.isPaused;
		
		if ($(e.target).html() == 'Release') {
			$(e.target).html('Hold');
		} else $(e.target).html('Release');
    }
}