Makes better warning/errors
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
DEF DEMO Payroll 223551123 12/19/2018 2950 HQ 0 50
|
||||
GHI DEMO Payroll 123551123 12/19/2018 21550 HQ 100 0
|
||||
DEF DEMO Payroll 223551123 12/19/2018 2950 HQ 0 x
|
||||
GHI DEMO Payroll 123551123 12/19/2018 21550 HQ 0 0
|
||||
1 DEMO Payroll 123551123 12/19/2018 21550 HQ 100 0
|
||||
234 DEMO Payroll 123551123 12/19/2018 21550 HQ 100 0
|
||||
8912 DEMO Payroll 123551123 12/19/2018 21550 HQ 100 0
|
||||
aosentuh DEMO Payroll 123551123 12/19/2018 21550 HQ 100 0
|
||||
aonet DEMO Payroll 123551123 12/19/2018 2750 HQ 0 50
|
||||
1923 DEMO Payroll 123551123 12/19/2018 2950 HQ 0 50
|
||||
|
||||
|
||||
1923 ABC Payroll 123551123 12/19/2018 24400 HQ 0 50
|
||||
1923 ABC Payroll 123551123 12/19/2018 25200 HQ 50 0
|
||||
1923 ABC Payroll 123551123 12/19/2018 24400 HQ 0 0
|
||||
1923 ABC Payroll 123551123 12/19/2018 25200 HQ 0 0
|
||||
|
||||
|
@@ -58,6 +58,7 @@
|
||||
|
||||
(defn field-errors
|
||||
([]
|
||||
(println "CURRENT IS" *current*)
|
||||
(field-errors *current*))
|
||||
([cursor]
|
||||
(get-in *form-errors* (cursor/path cursor))))
|
||||
|
||||
@@ -123,10 +123,12 @@
|
||||
|
||||
(defn external-import-table-form* [request]
|
||||
[:div#table-form
|
||||
(clojure.pprint/pprint (:form-errors request))
|
||||
(fc/start-form
|
||||
(:form-params request)
|
||||
(:form-errors request)
|
||||
(fc/with-field :table
|
||||
(clojure.pprint/pprint (fc/field-errors))
|
||||
(when (seq (fc/field-value))
|
||||
|
||||
[:div {:x-data (hx/json { "showTable" false})}
|
||||
@@ -134,7 +136,19 @@
|
||||
:autocomplete "off"}
|
||||
(when (:just-parsed? request)
|
||||
[:div (hx/htmx-transition-appear {:class "bg-green-50 text-green-700 rounded p-4 m-2 max-w-screen-2xl"})
|
||||
(format "Your data has been parsed. %,d rows found." (count (fc/field-value)))])
|
||||
(format "Your data has been parsed. %,d rows found. " (count (fc/field-value)))
|
||||
[:div.inline-flex.gap-2
|
||||
(->> (:form-errors request)
|
||||
:table
|
||||
( #(if (map? %) ( vals %) %))
|
||||
(mapcat identity)
|
||||
(group-by last)
|
||||
(map (fn [[k v]]
|
||||
(if (= :warn k)
|
||||
(com/pill {:color :yellow}
|
||||
(format "%d warnings" (count v)))
|
||||
(com/pill {:color :red}
|
||||
(format "%d errors" (count v)))))))] ])
|
||||
[:div.flex.gap-4.items-center
|
||||
(com/checkbox {"@click" "showTable=!showTable"}
|
||||
"Show table")
|
||||
@@ -323,7 +337,9 @@
|
||||
(defn tsv->import-data [data]
|
||||
(if (string? data)
|
||||
(with-open [r (io/reader (char-array data))]
|
||||
(into [] (trim-header (csv/read-csv r :separator \tab))))
|
||||
(into [] (filter (fn filter-row [r]
|
||||
(seq (filter (comp not-empty #(str/replace % #"\s+" "")) r))))
|
||||
(trim-header (csv/read-csv r :separator \tab))))
|
||||
data))
|
||||
|
||||
(def account-schema (mc/schema [:orn
|
||||
|
||||
Reference in New Issue
Block a user