#gate-group-index-page
  
  .page-header
    %h2
      %li.icon-cog
      = Yii::t("app", "Gates")
      
  .row
    - $gates = Gate::getAllGates()
    .tableContainer.pagination-data-container
      %table.table.table-condensed.span12
        %thead
          %tr
          %tr
            -if(user()->checkAccess('view_live'))
              %th
            %th
            %th
            %th= t('ID')
            %th= t('Description')
            %th= t('S/N')
            %th= t('IP')
            %th= t('Device')
            %th= t('Group')
            %th= t('Short name')
            %th= t('Code')
            %th
              %a.btn.btn-mini(href="#{Yii::app()->createAbsoluteUrl('gate/create')}")
                =Yii::t('app', 'New gate')   

        %tbody
          - foreach($gates as $gate)
            - $gate = new GatePresenter($gate)
            %tr
              -if(user()->checkAccess('view_live'))
                %td
                  -if($gate->hasLive())
                    %a(href="#{$gate->LivePageUrl}" target="_blank" title="#{t('Live')}")
                      .icon-facetime-video
              %td
                - if($gate->hasCoordinates())
                  %a(title="#{$gate->latitude} , #{$gate->longitude}" href="#{$gate->getGoogleMapsLink()}" target="_blank")
                    .icon-map-marker                
              %td
                -$lastLifeSignal = $gate->LastLifeSignal == null ? t("Never") : "".new DateTimeEx($gate->LastLifeSignal)
                %span.status-icon.icon-circle(class="#{$gate->statusClass}" title="#{$lastLifeSignal}")
              %td
                =$gate->ID
              %td
                =$gate->Descrizione
              %td
                =$gate->Gate
              %td
                =$gate->IP
              %td
                = t($gate->GateType)
              %td
                != SystemInfoHelper::getGateGroupCoolName($gate->id_group)
              %td
                =$gate->short_name
              %td
                =$gate->Code
              %td
                .btn-group
                  %a.btn.btn-small.dropdown-toggle(data-toggle="dropdown" href="#")
                    = Yii::t("app", "Actions")
                    %span.caret
                  %ul.dropdown-menu.pull-right
                    %li
                      %a(href="#{Yii::app()->createUrl('gate/view', array('id' => $gate->ID))}")
                        = Yii::t("app", ("View"))
                    %li
                      %a(href="#{Yii::app()->createUrl('gate/update', array('id' => $gate->ID))}")
                        = Yii::t("app", ("Modify"))
                    %li
                      %a(href="#{Yii::app()->createUrl('gate/delete', array('id' => $gate->ID))}")
                        = Yii::t("app", ("Delete")) 