Allows VS to edit all vendors.
This commit is contained in:
@@ -12,11 +12,6 @@
|
|||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[iol-ion.query :refer [can-see-client?]]))
|
[iol-ion.query :refer [can-see-client?]]))
|
||||||
|
|
||||||
(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]
|
(defn get-1099-companies [user session]
|
||||||
(let [clients (->> (dc/q '[:find ?c
|
(let [clients (->> (dc/q '[:find ?c
|
||||||
:in $ ?user
|
:in $ ?user
|
||||||
@@ -171,14 +166,12 @@
|
|||||||
"Paid $" (Math/round amount)))
|
"Paid $" (Math/round amount)))
|
||||||
(com/data-grid-right-stack-cell
|
(com/data-grid-right-stack-cell
|
||||||
{}
|
{}
|
||||||
(if (cannot-overwrite? vendor)
|
(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||||
[:div (com/link {:href "mailto:ben@integreatconsult.com"} "Contact Integreat")]
|
:company-1099-vendor-dialog
|
||||||
(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
:vendor-id (:db/id vendor))
|
||||||
:company-1099-vendor-dialog
|
:hx-target "#modal-holder"
|
||||||
:vendor-id (:db/id vendor))
|
:hx-swap "outerHTML"}
|
||||||
:hx-target "#modal-holder"
|
svg/pencil))))
|
||||||
:hx-swap "outerHTML"}
|
|
||||||
svg/pencil)))))
|
|
||||||
(defn table* [{:keys [identity session query-params hx-query-params]} & {:keys [flash-id]}]
|
(defn table* [{:keys [identity session query-params hx-query-params]} & {:keys [flash-id]}]
|
||||||
(let [start (or (some-> (or (get query-params "start") (get hx-query-params "start")) not-empty (Long/parseLong ))
|
(let [start (or (some-> (or (get query-params "start") (get hx-query-params "start")) not-empty (Long/parseLong ))
|
||||||
0)
|
0)
|
||||||
@@ -216,12 +209,11 @@
|
|||||||
(com/data-grid-header {})]})))
|
(com/data-grid-header {})]})))
|
||||||
|
|
||||||
(defn vendor-save [{:keys [form-params identity route-params] :as request}]
|
(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
|
||||||
@(dc/transact conn [(remove-nils
|
(-> (form-data->map form-params)
|
||||||
(-> (form-data->map form-params)
|
(assoc :db/id (Long/parseLong (:vendor-id route-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-1099-type #(some->> % not-empty (keyword "legal-entity-1099-type")))
|
(update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))])
|
||||||
(update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))]))
|
|
||||||
(html-response
|
(html-response
|
||||||
(table* request :flash-id (Long/parseLong (:vendor-id route-params)))
|
(table* request :flash-id (Long/parseLong (:vendor-id route-params)))
|
||||||
:headers {"hx-trigger" "closeModal"}))
|
:headers {"hx-trigger" "closeModal"}))
|
||||||
|
|||||||
Reference in New Issue
Block a user