not using namespaced keys, due to graphql

This commit is contained in:
Bryce Covert
2018-04-10 10:51:21 -07:00
parent 4a0275f024
commit 53905c317b
19 changed files with 114 additions and 109 deletions

View File

@@ -17,13 +17,12 @@
[:tr
[:th "Name"]
[:th "Email"]]]
[:tbody (for [{:keys [::entity/id ::entity/name ::entity/email] :as c} @companies]
[:tbody (for [{:keys [id name email] :as c} @companies]
^{:key (str name "-" id )}
[:tr {:on-click (fn [] (re-frame/dispatch [::events/edit id]))
:style {"cursor" "pointer"}}
[:td name]
[:td email]
])]]))
[:td email]])]]))
(defn admin-companies-page []
[:div {:class "inbox-messages"}
@@ -55,7 +54,8 @@
[:div.control
[bind-field
[:input.input {:type "text"
:field ::entity/name
:field :name
:spec ::entity/name
:event ::events/change
:subscription editing-company}]]]]
@@ -64,7 +64,8 @@
[:div.control
[bind-field
[:input.input {:type "email"
:field ::entity/email
:field :email
:spec ::entity/name
:event ::events/change
:subscription editing-company}]]]]

View File

@@ -26,12 +26,12 @@
[:th "Email"]
[:th "Invoice Reminders"]]]
[:tbody (for [v @vendors]
^{:key (str (::entity/id v))}
[:tr {:on-click (fn [] (re-frame/dispatch [::events/edit (::entity/id v)]))
^{:key (str (:id v))}
[:tr {:on-click (fn [] (re-frame/dispatch [::events/edit (:id v)]))
:style {"cursor" "pointer"}}
[:td (::entity/name v)]
[:td (::entity/primary-email v)]
[:td (::entity/invoice-reminder-schedule v)]])]]))
[:td (:name v)]
[:td (:primary-email v)]
[:td (:invoice-reminder-schedule v)]])]]))
(defn danger-for [[dom {:keys [field subscription class] :as keys} & rest]]
(let [keys (assoc keys :class (str class
@@ -50,9 +50,9 @@
[:div.modal-card
[:header.modal-card-head
[:p.modal-card-title
(if (::entity/id editing-vendor)
(str "Edit " (or (::entity/name editing-vendor) "<vendor>"))
(str "Add " (or (::entity/name editing-vendor) "<new vendor>")))]
(if (:id editing-vendor)
(str "Edit " (or (:name editing-vendor) "<vendor>"))
(str "Add " (or (:name editing-vendor) "<new vendor>")))]
(when (:error editing-vendor)
[:span.icon.has-text-danger
[:i.fa.fa-exclamation-triangle]])
@@ -63,7 +63,8 @@
[:div.control
[bind-field
[:input.input {:type "text"
:field ::entity/name
:field :name
:spec ::entity/name
:event ::events/change
:subscription editing-vendor}]]]]
@@ -73,7 +74,8 @@
[bind-field
[:input.input.is-expanded {:type "text"
:field ::entity/code
:field :code
:spec ::entity/code
:event ::events/change
:subscription editing-vendor}]]
[:p.help "The vendor code is used for invoice parsing. Only one vendor at a time can use a code"]]]
@@ -86,7 +88,8 @@
[bind-field
[:input.input.is-expanded {:type "text"
:placeholder "1700 Pennsylvania Ave"
:field ::entity/address1
:field :address1
:spec ::entity/address1
:event ::events/change
:subscription editing-vendor}]]]]
@@ -96,7 +99,8 @@
[bind-field
[:input.input.is-expanded {:type "text"
:placeholder "Suite 400"
:field ::entity/address2
:field :address2
:spec ::entity/address2
:event ::events/change
:subscription editing-vendor}]]]]
@@ -107,7 +111,8 @@
[bind-field
[:input.input.is-expanded {:type "text"
:placeholder "Cupertino"
:field ::entity/city
:field :city
:spec ::entity/city
:event ::events/change
:subscription editing-vendor}]]]
[:div.control
@@ -115,14 +120,16 @@
[bind-field
[:input.input {:type "text"
:placeholder "CA"
:field ::entity/state
:field :state
:spec ::entity/state
:event ::events/change
:subscription editing-vendor}]]]
[:div.control
[:p.help "Zip"]
[bind-field
[:input.input {:type "text"
:field ::entity/zip
:field :zip
:spec ::entity/zip
:event ::events/change
:subscription editing-vendor
:placeholder "95014"}]]]]
@@ -133,7 +140,8 @@
[:div.control.has-icons-left
[bind-field
[:input.input.is-expanded {:type "text"
:field ::entity/primary-contact
:field :primary-contact
:spec ::entity/primary-contact
:event ::events/change
:subscription editing-vendor}]]
[:span.icon.is-small.is-left
@@ -144,14 +152,16 @@
[:i.fa.fa-envelope]]
[bind-field
[:input.input {:type "email"
:field ::entity/primary-email
:field :primary-email
:spec ::entity/primary-email
:event ::events/change
:subscription editing-vendor}]]]
[:div.control.has-icons-left
[bind-field
[:input.input {:type "phone"
:field ::entity/primary-phone
:field :primary-phone
:spec ::entity/primary-phone
:event ::events/change
:subscription editing-vendor}]]
[:span.icon.is-small.is-left
@@ -162,7 +172,8 @@
[:div.control.has-icons-left
[bind-field
[:input.input.is-expanded {:type "text"
:field ::entity/secondary-contact
:field :secondary-contact
:spec ::entity/secondary-contact
:event ::events/change
:subscription editing-vendor}]]
[:span.icon.is-small.is-left
@@ -172,13 +183,15 @@
[:i.fa.fa-envelope]]
[bind-field
[:input.input {:type "email"
:field ::entity/secondary-email
:field :secondary-email
:spec ::entity/secondary-email
:event ::events/change
:subscription editing-vendor}]]]
[:div.control.has-icons-left
[bind-field
[:input.input {:type "phone"
:field ::entity/secondary-phone
:field :secondary-phone
:spec ::entity/secondary-phone
:event ::events/change
:subscription editing-vendor}]]
[:span.icon.is-small.is-left
@@ -192,7 +205,8 @@
[:input {:type "radio"
:name "schedule"
:value "Weekly"
:field ::entity/invoice-reminder-schedule
:field :invoice-reminder-schedule
:spec ::entity/invoice-reminder-schedule
:event ::events/change
:subscription editing-vendor}]]
" Send weekly"]
@@ -202,7 +216,8 @@
[:input {:type "radio"
:name "schedule"
:value "Never"
:field ::entity/invoice-reminder-schedule
:field :invoice-reminder-schedule
:spec ::entity/invoice-reminder-schedule
:event ::events/change
:subscription editing-vendor}]]
" Never"]]]