class BasicView {
    constructor(controller) {
        this.controller = controller;

        this.bindEvents();
        this.controller.model.registerObserver(this);

        this.navigation = new NavigationBar();
        this.fieldDaemon = new FieldDaemon();

        if ($('.field-container').length > 0) {
            this.fieldDaemon.handleFields();
            
            $('body').append(
                '<a class="button button-gray button-medium hold-button" id="hold-button">Hold</a>'
            );
        }

        //Initialise JQuery-UI elements
		$('#dialog').dialog({ 
			autoOpen: false,
			modal: true,
			buttons: {
				Ok: function() {
					$(this).dialog("close");
				}
			},
			position: { my: 'top', at: 'top+150' }
		});
    }

    bindEvents() {
        $('#button-container').on('click', '#apply-button', this.controller.clickApply.bind(this.controller));
        $('#button-container').on('click', '#cancel-button', this.controller.clickCancel.bind(this.controller));
        $('#button-container').on('click', '#ok-button', this.controller.clickOK.bind(this.controller)); 
        $(document).on('click', '#hold-button', this.controller.toggleHold.bind(this));       
    }

    update(model) {
        
    }
}