/// class ProspectDirector.Modules.ExplorerModel.Forms.FeatureListData
/// using ProspectDirector.Types.Core.Feature

/**
@class FeatureListData
@namespace ProspectDirector.Modules.ExplorerModel.Forms
**/
ProspectDirector.Modules.ExplorerModel.Forms.FeatureListData = ProspectDirector.Types.Core.Feature.extend({

    //---------------------------
    //--- CONSTRUCTOR
    //---------------------------

    init: function (options) {

        this._super(options);

        this.get_buttonEdit().on("click", $.proxy(this.buttonEdit_onClick, this));

    },

    //---------------------------
    //--- PROPERTIES
    //---------------------------

    get_buttonEdit: function () {
        return this.get_container().find("INPUT[type=button][role=form]");
    },

    get_hasChanges: function () {
        return this.get_container().find("INPUT[data-role=has-changes]");
    },

    //---------------------------
    //--- EVENT HANDLERS
    //---------------------------

    buttonEdit_onClick: function (e) {

        var that = this;

        PDJS.Canvas.Design.DesignerDialog.open({
            documentId: this.options.data.documentId,
            canvasType: PDJS.Canvas.Core.CanvasType.List,
            entityTypeId: this.options.data.entityTypeId,
            extensionId: this.options.data.extensionId,
            isListBased: true,
            callbacks: {
                ok: function (sender, e) {
                    if (e.hasChanged) {
                        that.get_hasChanges().val("1");
                        that.get_hasChanges().change();
                    }
                }
            }
        });

    }

});