-$u = $workPeriod->user
-$itsMe = $u->id == user()->id
%tr
  %td
    -if(!$workPeriod->closed)
      %span(title="#{t('Current active session')}")='*'
  %td            
    - if (Yii::app()->user->checkAccess('edit_event_behaviors'))            
      %a(href="#" data-behavior="AjaxModal" data-ajax-modal-target="#modal-report-detail" data-ajax-modal-url="#{Yii::app()->createAbsoluteUrl('report/viewSummary', array('workPeriodID' => $workPeriod->id))}")
        %i.icon-zoom-in
        = $workPeriod->id
    - else            
      %a(href="#" data-behavior="AjaxModal" data-ajax-modal-target="#modal-report-detail" data-ajax-modal-url="#{Yii::app()->createAbsoluteUrl('paySlip/viewSummary', array('workPeriodID' => $workPeriod->id))}")
        %i.icon-zoom-in
        = $workPeriod->id
  -if($all)
    %td
      -if(user()->checkAccess('user_view'))
        %a(href="#{url('user/view',array('id'=>$u->id))}" target="_blank")=$u->getFullName()
      -else
        =$u->getFullName()
  %td= new DateTimeEx($workPeriod->login_at)
  %td= $workPeriod->last_action_at == null ? "-" : new DateTimeEx($workPeriod->last_action_at)
  %td= $workPeriod->duration->format(t("%h hour %i min"))
  
  -if(paramdeep('payslip','showButton'))
    %td
      - if ($workPeriod->eventsManaged > 0 && $itsMe)
        %a.btn.btn-small(href="#" data-behavior="AjaxModal" data-ajax-modal-target="#modal-payslip-confirm" data-ajax-modal-url="#{Yii::app()->createAbsoluteUrl('paySlip/confirm', array('workPeriodID' => $workPeriod->id))}")
          =t("Generate")
      - else   
        .btn.btn-small.disable(disabled='disabled')
          =t("Generate")
    
  - if (Yii::app()->user->checkAccess('create_events_report') && paramdeep('report','byWorkPeriod'))
    %td
      -if(paramdeep('report','showPreviewButton'))
        - if ( ($workPeriod->eventsApproved > 0 || $workPeriod->eventsInvalid > 0) )
          %a.btn.btn-small(href="#{Yii::app()->createAbsoluteUrl('report/preview', array('workPeriodID' => $workPeriod->id))}")
            =t("Preview")
        - else
          .btn.btn-small.disable(disabled='disabled')
            =t("Preview")
      - if ($workPeriod->eventsReadyToTagCount > 0  && $itsMe)
        %a.btn.btn-small.btn-warning(data-behavior="AjaxModal" data-ajax-modal-target="#modal-report-confirm" data-ajax-modal-url="#{Yii::app()->createAbsoluteUrl('report/confirm', array('workPeriodID' => $workPeriod->id))}")
          =t("Generate")
          = "($workPeriod->eventsReadyToTagCount)"
      - else if ( ($workPeriod->eventsApproved > 0 || $workPeriod->eventsInvalid > 0)  && $itsMe)
        %a.btn.btn-small(href="#{Yii::app()->createAbsoluteUrl('report/create', array('workPeriodID' => $workPeriod->id))}")
          =t("Generate")
      - else
        .btn.btn-small.disable(disabled='disabled')
          =t("Generate")