modal
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
(:require [auto-ap.datomic
|
||||
:refer [conn pull-attr]]
|
||||
[auto-ap.datomic.accounts :as d-accounts]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.routes.invoice :as route]
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-client-redirect-unauthenticated]]
|
||||
@@ -13,10 +14,11 @@
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils
|
||||
:refer [apply-middleware-to-all-handlers entity-id html-response
|
||||
money wrap-schema-enforce]]
|
||||
:refer [apply-middleware-to-all-handlers clj-date-schema
|
||||
entity-id html-response money wrap-schema-enforce]]
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.core :as time]
|
||||
[datomic.api :as dc]
|
||||
[malli.core :as mc]
|
||||
[malli.util :as mut]))
|
||||
@@ -24,6 +26,7 @@
|
||||
(def new-form-schema
|
||||
[:map
|
||||
[:invoice/client entity-id]
|
||||
[:invoice/date clj-date-schema]
|
||||
[:invoice/vendor entity-id]
|
||||
[:invoice/expense-accounts
|
||||
[:vector {:coerce? true}
|
||||
@@ -43,9 +46,10 @@
|
||||
[])
|
||||
|
||||
(step-schema [_]
|
||||
(mut/select-keys (mm/form-schema linear-wizard) #{:invoice/client :invoice/vendor}))
|
||||
(mut/select-keys (mm/form-schema linear-wizard) #{:invoice/client :invoice/vendor :invoice/date}))
|
||||
|
||||
(render-step [this request]
|
||||
(alog/peek ::check (:multi-form-state request))
|
||||
(mm/default-render-step
|
||||
linear-wizard this
|
||||
:head [:div.p-2 "New invoice"]
|
||||
@@ -86,7 +90,7 @@
|
||||
{:label "Date"
|
||||
:errors (fc/field-errors)}
|
||||
[:div {:class "w-24"}
|
||||
(com/date-input {:value (-> (fc/field-value)
|
||||
(com/date-input {:value (some-> (fc/field-value)
|
||||
(atime/unparse-local atime/normal-date))
|
||||
:name (fc/field-name)
|
||||
:error? (fc/field-errors)
|
||||
@@ -96,7 +100,7 @@
|
||||
{:label "Due (optional)"
|
||||
:errors (fc/field-errors)}
|
||||
[:div {:class "w-24"}
|
||||
(com/date-input {:value (-> (fc/field-value)
|
||||
(com/date-input {:value (some-> (fc/field-value)
|
||||
(atime/unparse-local atime/normal-date))
|
||||
:name (fc/field-name)
|
||||
:error? (fc/field-errors)
|
||||
@@ -106,7 +110,7 @@
|
||||
{:label "Scheduled payment (optional)"
|
||||
:errors (fc/field-errors)}
|
||||
[:div {:class "w-24"}
|
||||
(com/date-input {:value (-> (fc/field-value)
|
||||
(com/date-input {:value (some-> (fc/field-value)
|
||||
(atime/unparse-local atime/normal-date))
|
||||
:name (fc/field-name)
|
||||
:error? (fc/field-errors)
|
||||
@@ -294,9 +298,10 @@
|
||||
|
||||
|
||||
(defn initial-new-wizard-state [request]
|
||||
(mm/->MultiStepFormState {:TODO nil}
|
||||
(mm/->MultiStepFormState {:TODO nil
|
||||
:invoice/date (time/plus (time/now) (time/days 12))}
|
||||
[]
|
||||
{}))
|
||||
{:invoice/date (time/plus (time/now) (time/days 12))}))
|
||||
|
||||
(defn location-select [{{:keys [name account-id client-id value] :as qp} :query-params}]
|
||||
(html-response (location-select* {:name name
|
||||
|
||||
Reference in New Issue
Block a user