sib-router(default-route='circle-profile', hidden)
  sib-route(name='circle-profile')
  sib-route(name='circle-edit')

#circle-profile(hidden)
  include ../../templates/hd-circle-team.pug
  .content-box__info

    .space-between
      sib-display(
        bind-resources
        fields='creationDateSet(title, creationDate)'

        class-title='word-spacing-right'

        value-title='Creation date: '

        widget-creationDate='sib-display-date'
      )
      sib-ac-checker(permission='acl:Append', bind-resources, nested-field='members')
        sib-link(class='button text-bold text-uppercase reversed button-blue bordered with-icon icon-pencil' next='circle-edit' bind-resources) Edit and add Members


    h2 Members:

    sib-display.block(
      bind-resources
      fields='members'

      multiple-members=''
      widget-members='circle-team-template'
    )

    div.box-button
      sib-ac-checker(permission='acl:Delete', bind-resources)
        sib-delete(
          class='button text-bold text-uppercase button-blue bordered with-icon icon-trash'
          bind-resources
          data-label='Delete Circle'
        )

      sib-widget(name='circle-leave-button')
        template
          sib-delete(
            class='button btn-margin-left text-bold text-uppercase reversed button-dark bordered with-icon icon-close'
            data-src="${src}"
            data-label='Leave Circle'
          )

      sib-widget(name='circle-join-button')
        template
          button.button.btn-margin-left.text-bold.text-uppercase.reversed.button-dark.bordered.with-icon.icon-arrow-right-circle.flex
            sib-form(
              data-src=''
              nested-field='members'

              fields='user.@id'
              label-user.@id=''
              value-user.@id=''
              widget-user.@id='sib-form-hidden'

              hd-inherit-bind-user2input="input[name='user.@id']"

              submit-button='Join Circle'
            )

      sib-display(
        bind-resources
        nested-field='members'
        fields='relation'
        action-relation='relation'
        widget-relation='circle-leave-button'
        search-fields='user'
        search-widget-user='sib-form-hidden'
        search-value-user=""
        empty-widget='circle-join-button'
        hd-inherit-bind-resources='circle-join-button'
        hd-inherit-user-id="search-value-user"
      )



#circle-edit(hidden)
  include page-circle-edit.pug
