diff --git a/resources/public/css/main.css b/resources/public/css/main.css index 8fcdf801..88b01155 100644 --- a/resources/public/css/main.css +++ b/resources/public/css/main.css @@ -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; } diff --git a/src/clj/auto_ap/graphql/transactions.clj b/src/clj/auto_ap/graphql/transactions.clj index 4cfe23b7..2217e1b4 100644 --- a/src/clj/auto_ap/graphql/transactions.clj +++ b/src/clj/auto_ap/graphql/transactions.clj @@ -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" diff --git a/src/clj/auto_ap/rule_matching.clj b/src/clj/auto_ap/rule_matching.clj index f25e4c0e..c4774cc7 100644 --- a/src/clj/auto_ap/rule_matching.clj +++ b/src/clj/auto_ap/rule_matching.clj @@ -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 diff --git a/src/cljs/auto_ap/views/components/grid.cljs b/src/cljs/auto_ap/views/components/grid.cljs index 2bbea058..dbdfbe6b 100644 --- a/src/cljs/auto_ap/views/components/grid.cljs +++ b/src/cljs/auto_ap/views/components/grid.cljs @@ -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)))) ) diff --git a/src/cljs/auto_ap/views/components/invoice_table.cljs b/src/cljs/auto_ap/views/components/invoice_table.cljs index bb6cb241..f6ea731c 100644 --- a/src/cljs/auto_ap/views/components/invoice_table.cljs +++ b/src/cljs/auto_ap/views/components/invoice_table.cljs @@ -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}])]])])) diff --git a/src/cljs/auto_ap/views/main.cljs b/src/cljs/auto_ap/views/main.cljs index 35c47b99..67e4f3c8 100644 --- a/src/cljs/auto_ap/views/main.cljs +++ b/src/cljs/auto_ap/views/main.cljs @@ -116,44 +116,13 @@ (defmethod page :admin-excel-import [_] [admin-excel-import-page]) -;; -;; ;;