mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
First simple item detail version for a share
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user