
.page-header
  %h2
    %li.icon-puzzle-piece
    = Yii::t("app", "Migrations")

%style=".linkami { padding: 2px; }"
%div(style="width: 100%; border: darkgray solid 1px; border-radius: 6px; padding: 5px; background-color: lightgray;")
  %b
    %a.linkami(href="#{url('debug/migrationCreate')}")
      .icon-plus
    %a.linkami(href="#{url('debug/migrationUp',array('version'=>''))}" title="#{t('Apply next migration')}")
      .icon-arrow-up
    %a.linkami(href="#{url('debug/migrationDown',array('version'=>''))}" title="#{t('Remove previous migration')}")
      .icon-arrow-down



%table.table.table-condensed
  %thead
    %tr
      %th
      %th=t('Name')
      %th=t('File')
      %th=t('Database')
      %th=t('Actions')
  %tbody
    -$index=0
    -$countDown=0
    -foreach($migrations as $m)
      -$onFile = false
      -$onDb = false
      %tr
        %td=$index++
        %td
          -if(array_key_exists($m,$fileMigrations))
            -$onFile = true
            %a(href="#{url('debug/viewAsText',array('filename'=>$fileMigrations[$m]->path))}")=$m
          -else
            =$m
        %td
          -if($onFile)
            .icon-ok.color-green
          -else
            .icon-remove.color-red
        %td
          -if(array_key_exists($m,$dbMigrations))
            .icon-ok.color-green
            -$onDb = true
          -else
            .icon-remove.color-red
        %td
          -if($onFile && !$onDb)
            %a(href="#{url('debug/migrationUp',array('version'=>$m))}" title="#{t('Apply all migrations to version')}")
              .icon-arrow-left
          -if($onFile && $onDb && $countDown == 0)
            -$countDown++
            %a(href="#{url('debug/migrationDown',array('version'=>null))}" title="#{t('Apply all migrations to version')}")
              .icon-arrow-right
          -if(!$onDb)
            %a(href="#{url('debug/migrationBypass',array('version'=>$m))}" title="#{t('Bypass this version')}" onclick="return confirm('Confirm BYPASS?');")
              .icon-angle-up
            %a(href="#{url('debug/migrationBypassTo',array('version'=>$m))}" title="#{t('Bypass all to version')}" onclick="return confirm('Confirm BYPASS?');")
              .icon-double-angle-up      
%pre
  =$this->getMigrateHelp()
  