progress on invoices.
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
:size :small}))
|
||||
|
||||
(com/field {:label "Role"}
|
||||
(com/radio {:size :small
|
||||
(com/radio-card {:size :small
|
||||
:name "role"
|
||||
:options [{:value ""
|
||||
:content "All"}
|
||||
@@ -292,49 +292,50 @@
|
||||
|
||||
|
||||
(defn dialog* [{:keys [form-params form-errors entity]}]
|
||||
(println "FORM PARMS" form-params)
|
||||
(fc/start-form
|
||||
form-params form-errors
|
||||
(com/modal
|
||||
{:hx-target "this"
|
||||
:hx-indicator "this"}
|
||||
[:form {:hx-ext "response-targets"
|
||||
:hx-put (str (bidi/path-for ssr-routes/only-routes
|
||||
:user-edit-save
|
||||
:request-method :put))
|
||||
:hx-swap "outerHTML swap:300ms"
|
||||
:hx-target-400 "#form-errors .error-content"
|
||||
:class "w-full h-full"}
|
||||
[:fieldset {:class "hx-disable h-full"}
|
||||
(com/modal-card
|
||||
{}
|
||||
[:div.flex [:div.p-2 "User"] [:p.ml-2.rounded.bg-gray-200.p-2.dark:bg-gray-600 (:user/name entity)]]
|
||||
[:div.space-y-6
|
||||
(fc/with-field :db/id
|
||||
(com/hidden {:name (fc/field-name)
|
||||
:value (fc/field-value)}))
|
||||
(fc/with-field :user/role
|
||||
(com/validated-field {:label "Role"
|
||||
:errors (fc/field-errors)}
|
||||
(com/select {:name (fc/field-name)
|
||||
:class "w-36"
|
||||
:autofocus true
|
||||
:value (some->> (fc/field-value) name)
|
||||
:options (ref->select-options "user-role")})))
|
||||
(fc/with-field :user/clients
|
||||
(com/validated-field {:label "Clients"}
|
||||
(com/data-grid {:headers [(com/data-grid-header {} "Client")
|
||||
(com/data-grid-header {} )]
|
||||
:id "client-table"}
|
||||
(fc/cursor-map #(client-row* %))
|
||||
(com/data-grid-new-row {:colspan 2
|
||||
:index (count (fc/field-value))
|
||||
:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:user-client-new)}
|
||||
"Assign new client"))))]
|
||||
[:div
|
||||
(com/form-errors {:errors (:errors fc/*form-errors*)})
|
||||
(com/validated-save-button {:errors (seq form-errors)}
|
||||
"Save user")])]])))
|
||||
form-params form-errors
|
||||
(com/modal
|
||||
{:hx-target "this"
|
||||
:hx-indicator "this"}
|
||||
[:form {:hx-ext "response-targets"
|
||||
:hx-put (str (bidi/path-for ssr-routes/only-routes
|
||||
:user-edit-save
|
||||
:request-method :put))
|
||||
:hx-swap "outerHTML swap:300ms"
|
||||
:hx-target-400 "#form-errors .error-content"
|
||||
:class "w-full h-full"}
|
||||
[:fieldset {:class "hx-disable h-full"}
|
||||
(com/modal-card
|
||||
{}
|
||||
[:div.flex [:div.p-2 "User"] [:p.ml-2.rounded.bg-gray-200.p-2.dark:bg-gray-600 (:user/name entity)]]
|
||||
[:div.space-y-6
|
||||
(fc/with-field :db/id
|
||||
(com/hidden {:name (fc/field-name)
|
||||
:value (fc/field-value)}))
|
||||
(fc/with-field :user/role
|
||||
(com/validated-field {:label "Role"
|
||||
:errors (fc/field-errors)}
|
||||
(com/select {:name (fc/field-name)
|
||||
:class "w-36"
|
||||
:autofocus true
|
||||
:value (some->> (fc/field-value) name)
|
||||
:options (ref->select-options "user-role")})))
|
||||
(fc/with-field :user/clients
|
||||
(com/validated-field {:label "Clients"}
|
||||
(com/data-grid {:headers [(com/data-grid-header {} "Client")
|
||||
(com/data-grid-header {})]
|
||||
:id "client-table"}
|
||||
(fc/cursor-map #(client-row* %))
|
||||
(com/data-grid-new-row {:colspan 2
|
||||
:index (count (fc/field-value))
|
||||
:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:user-client-new)}
|
||||
"Assign new client"))))]
|
||||
[:div
|
||||
(com/form-errors {:errors (:errors fc/*form-errors*)})
|
||||
(com/validated-save-button {:errors (seq form-errors)}
|
||||
"Save user")])]])))
|
||||
|
||||
(defn user-edit-save [{:keys [form-params identity] :as request}]
|
||||
(let [_ @(dc/transact conn [[:upsert-entity form-params]])
|
||||
|
||||
Reference in New Issue
Block a user