// <#-- Group Window -->
Ext.define("App.view.UserWindow", {
    extend: "Ext.window.Window",
    alias: "widget.userWindow",

    height: "692px",
    width: "729px",
    constrainHeader: true,
    modal: true,
    layout: "fit",
    resizable: false,
    params: {},

    loadWindow: function(){
        var me = this;
        if (me.params.id) {
            me.down("userForm")
                .down("#infoForm")
                .load({
                    url: App.url("/user/load"),
                    method: "GET",
                    params: me.params,
                    success: function(form, action) {
                        // if (me.params.id != 1) me.down("#deleteBtn").setDisabled(false);
                        // if (me.params.isPD) {
                        //     me.down("#pdToolbar").setHidden(false);
                        // }
                    }
                });
            me.down("userForm")
                .down("#firstTab")
                .down("#groupGrid")
                .getStore()
                .load({
                    params: { userId: me.params.id },
                    callback: function(records, operation, success) {}
                });

            me.down("userForm")
                .down("#secondTab")
                .down("container")
                .down("userAuthGrid")
                .getStore()
                .load({
                    params: { userId: me.params.id },
                    callback: function(records, operation, success) {}
                });
        } else {
            console.log("no data enter");
        }
    },

    initComponent: function() {
        var me = this;

        Ext.apply(me, {
            items: [
                {
                    xtype: "userForm",
                    params: me.params
                }
            ],

            listeners: {
                show: function() {
                    me.loadWindow();
                },
                close: function(window, opts) {
                    if (me.callbackOnClose) {
                        console.log(me)
                        me.callbackOnClose();
                    }
                }
            }
        });

        me.callParent(arguments);
    }
});
