Nearly able to create invoices manually

This commit is contained in:
2024-03-24 22:07:17 -07:00
parent ede4d756af
commit 1ac90804b8
6 changed files with 82 additions and 106 deletions

View File

@@ -1,28 +1,19 @@
(ns auto-ap.ssr.components.multi-modal
(:require [auto-ap.ssr.components :as com]
[auto-ap.ssr.form-cursor :as fc]
[auto-ap.ssr.nested-form-params :refer [wrap-nested-form-params]]
[auto-ap.ssr.utils
:refer [html-response
assert-schema
main-transformer
modal-response
wrap-form-4xx-2
wrap-schema-enforce]]
(:require [auto-ap.cursor :as cursor]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.components :as com]
[auto-ap.ssr.components.timeline :as timeline]
[auto-ap.ssr.form-cursor :as fc]
[auto-ap.ssr.hx :as hx]
[auto-ap.ssr.nested-form-params :refer [wrap-nested-form-params]]
[auto-ap.ssr.svg :as svg]
[auto-ap.ssr.utils
:refer [assert-schema html-response main-transformer
modal-response wrap-form-4xx-2 wrap-schema-enforce]]
[bidi.bidi :as bidi]
[hiccup.util :as hu]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.svg :as svg]
[auto-ap.ssr.hx :as hx]
[malli.core :as mc]
[hiccup2.core :as hiccup2]
[hiccup2.core :as hiccup]
[auto-ap.cursor :as cursor]
[malli.core :as m]
[auto-ap.logging :as alog])
(:import [auto_ap.cursor VecCursor]))
[malli.core :as m]))
(def default-form-props {:hx-ext "response-targets"
@@ -40,18 +31,12 @@
(step-name [this]))
(defprotocol Initializable
(init-step-params [this request]))
(init-step-params [this multi-form-state request]))
(defprotocol Discardable
(can-discard? [this step-params])
(discard-changes [this request]))
(defn- init-step-params- [step request]
(if (satisfies? Initializable step)
(init-step-params step request)
{}))
(defprotocol LinearModalWizard
(hydrate-from-request [this request])
(get-current-step [this])
@@ -175,7 +160,7 @@
(com/modal-card-advanced
{"@keydown.enter.prevent.stop" "$refs.next.click()"
:class (str
"w-[750px] h-[600px]
"w-full h-full md:w-[750px] md:h-[600px]
group-[.forward]/transition:htmx-swapping:opacity-0
group-[.forward]/transition:htmx-swapping:-translate-x-1/4
group-[.forward]/transition:htmx-swapping:scale-75
@@ -207,7 +192,7 @@
head)
#_(com/modal-header-attachment {})
[:div.flex.shrink.overflow-auto.grow
[:div.grow-0.pr-6.pt-2.bg-gray-100.self-stretch #_{:style "margin-left:-20px"} (render-timeline linear-wizard step validation-route)]
[:div.grow-0.pr-6.pt-2.bg-gray-100.self-stretch.hidden.md:block #_{:style "margin-left:-20px"} (render-timeline linear-wizard step validation-route)]
(com/modal-body {}
body)]
@@ -253,9 +238,11 @@
(-> request
(assoc :multi-form-state (-> (:multi-form-state request)
(merge-multi-form-state)
(select-state
(edit-path new-step request)
(init-step-params- new-step request))))))
(select-state (edit-path new-step request) {})
(#(cond-> %
(satisfies? Initializable new-step)
(assoc :step-params
(init-step-params new-step % request))))))))
:headers {"HX-reswap" (when transition-type "outerHTML swap:0.16s")
"x-transition-type" (or transition-type "none")})))
(wrap-ensure-step)

View File

@@ -40,7 +40,8 @@
children ]))
(defn vertical-timeline [params & children]
[:ol {:class "flex flex-col items-start space-y-2 text-xs text-center text-gray-500 bg-gray-100 dark:text-gray-400 sm:text-base dark:bg-gray-800 sm:space-y-4 px-2"}
[:ol {:class (hh/add-class "flex flex-col items-start space-y-2 text-xs text-center text-gray-500 bg-gray-100 dark:text-gray-400 sm:text-base dark:bg-gray-800 sm:space-y-4 px-2"
(:class params))}
children
#_[:li {:class "flex items-center"}
[:span {:class "flex items-center justify-center w-5 h-5 mr-2 text-xs border border-gray-500 rounded-full shrink-0 dark:border-gray-400"}]]])