fully removes old invoice experience

This commit is contained in:
2024-08-09 20:32:32 -07:00
parent e947b4592c
commit 1bb8387051
21 changed files with 268 additions and 2333 deletions

View File

@@ -2,13 +2,13 @@
(ns auto-ap.ssr.invoice.glimpse
(:require [amazonica.aws.s3 :as s3]
[amazonica.aws.textract :as textract]
[auto-ap.client-routes :as client-routes]
[auto-ap.datomic :refer [conn pull-attr]]
[auto-ap.datomic.clients :as d-clients]
[auto-ap.datomic.vendors :as d-vendors]
[auto-ap.datomic.invoices :as d-invoices]
[auto-ap.datomic.vendors :as d-vendors]
[auto-ap.graphql.utils :refer [extract-client-ids]]
[auto-ap.logging :as alog]
[auto-ap.routes.invoice :as i-route]
[auto-ap.solr :as solr]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.components :as com]
@@ -443,8 +443,8 @@ invoice_dropzone = new Dropzone(\"#invoice\", {
:headers {"hx-push-url" (bidi/path-for ssr-routes/only-routes :invoice-glimpse)
"hx-retarget" "#invoice-glimpse-content"
"hx-trigger" (cheshire/generate-string {"notification" (str (hiccup/html [:div "Successfully created "
(com/link {:href (str (bidi/path-for client-routes/routes
:invoices)
(com/link {:href (str (bidi/path-for ssr-routes/only-routes
::i-route/all-page)
"?exact-match-id="
new-invoice-id)}
(format "invoice %s" (:invoice/invoice-number new-invoice)))

View File

@@ -339,7 +339,7 @@
[:div.flex.justify-between.items-center [:h1.text-2xl.mb-3.font-bold "Import new invoices"]
[:div.flex.gap-2.items-baseline "Trouble with the new upload experience?"
#_[:div.flex.gap-2.items-baseline "Trouble with the new upload experience?"
[:a {:href (bidi/path-for client-routes/routes :import-invoices)}
(com/pill {:color :secondary}
"Go back to previous version")]]]

View File

@@ -1266,6 +1266,12 @@
[]
{:mode :simple
:has-warning? (boolean has-warning?)}))))
(defn redirect-handler [target-route]
(fn handle [request]
{:status 302
:headers {"Location" (str (hu/url (bidi.bidi/path-for ssr-routes/only-routes
target-route)
(:query-params request)))}}))
(def key->handler
(apply-middleware-to-all-handlers
@@ -1278,6 +1284,12 @@
(wrap-implied-route-param :status :invoice-status/unpaid))
::route/voided-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :invoice-status/voided))
::route/legacy-invoices (redirect-handler ::route/all-page)
::route/legacy-import-invoices (redirect-handler ::route/import-page)
::route/legacy-unpaid-invoices (redirect-handler ::route/unpaid-page)
::route/legacy-paid-invoices (redirect-handler ::route/paid-page)
::route/legacy-voided-invoices (redirect-handler ::route/voided-page)
::route/legacy-new-invoice (redirect-handler ::route/new-wizard)
::route/unvoid (-> unvoid-invoice
(wrap-entity [:route-params :db/id] default-read)
(wrap-schema-enforce :route-params [:map [:db/id entity-id]]))

View File

@@ -468,3 +468,236 @@
(dc/pull (dc/db conn) '[* {:bank-account/_plaid-account [:bank-account/code]}] 17592310327452)
(seq (dc/q '[:find ?ns
:in $ $$ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[?a :db/ident ?a2]
[(namespace ?a2) ?ns]
]
(dc/db conn)
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/log conn)))
(dc/q '[:find ?d2 ?ns ?code ?a2 ?added (count ?x)
:in $ $$ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(get-some $$ ?e :transaction/client :invoice/client :payment/client :journal-entry/client) [?attr ?c]]
[?c :client/code ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?ns]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]]
(dc/db conn)
(dc/history (dc/since (dc/db conn) #inst "2024-07-01T00:00:00-08:00"))
(dc/log conn))
(defn join-attrs [xs]
(clojure.string/join ", " (sort xs)))
(comment
"Behaviors in time region"
(clojure.data.csv/write-csv *out*
(concat
(->> (dc/q '[:find ?d2 ?code ?entity ?e ?desc (user/join-attrs ?attr)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
($$$ or-join [?e ?c]
[?c :client/bank-accounts ?e]
[?e :account-client-override/client ?c]
[?e :journal-entry/client ?c]
(and [?t :transaction/accounts ?e]
[?t :transaction/client ?c])
(and [?e :client/code]
[?e ?c])
(and [?je :journal-entry/line-items ?e]
[?je :journal-entry/client ?c])
[?e :payment/client ?c]
[?e :invoice/client ?c]
(and [?i :invoice/expense-accounts ?e]
[?i :invoice/client ?c])
[?e :transaction/client ?c]
(and [?e :invoice-payment/invoice ?i]
[?i :invoice/client ?c])
#_[(ground 0) ?c])
[(get-else $ ?c :client/code "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq)
(->> (dc/q '[:find ?d2 ?code ?entity ?e ?desc (user/join-attrs ?attr)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(ground "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
(not
[(get #{"invoice" "transaction" "account-client-override" "journal-entry"
"journal-entry-line" "bank-account" "payment" "invoice-payment"
"client" "invoice-expense-account" "transaction-account"} ?entity)])
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq))
:separator \tab)
)
(clojure.data.csv/write-csv *out*
(concat
(->> (dc/q '[:find ?d2 ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
($$$ or-join [?e ?c]
[?c :client/bank-accounts ?e]
[?e :account-client-override/client ?c]
[?e :journal-entry/client ?c]
(and [?t :transaction/accounts ?e]
[?t :transaction/client ?c])
(and [?e :client/code]
[?e ?c])
(and [?je :journal-entry/line-items ?e]
[?je :journal-entry/client ?c])
[?e :payment/client ?c]
[?e :invoice/client ?c]
(and [?i :invoice/expense-accounts ?e]
[?i :invoice/client ?c])
[?e :transaction/client ?c]
(and [?e :invoice-payment/invoice ?i]
[?i :invoice/client ?c])
#_[(ground 0) ?c])
[(get-else $ ?c :client/code "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq)
(->> (dc/q '[:find ?d2 ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(ground "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
(not
[(get #{"invoice" "transaction" "account-client-override" "journal-entry"
"journal-entry-line" "bank-account" "payment" "invoice-payment"
"client" "invoice-expense-account" "transaction-account"} ?entity)])
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq))
:separator \tab)
(clojure.data.csv/write-csv *out*
(concat
(->> (dc/q '[:find ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
($$$ or-join [?e ?c]
[?c :client/bank-accounts ?e]
[?e :account-client-override/client ?c]
[?e :journal-entry/client ?c]
(and [?t :transaction/accounts ?e]
[?t :transaction/client ?c])
(and [?e :client/code]
[?e ?c])
(and [?je :journal-entry/line-items ?e]
[?je :journal-entry/client ?c])
[?e :payment/client ?c]
[?e :invoice/client ?c]
(and [?i :invoice/expense-accounts ?e]
[?i :invoice/client ?c])
[?e :transaction/client ?c]
(and [?e :invoice-payment/invoice ?i]
[?i :invoice/client ?c])
#_[(ground 0) ?c])
[(get-else $ ?c :client/code "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq)
(->> (dc/q '[:find ?code ?entity (count ?e)
:in $$$ $$ $ ?log
:where
[$$ ?x :audit/user "admin-Ashlee Phillips"]
[(tx-data ?log ?x) [[?e ?a ?v _ ?added]]]
[(ground "") ?code]
[?a :db/ident ?a2]
[(namespace ?a2) ?entity]
(not
[(get #{"invoice" "transaction" "account-client-override" "journal-entry"
"journal-entry-line" "bank-account" "payment" "invoice-payment"
"client" "invoice-expense-account" "transaction-account"} ?entity)])
[(name ?a2) ?attr]
#_[(= ?a3 "account-client-override")]
[?x :db/txInstant ?d]
[(iol-ion.query/excel-date ?d) ?d2]
[(if ?added "changed" "replaced/deleted") ?desc]]
(dc/history (dc/db conn))
(dc/history (dc/since (dc/db conn) #inst "2024-06-15T00:00:00-08:00"))
(dc/db conn)
(dc/log conn))
seq))
:separator \tab)
(dc/q '[:find ?c
:in $ [?e ...]
:where (or-join [?e ?c]
[?e :invoice/client ?c]
[?e :transaction/client ?c])]
(dc/db conn)
[17592296942460])
1