// scss-lint:disable SelectorDepth SelectorFormat QualifyingElement
// scss-lint:disable NestingDepth ImportantRule


@import "../layouts/reminders";

.repository-table {
  --content-header-size: 3.5rem;
  --repository-top-toolbar-height: 3.5rem;
  height: calc(100vh - var(--navbar-height) - var(--content-header-size));
  position: relative;

  .dataTables_wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
  }

  .dataTables_scrollHead {
    flex-shrink: 0;

    .table.dataTable .sorting {
      &::after {
        opacity: 0;
      }

      &:hover {
        &::after {
          opacity: 1;
        }
      }
    }

    thead .sci-checkbox-container {
      margin-left: .125em !important;
    }
  }

  .dataTables_filter {
    display: flex;
    float: right;

    #filtersDropdownButton {
      margin-left: .5em;
    }
  }

  .processing-error {
    color: $brand-danger;
    margin-left: 2px;

    .fa-exclamation-triangle {
      margin-right: 5px;
    }
  }

  .repository-table-error {
    background: $color-white;
    display: none;
    height: 200px;
    padding: 1em;
    position: absolute;
    text-align: center;
    top: 176px;
    width: 100%;
    z-index: 1;

    &.active {
      display: block;
    }
  }

  // hack only for firefox
  @-moz-document url-prefix() {
    input.form-control[type="file"] {
      font-size: 13px;
      height: auto;
      padding: 3px 12px;
    }
  }

  // Cells
  td.added-on,
  td.asset-value-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  // Assigned

  .assigned-column {
    overflow: unset;
    padding: 1px 8px;
    position: relative;
    white-space: nowrap;

    .sn-icon.sn-icon-edit {
      line-height: 35px;
      text-align: center;
      width: 30px;
    }

    .repository-row-edit-icon {
      cursor: pointer;
      display: inline-block;
      opacity: 0;
    }

    .row-reminders-dropdown {
      cursor: pointer;
      display: inline-block;
      margin-right: 8px;
      padding: 8px;

      .fa-bell {
        height: 16px;
        text-align: center;
        width: 16px;
      }

      &.open {
        background: $color-concrete;
        border-radius: 4px;
      }
    }

    .assign-counter-container {
      border-radius: $border-radius-tag;
      display: inline-block;
      line-height: 35px;
      position: absolute;
      right: 5px;

      .assign-counter {
        display: inline-block;
        height: 100%;
        padding-left: 5px;
        width: 100%;

        &:hover,
        &:visited,
        &:focus {
          text-decoration: none;
        }

        &.has-assigned {
          color: $brand-primary;
        }
      }

      &:hover {
        background-color: $color-alto;
      }

      .dropdown-menu {
        padding: 8px;
        width: 320px;

        .search-tasks:placeholder-shown + .fa-times-circle {
          display: none;
        }

        .fa-times-circle {
          cursor: pointer;
        }
      }
    }

    .circle-icon {
      margin: 9px 30px;
    }
  }

  .checklist-column {
    overflow: unset;
  }

  .item-name {
    padding: 2px 8px;

    .row-reminders-dropdown {
      cursor: pointer;
      display: inline-block;
      margin-right: 8px;
      padding: 8px;

      .fa-bell {
        height: 16px;
        text-align: center;
        width: 16px;
      }

      &.open {
        background: $color-concrete;
        border-radius: 4px;
      }
    }

    .record-info-link {
      display: inline-block;
      margin: 8px 0;
    }
  }
  // Added on
  .added-on {
    white-space: nowrap;
  }

  // Checklists
  .checklist-dropdown {
    .dropdown-menu {
      min-width: 220px;

      .checklist-item {
        line-height: 18px;
        padding: 5px 15px;
      }
    }

    span {
      color: $brand-primary;
      cursor: pointer;

      &:hover {
        text-decoration: underline;
      }
    }
  }
  // Text and Number field

  .text-field.sci-input-container {
    min-width: 150px;
  }

  // Status
  .repository-status-value-container {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
  }

  .repository-status-value-icon {
    .emoji {
      display: inline;
      height: 24px;
      margin-right: 5px;
      min-width: 24px;
      width: 24px;
    }
  }

  .dropdown-selector-container {
    width: 150px;

    .dropdown-container {
      left: 0 !important;
      margin: 0 !important;
      position: absolute !important;
    }

    .emoji-status {
      .emoji {
        height: 24px;
        margin-right: 5px;
        min-width: 24px;
        transition: .3s;
        width: 24px;
      }
    }

    &.open {
      .ds-simple.emoji-status {
        .emoji {
          height: 12px;
          margin-right: 2px;
          min-width: 12px;
          width: 12px;
        }
      }
    }
  }

  // Stock
  .stock-value-view-render {
    &.stock-empty {
      color: $brand-danger;

      &::before {
        @include font-awesome;
        content: $font-fas-exclamation-triangle;
      }
    }

    &.stock-low {
      &::before {
        @include font-awesome;
        color: $brand-warning;
        content: $font-fas-exclamation-triangle;
      }
    }

  }

  .not-assigned-stock {
    color: $color-black;
    cursor: pointer;

    &:hover {
      text-decoration: none;
    };
  }

  .manage-repository-stock-value-link {
    cursor: pointer;
  }

  .manage-repository-consumed-stock-value-link:not(.stock-value-view-render) {
    color: $color-volcano;
  }

  .empty-stock-render,
  .consumption-locked {
    color: $color-silver-chalice;
  }

  .row-stock,
  .row-consumption {
    min-width: 140px;
  }


  // DateTime
  .datetime-container {
    display: flex;
    position: relative;

    .sci-input-container {
      margin: 0 2px;
    }

    .separator {
      line-height: 36px;
      text-align: center;
      width: 20px;
    }

    .start-time,
    .end-time {
      display: flex;
      position: relative;
    }

    .date-container {
      &.datetime {
        width: 240px;
      }

      &.time {
        width: 120px;
      }

      &.date {
        width: 200px;
      }

      &.error {
        &::after {
          color: $brand-danger;
          content: attr(data-error-text);
          font-size: 12px;
          margin-top: -4px;
          position: absolute;
          top: 100%;
        }
      }
    }

    .time-container {
      width: 90px;

      .fa-clock {
        cursor: pointer;
      }
    }


    &.dateonly,
    &.range-type .dateonly {
      .time-container {
        display: none;
      }
    }

    &.timeonly,
    &.range-type .timeonly {
      .date-container {
        display: none;
      }
    }
  }

  // Actions
  .dataTable {
    tbody {
      tr:hover {
        background-color: var(--sn-super-light-grey);

        .assigned-column {
          .repository-row-edit-icon {
            opacity: 1;
          }
        }

        &.editing {
          .assigned-column .repository-row-edit-icon {
            opacity: 0;
            pointer-events: none;
          }
        }
      }

      .editing {
        border: 1px solid;
      }
    }
  }

  &.editing {
    .dataTable {
      tbody {
        tr.blocked {
          opacity: .4;
          pointer-events: none;
        }

        tr:hover {
          .assigned-column {
            .assign-counter-container {
              background-color: transparent;
            }

            .circle-icon {
              margin-left: 30px;
            }
          }
        }

        td {
          overflow: visible;
        }
      }
    }
  }
}

.repository-table,
#myModuleRepositoryFullViewModal {
  .modal-body {
    padding: 0;
    border-bottom: 0;
  }

  .date-time-cell-value,
  .date-cell-value {
    display: inline-block;

    &.reminder {
      position: relative;

      &::after {
        background-color: $brand-danger;
        border: 2px solid $color-white;
        border-radius: 50%;
        content: "";
        display: inline-block;
        height: 10px;
        position: absolute;
        right: -.7em;
        top: 0;
        width: 10px;
      }
    }
  }
}
