-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMsg.elm
41 lines (37 loc) · 1.04 KB
/
Msg.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module Msg exposing (..)
type Msg
= Nop
| Calcular
| ReceivedJsonFromJs (TipoEnvio, String)
| ReceivedRequest (TipoEnvio, (Result String String))
| UpdateCepOrigem String
| UpdateCepDestino String
| UpdatePeso String
| UpdateAltura String
| UpdateLargura String
| UpdateComprimento String
| UpdateAvisoRecebimento Bool
| UpdateEntregaMaoPropria Bool
| UpdateValorDeclarado String
| UpdatePossuiContrato Bool
| UpdateCodigoEmpresa String
| UpdateSenha String
| UpdateCodigoServicoPac String
| UpdateCodigoServicoSedex String
| UpdateCodigoServicoESedex String
type TipoEnvio
= Pac
| Sedex
| ESedex
tipoEnvioToInt : TipoEnvio -> Int
tipoEnvioToInt tipo =
case tipo of
Pac -> 1
Sedex -> 2
_ -> 3
intToTipoEnvio : Int -> TipoEnvio
intToTipoEnvio n =
case n of
1 -> Pac
2 -> Sedex
_ -> ESedex