From ab4db8c9fff681dd6114e8bac6f3ee9a6c5081d3 Mon Sep 17 00:00:00 2001 From: Bryce Date: Thu, 25 May 2023 09:44:30 -0700 Subject: [PATCH] allows editing all vendors. --- src/clj/auto_ap/ssr/company/company_1099.clj | 30 ++++++++------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/clj/auto_ap/ssr/company/company_1099.clj b/src/clj/auto_ap/ssr/company/company_1099.clj index 8fe259ea..85ba0041 100644 --- a/src/clj/auto_ap/ssr/company/company_1099.clj +++ b/src/clj/auto_ap/ssr/company/company_1099.clj @@ -12,10 +12,7 @@ [datomic.api :as dc] [hiccup2.core :as hiccup])) -(defn cannot-overwrite? [vendor] - (some? (or (:vendor/legal-entity-1099-type vendor) - (:vendor/legal-entity-tin vendor) - (:vendor/legal-entity-tin-type vendor)))) + (defn get-1099-companies [user session] (let [clients (->> (dc/q '[:find ?c @@ -179,14 +176,12 @@ (-> 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 ]]])]]])]] + [: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]]]]) @@ -214,12 +209,11 @@ :else k)) (defn vendor-save [{:keys [form-params identity route-params] :as request}] - (when-not (cannot-overwrite? (dc/pull (dc/db conn) '[*] (Long/parseLong (:vendor-id route-params)))) - @(dc/transact conn [(remove-nils - (-> (form-data->map form-params) - (assoc :db/id (Long/parseLong (:vendor-id route-params))) - (update :vendor/legal-entity-1099-type #(some->> % not-empty (keyword "legal-entity-1099-type"))) - (update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))])) + @(dc/transact conn [(remove-nils + (-> (form-data->map form-params) + (assoc :db/id (Long/parseLong (:vendor-id route-params))) + (update :vendor/legal-entity-1099-type #(some->> % not-empty (keyword "legal-entity-1099-type"))) + (update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))]) (html-response (table request :flash-id (Long/parseLong (:vendor-id route-params)))))