extends ../partials/page-templates/_layout.pug
include ../partials/mixins-demo/_nav-components.pug
include ../partials/mixins/_notification.pug
include ../partials/mixins/_toolbar.pug
include ../partials/mixins/_toolbar-filter.pug
include ../partials/mixins/_search-filter.pug
include ../partials/mixins/_form-field.pug

block append variables
  -var active_nav_item = "components"
  -var sidebar = true
  - var page_title = "Component: Toolbar"

block content

  .page__content__block
    .text--stamp Component
    h1
      strong Toolbar
    p A toolbar for manipulating content displayed below the toolbar, e.g. in a list or in a table. The toolbar may contain interactive elements, i.e.
      | 
      a(href="/buttons ") buttons
      |,
      | 
      a(href="/form-fields") form elements
      |
      | and
      | 
      a(href="/links") links
      |.

    +toolbar()
      form.form
        .form__inline-submit
          .form__field.form__field--inline-label
            label(for="demo-search") Search
            input(type="search" autocomplete="off" autocorrect="off" autocapitalize="off" id="demo-search")
          input(type="submit" value="Submit").form__inline-submit__button  
      button.icon-confirm-circle.button.button--icon Mark as read
      button(title="Delete").icon-delete.button.button--icon.button--icon--hide-label Delete
      button.button.button--text Select all
      .toolbar__split
      .toolbar__text-item
        a(href="#").a--text-link Open in new tab
    .box.theme--background-secondary
      p List of messages goes here

    p If the toolbar contains more items, than will fit on a single line, items wrap from the right and are collapsed behind a toogle button (
      span.icon.icon-context-menu
      |).

    +toolbar()
      each val in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
        button.button= "Action " + val
    .box.theme--background-secondary
      p List or table of actionable items goes here

    p If a group of items belong together, like the radio buttons and checkboxes below, they must be wrapped in a
      code div
      |
      | with class
      code .toolbar__group
      |. This ensures that all items within in the group are either visible or collapsed at anytime - i.e. a single item from the group cannot be visible, while others are collapsed.

    +toolbar()
      .toolbar__group
        .form__field.form__field--horizontal
          label(for="demo-all") All issues
          input(type="radio" name="demo" value="all" id="demo-all" checked)
        .form__field.form__field--horizontal
          label(for="demo-open") Open
          input(type="radio" name="demo" value="all" id="demo-open")
        .form__field.form__field--horizontal
          label(for="demo-resolved") Resolved
          input(type="radio" name="demo" value="all" id="demo-resolved")
      .toolbar__split
      .toolbar__group
        .form__field.form__field--horizontal
          label(for="demo-epics") Epics
          input(type="checkbox" id="demo-epics" checked)
        .form__field.form__field--horizontal
          label(for="demo-stories") Stories
          input(type="checkbox" id="demo-stories" checked)
        .form__field.form__field--horizontal
          label(for="demo-tasks") Tasks
          input(type="checkbox" id="demo-tasks" checked)
    .box.theme--background-secondary
      p List of issues goes here


  .page__content__block
    h2 Examples
    h3 Toolbar above a timetable
    +toolbar()
      .toolbar__group.toolbar__group--nowrap
        button(title="Previous week").icon-previous.button.button--icon.button--icon--hide-label Previous week
        button.button.button--text Today
        button(title="Next week").icon-next.button.button--icon.button--icon--hide-label Next week
      .toolbar__split
      button.icon-sync.button.button--text.button--icon Sync with calendar

    .box.theme--background-secondary
      p Timetable goes here

    h3 Toolbar for sorting and paging search results
    +toolbar()
      .toolbar__text-item 
        strong 3.215
        | 
        | courses found
      .toolbar__split
      form.form  
        .form__field.form__field--inline-label.form__field--inline-label--select
          label(for="sort") Sort by
          select(id="sort")
            option(value="name") Name
            option(value="ects") ECTS points
            option(value="semester") Semester  
      .toolbar__group.toolbar__group--nowrap
        button(title="Previous page" disabled).visually-disabled.icon-previous.button.button--icon.button--icon--hide-label Previous page
        .toolbar__text-item.text--secondary 1 to 100 of 3.215
        button(title="Next page").icon-next.button.button--icon.button--icon--hide-label Next page
    
    .box.theme--background-secondary
      p Search results goes here    

  .page__content__block
    h3 Toolbar for sending mails and filtering a table of recipients
    +toolbar()
      button.button Send mail
      button.button Send first reminder
      button.button Send second reminder
      button(title="Refresh").icon-refresh.button.button--icon.button--icon--hide-label Refresh
      .toolbar__split
      .form
        .form__field.form__field--inline-label.form__field--inline-label--select
          label(for="filter") Filter
          select(id="filter")
            option(value="all") All recipients
            option(value="responded") Has responded
            option(value="no-response") No response before reminder
            option(value="no-response-after-reminder") No response after first reminder
            option(value="no-response-after-second-reminder") No response after second reminder

    .box.theme--background-secondary
      p Table goes here

  .page__content__block
    h3 Toolbar used for filtering a list of an employee's absence
    +toolbar()
      .toolbar__group
        .form__field.form__field--horizontal
          label(for="own-absence") Own absence
          input(type="checkbox" id="own-absence")
        .form__field.form__field--horizontal
          label(for="childs-absence") Child's absence
          input(type="checkbox" id="childs-absence")
        .form__field.form__field--horizontal
          label(for="other-absence") Other type of absence
          input(type="checkbox" id="other-absence")
      .toolbar__split
      .toolbar__group
        .form__field.form__field--inline-label
          label(for="from-date") From
          input(type="date" id="from-date" value="2019-01-01" min="2017-01-01" max="2019-10-21")
        .form__field.form__field--inline-label
          label(for="to-date") To
          input(type="date" id="to-date" value="2019-10-21" min="2017-01-01" max="2019-10-21")

    .box.theme--background-secondary
      p Table goes here

  .page__content__block
    h3 Toolbar for filtering a list of learning tools
    +toolbar()
      form.form
        .form__inline-submit
          .form__field.form__field--inline-label
            label(for="search") Search
            input(type="search" utocomplete="off" autocorrect="off" autocapitalize="off" id="search")
          input(type="submit" value="Submit").form__inline-submit__button  
      .toolbar__split
      .toolbar__group
        .form__field.form__field--horizontal
          label(for="learning-tools-all") All tools
          input(type="radio" name="learning-tools" value="all" id="learning-tools-all" checked)
        .form__field.form__field--horizontal
          label(for="learning-tools-favs") Favourites
          input(type="radio" name="learning-tools" value="all" id="learning-tools-favs")
        .form__field.form__field--horizontal
          label(for="learning-tools-projects") Project work
          input(type="radio" name="learning-tools" value="all" id="learning-tools-projects")
        .form__field.form__field--horizontal
          label(for="learning-tools-eva") Evaluation
          input(type="radio" name="learning-tools" value="all" id="learning-tools-eva")
        .form__field.form__field--horizontal
          label(for="learning-tools-guide") Supervision
          input(type="radio" name="learning-tools" value="all" id="learning-tools-guide")
        .form__field.form__field--horizontal
          label(for="learning-tools-feedback") Feedback
          input(type="radio" name="learning-tools" value="all" id="learning-tools-feedback")

    .box.theme--background-secondary
      p List of learning tools here

  .page__content__block
    h3#filters Toolbar for multi dimensional filtering
    p The toolbar below applies the
      |  
      a(href="/form-search#search-filters") search filters
      | 
      | for indicating the current selected filters, which is highly recommned to be used together with the toolbar filters.
    p The toolbar also uses the
      | 
      code .toolbar--no-collapse
      | 
      | modfier for a more explicite toolge button, see below.
    
    - var terms = ["Autumn 2023", "Spring 2023","Autumn 2022", "Spring 2022", "Autumn 2021", "Spring 2021", "Autumn 2020", "Spring 2020", "Autumn 2019", "Spring 2019", "Autumn 2018", "Spring 2018", "Autumn 2017", "Spring 2017",]
    
    - var points = ["0 ECTS", "5 ECTS", "10 ECTS", "15 ECTS", "20 ECTS", "25 ECTS", "30 ECTS", "35 ECTS", "40 ECTS", "45 ECTS", "50 ECTS", "55 ECTS", "60 ECTS"]
    
    - var locations = ["Aarhus", "Copenhagen", "Herning"]
    
    - var faculties = ["Aarhus BSS", "Arts", "Health", "Natural Sciences", "Technical Sciences"]
    
    - var languages = ["Danish", "English", "German", "French", "Norwegian", "Swedish", "Chineese"]
    
    - var levels = ["Bachelor", "Master", "PhD"]
    
    +toolbar("All filters", true, "filter", "All", "Show all filter options")
      +toolbar-filter(terms, "Semester", "semester", "en", 2)
      +toolbar-filter(points, "ECTS", "points")
      +toolbar-filter(locations, "Location", "location", "en", 1)
      +toolbar-filter(faculties, "Faculty", "faculty")
      +toolbar-filter(languages, "Language", "language")
      +toolbar-filter(levels, "Level", "level")
      
    .search-filter.search-filter--unconstrained
      h3.search-filter__label Selected filters:
      .search-filter__items
        +search-filter("Autumn 2023")
        +search-filter("Spring 2023")
        +search-filter("Aarhus")
        button(type="button" title="Clear all filters" aria-label="Clear all filters").search-filter__item.search-filter__item--clear-all Clear all
      
    .box.theme--background-secondary.vertical-spacing-top
      p List of coureses here

  .page__content__block
    h2#modifers Design and behaviour modifiers
    p The toolbar below uses a series of modifier to change the design and behavior of the toolbar.
    ul
      li 
        code .toolbar__split--force-overflow
        |
        | forces all elements after the 
        |
        code .toolbar__split
        | 
        | to overflow and be hidden, even if space is avialable. You can further use the
        | 
        code .toolbar__split--force-overflow--not-on-medium
        | 
        | and 
        | 
        code .toolbar__split--force-overflow--not-on-wide
        | 
        | modifiers to have this apply only in narrow viewports.
      li An
        | 
        a(href="/icons#icon-details") icon class
        |
        | on the toggle buttons changes the icon from the default context menu icon. Use this for indicating a specfic funtionality that hides behind the toggle. Also update text, title and aria-label on the button.
      li 
        code .toolbar__toggle--ghost
        | 
        | on the toogle button dims the design of the button.
    
    +toolbar("Change sorting", false, "reorder", null, null, true).vertical-spacing-bottom--small
      h3.toolbar__text-item
        strong 3.271
        | 
        | courses found
      .toolbar__split.toolbar__split--force-overflow
      form.form
        .form__field.form__field--inline-label.form__field--inline-label--select
          label(for="sort") Sort 
          select#sort
            option(value="name-a-z") Name  
            option(value="name-z-a") Navn Z-A
            option(value="ECTS-acending") ECTS acending
            option(value="ECTS-decending") ECTS decending
    
    .box.theme--background-secondary
      p List of courses here  
    
    p The toolbar below uses the
      | 
      code .toolbar__no-collapse
      | 
      | modifier on the toggle that makes it bigger and adds an icon. But also removes the option to toggle the toolbar back into the collapsed state. Use this when you want to be more explcite about what hides behind the toggle. Note that the button has a shorter label in narrow viewports.
      
    +toolbar("All options", true, "expand", "All")
      each val in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
        button.button.button--dimmed= "Option " + val
    .box.theme--background-secondary
      p List or table of items goes here    
      
    p The toolbar below uses the
      | 
      code .toolbar--center-align-items
      | 
      | modifer for centerings content in the toolbar.
    
    .box.theme--background-secondary.vertical-spacing-bottom--small
      p List or table of items goes here
    +toolbar().toolbar--center-align-items
      .toolbar__group.toolbar__group--nowrap
        button(title="Previous page" disabled="disabled").button.button--icon.button--icon--hide-label.visually-disabled.icon-previous Previous page
        .toolbar__text-item.text--secondary 1 to 25 of 3.271
        button(title="Next page").button.button--icon.button--icon--hide-label.icon-next Next page

    +toolbar()
      a.button.button--icon.icon-add Ny side
      .form__inline-submit
        .form__field.form__field--inline-label
          label(for="overview-search") Søg på navn
          input(type="search" id="overview-search")
        input.form__inline-submit__button(type="submit" value="Søg")
      .toolbar__split.toolbar__split--force-overflow
      .toolbar_group 
        +form-field("text", "destination", "Destination")
        +form-field("text", "language", "Language")
        +form-field("text", "education", "Educations")

block sidebar

  +components-nav("toolbar")
