mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-04 06:05:59 +00:00
Add correspondent organizations in item edit view
This commit is contained in:
parent
c6accca0ff
commit
a4d60c0d92
@ -1,5 +1,6 @@
|
||||
module Api exposing
|
||||
( addTag
|
||||
( addCorrOrg
|
||||
, addTag
|
||||
, cancelJob
|
||||
, changePassword
|
||||
, checkCalEvent
|
||||
@ -1086,6 +1087,16 @@ setCorrOrg flags item id receive =
|
||||
}
|
||||
|
||||
|
||||
addCorrOrg : Flags -> String -> Organization -> (Result Http.Error BasicResult -> msg) -> Cmd msg
|
||||
addCorrOrg flags item org receive =
|
||||
Http2.authPost
|
||||
{ url = flags.config.baseUrl ++ "/api/v1/sec/item/" ++ item ++ "/corrOrg"
|
||||
, account = getAccount flags
|
||||
, body = Http.jsonBody (Api.Model.Organization.encode org)
|
||||
, expect = Http.expectJson receive Api.Model.BasicResult.decoder
|
||||
}
|
||||
|
||||
|
||||
setCorrPerson : Flags -> String -> OptionalId -> (Result Http.Error BasicResult -> msg) -> Cmd msg
|
||||
setCorrPerson flags item id receive =
|
||||
Http2.authPut
|
||||
|
@ -196,6 +196,20 @@ update flags msg model =
|
||||
else
|
||||
( model, Cmd.none, Nothing )
|
||||
|
||||
OM om ->
|
||||
let
|
||||
org =
|
||||
Comp.OrgForm.getOrg om
|
||||
in
|
||||
if Comp.OrgForm.isValid om then
|
||||
( { model | submitting = True }
|
||||
, Api.addCorrOrg flags model.itemId org SubmitResp
|
||||
, Nothing
|
||||
)
|
||||
|
||||
else
|
||||
( model, Cmd.none, Nothing )
|
||||
|
||||
_ ->
|
||||
Debug.todo "implement"
|
||||
|
||||
|
@ -30,6 +30,7 @@ import Comp.Dropdown exposing (isDropdownChangeMsg)
|
||||
import Comp.Dropzone
|
||||
import Comp.ItemMail
|
||||
import Comp.MarkdownInput
|
||||
import Comp.OrgForm
|
||||
import Comp.SentMails
|
||||
import Comp.YesNoDimmer
|
||||
import Data.Direction exposing (Direction)
|
||||
@ -247,6 +248,7 @@ type Msg
|
||||
| AttachDDMsg (DD.Msg String String)
|
||||
| ModalEditMsg Comp.DetailEdit.Msg
|
||||
| StartTagModal
|
||||
| StartCorrOrgModal
|
||||
| CloseModal
|
||||
|
||||
|
||||
@ -1240,6 +1242,14 @@ update key flags next msg model =
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
StartCorrOrgModal ->
|
||||
noSub
|
||||
( { model
|
||||
| modalEdit = Just (Comp.DetailEdit.initOrg model.item.id Comp.OrgForm.emptyModel)
|
||||
}
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
CloseModal ->
|
||||
noSub ( { model | modalEdit = Nothing }, Cmd.none )
|
||||
|
||||
@ -1938,6 +1948,13 @@ renderEditForm settings model =
|
||||
[ label []
|
||||
[ Icons.organizationIcon
|
||||
, text "Organization"
|
||||
, a
|
||||
[ class "right-float"
|
||||
, href "#"
|
||||
, onClick StartCorrOrgModal
|
||||
]
|
||||
[ i [ class "add link icon" ] []
|
||||
]
|
||||
]
|
||||
, Html.map OrgDropdownMsg (Comp.Dropdown.view settings model.corrOrgModel)
|
||||
, renderOrgSuggestions model
|
||||
|
Loading…
x
Reference in New Issue
Block a user