ui improvements.

This commit is contained in:
Bryce Covert
2019-01-25 13:16:21 -08:00
parent 09f30e19cf
commit fb4191059f
7 changed files with 384 additions and 386 deletions

View File

@@ -31,6 +31,7 @@
(re-frame/reg-event-fx
::change-expense-accounts-saving
(fn [{:keys [db]} [_ on-success id ]]
(let [{:keys [id expense-accounts]} (get-in db [::change-expense-accounts :invoice])]
{:graphql
{:token (-> db :user)
@@ -49,7 +50,7 @@
[:expense_accounts [:amount :id :location :expense_account_id
[:expense_account [:id :name [:parent [:id :name]]]]]]
[:client [:name :id :locations]]
[:payments [:amount [:payment [:amount :s3_url :check_number ]]]]
[:payments [:amount :id [:payment [:amount :s3_url :check_number ]]]]
]]}]}
:on-success on-success}})))

View File

@@ -201,7 +201,7 @@
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content
(for [payment payments]
(if (:s3-url (:payment payment))
(if (:s3-url (:payment payment))
^{:key (:id payment)}
[:a.dropdown-item {:href (:s3-url (:payment payment)) :target "_new"} [:i.fa.fa-money-check] [:span.icon [:i.fa.fa-money]] (str " " (:check-number (:payment payment)) " (" (gstring/format "$%.2f" (:amount payment) ) ")")]

View File

@@ -19,16 +19,15 @@
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :unpaid-invoices)
:class [(active-when ap = :unpaid-invoices)]}
[:span {:class "icon icon-accounting-document" :style {"font-size" "25px"}}]
[:span {:class "icon icon-accounting-document" :style {:font-size "25px"}}]
[:span {:class "name"} "Unpaid Invoices"]]]
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :paid-invoices)
:class [(active-when ap = :paid-invoices)]}
[:span {:class "icon icon-accounting-invoice-mail" :style {"font-size" "25px"}}]
[:span {:class "icon icon-accounting-invoice-mail" :style {:font-size "25px"}}]
[:span {:class "name"} "Paid Invoices"]]]]
]
[:span {:class "name"} "Paid Invoices"]]]]]
[:div
rest]
[:div {:class "compose has-text-centered"}

View File

@@ -30,7 +30,7 @@
valid-matches (get-valid-matches matches not-found-description not-found-value text)]
[:div.typeahead
(if @selected
[:div.input {:class class
^{:key "typeahead"} [:div.input {:class class
:tab-index "0"
:on-key-up (fn [e]
(if (= 8 (.-keyCode e))
@@ -42,9 +42,8 @@
[:div.tags.has-addons
[:span.tag text]
[:a.tag.is-delete {:on-click (fn [] (select [nil "" nil]))}]]]]
[:input.input {:type "text"
^{:key "typeahead"} [:input.input {:type "text"
:class class
:field field
:value text
:auto-focus auto-focus
:on-blur (fn [e]
@@ -54,35 +53,36 @@
(#{"" nil} text)
nil
(seq valid-matches)
(do (select (first valid-matches))
@highlighted
(do (select @highlighted)
true)
:else
(do (select [nil ""])
true)))
:on-key-up (fn [e]
:on-key-down (fn [e]
(condp = (.-keyCode e)
; up
38 (do
(when-let [new-match (->> valid-matches
(take-while #(not= (first %) @highlighted))
(take-while #(not= % @highlighted))
(last))]
(reset! highlighted new-match))
true)
;; dwon
40 (do
(when-let [new-match (->> valid-matches
(drop-while #(not= (first %) @highlighted))
(drop-while #(not= % @highlighted))
(drop 1)
(first))]
(reset! highlighted new-match))
true)
13 (when @highlighted
(select @highlighted)
false)
true)
)
13 (do (.preventDefault e)
(when @highlighted
(select @highlighted)
false))
true))
:on-change (fn [e]
(let [new-matches (get-valid-matches matches not-found-description not-found-value (.. e -target -value))]
(reset! highlighted (first new-matches)))

View File

@@ -170,7 +170,6 @@
(re-frame/reg-event-fx
::print-checks
(fn [{:keys [db]} [_ bank-account-id type]]
(println type)
(let [invoice-amounts (by :id :outstanding-balance (get-in db [::invoice-page :invoices]))]
{:db (-> db
@@ -786,13 +785,15 @@
(defn unpaid-invoices-page []
[side-bar-layout {:side-bar [invoices-side-bar {}
[:p.menu-label "Vendor"]
[:div
[vendor-filter]]
[:p.menu-label "Invoice #"]
[:div
[invoice-number-filter]
]]
^{:key "extra-filter"}
[:div
[:p.menu-label "Vendor"]
[:div [vendor-filter]]
[:p.menu-label "Invoice #"]
[:div
[invoice-number-filter]
]]
]
:main [unpaid-invoices-content]
:bottom [vendor-dialog {:vendor @(re-frame/subscribe [::subs/user-editing-vendor])
:save-event [::events/save-vendor]