-$gateObj = Gate::getByCode($gate)
-$allowedCounter = 0

%h2=t('Plate authorizations for transit')
%h4=t('Plate').': '.$plate
%h4=t('Gate').': '.$gateObj->Descrizione." ($gate)"
%h4=t('Time').': '.$time

%table.table.table-condensed
  %thead
    %tr
      %th
      %th='ID'
      %th=t('List')
      %th=t('Active')
      %th=t('Confirmed')
      %th
      %th=t('Gate')
      %th
      %th=t('Time schedule')
      %th
      %th=t('Start date')
      %th
      %th=t('End date')
      %th(style="border-left: 1px solid #dddddd;")
      %th=t('Result')
  %tbody    
    -foreach($plateAuths as $p)
      -$allowed = $p->allowed($gate,$time)
      -if($allowed)
        -$allowedCounter++
      %tr
        %td
          %a.icon-eye-open(href="#{$p->url_view}" title="#{t('View')}")            
        %td
          =$p->IDPermesso
        %td
          =$p->Lista
        %td
          -if($p->Enabled)
            .color-green.icon-ok
          -else
            .color-red.icon-remove
        %td
          -if($p->ToBeConfirmed)
            .color-red.icon-remove
          -else
            .color-green.icon-ok
        %td
          -if($p->containsGate($gate))
            .color-green.icon-ok
          -else
            .color-red.icon-remove
        %td
          !=SystemInfoHelper::getPlateAuthGateCoolName($p->IDGate,$p->IDGate_type)
        %td
          -if($p->containsTimeSchedule($time))
            .color-green.icon-ok
          -else
            .color-red.icon-remove
        %td
          !=SystemInfoHelper::getTimeScheduleCoolName($p->IDTime)
        %td
          -if($p->DataInizio <= $time)
            .color-green.icon-ok
          -else
            .color-red.icon-remove
        %td
          =$p->DataInizio
        %td
          -if($p->DataFine >= $time)
            .color-green.icon-ok
          -else
            .color-red.icon-remove
        %td
          =$p->DataFine
        %td(style="border-left: 1px solid #dddddd;")
          -if($allowed)
            .color-green.icon-ok
          -else
            .color-red.icon-remove
        %td
          -if($allowed)
            =t('Authorized')
          -else
            =t('Unauthorized')
    %tr
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
      %td
            
-if($allowedCounter > 0)
  %h1.color-green=t('Authorized transit')
-else
  %h1.color-red=t('Unauthorized transit')
            
-if(user()->checkAccess('plate_auth_status') && user()->checkAccess('plate_auth_status_global'))
  %h4
    %a.btn(target="_blank" href="#{url('plateAuthorization/whitelistStatus', array('plateListId'=>-1, 'search'=>$plate))}" style="margin-left: 10px;")
      =t('View all')
            