progress on bugs

This commit is contained in:
Bryce Covert
2020-08-19 18:25:27 -07:00
parent 2716b6e2ba
commit a08c197159
8 changed files with 26 additions and 47 deletions

View File

@@ -550,3 +550,6 @@ table.balance-sheet th.total {
.table.table.grid thead tr:first-child>th:last-child {
border-radius: 0px 4px 0px 0px !important;
}
.table.grid.wrappable td {text-overflow: ""; overflow: visible; white-space: normal; }
.table.grid.wrappable td.expandable {text-overflow: ""; overflow: visible; white-space: normal; }
.table.grid.wrappable th.expandable {text-overflow: ""; overflow: visible; white-space: normal; }

View File

@@ -150,7 +150,7 @@
conj
[]
transaction_ids)
transaction-rule (update (tr/get-by-id transaction_rule_id) :transaction-rule/description #(some-> % re-pattern))]
transaction-rule (update (tr/get-by-id transaction_rule_id) :transaction-rule/description #(some-> % rm/->pattern))]
(doseq [transaction transactions]
(when (not (rm/rule-applies? transaction transaction-rule))
(throw (ex-info "Transaction rule does not apply" {:validation-error "Transaction rule does not apply"

View File

@@ -13,6 +13,9 @@
[auto-ap.datomic.transaction-rules :as tr]
[clojure.tools.logging :as log]))
(defn ->pattern [x]
(. java.util.regex.Pattern (compile x java.util.regex.Pattern/CASE_INSENSITIVE)))
(defn rule-applies? [transaction {:keys [:transaction-rule/description
:transaction-rule/dom-gte :transaction-rule/dom-lte
:transaction-rule/amount-gte :transaction-rule/amount-lte
@@ -83,8 +86,7 @@
(recur rules)))
[])))
(defn ->pattern [x]
(. java.util.regex.Pattern (compile x java.util.regex.Pattern/CASE_INSENSITIVE)))
(defn group-rules-by-priority [rules]
(->> rules

View File

@@ -121,11 +121,12 @@
(mapv (fn [c]
[:div.level-item c]) children))]]))))]))
(defn table [{:keys [fullwidth]}]
(defn table [{:keys [fullwidth class]}]
(into
[:table.table.compact.grid {:class (if fullwidth
["is-fullwidth"])}]
[:table.table.compact.grid {:class (cond-> []
fullwidth (conj "is-fullwidth")
class (into class))}]
(r/children (r/current-component))))
(defn header []
@@ -172,7 +173,7 @@
(map r/as-element (r/children (r/current-component)))))
(defn cell [params]
(apply r/create-element "td" #js {}
(apply r/create-element "td" #js {:className (:class params)}
(map r/as-element (r/children (r/current-component))))
)

View File

@@ -91,8 +91,8 @@
(fn [{:keys [db]} [_ invoice]]
{:db db}))
(defn row [{:keys [invoice check-boxes selected-client overrides expense-event actions]}]
(let [{:keys [client payments expense-accounts invoice-number date due total outstanding-balance id vendor checkable?] :as i} invoice
(defn row [{:keys [invoice check-boxes selected-client overrides checkable? expense-event actions]}]
(let [{:keys [client payments expense-accounts invoice-number date due total outstanding-balance id vendor] :as i} invoice
accounts-by-id @(re-frame/subscribe [::subs/accounts-by-id client])
account->name #(:name (accounts-by-id (:id %)))]
[grid/row {:class (:class i) :id id :checkable? checkable? :entity invoice}
@@ -179,7 +179,7 @@
[buttons/fa-icon {:icon "fa-undo"
:event [::unvoid-invoice i]}])]]]))
(defn invoice-table [{:keys [id check-boxes overrides actions data-page]}]
(defn invoice-table [{:keys [id check-boxes overrides actions data-page checkable-fn]}]
(let [selected-client @(re-frame/subscribe [::subs/client])
{:keys [data status table-params]} @(re-frame/subscribe [::data-page/page data-page])
@@ -235,5 +235,8 @@
^{:key id}
[row {:invoice i
:selected-client selected-client
:checkable? (if checkable-fn
(checkable-fn i)
true)
:actions actions
:overrides overrides}])]])]))

View File

@@ -116,44 +116,13 @@
(defmethod page :admin-excel-import [_]
[admin-excel-import-page])
;;
;; ;; <div id="app">
;; <nav class="navbar has-shadow">
;; <div class="container">
;; <div class="navbar-brand">
;; <a class="navbar-item" href="../">
;; <img src="/img/logo.png" />
;; </a>
;; </div>
;; </div>
;; </nav>
;; <div class="has-text-centered hero is-fullheight is-vertically-centered" id="mail-app">
;; <div class="is-vertically-centered">
;; <h1 class="title"><i class="fa fa-spin fa-spinner"></i></h1>
;; </div>
;; </div>
;; <footer class="footer">
;; <div class="container">
;; <div class="content has-text-centered">
;; <p>
;; <strong>Integreat</strong>
;; by <a href="https://github.com/">Integreat</a>.
;; </p>
;; <p>
;; <a class="icon" href="https://github.com/dansup/bulma-templates">
;; <i class="fa fa-github"></i>
;; </a>
;; </p>
;; </div>
;; </div>
;; </footer>
;; </div>
(defn active-page []
(let [ap (re-frame/subscribe [::subs/active-page])
current-client @(re-frame/subscribe [::subs/client])
is-loading? @(re-frame/subscribe [::subs/is-initial-loading?])]
(if is-loading?
[loading-layout]
[:div
^{:key @ap} [page @ap]])))
^{:key (str @ap "-" current-client)} [page @ap]])))

View File

@@ -61,16 +61,16 @@
:status status
:column-count (if selected-client 5 6)}
[grid/controls ledger-page]
[grid/table {:fullwidth true}
[grid/table {:fullwidth true :class ["wrappable"]}
[grid/header
[grid/row {}
(when-not selected-client
[grid/sortable-header-cell {:sort-key "client" :sort-name "Client"} "Client"])
[grid/sortable-header-cell {:sort-key "vendor" :sort-name "Vendor"} "Vendor"]
[grid/sortable-header-cell {:sort-key "date" :sort-name "Date" :style {:width "15em"}} "Date"]
[grid/sortable-header-cell {:sort-key "date" :sort-name "Date" :style {:width "8em"}} "Date"]
[grid/header-cell {} "Account"]
[grid/sortable-header-cell {:sort-key "amount" :sort-name "Amount" :class "has-text-right" :style {:width "12em"}} "Debit"]
[grid/sortable-header-cell {:sort-key "amount" :sort-name "Amount" :class "has-text-right" :style {:width "12em"}} "Credit"]]]
[grid/sortable-header-cell {:sort-key "amount" :sort-name "Amount" :class "has-text-right" :style {:width "7em"}} "Debit"]
[grid/sortable-header-cell {:sort-key "amount" :sort-name "Amount" :class "has-text-right" :style {:width "7em"}} "Credit"]]]
[grid/body
(for [{:keys [client vendor status date amount id line-items] :as i} (:journal-entries ledger-page)]
^{:key id}

View File

@@ -186,6 +186,7 @@
[table/invoice-table {:id (:id page)
:data-page :invoices
:check-boxes (= status :unpaid)
:checkable-fn (fn [i] (not (:automatically-paid-when-due i)))
:actions #{:edit :void :expense-accounts}}]]))
(defn unpaid-invoices-page [params]