From c39b3d936ea84268cae664df890d5d4c9b15ada5 Mon Sep 17 00:00:00 2001 From: Bryce Date: Mon, 18 Nov 2024 20:00:29 -0800 Subject: [PATCH] Invoices can be renamed --- src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj b/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj index 9fcad35c..42b42791 100644 --- a/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj +++ b/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj @@ -302,7 +302,7 @@ :errors (fc/field-errors)} [:div {:class "w-24"} (com/text-input {:value (-> (fc/field-value)) - :disabled (boolean (-> request :multi-form-state :snapshot :db/id)) + #_#_:disabled (boolean (-> request :multi-form-state :snapshot :db/id)) :name (fc/field-name) :error? (fc/field-errors) :placeholder "HA-123"})])) @@ -584,10 +584,11 @@ :validation-route ::route/new-wizard-navigate))) -(defn assert-no-conflicting [{:invoice/keys [invoice-number client vendor]}] +(defn assert-no-conflicting [{:invoice/keys [invoice-number client vendor] :db/keys [id]}] (when (seq (d-invoices/find-conflicting {:invoice/invoice-number invoice-number :invoice/vendor (->db-id vendor) - :invoice/client (->db-id client)})) + :invoice/client (->db-id client) + :db/id id})) (form-validation-error (str "Invoice '" invoice-number "' already exists.")))) @@ -736,8 +737,7 @@ (update :invoice/due coerce/to-date) (update :invoice/scheduled-payment coerce/to-date))]] (assert-invoice-amounts-add-up (second transaction)) - (when-not extant? - (assert-no-conflicting invoice)) + (assert-no-conflicting invoice) (exception->4xx #(assert-can-see-client (:identity request) client-id)) (exception->4xx #(assert-not-locked client-id (:invoice/date invoice)))