First simple item detail version for a share

This commit is contained in:
eikek
2021-10-07 01:33:59 +02:00
parent f216c472ee
commit f25d40b493
5 changed files with 141 additions and 21 deletions

View File

@ -8,14 +8,49 @@
module Util.Item exposing
( concTemplate
, corrTemplate
, toItemLight
)
import Api.Model.Attachment exposing (Attachment)
import Api.Model.AttachmentLight exposing (AttachmentLight)
import Api.Model.ItemDetail exposing (ItemDetail)
import Api.Model.ItemLight exposing (ItemLight)
import Data.Fields
import Data.ItemTemplate as IT exposing (ItemTemplate)
import Data.UiSettings exposing (UiSettings)
toItemLight : ItemDetail -> ItemLight
toItemLight detail =
{ id = detail.id
, name = detail.name
, state = detail.state
, date = Maybe.withDefault detail.created detail.itemDate
, dueDate = detail.dueDate
, source = detail.source
, direction = Just detail.direction
, corrOrg = detail.corrOrg
, corrPerson = detail.corrPerson
, concPerson = detail.concPerson
, concEquipment = detail.concEquipment
, folder = detail.folder
, attachments = List.indexedMap toAttachmentLight detail.attachments
, tags = detail.tags
, customfields = detail.customfields
, notes = detail.notes
, highlighting = []
}
toAttachmentLight : Int -> Attachment -> AttachmentLight
toAttachmentLight index attach =
{ id = attach.id
, position = index
, name = attach.name
, pageCount = Nothing
}
corrTemplate : UiSettings -> ItemTemplate
corrTemplate settings =
let