Ext.define("App.view.OrderPaymentWindow", {
    extend: "Ext.window.Window",
    alias: "widget.orderPaymentWindow",
    xtype: "orderPaymentWindow",
    title: App.localeRes("Order Payment Details"),
    width: 600,
    modal: true,

    resizable: true,
    layout: "fit",
    constrainHeader: true,

    initComponent: function () {
        var me = this;
        Ext.apply(me, {
            items: [
                {
                    xtype: "orderPaymentForm",
                    padding: '16 16 0 16',
                    params: {},
                    callbackOnSave: function(){
                        me.close();
                    }
                },
            ],
            listeners: {
                show: function () {
                    if(me.params && me.params.record){
                        me.down('orderPaymentForm').loadRecord(me.params.record);
                    }else if(me.params && me.params.orderId){
                        me.down('#orderId').setValue(me.params.orderId);
                    }
                },
                close: function (window, opts) {
                    if (me.callbackOnClose) {
                        me.callbackOnClose();
                    }
                }
            }
        });
        me.callParent(arguments);
    }
});
