mixin dictionary-domain-labels
  .content-hold-prerequisites
    #offset-main.main-container.mt-2
      if results.length
        .d-flex.justify-content-end.my-3
          .d-flex
            include /utilities/pager
            +pager

        form#dictionary-domain-labels(
          method="post"
          action="/api/v1/dictionaries/update-domain-labels"
        )
          input#subareas-dict-id(
            type="hidden"
            name="dictionaryId"
            value=dictionary.id
          )
          table#all-areas-table.table.areas-table.table-responsive
            thead
              tr
                th.visible-th(scope="col")= t('Vidno')
                th(scope="col")= t('Področna oznaka')
                th(scope="col") 
            tbody#page-results
              each result in results
                tr
                  input(type="hidden" name="domainLabelId" value=result.id)
                  th(scope="row")
                    if result.isVisible
                      input.form-check.checkbox-table(
                        type="checkbox"
                        name="isVisible"
                        checked
                        disabled
                      )
                    else
                      input.form-check.checkbox-table(
                        type="checkbox"
                        name="isVisible"
                        disabled
                      )
                  td.tdata-area= result.name
                  td.buttons-group
                    .table-buttons
                      button.p-0.table-button-grp.me-3.edit-row-btn(
                        type="button"
                      )
                        img(src="/images/u_edit-alt.svg" alt="")
                      button.p-0.table-button-grp.delete-row-btn(
                        type="button"
                        data-bs-target="#alert-modal"
                        data-bs-toggle="modal"
                      )
                        img(src="/images/red-trash-icon.svg" alt="")
      else
        form#dictionary-domain-labels(
          method="post"
          action="/api/v1/dictionaries/update-domain-labels"
        )
          input#subareas-dict-id(
            type="hidden"
            name="dictionaryId"
            value=dictionary.id
          )
          #subareas-info.d-flex.justify-content-center.mt-5
            p= t('Niste vnesli področnih oznak.')
          #no-subareas-section.d-none
            .d-flex.justify-content-end.mt-4
              .d-flex
                include /utilities/pager
                +pager

            table#all-areas-table.table.areas-table.table-responsive
              thead
                tr
                  th.visible-th(scope="col")= t('Vidno')
                  th(scope="col")= t('Področna oznaka')
                  th(scope="col") 
              tbody
                tr.hidden(hidden)
      .row
        .col-sm-3
          .subject-name
            label.input-name-txt= t('PODROČNA OZNAKA')
          input#subarea-input.form-control(type="text")
        .col.d-flex.align-items-end.mt-2
          button#add-area.btn.btn-primary(type="submit" disabled)= t('Dodaj')
      include /common/footer
  include /utilities/modal-alert
  include /utilities/modal-alert-mixin
  +alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
