From 4914fb8c76a7ad1ad8600238db5d7e9826adc517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veikko=20Lintuj=C3=A4rvi?= Date: Mon, 1 Jan 2024 19:43:50 +0200 Subject: [PATCH] New pikkuboksi order types added --- lib/osuuspuutarha/orders/order.ex | 13 +++++++- lib/osuuspuutarha/orders/parser.ex | 31 +++++++++++++++++-- .../live/order_live/form_component.html.heex | 6 +++- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/lib/osuuspuutarha/orders/order.ex b/lib/osuuspuutarha/orders/order.ex index eb498c5..b5e567f 100644 --- a/lib/osuuspuutarha/orders/order.ex +++ b/lib/osuuspuutarha/orders/order.ex @@ -24,7 +24,18 @@ defmodule Osuuspuutarha.Orders.Order do :merimasku ] - field :order_type, Ecto.Enum, values: [:full, :everyother, :elo, :community] + field :order_type, Ecto.Enum, + values: [ + :full, + :everyother, + :elo, + :community, + :full_pikku, + :everyother_pikku, + :elo_pikku, + :community_pikku + ] + field :pcode, :string field :phone, :string field :split_invoice, :boolean, default: false diff --git a/lib/osuuspuutarha/orders/parser.ex b/lib/osuuspuutarha/orders/parser.ex index d2d79b8..ecefed9 100644 --- a/lib/osuuspuutarha/orders/parser.ex +++ b/lib/osuuspuutarha/orders/parser.ex @@ -7,9 +7,18 @@ defmodule Osuuspuutarha.Orders.Parser do end end - @spec parse_order_type(:community | :elo | :everyother | :full) :: <<_::64, _::_*8>> + @spec parse_order_type( + :community + | :elo + | :everyother + | :full + | :full_pikku + | :everyother_pikku + | :elo_pikku + | :community_pikku + ) :: <<_::64, _::_*8>> def parse_order_type(:full) do - "Joka viikko" + "Koko kausi" end def parse_order_type(:everyother) do @@ -21,7 +30,23 @@ defmodule Osuuspuutarha.Orders.Parser do end def parse_order_type(:community) do - "Osuuskuntatoiminta" + "Viljely-yhteisö" + end + + def parse_order_type(:full_pikku) do + "Koko kausi (pikkuboksi)" + end + + def parse_order_type(:everyother_pikku) do + "Joka toinen viikko (pikkuboksi)" + end + + def parse_order_type(:elo_pikku) do + "Elotilaus (pikkuboksi)" + end + + def parse_order_type(:community_pikku) do + "Viljely-yhteisö (pikkuboksi)" end @spec parse_location( diff --git a/lib/osuuspuutarha_web/live/order_live/form_component.html.heex b/lib/osuuspuutarha_web/live/order_live/form_component.html.heex index bbb740a..a48a623 100644 --- a/lib/osuuspuutarha_web/live/order_live/form_component.html.heex +++ b/lib/osuuspuutarha_web/live/order_live/form_component.html.heex @@ -16,7 +16,11 @@ "Koko kausi": :full, "Joka toinen viikko": :everyother, "Elotilaus": :elo, - "Viljely-yhteisö": :community + "Viljely-yhteisö": :community, + "Koko kausi (pikkuboksi)": :full_pikku, + "Joka toinen viikko (pikkuboksi)": :everyother_pikku, + "Elotilaus (pikkuboksi)": :elo_pikku, + "Viljely-yhteisö (pikkuboksi)": :community_pikku ], prompt: "Ei valintaa" %>