mirror of
				https://github.com/TheAnachronism/docspell.git
				synced 2025-11-04 12:30:12 +00:00 
			
		
		
		
	Add correspondent organizations in item edit view
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
module Api exposing
 | 
					module Api exposing
 | 
				
			||||||
    ( addTag
 | 
					    ( addCorrOrg
 | 
				
			||||||
 | 
					    , addTag
 | 
				
			||||||
    , cancelJob
 | 
					    , cancelJob
 | 
				
			||||||
    , changePassword
 | 
					    , changePassword
 | 
				
			||||||
    , checkCalEvent
 | 
					    , 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 -> String -> OptionalId -> (Result Http.Error BasicResult -> msg) -> Cmd msg
 | 
				
			||||||
setCorrPerson flags item id receive =
 | 
					setCorrPerson flags item id receive =
 | 
				
			||||||
    Http2.authPut
 | 
					    Http2.authPut
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -196,6 +196,20 @@ update flags msg model =
 | 
				
			|||||||
                    else
 | 
					                    else
 | 
				
			||||||
                        ( model, Cmd.none, Nothing )
 | 
					                        ( 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"
 | 
					                    Debug.todo "implement"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,7 @@ import Comp.Dropdown exposing (isDropdownChangeMsg)
 | 
				
			|||||||
import Comp.Dropzone
 | 
					import Comp.Dropzone
 | 
				
			||||||
import Comp.ItemMail
 | 
					import Comp.ItemMail
 | 
				
			||||||
import Comp.MarkdownInput
 | 
					import Comp.MarkdownInput
 | 
				
			||||||
 | 
					import Comp.OrgForm
 | 
				
			||||||
import Comp.SentMails
 | 
					import Comp.SentMails
 | 
				
			||||||
import Comp.YesNoDimmer
 | 
					import Comp.YesNoDimmer
 | 
				
			||||||
import Data.Direction exposing (Direction)
 | 
					import Data.Direction exposing (Direction)
 | 
				
			||||||
@@ -247,6 +248,7 @@ type Msg
 | 
				
			|||||||
    | AttachDDMsg (DD.Msg String String)
 | 
					    | AttachDDMsg (DD.Msg String String)
 | 
				
			||||||
    | ModalEditMsg Comp.DetailEdit.Msg
 | 
					    | ModalEditMsg Comp.DetailEdit.Msg
 | 
				
			||||||
    | StartTagModal
 | 
					    | StartTagModal
 | 
				
			||||||
 | 
					    | StartCorrOrgModal
 | 
				
			||||||
    | CloseModal
 | 
					    | CloseModal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1240,6 +1242,14 @@ update key flags next msg model =
 | 
				
			|||||||
                , Cmd.none
 | 
					                , Cmd.none
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        StartCorrOrgModal ->
 | 
				
			||||||
 | 
					            noSub
 | 
				
			||||||
 | 
					                ( { model
 | 
				
			||||||
 | 
					                    | modalEdit = Just (Comp.DetailEdit.initOrg model.item.id Comp.OrgForm.emptyModel)
 | 
				
			||||||
 | 
					                  }
 | 
				
			||||||
 | 
					                , Cmd.none
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        CloseModal ->
 | 
					        CloseModal ->
 | 
				
			||||||
            noSub ( { model | modalEdit = Nothing }, Cmd.none )
 | 
					            noSub ( { model | modalEdit = Nothing }, Cmd.none )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1938,6 +1948,13 @@ renderEditForm settings model =
 | 
				
			|||||||
                [ label []
 | 
					                [ label []
 | 
				
			||||||
                    [ Icons.organizationIcon
 | 
					                    [ Icons.organizationIcon
 | 
				
			||||||
                    , text "Organization"
 | 
					                    , text "Organization"
 | 
				
			||||||
 | 
					                    , a
 | 
				
			||||||
 | 
					                        [ class "right-float"
 | 
				
			||||||
 | 
					                        , href "#"
 | 
				
			||||||
 | 
					                        , onClick StartCorrOrgModal
 | 
				
			||||||
 | 
					                        ]
 | 
				
			||||||
 | 
					                        [ i [ class "add link icon" ] []
 | 
				
			||||||
 | 
					                        ]
 | 
				
			||||||
                    ]
 | 
					                    ]
 | 
				
			||||||
                , Html.map OrgDropdownMsg (Comp.Dropdown.view settings model.corrOrgModel)
 | 
					                , Html.map OrgDropdownMsg (Comp.Dropdown.view settings model.corrOrgModel)
 | 
				
			||||||
                , renderOrgSuggestions model
 | 
					                , renderOrgSuggestions model
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user