Adds cleanup to the company 1099 page to make loading clearer.

This commit is contained in:
2023-01-23 20:12:04 -08:00
parent 63ea83af9b
commit 344841420a
4 changed files with 261 additions and 243 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -182,3 +182,15 @@ tbody tr.live-added {
background-color: $primary; background-color: $primary;
cursor: pointer; cursor: pointer;
} }
.htmx-indicator.button {
opacity: 1.0 !important
}
.htmx-request .button.htmx-indicator {
@extend .is-loading
}
.htmx-request.button.htmx-indicator {
@extend .is-loading
}

View File

@@ -137,54 +137,58 @@
[:button.modal-close.is-large {"_" (hiccup/raw "on click remove <#modal-holder div/>")}]]) [:button.modal-close.is-large {"_" (hiccup/raw "on click remove <#modal-holder div/>")}]])
(defn table [{:keys [identity session]} & {:keys [flash-id]}] (defn table [{:keys [identity session]} & {:keys [flash-id]}]
[:div#vendor-table {:hx-get (bidi/path-for ssr-routes/only-routes
[:table#vendor-table.table.grid.compact.is-fullwidth {:hx-get (bidi/path-for ssr-routes/only-routes :company-1099-vendor-table
:company-1099-vendor-table :request-method :get)
:request-method :get) :hx-trigger "clientSelected from:body"
:hx-trigger "clientSelected from:body" "_" (hiccup/raw "on htmx:beforeRequest remove <table/> in me")
:hx-swap "outerHTML"} :hx-swap "outerHTML swap:300ms"}
[:thead [:table.table.grid.compact.is-fullwidth
[:tr [:thead
[:th {:style {:width "5em"}}"Client"] [:tr
[:th "Vendor Name"] [:th {:style {:width "5em"}}"Client"]
[:th "Name"] [:th "Vendor Name"]
[:th {:style {:width "9em"}} "1099 Type"] [:th "Name"]
[:th {:style {:width "8em"}} "TIN"] [:th {:style {:width "9em"}} "1099 Type"]
[:th "Address"] [:th {:style {:width "8em"}} "TIN"]
[:th "Amount Paid"] [:th "Address"]
[:th {:style {:width "10em"}}] [:th "Amount Paid"]
]] [:th {:style {:width "10em"}}]
[:tbody ]]
(for [[client vendor amount] (get-1099-companies identity session)] [:tbody
[:tr (when (= flash-id (for [[client vendor amount] (get-1099-companies identity session)]
(:db/id vendor)) [:tr (when (= flash-id
{:class "live-added"}) (:db/id vendor))
[:td (:client/code client)] {:class "live-added"})
[:td (:vendor/name vendor)] [:td (:client/code client)]
[:td (or (-> vendor :vendor/legal-entity-name not-empty) [:td (:vendor/name vendor)]
(str (-> vendor :vendor/legal-entity-first-name) " " [:td (or (-> vendor :vendor/legal-entity-name not-empty)
(-> vendor :vendor/legal-entity-middle-name) " " (str (-> vendor :vendor/legal-entity-first-name) " "
(-> vendor :vendor/legal-entity-last-name)))] (-> vendor :vendor/legal-entity-middle-name) " "
[:td (some-> vendor :vendor/legal-entity-1099-type :db/ident name)] " " (-> vendor :vendor/legal-entity-last-name)))]
[:td [:td (some-> vendor :vendor/legal-entity-1099-type :db/ident name)] " "
(some-> vendor :vendor/legal-entity-tin-type :db/ident name) " "
(-> vendor :vendor/legal-entity-tin)]
[:td
(-> vendor :vendor/address :address/street1) " "
(-> vendor :vendor/address :address/street2) " "
(-> vendor :vendor/address :address/city) " "
(-> vendor :vendor/address :address/state) " "
(-> vendor :vendor/address :address/zip)
[:td "$" (Math/round amount)]
[:td [:td
(if (cannot-overwrite? vendor) (some-> vendor :vendor/legal-entity-tin-type :db/ident name) " "
[:a {:href "mailto:ben@integreatconsult.com"} "Contact Integreat"] (-> vendor :vendor/legal-entity-tin)]
[:button.button {:hx-get (bidi/path-for ssr-routes/only-routes [:td
:company-1099-vendor-dialog (-> vendor :vendor/address :address/street1) " "
:vendor-id (:db/id vendor)) (-> vendor :vendor/address :address/street2) " "
:hx-target "#modal-holder" (-> vendor :vendor/address :address/city) " "
:hx-swap "innerHTML"} (-> vendor :vendor/address :address/state) " "
[:span.icon [:i.fa.fa-pencil ]]])]]])]]) (-> vendor :vendor/address :address/zip)
[:td "$" (Math/round amount)]
[:td
(if (cannot-overwrite? vendor)
[:a {:href "mailto:ben@integreatconsult.com"} "Contact Integreat"]
[:button.button {:hx-get (bidi/path-for ssr-routes/only-routes
:company-1099-vendor-dialog
:vendor-id (:db/id vendor))
:hx-target "#modal-holder"
:hx-swap "innerHTML"}
[:span.icon [:i.fa.fa-pencil ]]])]]])]]
[:div.container.htmx-indicator
[:div.column.is-4.is-offset-4.has-text-centered
[:div.loader.is-loading.is-active.big.is-centered]]]])
(defn form-data->map [form-data] (defn form-data->map [form-data]
(reduce-kv (reduce-kv
@@ -341,9 +345,7 @@
[:option {:value "none" :selected (= (-> vendor :vendor/legal-entity-1099-type :db/ident) :legal-entity-1099-type/none)} "None"] [:option {:value "none" :selected (= (-> vendor :vendor/legal-entity-1099-type :db/ident) :legal-entity-1099-type/none)} "None"]
[:option {:value "misc" :selected (= (-> vendor :vendor/legal-entity-1099-type :db/ident) :legal-entity-1099-type/misc)} "Misc"] [:option {:value "misc" :selected (= (-> vendor :vendor/legal-entity-1099-type :db/ident) :legal-entity-1099-type/misc)} "Misc"]
[:option {:value "landlord" :selected (= (-> vendor :vendor/legal-entity-1099-type :db/ident) :legal-entity-1099-type/landlord)} "Landlord"]]]]]]]]] [:option {:value "landlord" :selected (= (-> vendor :vendor/legal-entity-1099-type :db/ident) :legal-entity-1099-type/landlord)} "Landlord"]]]]]]]]]
[:button.button.is-primary "Save"])]))) [:button.button.is-primary.htmx-indicator "Save"])])))
(defn vendor-table [request] (defn vendor-table [request]
(html-response (table request))) (html-response (table request)))
@@ -356,8 +358,8 @@
:company-1099-vendor-table :company-1099-vendor-table
:request-method :get) :request-method :get)
:hx-trigger "load, clientSelected from:body" :hx-trigger "load, clientSelected from:body"
:hx-swap "outerHTML"} :hx-swap "outerHTML swap:400ms"}
[:div.container [:div.container.htmx-indicator
[:div.column.is-4.is-offset-4.has-text-centered [:div.column.is-4.is-offset-4.has-text-centered
[:div.loader.is-loading.is-active.big.is-centered]]]]] [:div.loader.is-loading.is-active.big.is-centered]]]]]
[:div [:div