Extend search stats to fully populate search menu

Refs: #856
This commit is contained in:
eikek
2021-10-05 13:50:31 +02:00
parent e961a5ac10
commit 813797756c
8 changed files with 167 additions and 8 deletions

View File

@ -10,9 +10,12 @@ module Util.CustomField exposing
, nameOrLabel
, renderValue
, renderValue2
, statsToFields
)
import Api.Model.CustomField exposing (CustomField)
import Api.Model.ItemFieldValue exposing (ItemFieldValue)
import Api.Model.SearchStats exposing (SearchStats)
import Data.CustomFieldType
import Data.Icons as Icons
import Html exposing (..)
@ -20,6 +23,15 @@ import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
statsToFields : SearchStats -> List CustomField
statsToFields stats =
let
mkField fs =
CustomField fs.id fs.name fs.label fs.ftype fs.count 0
in
List.map mkField stats.fieldStats
{-| This is how the server wants the value to a bool custom field
-}
boolValue : Bool -> String