UI improvements.
This commit is contained in:
@@ -140,9 +140,7 @@
|
||||
:date date}))))
|
||||
|
||||
inserted-row-count (invoices/upsert-multi! insert-rows)
|
||||
already-imported-count (- (count insert-rows) inserted-row-count)
|
||||
|
||||
]
|
||||
already-imported-count (- (count insert-rows) inserted-row-count)]
|
||||
(expense-accounts/assign-defaults!)
|
||||
|
||||
|
||||
|
||||
@@ -25,21 +25,27 @@
|
||||
(let [{:keys [visible? saving?]} @(re-frame/subscribe [::subs/modal-state id])]
|
||||
(when visible?
|
||||
(-> [modal {:title title
|
||||
:foot [:button.button.is-primary {:on-click (fn []
|
||||
(re-frame/dispatch [::events/modal-status id {:saving? true}])
|
||||
(re-frame/dispatch save-event))
|
||||
:disabled (cond saving?
|
||||
"disabled"
|
||||
:foot [:input.button.is-primary {
|
||||
:type "submit"
|
||||
:form id
|
||||
:disabled (cond saving?
|
||||
"disabled"
|
||||
|
||||
(not can-submit?)
|
||||
"disabled"
|
||||
(not can-submit?)
|
||||
"disabled"
|
||||
|
||||
:else
|
||||
"")
|
||||
:class (when saving?
|
||||
"is-loading")}
|
||||
[:span action-text]]
|
||||
:else
|
||||
"")
|
||||
:class (when saving?
|
||||
"is-loading")
|
||||
:value action-text}
|
||||
]
|
||||
:id id
|
||||
:hide-event [::events/modal-status id {:visible? false}]}]
|
||||
(into (r/children (r/current-component)) )
|
||||
:hide-event [::events/modal-status id {:visible? false}]}
|
||||
(into [:form {:id id
|
||||
:on-submit (fn [e]
|
||||
(.preventDefault e)
|
||||
(re-frame/dispatch [::events/modal-status id {:saving? true}])
|
||||
(re-frame/dispatch save-event))}]
|
||||
(r/children (r/current-component)) )]
|
||||
(into [(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])])))))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[clojure.string :as str]))
|
||||
|
||||
(defn typeahead [{:keys [matches on-change field text-field value class not-found-description
|
||||
not-found-value]}]
|
||||
not-found-value auto-focus]}]
|
||||
(let [text (r/atom (or (second (first (filter #(= (first %) value) matches))) ""))
|
||||
highlighted (r/atom 0)
|
||||
selected (r/atom (first (first (filter #(= (first %) value) matches))))
|
||||
@@ -34,6 +34,7 @@
|
||||
:class class
|
||||
:field field
|
||||
:value @text
|
||||
:auto-focus auto-focus
|
||||
:on-blur (fn [e]
|
||||
(cond @selected
|
||||
nil
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
(let [form-data (re-frame/subscribe [::subs/new-invoice-form])]
|
||||
[:div
|
||||
[:form
|
||||
[:h1.title "New Invoice"]
|
||||
[:h1.title "New InvoiceR"]
|
||||
[:div.field
|
||||
[:label.label "Vendor"]
|
||||
[:div.control
|
||||
[:input.input {:type "text"
|
||||
:auto-focus true
|
||||
:placeholder "CINTAS"
|
||||
:value (:vendor @form-data)
|
||||
:on-change (fn [e]
|
||||
|
||||
@@ -426,6 +426,7 @@
|
||||
[bind-field
|
||||
[typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/vendors]))
|
||||
:type "typeahead"
|
||||
:auto-focus true
|
||||
:field [:vendor-id]
|
||||
:text-field [:vendor-name]
|
||||
:not-found-description #(str "Create vendor '" % "'")
|
||||
|
||||
Reference in New Issue
Block a user