- $currentUrl = Yii::app()->createAbsoluteUrl($this->route,$context)

- $hasData = isset($owners) && count($owners->data)>0

.page-header
  %h2
    %i.icon-user
    =t('Vehicle owners')

%h5
  - $navigate_url_list = Yii::app()->createAbsoluteUrl('plateAuthorization')
  %a(href="#{$navigate_url_list}")
    %i.icon-file-text-alt
    =$objList->name
  %i.icon-long-arrow-right
  %i.icon-user
  =t('Select owner')
  %i.icon-long-arrow-right
  %font(color="gray")
    %i.icon-truck
    =t('Select vehicle')
  %i.icon-long-arrow-right
  %font(color="gray")
    %i.icon-time
    =t('Select validity period')
  %i.icon-long-arrow-right 
  %font(color="gray")
    %i.icon-ok-circle
    =t('Select plate authorization')

- $goback_url = Yii::app()->createAbsoluteUrl('plateAuthorization')

%br
  
.row
  .form-box 
    - $form = $this->beginWidget('bootstrap.widgets.TbActiveForm',       |
                array(                                                     |
                'id'=>'vehicleowner-search-form',                                  |
                'action' => Yii::app()->createUrl($this->route),           |
                'method' => 'GET',           |
              ))                                                           |

    %input(type="hidden" name="plateListId" value="#{$plateListId}")
    %input(type="hidden" name="step" value="1")
    %input(type="hidden" name="action" value="search")

    %h3
      =t("Search vehicle owner")

    %input(type="text" name="what" value="#{$what}")
    %a(href="#{$currentUrl}")
      %i.icon-remove-sign
        
    - $this->endWidget()

    
    - if ($hasData)

      .tableContainer.pagination-data-container
        %table.table.table-condensed
          %thead
            %tr
              %th
              %th= VehicleOwner::model()->getAttributeLabel('Nome')
              %th= VehicleOwner::model()->getAttributeLabel('Cognome')
              %th= VehicleOwner::model()->getAttributeLabel('epoch')
              %th= t('Actions')
          
          %tbody
            - foreach($owners->data as $owner)
              - $owner_url = Yii::app()->createAbsoluteUrl($this->route,array('plateListId'=>$plateListId,'step'=>'2','ownerId'=>$owner->ID))
              - $delete_url = Yii::app()->createUrl('plateAuthorization/whiteListWizardDelete',array('listId'=>$plateListId, 'objType'=>'owner', 'objId'=>$owner->ID, 'returnUrl'=>$currentUrl))
              %tr
                %td
                  %a(href="#{$owner_url}")
                    %i.icon-eye-open
                %td
                  %a(href="#{$owner_url}")
                    = $owner->Nome
                %td
                  %a(href="#{$owner_url}")
                    = $owner->Cognome
                %td
                  = $owner->epoch
                %td
                  -if(user()->checkAccess('vehicle_owner_management') && user()->checkAccess('vehicle_owner_update'))
                    %a(href="#{url('vehicleOwner/update', array('id'=>$owner->ID))}")
                      %i.icon-pencil
                  -if(Yii::app()->user->checkAccess("plate_auth_delete"))
                    %a(href="#{$delete_url}" onclick="return confirm('#{t('Are you sure you want to delete this item?')}')")
                      %i.icon-trash

      - if (isset($owners->pagination))
        .pagination.pagination-links-container
          - $this->widget('bootstrap.widgets.TbPager', array('pages' => $owners->pagination))

    - else

      %h4= Yii::t("app", "No results")

- if(true)
  %br
  .row
    .form-box 
      - $form = $this->beginWidget('bootstrap.widgets.TbActiveForm',       |
                array(                                                     |
                'id'=>'vehicleowner-create-form',                                  |
                'action' => Yii::app()->createUrl($this->route),           |
                'method' => 'POST',           |
              ))                                                           |

      %input(type="hidden" name="plateListId" value="#{$plateListId}")
      %input(type="hidden" name="step" value="1")
      %input(type="hidden" name="action" value="create")
      %input(type="hidden" name="create_confirmed" value="#{$properties[create_confirmed]}")

      %h3=t("Create vehicle owner")

      %h5
        =VehicleOwner::model()->getAttributeLabel('Nome')
        %font(color="red")='*'
      %input(type="text" name="name" value="#{$properties[owner_confirmation_name]}")
      
      %h5
        =VehicleOwner::model()->getAttributeLabel('Cognome')
        %font(color="red")='*'
      %input(type="text" name="surname" value="#{$properties[owner_confirmation_surname]}")

      %br
      %br

      %input(type="submit" name="create" value="#{t('Create')}")
        
      - $this->endWidget()

%br
%a(href="#{$goback_url}")
  %h4=t('Go back')     