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

 $this->breadcrumbs = array(
     yii::t('default', 'Reports') => array('/dashboard/Reports'),
     yii::t('default', 'Expired Badges Within Period'),
 );
?>

<?php
 $form = $this->beginWidget('ext.bootstrap.widgets.FTbActiveForm', 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'),
         'VReportExpiredBadgesWithinPeriod_department'
 );


 $location = $model->location;
 $departments = array();
 $departments[''] = yii::t('default', 'All Departments');
 if ($location != '')
 {
     $selected_location = Location::model()->findByPk($location);

     if (isset($selected_location->departments) && ($selected_location->departments != null))
     {
         foreach ($selected_location->departments as $department)
         {
             $departments[$department->id] = $department->name;
         }
     }
 }
 echo $form->dropDownListRow($model, 'department', $departments);



 echo $form->textFieldRow($model, 'period_days', array('size' => 60, 'maxlength' => 255));
?>
<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(
             'badge',
             'person',
             'department',
             'activation_start_date',
             'activation_end_date'
         ),
     ));
?>
