more viewing from UI.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
[auto-ap.datomic :refer [uri]]))
|
||||
|
||||
(defn get-all []
|
||||
|
||||
(->> (d/q '[:find (pull ?e [*])
|
||||
:where [?e :client/name]]
|
||||
(d/db (d/connect uri)))
|
||||
|
||||
16
src/clj/auto_ap/datomic/vendors.clj
Normal file
16
src/clj/auto_ap/datomic/vendors.clj
Normal file
@@ -0,0 +1,16 @@
|
||||
(ns auto-ap.datomic.vendors
|
||||
(:require [datomic.api :as d]
|
||||
[auto-ap.datomic :refer [uri]]))
|
||||
|
||||
(defn get-all []
|
||||
|
||||
(->> (d/q '[:find (pull ?e [*])
|
||||
:where [?e :vendor/name]]
|
||||
(d/db (d/connect uri)))
|
||||
(map first)
|
||||
#_(map (fn [c]
|
||||
(update c :client/bank-accounts
|
||||
(fn [bas]
|
||||
(map (fn [ba]
|
||||
(update ba :bank-account/type :db/ident ))
|
||||
bas)))))))
|
||||
@@ -12,6 +12,7 @@
|
||||
[auto-ap.db.vendors :as vendors]
|
||||
[auto-ap.db.companies :as companies]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.db.users :as users]
|
||||
[auto-ap.db.checks :as checks]
|
||||
[auto-ap.routes.checks :as rchecks]
|
||||
@@ -40,6 +41,11 @@
|
||||
:address {:type :address}
|
||||
:locations {:type '(list String)}
|
||||
:bank_accounts {:type '(list :bank_account)}}}
|
||||
:contact
|
||||
{:fields {:id {:type 'String}
|
||||
:name {:type 'String}
|
||||
:email {:type 'String}
|
||||
:phone {:type 'String}}}
|
||||
|
||||
:bank_account
|
||||
{:fields {:id {:type 'String}
|
||||
@@ -56,20 +62,14 @@
|
||||
:state {:type 'String}
|
||||
:zip {:type 'String}}}
|
||||
:vendor
|
||||
{:fields {:id {:type 'Int}
|
||||
{:fields {:id {:type 'String}
|
||||
:name {:type 'String}
|
||||
:code {:type 'String}
|
||||
|
||||
:print_as {:type 'String}
|
||||
:primary_contact {:type 'String}
|
||||
:primary_contact {:type :contact}
|
||||
:secondary_contact {:type :contact}
|
||||
:address {:type :address}
|
||||
:primary_email {:type 'String}
|
||||
:primary_phone {:type 'String}
|
||||
|
||||
:secondary_contact {:type 'String}
|
||||
:secondary_email {:type 'String}
|
||||
:secondary_phone {:type 'String}
|
||||
|
||||
|
||||
:default_expense_account {:type 'Int}
|
||||
:invoice_reminder_schedule {:type 'String}}}
|
||||
@@ -453,10 +453,9 @@
|
||||
|
||||
(defn get-company [context args value]
|
||||
(println "GETTING COMPANY" (:id context))
|
||||
(doto (->graphql
|
||||
(filter #(can-see-company? (:id context) %)
|
||||
(d-clients/get-all)))
|
||||
println))
|
||||
(->graphql
|
||||
(filter #(can-see-company? (:id context) %)
|
||||
(d-clients/get-all))))
|
||||
|
||||
(defn join-companies [users]
|
||||
(let [companies (by :id (companies/get-all))]
|
||||
@@ -478,7 +477,7 @@
|
||||
|
||||
(defn get-vendor [context args value]
|
||||
(->graphql
|
||||
(vendors/get-all)))
|
||||
(d-vendors/get-all)))
|
||||
|
||||
(defn print-checks [context args value]
|
||||
|
||||
@@ -555,4 +554,4 @@
|
||||
(query id q nil ))
|
||||
([id q v]
|
||||
(println "executing graphql query" id q v)
|
||||
(simplify (execute schema q v {:id id}))))
|
||||
(time (simplify (execute schema q v {:id id})))))
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
[:id :name :locations [:bank-accounts [:id :number :check-number :name :type] ]
|
||||
[:address [:street1 :street2 :city :state :zip]]]]
|
||||
[:vendor
|
||||
[:id :name :default-expense-account :primary-contact :primary-email :primary-phone :secondary-contact :secondary-email :secondary-phone :print-as :invoice-reminder-schedule :code]]]}
|
||||
[:id :name :default-expense-account [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]]}
|
||||
|
||||
:on-success [::received-initial]}}))))
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
:query-obj {:venia/queries [[:company
|
||||
[:id :name [:bank-accounts [:id :number :check-number :name :type]]]]
|
||||
[:vendor
|
||||
[:id :name :default-expense-account]]]}
|
||||
[:id :name :default-expense-account [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]]}
|
||||
|
||||
:on-success [::received-initial]}
|
||||
:db (assoc db :user (assoc user :token token))}))
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
[:div.control.has-icons-left
|
||||
[bind-field
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:field :primary-contact
|
||||
:field [:primary-contact :name]
|
||||
:spec ::entity/primary-contact
|
||||
:event change-event
|
||||
:subscription vendor}]]
|
||||
@@ -92,7 +92,7 @@
|
||||
[:i.fa.fa-envelope]]
|
||||
[bind-field
|
||||
[:input.input {:type "email"
|
||||
:field :primary-email
|
||||
:field [:primary-contact :email]
|
||||
:spec ::entity/primary-email
|
||||
:event change-event
|
||||
:subscription vendor}]]]
|
||||
@@ -100,7 +100,7 @@
|
||||
[:div.control.has-icons-left
|
||||
[bind-field
|
||||
[:input.input {:type "phone"
|
||||
:field :primary-phone
|
||||
:field [:primary-contact :phone]
|
||||
:spec ::entity/primary-phone
|
||||
:event change-event
|
||||
:subscription vendor}]]
|
||||
@@ -112,7 +112,7 @@
|
||||
[:div.control.has-icons-left
|
||||
[bind-field
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:field :secondary-contact
|
||||
:field [:secondary-contact :name]
|
||||
:spec ::entity/secondary-contact
|
||||
:event change-event
|
||||
:subscription vendor}]]
|
||||
@@ -123,14 +123,14 @@
|
||||
[:i.fa.fa-envelope]]
|
||||
[bind-field
|
||||
[:input.input {:type "email"
|
||||
:field :secondary-email
|
||||
:field [:secondary-contact :email]
|
||||
:spec ::entity/secondary-email
|
||||
:event change-event
|
||||
:subscription vendor}]]]
|
||||
[:div.control.has-icons-left
|
||||
[bind-field
|
||||
[:input.input {:type "phone"
|
||||
:field :secondary-phone
|
||||
:field [:secondary-contact :phone]
|
||||
:spec ::entity/secondary-phone
|
||||
:event change-event
|
||||
:subscription vendor}]]
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
(vec (concat [dom keys] rest))))
|
||||
|
||||
|
||||
|
||||
#_(defn edit-dialog []
|
||||
(let [editing-vendor (:vendor @(re-frame/subscribe [::subs/admin]))
|
||||
companies-by-id @(re-frame/subscribe [::subs/companies-by-id])]
|
||||
|
||||
Reference in New Issue
Block a user