-$hasPermits=count($permessi)>0
-$validTransit=count($permessiAttivi)>0
-$fontColor=$validTransit ? "green" : "red"
-$transitValidityMessage= $validTransit ? t('authorized.') : t('not authorized.')

#whitelist-smart-tips
  -if($hasPermits)
    %h5
      =t('The vehicle has ').count($permessi).t(' plate authorizations, of which ').count($permessiAttivi).t(' actives. The transit is therefore ')
      %font(color=$fontColor)
        =$transitValidityMessage
    -if($validTransit)
      %h5
        =t('This plate authorizations cancel the white list violation').':'
      -if(AuthItem::countLike("plate_list_%")>0)
        -$printedPermit = 0
        -foreach($permessiAttivi as $p)
          -if($printedPermit > 0)
            =','
          %a(href="#{$p->url_view}" target="_blank" title="#{$p->DescrizionePermesso}")
            .icon-ok-circle
            =$p->IDPermesso
          -$printedPermit++
        %br
  -if(count($permessi)<=0)
    %h5
      =t('The vehicle has no plate authorization associated. The transit is therefore')
      %font(color=$fontColor)
        =$transitValidityMessage
  %h5
    =t('Available actions:')
    %ul
      -if($hasPermits)
        %li
          %a(target="_blank" href="#{url('plateAuthorization/CheckWhitelistPlate', array('plate'=>$plate, 'time'=>tts($timestamp), 'nationality'=>$nationality, 'gate'=>$gate))}")
            =t('Detailed authorizations analysis')
      %li
        %a(data-toggle="modal" href="#" data-target="#white-list-modal")=t('Quick lists management')
    

#white-list-modal.modal.hide.fade(tabindex="-1" role="dialog" aria-labelledby="white-list-modal" aria-hidden="true")
  .modal-dialog
    .modal-content
      .modal-header
        %button.close(type="button" data-dismiss="modal" aria-hidden="true") &times;
        %h3=t('Quick lists management')
      .modal-body
        %table.table.table-striped.table-condensed(style="border: 1px solid grey")
          %tbody
            %thead
              %tr
                %th
                  =t("Lista")
                %th
                  =t("Action")
            -foreach(PlateList::getCurrentUserWhiteLists() as $l)
              -if($l->editable)
                %tr
                  -$listName = $l->getListTitle()
                  %td
                    =$listName
                  -foreach(PlateAuthInsertProfile::model()->findAll() as $paip)
                    -if(user()->checkAccess("plate_auth_insert_profile_".$paip->id) && $l->editable && ($paip->list_code==-1 || $paip->list_code==$l->code))
                      %td        
                        %a(href="#{Yii::app()->createUrl('plateAuthorization/NewPlateAuthProfile', array('plateListId' => $l->code, 'plate'=>$plate, 'profileId'=>$paip->id))}" target="_blank")
                          = $paip->description
                  %td
                    %a(target="_blank" href="#{url('plateAuthorization/newWhitelist', array('plateListId'=>$l->code,'idIsCode'=>1, 'plate'=>$plate, 'refTimestamp'=>tts($timestamp), 'nationality'=>$nationality))}")
                      =t("Fast insert")

  
- if(paramdeep('validation','voidButton','enabled'))
  -if(count($permessiAttivi)>0)
    :javascript
      $(document).ready( function() {
        $('.btn-status-approved').addClass( 'hidden' );
        $('.btn-status-pending').addClass( 'hidden' );
        $('.btn-status-invalid').addClass( 'hidden' );
      } );
  -else
    :javascript
      $(document).ready( function() {
        $('.btn-status-approved').removeClass( 'hidden' );
        $('.btn-status-pending').removeClass( 'hidden' );
        $('.btn-status-invalid').removeClass( 'hidden' );
      } );
    