 (ns elevent-client.pages.events.id.activities.id.edit
   (:require
+    [goog.string :as string]
     [reagent.core :as r :refer [atom]]
     [validateur.validation :refer [format-of presence-of validation-set]]
     [datascript :as d]

      (if-let [activity (seq (d/entity @api/activities-db activity-id))]
        (reset! form (let [activity (into {} activity)]
                       (assoc activity
                         :EnrollmentCap (str (:EnrollmentCap activity)))))
        (add-watch api/activities-db
                   :activity-edit
                   (fn [_ _ _ _]

                                                      activity-id))]
                               (assoc activity
                                 :EnrollmentCap
                                 (str (:EnrollmentCap activity))
                                 :TicketPrice
                                 (if (> (:TicketPrice activity) 0)
                                   (string/format "%.2f" (:TicketPrice activity))
                                   ""))))
                     (remove-watch api/activities-db :activity-edit)))))
    (fn [event-id]
      (let [{:keys [Name Location EnrollmentCap StartTime EndTime TicketPrice Description]}
            @form

            errors
