From 76c903d16d48ac1373c6d68928510ebcda3a8595 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sun, 12 May 2019 20:31:28 -0700 Subject: [PATCH] rules can be edited fully and more. --- resources/public/finance-font/demo.html | 52 +++++++++++++++++- .../public/finance-font/fonts/icomoon.eot | Bin 64932 -> 66564 bytes .../public/finance-font/fonts/icomoon.svg | 3 + .../public/finance-font/fonts/icomoon.ttf | Bin 64768 -> 66400 bytes .../public/finance-font/fonts/icomoon.woff | Bin 64844 -> 66476 bytes resources/public/finance-font/selection.json | 2 +- resources/public/finance-font/style.css | 19 +++++-- src/clj/auto_ap/datomic.clj | 4 +- .../datomic/migrate/add_general_ledger.clj | 11 +++- src/clj/auto_ap/datomic/transaction_rules.clj | 1 + src/clj/auto_ap/graphql.clj | 11 +++- src/clj/auto_ap/graphql/transaction_rules.clj | 2 + .../views/components/admin/side_bar.cljs | 12 ++-- .../views/pages/admin/rules/common.cljs | 4 ++ .../auto_ap/views/pages/admin/rules/form.cljs | 43 ++++++++++----- test/clj/auto_ap/graphql.clj | 6 +- 16 files changed, 132 insertions(+), 38 deletions(-) diff --git a/resources/public/finance-font/demo.html b/resources/public/finance-font/demo.html index 1656611e..4fc528d3 100755 --- a/resources/public/finance-font/demo.html +++ b/resources/public/finance-font/demo.html @@ -9,10 +9,58 @@
-

Font Name: icomoon (Glyphs: 103)

+

Font Name: icomoon (Glyphs: 106)

Grid Size: Unknown

+
+
+ + + + icon-list-bullets +
+
+ + +
+
+ liga: + +
+
+
+
+ + + + icon-single-neutral-book +
+
+ + +
+
+ liga: + +
+
+
+
+ + + + icon-cog-play-1 +
+
+ + +
+
+ liga: + +
+
@@ -1673,7 +1721,7 @@ -
  +
 
diff --git a/resources/public/finance-font/fonts/icomoon.eot b/resources/public/finance-font/fonts/icomoon.eot index e49a56202d855bb6f65325ad86072a91877a1f20..6f78eb34172e65f700a90f532a123795d4463514 100755 GIT binary patch delta 1789 zcmah~O>7%Q6n<}KcXrp_O|c!X|MF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CrU#3S8sY#;a)GXqZq4+m03e@Ief?}TIuVBus2+U=pf;i4thDs*UjNy`r zijSvaY>&t)?GsgyiJA^FeU?t>lbXw=P3nns=eo1oI@T{^YLPMgM=7IsOrmJIgA3Qy ztJwBUm1K(rr5kk~5D9TcuAt|jqW_N7-A_3%)*{Q6cIZ6-u1IGg*lmDXalyDKTtm^u z9ub$>P&B)_B`c-KQt67dsAo-1ezIlaM2mCl7#Myf02SQGO{^$jXkk3h!0_7w$XCcq%uSu? z#rYe^2O7xOR*+v@0(2-4{CO~OhdX21Bt~z>w9P(@yx)~U{s3aFgTn0b{5D@1xLH8z m7;an(1lk9oC!hFd&X~RF{~E@rI~Z@UfxVu+eI6s@Aw~e=GEXW1 diff --git a/resources/public/finance-font/fonts/icomoon.woff b/resources/public/finance-font/fonts/icomoon.woff index 0897e89720b15d372ed259f140bb384d5b7e8ab6..2d18765748a46257bb860bc6b4cf7b83e5017403 100755 GIT binary patch delta 1821 zcmah~O>A355Z-y~_hmK2D7!s1qSta!?+l8)!sT%Ew5m15fjgndFH>qeY|{% zVjrQebnJoSORpTm*iFV7F|zRI?|!v-wER3{&D)4cleveg>x&paZ;*w336@6E!A`V1U|6W8AX?f0OHWwtDgSFlqLGg*Qa*i-B|c8tBmn5(`z z<*EPjqpXf34EKOEHUbpU$HY-{B9%_|MG05yMk=vFAr{N$V}Vd8;5W^mRZUZcRYlX3 z#_BfvN7fJQzWKhlg*9X*_QHCL+8+qb*;Um}R%_0+%VN^R1Oeu?c2aB3=VN>F`8~1x z`+vWvDO6a|7?W6Kdy}v6O%`MiqX>_)XV@XeJlLt;)9R??9xz&s>!e4R9DQWe4C@(0 z22z7cMvE zY=(7RwL4vfXmoEp8Y#M*cC|SNmz3&(>174ZeKJ`pP3B9bJZXz66bmt497|9eKArgP zee3j90wEreq=vO#9Zlv+YgX2%BsPypV#Y zVF_?g<4RA$ID};fwqZU3W~x9gK2Jg_y$|}snu?I59iAZ4rK#9N3g(kaTL@|_wKABQKAk6;qb0$b{K)j>)F!#K@$yn~`ywB}?WQ#;?8LNZhT)f}uB zM}swF?o71RZ4j`TR^0-G-LMr1`QzTK>ecLCHRp0=ZMrmzXTm=#>9(xPl~cWT&8ud; zaepWf`CqU{+X27FMPV>k8^+~VBWTKSZcq@pMd4Fi7IDaN{7i`gceo|NE-%nAS&;35 zJQgjLRI3%Gn{f4sgno_^wSGnajZJtSbt2ZPs@4wldjL|T zw-MZpfLf7YBnoLLI;6o|pCXb2MbqWBtem%5YF!$|M#ApU$h!R4e{eWad0HCIZ96i# z4a2=7nZW4S;{QO;5#Af6DkjuCRgcmVz?99ne2CB3B1r%Vo0m2h4&aKN$tN>d4y9LNs z0OJ % + (update :id (fn [i] (if (some-> i (str/starts-with? "new-")) + nil + i))) + (assoc :percentage (/ (get-in % [:amount-percentage]) 100 )) + (assoc :account-id (get-in % [:account :id])) + (select-keys [:percentage :id :location :account-id])) + as))) (assoc :client-id (:id (:client data))) (assoc :bank-account-id (:id (:bank-account data))))} default-read]}]})) @@ -88,23 +99,27 @@ :dom-lte nil :dom-gte nil :vendor nil - :expense-accounts []))))) + :accounts []))))) (re-frame/reg-event-db ::editing (fn [db [_ which]] - (-> db (forms/start-form ::form (assoc (select-keys which - [:description - :id - :client - :bank-account - :note - :amount-lte - :amount-gte - :dom-lte - :dom-gte - :vendor]) - :expense-accounts []))))) + (-> db (forms/start-form ::form (-> which + (select-keys [:description + :id + :client + :bank-account + :note + :amount-lte + :amount-gte + :dom-lte + :dom-gte + :vendor + :accounts]) + (update :accounts (fn [xs] + (println xs) + (mapv #(assoc % :amount-percentage (* (:percentage %) 100.0)) + xs)))))))) (re-frame/reg-event-db @@ -251,7 +266,7 @@ :percentage-only? true :locations @(re-frame/subscribe [::subs/locations-for-client (:id (:client data))]) :max 100 - :field [:expense-accounts]}]] + :field [:accounts]}]] [error-notification] diff --git a/test/clj/auto_ap/graphql.clj b/test/clj/auto_ap/graphql.clj index 3b5881d3..3570234f 100644 --- a/test/clj/auto_ap/graphql.clj +++ b/test/clj/auto_ap/graphql.clj @@ -47,8 +47,7 @@ {:transaction-rule {:accounts [{:account-id account-id :percentage "0.25" :location "B"}]}} - [:id ]])}]}) - ] + [:id ]])}]})] (is (thrown? clojure.lang.ExceptionInfo (sut/query nil q))))) (testing "it should add rules" (let [q (v/graphql-query {:venia/operation {:operation/type :mutation @@ -56,6 +55,7 @@ :venia/queries [{:query/data (sut/->graphql [:upsert-transaction-rule {:transaction-rule {:description "123" :vendor-id vendor-id + :transaction-approval-status :approved :accounts [{:account-id account-id :percentage "0.5" :location "B"} @@ -63,6 +63,7 @@ :percentage "0.5" :location "A"}]}} [:id :description + :transaction-approval-status [:vendor [:name]] [:accounts [:id :percentage [:account [:name]]]]]])}]}) result (-> (sut/query nil q) @@ -71,6 +72,7 @@ (is (= "123" (:description result))) (is (= "Bryce's Meat Co" (-> result :vendor :name))) + (is (= :approved (:transaction-status result))) (is (= "hello" (-> result :accounts (get 0) :account :name ))) (is (:id result)) (testing "it should delete removed rules"