/*jslint browser: true, undef: true, laxbreak: true *//*global Ext*/
Ext.define('SlateAdmin.view.progress.narratives.Printer', {
    extend: 'Ext.Container',
    xtype: 'progress-narratives-printer',

    requires: [
        'Ext.layout.container.VBox',
        'Ext.layout.container.HBox',
        'Ext.form.Panel',
        'Ext.form.FieldSet',
        'Ext.form.field.ComboBox',
        'Ext.util.Cookies'
    ],

    componentCls: 'progress-narratives-printer',

    layout: {
        type: 'vbox',
        align: 'stretch'
    },

    items: [{
        xtype: 'form',
        itemId: 'filterForm',
        bodyPadding: 5,
        dockedItems: [{
            dock: 'bottom',
            xtype: 'container',
            layout: {
                type: 'hbox',
                align: 'middle'
            },
            defaults: {
                margin: '0 8px 4px 8px'
            },
            items: [{
                xtype: 'tbfill'
            },{
                xtype: 'button',
                text: 'Preview',
                action: 'preview'
            },{
                xtype: 'button',
                text: 'Print to PDF',
                action: 'print-pdf'
            },{
                xtype: 'button',
                text: 'Print via Browser',
                action: 'print-browser'
            },{
                xtype: 'button',
                text: 'Email to Parents',
                action: 'email',
                disabled: true
            },{
                xtype: 'button',
                text: 'Clear Filters',
                action: 'clear-filters'
            },{
                xtype: 'tbfill'
            }]
        }],
        items: [{
            xtype: 'fieldset',
            title: 'Filter reports by&hellip;',
            layout: 'hbox',
            padding: 10,
            defaultType: 'combobox',
            defaults: {
                flex: 1,
                labelAlign: 'right',
                labelWidth: 60,
                forceSelection: false,
                allowBlank: true,
                valueField: 'ID'
            },
            items: [{
                name: 'termID',
                fieldLabel: 'Term',
                emptyText: 'Current Term',
                displayField: 'Title',
                itemId: 'termSelector',
                valueField: 'ID',
                queryMode: 'local',
                store: 'Terms'
            },{
                name: 'advisorID',
                fieldLabel: 'Advisor',
                emptyText: 'Any',
                displayField: 'FullName',
                queryMode: 'local',
                typeAhead: true,
                allowBlank: true,
                store: 'people.Advisors'
            },{
                name: 'studentID',
                fieldLabel: 'Student',
                emptyText: 'All',
                queryMode: 'remote',
                queryParam: 'q',
                hideTrigger: true,
                //store: 'progress.narratives.People',
                listConfig: {
                    getInnerTpl: function () {
                        return '{LastName}, {FirstName}';
                    }
                },
                displayTpl: '<tpl for=".">{LastName}, {FirstName}</tpl>',
                listeners: {
                    beforequery: function (qe) {
                        if (!qe) {
                            return false;
                        } else {
                            qe.query += ' class:Student';
                        }
                    }
                }
/*
            },{
                name: 'authorID',
                fieldLabel: 'Author',
                emptyText: 'Any',
                displayField: 'FullName',
                typeAhead: true,
                store: {
                    autoLoad: true,
                    fields: [
                        'FirstName',
                        'LastName',
                        {name: 'ID', type: 'int'},
                        {
                            name: 'FullName',
                            convert: function (v, r) {
                                return r.data.data[0].LastName + ', ' + r.data.data[0].FirstName;
                            }
                        }
                    ],
                    proxy: {
                        type: 'slateapi',
                        url: '/progress/narratives/authors'
                    }
                }
*/
            }]
        }]
    },{
        xtype: 'component',
        itemId: 'previewBox',
        cls: 'print-preview',
        flex: 1,
        disabled: true,
        renderTpl: '<iframe width="100%" height="100%"></iframe>',
        renderSelectors: {
            iframeEl: 'iframe'
        }
    }]
});

@@ -2857,25 +2857,30 @@
     
-queryMode: 'remot
+displayField: 'FullNam
 e',%0A
@@ -2904,17 +2904,20 @@
 uery
-Param: 'q
+Mode: 'local
 ',%0A 
@@ -2935,19 +2935,16 @@
     
-hideTrigger
+anyMatch
 : tr
@@ -2967,181 +2967,98 @@
     
-//
 store: 
-'progress.narratives.People',%0A                listConfig: %7B%0A                    getInnerTpl: function () %7B%0A                        return '%7BLastName%7D, %7BFirstName%7D';
+%7B%0A                    type: 'chained',%0A                    source: 'people.People',
 %0A   
@@ -3074,34 +3074,35 @@
         
-%7D%0A        
+filters: %5B%0A
         
 %7D,%0A     
@@ -3085,35 +3085,32 @@
 ters: %5B%0A        
-%7D,%0A
                 
@@ -3113,143 +3113,105 @@
     
-displayTpl: '%3Ctpl for=%22.%22%3E%7BLastName%7D, %7BFirstName%7D%3C/tpl%3E',%0A                listeners: %7B%0A                    beforequery: function (qe) %7B
+function(rec) %7B%0A                            return (rec.get('Class')==='Slate%5C%5CPeople%5C%5CStudent');
 %0A   
@@ -3235,18 +3235,9 @@
     
-if (!qe) %7B
+%7D
 %0A   
@@ -3257,29 +3257,10 @@
     
-        return false;
+%5D,
 %0A   
@@ -3280,19 +3280,18 @@
     
-    %7D else 
+sorters: %5B
 %7B%0A  
@@ -3316,41 +3316,29 @@
     
-    qe.query += ' class:Student';
+property: 'LastName',
 %0A   
@@ -3350,33 +3350,48 @@
                 
-%7D
+direction: 'asc'
 %0A               
@@ -3388,32 +3388,33 @@
                %7D
+%5D
 %0A               

Change student combo store to a chained store