%script{:type => "text/javascript",
        :src  => "../js/columnReorderer.js"}
- $isBlack = $plateList->mode == PlateList::MODE_BLACK_LIST

-if(Yii::app()->params['listsType']=="black")
  - $isBlack = true

- if($isBlack)
  %script{:type => "text/javascript"}
    !="moveColumn(jQuery('table'), 2, 8);"
    !="moveColumn(jQuery('table'), 2, 8);"

- $liste = array()
- if($plateList == null)
  - $globalMode = true
  - $liste = PlateList::getCurrentUserLists()
  - $liste = array_remap($liste, function($k, $v){ return $v->code; });
- else
  - $liste[$plateList->code] = $plateList

- if (isset($dataProvider) && count($dataProvider->data)>0)

  - $permessi = $dataProvider->data
  .tableContainer
    %table.table.table-condensed.span12
      %thead
        %tr
          %th
          %th
            = t('List')
          %th
            = t('Name')
          %th
            = t('Surname')
          %th
          %th
            = t('Plate')
          -if($isBlack)  
            %th
              = t('Model')
            %th
              = t('Vehicle class')
            %th
              = t('Alert type')
            %th
              = t('Notes')
          -if(!$isBlack)
            %th
              = t('Gate')
            %th
              = t('Time Schedule')
            %th
              = t('Start date')
            %th
              = t('End date')
            %th
              = t('Status')
          %th
            = t('Actions')

      %tbody
        - foreach($permessi as $permessoRow)
          - $permesso = $this->createPermessoFromRow($permessoRow, $currentUrl)
          - $lista = $liste[$permesso->IDLista]
          %tr
            %td
              %a(href="#{$permesso->url_view}" title="#{t('View')}")
                %i.icon-eye-open
            %td
              -if($permesso->ListaIsBlack)
                %i.icon-file-text
              -else
                %i.icon-file-text-alt
              =$permesso->Lista
            %td                  
              -if(user()->checkAccess('plate_auth_insert') && user()->checkAccess('plate_auth_insert_wizard'))
                %a(href="#{url('plateAuthorization/whiteListWizard',array('plateListId'=>$permesso->IDLista,'ownerId'=>$permesso->IDUtente,'step'=>2))}")
                  =$permesso->Nome
              -else
                =$permesso->Nome
            %td
              -if(user()->checkAccess('plate_auth_insert') && user()->checkAccess('plate_auth_insert_wizard'))
                %a(href="#{url('plateAuthorization/whiteListWizard',array('plateListId'=>$permesso->IDLista,'ownerId'=>$permesso->IDUtente,'step'=>2))}")
                  =$permesso->Cognome
              -else
                =$permesso->Cognome
            %td
              -$this->printCountryFlag($permesso->Nationality)
            %td
              -if(user()->checkAccess('plate_auth_insert') && user()->checkAccess('plate_auth_insert_wizard'))
                %a(href="#{url('plateAuthorization/whiteListWizard',array('plateListId'=>$permesso->IDLista,'ownerId'=>$permesso->IDUtente,'vehicleId'=>$permesso->IDVeicolo,'step'=>3))}")
                  =$permesso->Targa
              -else
                =$permesso->Targa
            -if($isBlack)
              %td
                #{$permesso->DescrizioneVeicolo}
              %td
                %img.vehicle-class-icon-small(src="#{Yii::app()->baseUrl}/images/vehicle-classes/#{$permesso->Classe != "" ? $permesso->Classe : "vehicle"}.png")
              %td
                #{$permesso->Categoria}
              %td
                #{$permesso->Note}
            -if(!$isBlack)
              %td
                !=SystemInfoHelper::getPlateAuthGateCoolName($permesso->IDGate,$permesso->IDGate_type)
              %td
                !=SystemInfoHelper::getTimeScheduleCoolName($permesso->IDTime)
              %td
                -if(user()->checkAccess('plate_auth_insert') && user()->checkAccess('plate_auth_insert_wizard'))
                  %a(href="#{url('plateAuthorization/whiteListWizard',array('plateListId'=>$permesso->IDLista,'ownerId'=>$permesso->IDUtente,'vehicleId'=>$permesso->IDVeicolo,'validityPeriodId'=>$permesso->IDAbbonamento,'step'=>4))}")
                    =$permesso->DataInizio
                -else
                  =$permesso->DataInizio
              %td
                -if(user()->checkAccess('plate_auth_insert') && user()->checkAccess('plate_auth_insert_wizard'))
                  %a(href="#{url('plateAuthorization/whiteListWizard',array('plateListId'=>$permesso->IDLista,'ownerId'=>$permesso->IDUtente,'vehicleId'=>$permesso->IDVeicolo,'validityPeriodId'=>$permesso->IDAbbonamento,'step'=>4))}")
                    =$permesso->DataFine
                -else
                  =$permesso->DataFine
              %td
                %font(color="#{$permesso->statusColor}")
                  =$permesso->statusText
            %td
              -$this->printPrintBtn($permesso)
              -if($lista->editable && Yii::app()->user->checkAccess('plate_auth_enable'))
                -if($permesso->Enabled == 1)
                  %a(href="#{$permesso->url_revoke}" title="#{t('Revoke')}")
                    %i.icon-pause
                -else
                  -if($lista->editable && Yii::app()->user->checkAccess('plate_auth_activate')) 
                    %a(href="#{$permesso->url_activate}" title="#{t('Activate')}")
                      %i.icon-play
              -if($lista->editable && $permesso->ToBeConfirmed == 1 && Yii::app()->user->checkAccess('plate_auth_confirmed'))
                %a(href="#{$permesso->url_confirm}" title="#{t('Confirm')}")
                  %i.icon-unlock-alt
              -if($lista->editable && ($permesso->aboutToExpire || $permesso->expired) && Yii::app()->user->checkAccess('plate_auth_renew'))
                %a(href="#{$permesso->url_renew}" title="#{t('Renew')}")
                  %i.icon-repeat
              -if($lista->editable && Yii::app()->user->checkAccess('plate_auth_delete'))
                %a(href="#{$permesso->url_delete}" title="#{t('Delete')}" onclick="return confirm('#{t('Are you sure you want to delete this item?')}')")
                  %i.icon-trash

  - if (isset($dataProvider->pagination))
    .pagination.pagination-links-container
      - $this->widget('bootstrap.widgets.TbPager', array('pages' => $dataProvider->pagination))
    =t("Results").": $totalResults"
- else
  %h4= Yii::t("app", "No results")