Ext.onReady(function() {
    Ext.QuickTips.init();

    var form = new Ext.form.FormPanel({
        id: 'formFilter',
        title: '',
        url: PTJS_APPLICATION_SYSTEM_SITE_WS + 'programs/index',
        labelWidth: 80,
        labelAlign: 'left',
        baseCls: 'x-plain',
        bodyStyle: 'padding:0px 0px 0px 0px; position:relative; background-color: transparent; border:0px solid #000000;',
        autoWidth: true,
        autoHeight: true,
        autoScroll: false,
        renderTo: 'date-filter',
        layout:'column',
        border: true,

        items:[
            {
                columnWidth: .5,
                layout: 'form',
                border: false,
                bodyStyle: 'padding:0px 0px 0px 0px; position:relative; background-color: transparent;',
                items: [
                    new Ext.form.DateField({
                        id: 'date',
                        name: 'date',
                        allowBlank: true,
                        blankText: String.format('Selecione uma data'),
                        msgTarget: 'side',
                        msgDisplay: 'block',
                        fieldLabel: String.format('Data'),
                        hideLabel: true,
                        format: 'd/m/Y',
                        value: FILTER_DATE,
                        width: 100
                    })
                ]
            },

            {
                columnWidth: .45,
                layout: 'form',
                border: false,
                bodyStyle: 'padding:0px 0px 0px 0px; position:relative; background-color: transparent;',
                items: [
                    new Ext.Button({
                        text: 'Buscar',
                        id: 'bt-send-filter',
                        cls: 'submit-box-filter',
                        minWidth: 80,
                        handler: function() {
                          document.location = PTJS_APPLICATION_SYSTEM_SITE_WS + 'programs/index?date=' + Ext.getCmp('date').getRawValue();
                        }
                    })
                ]
            }
        ]
    });
});
