extends ../layouts/main
block content

  include components/list-item

  form(method="post", action= `/admin/service-node/${serviceNode._id}`).uk-form
    .uk-card.uk-card-default
      .uk-card-header
        div(uk-grid).uk-grid-collapse.uk-flex-middle
          div(class="uk-width-1-1 uk-width-expand@l")
            h1.uk-card-title.uk-margin-remove= serviceNode.site.name
          div(class="uk-width-1-1 uk-width-auto@l")
            .uk-text-small client id: #{serviceNode._id}

      .uk-card-body
        .uk-margin
          +renderServiceNodeListItem(serviceNode)

        .uk-margin
          label(for="notes").uk-form-label Notes
          textarea(id="notes", name="notes", rows="4", placeholder="Enter client notes").uk-textarea= (serviceNode.admin && serviceNode.admin.notes) ? serviceNode.admin.notes : undefined

        .uk-margin
          label(for="is-active")
            input(id="is-active", name="isActive", type="checkbox", checked= serviceNode.flags.isActive).uk-checkbox
            span.uk-margin-small-left Is Active

      .uk-card-footer
        div(uk-grid).uk-grid-small
          .uk-width-expand
            +renderBackButton()

          .uk-width-auto
            button(
              type="button",
              data-service-node-id= serviceNode._id,
              onclick="return dtp.adminApp.deleteServiceNode(event);"
            ).uk-button.uk-button-danger.uk-border-rounded
              span
                i.fas.fa-trash
              span.uk-margin-small-left Delete

          .uk-width-auto
            button(type="submit").uk-button.uk-button-primary.uk-border-rounded
              span
                i.fas.fa-save
              span.uk-margin-small-left Save