Skip to content

Commit

Permalink
coverage add form: add more instructions and hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramblurr committed May 17, 2024
1 parent 20bc0be commit c497027
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 16 deletions.
46 changes: 41 additions & 5 deletions resources/lang/app.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Probematic\n"
"POT-Creation-Date: 2024-05-16 16:13+0200\n"
"POT-Creation-Date: 2024-05-17 11:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -611,6 +611,12 @@ msgctxt ":instrument/if-available"
msgid "if available"
msgstr ""

#: :instrument/make-hint
#, ycp-format
msgctxt ":instrument/make-hint"
msgid "Which company manufactures the item? e.g., Yamaha, unknown"
msgstr ""

#: :instrument/make
#, ycp-format
msgctxt ":instrument/make"
Expand Down Expand Up @@ -641,6 +647,12 @@ msgctxt ":instrument/create-title"
msgid "New Instrument"
msgstr ""

#: :instrument/model-hint
#, ycp-format
msgctxt ":instrument/model-hint"
msgid "What is the model number?"
msgstr ""

#: :instrument/description-hint
#, ycp-format
msgctxt ":instrument/description-hint"
Expand All @@ -653,6 +665,12 @@ msgctxt ":instrument/photo-upload-title"
msgid "Upload Instrument Photos"
msgstr ""

#: :instrument/name-hint
#, ycp-format
msgctxt ":instrument/name-hint"
msgid "e.g., Trompet, Yamaha or Mouthpiece Tenorsax"
msgstr ""

#: :instrument/images-share-url-hint
#, ycp-format
msgctxt ":instrument/images-share-url-hint"
Expand All @@ -665,10 +683,22 @@ msgctxt ":instrument/images-share-url"
msgid "Photos Public Link"
msgstr ""

#: :instrument/separate-warning
#, ycp-format
msgctxt ":instrument/separate-warning"
msgid "A separate form must be filled out for each instrument and accessory."
msgstr ""

#: :instrument/category-hint
#, ycp-format
msgctxt ":instrument/category-hint"
msgid "What type of item is this? Watch out! Flutes are Holz, but saxophones are Blech, Sax, Elektrisch!"
msgstr ""

#: :instrument/create-subtitle
#, ycp-format
msgctxt ":instrument/create-subtitle"
msgid "Enter details for the Instrument"
msgid "Please enter the information about your instrument/accessories asked below in as much detail as possible."
msgstr ""

#: :instrument/owner
Expand Down Expand Up @@ -1184,7 +1214,7 @@ msgstr ""
#: :insurance.survey/pay-cost-confirm
#, ycp-format
msgctxt ":insurance.survey/pay-cost-confirm"
msgid "You will have to pay about %1 per year for this item. Is that OK?"
msgid "You will have to pay about %1 per year for this item. Is that OK?"
msgstr ""

#: :insurance.survey/admin-title
Expand All @@ -1196,7 +1226,7 @@ msgstr ""
#: :insurance.survey/keep-insured-private-hint
#, ycp-format
msgctxt ":insurance.survey/keep-insured-private-hint"
msgid "Since this wasn't used at a gig in the last year you the band can no longer pay for it."
msgid "Since this wasn't used at a gig in the last year the band can no longer pay for it."
msgstr ""

#: :insurance.survey/already-closed
Expand All @@ -1220,7 +1250,7 @@ msgstr ""
#: :insurance.survey/keep-insured-private-cost
#, ycp-format
msgctxt ":insurance.survey/keep-insured-private-cost"
msgid "If you want the item to stay insured, you'll have to pay for it yourself. This will cost about %1 per year for this item."
msgid "If you want the item to stay insured, you'll have to pay for it yourself. This will cost about %1 per year for this item."
msgstr ""

#: :insurance.survey/close-survey
Expand All @@ -1235,6 +1265,12 @@ msgctxt ":insurance.survey/email-p2"
msgid "Or add new ones! It only takes a few minutes."
msgstr ""

#: :insurance.survey/almost-there
#, ycp-format
msgctxt ":insurance.survey/almost-there"
msgid "Almost there"
msgstr ""

#: :insurance.survey/confirm-close-title
#, ycp-format
msgctxt ":insurance.survey/confirm-close-title"
Expand Down
11 changes: 8 additions & 3 deletions resources/lang/en.edn
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,22 @@
:instrument {:owner "Owner"
:instrument "Instrument"
:category "Category"
:category-hint "What type of item is this? Watch out! Flutes are Holz, but saxophones are Blech, Sax, Elektrisch!"
:description "Description"
:description-hint "Z.B. farbe, material"
:make "Make"
:make-hint "Which company manufactures the item? e.g., Yamaha, unknown"
:images "Photos"
:model "Model"
:model-hint "What is the model number?"
:name "Instrument Name"
:name-hint "e.g., Trompet, Yamaha or Mouthpiece Tenorsax"
:serial-number "Serial Number"
:if-available "if available"
:build-year "Build Year"
:create-title "New Instrument"
:create-subtitle "Enter details for the Instrument"
:create-subtitle "Please enter the information about your instrument/accessories asked below in as much detail as possible."
:separate-warning "A separate form must be filled out for each instrument and accessory."
:photo-upload "Photo Upload"
:photo-upload-title "Upload Instrument Photos"
:photo-upload-subtitle "Upload a couple photos showing the instrument/item from several angles."
Expand Down Expand Up @@ -550,10 +555,10 @@
:no-keep "No, keep the insurance"
:yes-remove "Yes, remove it"
:keep-insured-private-hint "Since this wasn't used at a gig in the last year the band can no longer pay for it."
:keep-insured-private-cost "If you want the item to stay insured, you'll have to pay for it yourself. This will cost about %1 per year for this item."
:keep-insured-private-cost "If you want the item to stay insured, you'll have to pay for it yourself. This will cost about %1 per year for this item."
:no-stop "No, stop insurance"
:yes-pay "Yes, I'll pay"
:pay-cost-confirm "You will have to pay about %1 per year for this item. Is that OK?"
:pay-cost-confirm "You will have to pay about %1 per year for this item. Is that OK?"
:data-correct "Is all the data shown still correct?"
:data-correct-hint "You might want to change the insured value if the market value has change or if you want to change the type of coverage."}

Expand Down
16 changes: 11 additions & 5 deletions src/clj/app/insurance/views.clj
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ Mit freundlichen Grüßen,
(:member/member-id current-member)))]

(list
(ui/text-left :label (tr [:instrument/name]) :id "instrument-name" :value name :error error)
(ui/text-left :label (tr [:instrument/name]) :id "instrument-name" :value name :error error :hint (tr [:instrument/name-hint]))
(when-not hide-owner?
(ui/member-select :with-empty-opt? insurance-team-member?
:full-names? true
Expand All @@ -565,9 +565,13 @@ Mit freundlichen Grüßen,
:value owner-id
:members (q/members-for-select db)
:error error))
(ui/instrument-category-select :variant :left :label (tr [:instrument/category]) :id "category-id" :value (:instrument.category/category-id category) :categories (controller/instrument-categories db) :error error)
(ui/text-left :label (tr [:instrument/make]) :id "make" :value make :error error)
(ui/text-left :label (tr [:instrument/model]) :hint (tr [:instrument/if-available]) :id "model" :value model :required? false :error error)
(ui/instrument-category-select :variant :left :label (tr [:instrument/category])
:hint (tr [:instrument/category-hint])
:id "category-id" :value (:instrument.category/category-id category) :categories (controller/instrument-categories db) :error error)
(ui/text-left :label (tr [:instrument/make])
:hint (tr [:instrument/make-hint]) :id "make" :value make :error error)
(ui/text-left :label (tr [:instrument/model])
:hint [:span (tr [:instrument/model-hint]) [:br] (tr [:instrument/if-available])] :id "model" :value model :required? false :error error)
(ui/text-left :label (tr [:instrument/serial-number]) :hint (tr [:instrument/if-available]) :id "serial-number" :value serial-number :required? false :error error)
(ui/text-left :label (tr [:instrument/build-year]) :hint (tr [:instrument/if-available]) :id "build-year" :value build-year :required? false :error error)
(ui/textarea-left :label (tr [:instrument/description]) :hint (tr [:instrument/description-hint]) :name "description" :id "description" :value description :required? false :error error)))))
Expand Down Expand Up @@ -1489,7 +1493,9 @@ document.addEventListener('DOMContentLoaded', function() {
[:div {:id (util/id :comp/coverage-create)}
[:div {:class "flex justify-center items-center mt-10"}
(ui/step-circles 3 1)]
(ui/panel {:title (tr [:instrument/create-title])}
(ui/panel {:title (tr [:instrument/create-title])
:subtitle (tr [:instrument/create-subtitle])}
[:div [:span (icon/circle-exclamation {:class "w-5 h-5 text-sno-orange-500 inline mr-2"}) (tr [:instrument/separate-warning])]]
[:form {:hx-post (util/endpoint-path insurance-coverage-create-handler) :class "space-y-8" :hx-target (util/hash :comp/coverage-create)}
(when redirect
[:input {:type :hidden :name "redirect" :value redirect}])
Expand Down
10 changes: 7 additions & 3 deletions src/clj/app/ui.clj
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,16 @@
(when required?
[:span {:class "text-red-400"} " required"])))

(defn select-left [& {:keys [id label options required? error value]
(defn select-left [& {:keys [id label options required? error value hint]
:or {required? true}}]
(let [has-error? (get error (keyword id))
selected-value value]
[:div {:class "sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-t sm:border-gray-200 sm:pt-5"}
[:label {:for id :class "block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2"}
label (required-label required?)]
label (required-label required?)
(when hint
[:p {:class "mt-2 text-sm text-gray-500 font-normal"}
hint])]
[:div {:class "mt-1 sm:col-span-2 sm:mt-0"}
[:div {:class "relative max-w-lg sm:max-w-xs "}
(when has-error?
Expand Down Expand Up @@ -597,7 +600,7 @@
:value value
:options options))))

(defn instrument-category-select [& {:keys [id value label categories variant with-empty-opt?]
(defn instrument-category-select [& {:keys [id value label categories variant with-empty-opt? hint]
:or {label "Instrument Category"
with-empty-opt? true
variant :inline}}]
Expand All @@ -623,6 +626,7 @@
:options options)
:left
(select-left :id id
:hint hint
:label label
:value value
:options options))))
Expand Down

0 comments on commit c497027

Please sign in to comment.