<?php
/* @var $this LocationController */
/* @var $model Location */

$this->breadcrumbs = array(
    yii::t('default', 'Reports') => array('/dashboard/Reports'),
    yii::t('default', 'Ticket Summary For Department'),
);
?>

<?php
$form = $this->beginWidget('ext.bootstrap.widgets.TbActiveForm', array(
            'action' => Yii::app()->createUrl($this->route),
            'method' => 'get',
        ));

echo Yii::t('default', 'Location');
echo "<br />";


$state = $this->createWidget('application.extensions.jquery-cascade.jQueryCascade');
echo $state->dropDownList('Location',
        $model->location,
        User::model()->getLocationsInGeomarket(true),
        array('name'=>''),
        CController::createUrl('report/getDepartments'),
        'VReportTicketSummaryForDepartment_department'
);

$location = $model->location;
$departments = array();
if ($location != '')
    $departments = Department::getDepartmentsInLocation($location,true);
else
    $departments[''] = yii::t('default', 'All Departments');

echo $form->dropDownListRow($model, 'department', $departments);


echo "<br />";
echo Yii::t('default', 'From Date');
echo "<br />";
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker', array(
    'model' => $model,
    'attribute' => 'from_date',
    'mode' => 'date', //use "time","date" or "datetime" (default)
    'language' => '',
    'options' => array(
        'dateFormat' => 'yy-mm-dd',
        'showAnim' => 'fold',
        'changeMonth' => true,
        'changeYear' => true,
        'yearRange' => 'c-30:c+5',
    )
));

echo "<br />";
echo Yii::t('default', 'To Date');
echo "<br />";
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker', array(
    'model' => $model,
    'attribute' => 'to_date',
    'mode' => 'date', //use "time","date" or "datetime" (default)
    'language' => '',
    'options' => array(
        'dateFormat' => 'yy-mm-dd',
        'showAnim' => 'fold',
        'changeMonth' => true,
        'changeYear' => true,
        'yearRange' => 'c-30:c+5',
    )
)); ?>
<div class="actions">
    <?php echo CHtml::submitButton(Yii::t('default', 'Go'), array('class' => 'btn primary')); ?>
    &ensp;
    <?php echo CHtml::submitButton(Yii::t('default', 'Export'), array('name' => 'export', 'class' => 'btn primary')); ?>
</div>
<?php $this->endWidget(); ?>
    <!-- search-form -->







<?php
    $this->widget('ext.bootstrap.widgets.TbGridView', array(
        'id' => 'VReportTicketSummaryForDepartment-grid',
        'type' => 'striped',
        'dataProvider' => $model->search($is_empty),
        'type' => 'striped',
        'filter' => $model,
        'columns' => array(
            'ticket_type',
            'department',
            'accounting_unit',
            'activity_code',
            'user_name',
            'person',
            'pos',
            'badge',
            'schedule',
            'number_of_tickets',
        ),
    ));
?>
