From 23d1fb93695221bc86e644aaa6327c3e31642647 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sun, 17 Feb 2019 08:46:43 -0800 Subject: [PATCH] adding more sidebar cleanup. --- resources/public/css/main.css | 4 +- src/cljc/auto_ap/entities/clients.cljc | 6 +- .../auto_ap/views/components/layouts.cljs | 2 +- .../auto_ap/views/pages/admin/clients.cljs | 90 +++++++++---------- 4 files changed, 50 insertions(+), 52 deletions(-) diff --git a/resources/public/css/main.css b/resources/public/css/main.css index 1cbf3803..654b74ea 100644 --- a/resources/public/css/main.css +++ b/resources/public/css/main.css @@ -143,7 +143,7 @@ nav.navbar .navbar-item.is-active { font-weight: 700; } .aside .main { - padding: 40px 40px 40px 30px; + padding: 40px 10px 40px 30px; color: #6F7B7E; } @@ -183,7 +183,7 @@ nav.navbar .navbar-item.is-active { font-weight: 500; } .messages { - padding: 40px 20px; + padding: 40px 40px 0px 20px; } .message { padding: 40px 20px; diff --git a/src/cljc/auto_ap/entities/clients.cljc b/src/cljc/auto_ap/entities/clients.cljc index fc34f9bb..b7e49b19 100644 --- a/src/cljc/auto_ap/entities/clients.cljc +++ b/src/cljc/auto_ap/entities/clients.cljc @@ -28,16 +28,16 @@ (s/def ::bank-accounts (s/coll-of ::bank-account)) (s/def ::location string?) -(s/def ::locations (s/coll-of ::location)) +(s/def ::locations (s/coll-of ::location :min-count 1)) (s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %) :is-empty #(= % ""))))) -(s/def ::client (s/keys :req-un [::name ::code] +(s/def ::client (s/keys :req-un [::name ::code ::locations] :opt-un [::email ::address - ::locations + ::bank-accounts ::id])) diff --git a/src/cljs/auto_ap/views/components/layouts.cljs b/src/cljs/auto_ap/views/components/layouts.cljs index c8ac5da2..fd073f09 100644 --- a/src/cljs/auto_ap/views/components/layouts.cljs +++ b/src/cljs/auto_ap/views/components/layouts.cljs @@ -86,7 +86,7 @@ (fn [{:keys [visible?]} & children] [css-transition-group {:in visible? :class-names {:exitDone "bounce animated" :exit "fadeOutRight animated" :enter "fadeInRight animated"} :timeout 300 :onEnter (fn [] (reset! final-state true )) :onExited (fn [] (reset! final-state false))} (if (or @final-state visible?) - [:aside {:class "column is-4 aside menu hero is-fullheight" :style {:height "100vh" :overflow "auto"}} + [:aside {:class "column is-3 aside menu hero is-fullheight" :style {:height "100vh" :overflow "auto"}} [:div.sub-main {:style {:padding-bottom "80px"}}children ]] [:div])]))) diff --git a/src/cljs/auto_ap/views/pages/admin/clients.cljs b/src/cljs/auto_ap/views/pages/admin/clients.cljs index 9a4f8674..c1d28934 100644 --- a/src/cljs/auto_ap/views/pages/admin/clients.cljs +++ b/src/cljs/auto_ap/views/pages/admin/clients.cljs @@ -82,6 +82,7 @@ :bank-code bank-code}) (:bank-accounts new-client-data))} user @(re-frame/subscribe [::subs/token])] + (if (s/valid? ::entity/client new-client-req) {:db (-> new-client-form @@ -187,53 +188,51 @@ (defn new-client-form [] (let [{error :error new-client :data } @(re-frame/subscribe [::form ::new-client])] [:form - [:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}} - [:h1.title.is-2 "Add client"] - [:div.field - [:label.label "Name"] - [:div.control - [bind-field - [:input.input {:type "text" - :field :name - :spec ::entity/name - :event ::change-new - :subscription new-client}]]]] + [:h1.title.is-2 "Add client"] + [:div.field + [:label.label "Name"] + [:div.control + [bind-field + [:input.input {:type "text" + :field :name + :spec ::entity/name + :event ::change-new + :subscription new-client}]]]] - [:div.field - [:label.label "Client code"] - [:div.control - [bind-field - [:input.input {:type "code" - :field :code - :spec ::entity/code - :event ::change-new - :subscription new-client}]]]] + [:div.field + [:label.label "Client code"] + [:div.control + [bind-field + [:input.input {:type "code" + :field :code + :spec ::entity/code + :event ::change-new + :subscription new-client}]]]] - [:div.field - [:label.label "Email"] - [:div.control - [bind-field - [:input.input {:type "email" - :field :email - :spec ::entity/email - :event ::change-new - :subscription new-client}]]]] + [:div.field + [:label.label "Email"] + [:div.control + [bind-field + [:input.input {:type "email" + :field :email + :spec ::entity/email + :event ::change-new + :subscription new-client}]]]] - [:div.field - [:label.label "Locations"] - [:div.control - [:div.field.has-addons - [:p.control - [bind-field - [:input.input {:type "text" - :field :location - :event ::change-new - :subscription new-client}]]] - [:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location])} "Add"]]] - [:ul - (for [location (:locations new-client)] - ^{:key location} [:li location ])]]] - ] + [:div.field + [:label.label "Locations"] + [:div.control + [:div.field.has-addons + [:p.control + [bind-field + [:input.input {:type "text" + :field :location + :event ::change-new + :subscription new-client}]]] + [:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location])} "Add"]]] + [:ul + (for [location (:locations new-client)] + ^{:key location} [:li location ])]]] [:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}} [:h2.subtitle "Address"] @@ -356,8 +355,7 @@ (when error [:div.notification.is-warning.animated.fadeInUp - error] - ) + error]) [:submit.button.is-large.is-primary {:disabled (if (s/valid? ::entity/client new-client) ""