extends ../layouts/default

block pageHeader
  .page-header
    .row
      .col-md-7
        h1 Workers
      .col-md-5.text-right
        button.btn.btn-danger(data-toggle="modal", data-target="#myModal")
          i.fa.fa-plus
          !=" New Worker"

block content
  .panel.panel-default
    .panel-heading
      .row
        .col-md-1 name
        .col-md-2 id/key
        .col-md-3 secret
        .col-md-3 desc
        .col-md-1.text-right created
        .col-md-1.text-right updated
        .col-md-1.text-right remove

    ul.list-group
      each worker in workers
        li.list-group-item
          .row
            .col-md-1
              small=worker.name
            .col-md-2
              small
                code=worker.id
            .col-md-3
              small
                code.text-muted=worker.consumer_secret
            .col-md-3=worker.desc
            .col-md-1.text-right
              !=helper.genDateTag(worker.created_at)
            .col-md-1.text-right
              !=helper.genDateTag(worker.updated_at)
            .col-md-1.text-right
              form.trashed(action="/workers/trashed", method="post")
                input#worker_id(type='hidden', name='worker_id', value="#{worker.id}")
                - if(worker.trashed_at!=null){
                    button.btn-danger(type="submit")
                      i.fa.fa-medkit
                - } else{
                    button.btn-primary(type='submit')
                      i.fa.fa-trash-o
                - }

  #myModal.modal.fade(tabindex='-1', role='dialog', aria-labelledby='myModalLabel', aria-hidden='true')
    form.login(action="/workers/new", method="post")
      .modal-dialog
        .modal-content
          .modal-header
            button.close(type='button', data-dismiss='modal', aria-hidden='true') &times;
            h4#myModalLabel.modal-title Create new worker
          .modal-body

            .form-group
              .controls
                input.input-lg.form-control#name(type='text', name="name", placeholder='Worker Name')

            .form-group
              .controls
                input.input-lg.form-control#desc(type='text', name="desc", placeholder='Description')

          .modal-footer
            button.btn.btn-default(type='button', data-dismiss='modal') Close
            button.btn.btn-primary(type='submit') Save changes




