makes it possible to filter to only errors.
This commit is contained in:
@@ -84,7 +84,16 @@
|
|||||||
[drop-down-contents
|
[drop-down-contents
|
||||||
[:div
|
[:div
|
||||||
[:span.dropdown-item (error-set (line->id %)) ]]]]
|
[:span.dropdown-item (error-set (line->id %)) ]]]]
|
||||||
))
|
)
|
||||||
|
:status-category
|
||||||
|
(cond (successful-set (line->id %))
|
||||||
|
:success
|
||||||
|
|
||||||
|
(existing-set (line->id %))
|
||||||
|
:existing
|
||||||
|
|
||||||
|
(error-set (line->id %))
|
||||||
|
:error))
|
||||||
lis))))})))
|
lis))))})))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
@@ -110,7 +119,7 @@
|
|||||||
(let [text-form (r/atom "")
|
(let [text-form (r/atom "")
|
||||||
include-headers (r/atom false)
|
include-headers (r/atom false)
|
||||||
table-form (r/atom nil)]
|
table-form (r/atom nil)]
|
||||||
(fn [{:keys [headings value on-change]}]
|
(fn [{:keys [headings value on-change row-filter]}]
|
||||||
[:form.form
|
[:form.form
|
||||||
(if value
|
(if value
|
||||||
[:div
|
[:div
|
||||||
@@ -124,14 +133,14 @@
|
|||||||
(for [[heading-name _] read-only-headings]
|
(for [[heading-name _] read-only-headings]
|
||||||
[:th heading-name]))]]
|
[:th heading-name]))]]
|
||||||
(list
|
(list
|
||||||
(for [[index row] (map vector (range )value)]
|
(for [[index row] (map vector (range )value)
|
||||||
|
:when (row-filter row)]
|
||||||
[:tr
|
[:tr
|
||||||
(list
|
(list
|
||||||
(for [[_ k] headings]
|
(for [[_ k] headings]
|
||||||
[:td
|
[:td
|
||||||
[:input.input {:on-change (fn [x]
|
[:input.input {:on-change (fn [x]
|
||||||
(.preventDefault x)
|
(.preventDefault x)
|
||||||
(println value)
|
|
||||||
(on-change
|
(on-change
|
||||||
(assoc-in value [index k] (.. x -target -value))))
|
(assoc-in value [index k] (.. x -target -value))))
|
||||||
:value (get row k)}]]))
|
:value (get row k)}]]))
|
||||||
@@ -179,26 +188,41 @@
|
|||||||
"Imported with " (count (:errors result)) " errors, " (count (:success result)) " successful."])
|
"Imported with " (count (:errors result)) " errors, " (count (:success result)) " successful."])
|
||||||
(if @(re-frame/subscribe [::forms/is-loading? ::form])
|
(if @(re-frame/subscribe [::forms/is-loading? ::form])
|
||||||
[:div [:i.icon.fa.fa-spin.fa-spinner]]
|
[:div [:i.icon.fa.fa-spin.fa-spinner]]
|
||||||
[:div
|
[:div
|
||||||
|
[:div.is-clearfix
|
||||||
|
[:div.is-pulled-right
|
||||||
|
[:label.checkbox
|
||||||
|
[bind-field
|
||||||
|
[:input {:type "checkbox"
|
||||||
|
:event [::forms/change ::form]
|
||||||
|
:subscription data
|
||||||
|
:field [:only-show-errors?]}]]
|
||||||
|
"Only show errors"]]]
|
||||||
|
[:div
|
||||||
|
[bind-field
|
||||||
|
[textarea->table {:type "textarea->table"
|
||||||
|
:field [:line-items]
|
||||||
|
:headings [["Id" :id]
|
||||||
|
["Client" :client-code]
|
||||||
|
["Source" :source]
|
||||||
|
["Vendor" :vendor-name]
|
||||||
|
["Date" :date]
|
||||||
|
["Account" :account-identifier]
|
||||||
|
["Location" :location]
|
||||||
|
["Debit" :debit]
|
||||||
|
["Credit" :credit]]
|
||||||
|
:read-only-headings
|
||||||
|
[["status" :status]]
|
||||||
|
|
||||||
[bind-field
|
:row-filter
|
||||||
[textarea->table {:type "textarea->table"
|
(fn [{:keys [status-category]}]
|
||||||
:field [:line-items]
|
(if (:only-show-errors? data)
|
||||||
:headings [["Id" :id]
|
(= :error status-category)
|
||||||
["Client" :client-code]
|
true))
|
||||||
["Source" :source]
|
|
||||||
["Vendor" :vendor-name]
|
|
||||||
["Date" :date]
|
|
||||||
["Account" :account-identifier]
|
|
||||||
["Location" :location]
|
|
||||||
["Debit" :debit]
|
|
||||||
["Credit" :credit]]
|
|
||||||
:read-only-headings
|
|
||||||
[["status" :status]]
|
|
||||||
|
|
||||||
:event [::forms/change ::form]
|
:event [::forms/change ::form]
|
||||||
:subscription data}
|
:subscription data}
|
||||||
]]])]))
|
]]]])]))
|
||||||
{}))
|
{}))
|
||||||
|
|
||||||
(defn external-import-page []
|
(defn external-import-page []
|
||||||
|
|||||||
Reference in New Issue
Block a user