Allows you to filter down to ccp-processor

This commit is contained in:
2021-06-18 07:09:48 -07:00
parent 7c98fe7d51
commit f40d1f4fb8
6 changed files with 150 additions and 99 deletions

View File

@@ -46,6 +46,13 @@
:where ['[?e :sales-order/client ?client-id] :where ['[?e :sales-order/client ?client-id]
'[?client-id :client/code ?client-code]]} '[?client-id :client/code ?client-code]]}
:args [(:client-code args)]}) :args [(:client-code args)]})
(:processor args)
(merge-query {:query {:in ['?processor]
:where ['[?e :sales-order/charges ?chg]
'[?chg :charge/processor ?processor]]}
:args [(keyword "ccp-processor"
(name (:processor args)))]})
(:total-gte args) (:total-gte args)
(merge-query {:query {:in ['?total-gte] (merge-query {:query {:in ['?total-gte]
@@ -96,13 +103,28 @@
(mapv <-datomic))] (mapv <-datomic))]
payments)) payments))
(defn summarize-orders [ids]
(let [[total tax] (->>
(d/query {:query {:find ['(sum ?t) '(sum ?tax)]
:with ['?id]
:in ['$ '[?id ...]]
:where ['[?id :sales-order/total ?t]
'[?id :sales-order/tax ?tax]]}
:args [(d/db (d/connect uri))
ids]})
first)]
{:total total
:tax tax}))
(defn get-graphql [args] (defn get-graphql [args]
(log/info "ARGS" args) (log/info "ARGS" args)
(let [db (d/db (d/connect uri)) (let [db (d/db (d/connect uri))
{ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)] {ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)]
[(->> (graphql-results ids-to-retrieve db args)) [(->> (graphql-results ids-to-retrieve db args))
matching-count])) matching-count
(summarize-orders ids-to-retrieve)]))
(defn get-by-id [id] (defn get-by-id [id]
(->> (->>

View File

@@ -63,8 +63,8 @@
(str %) (str %)
:else :else
%) %)}
}
:percentage {:parse #(cond (and (string? %) :percentage {:parse #(cond (and (string? %)
(not (str/blank? %))) (not (str/blank? %)))
(Double/parseDouble %) (Double/parseDouble %)
@@ -126,7 +126,7 @@
:phone {:type 'String}}} :phone {:type 'String}}}
:bank_account :bank_account
{:fields {:id {:type :id } {:fields {:id {:type :id}
:type {:type :ident} :type {:type :ident}
:start_date {:type :iso_date} :start_date {:type :iso_date}
:number {:type 'String} :number {:type 'String}
@@ -177,8 +177,8 @@
:terms_override :terms_override
{:fields {:id {:type :id} {:fields {:id {:type :id}
:client {:type :client} :client {:type :client}
:terms {:type 'Int} :terms {:type 'Int}}}
}}
:schedule_payment_dom :schedule_payment_dom
{:fields {:id {:type :id} {:fields {:id {:type :id}
@@ -218,9 +218,9 @@
:legal_entity_last_name {:type 'String} :legal_entity_last_name {:type 'String}
:legal_entity_tin {:type 'String} :legal_entity_tin {:type 'String}
:legal_entity_tin_type {:type :tin_type} :legal_entity_tin_type {:type :tin_type}
:legal_entity_1099_type {:type :type_1099} :legal_entity_1099_type {:type :type_1099}}}
}}
:reminder :reminder
{:fields {:id {:type 'Int} {:fields {:id {:type 'Int}
:email {:type 'String} :email {:type 'String}
@@ -228,8 +228,8 @@
:body {:type 'String} :body {:type 'String}
:scheduled {:type 'String} :scheduled {:type 'String}
:sent {:type 'String} :sent {:type 'String}
:vendor {:type :vendor} :vendor {:type :vendor}}}
}}
:journal_entry_line :journal_entry_line
{:fields {:id {:type :id} {:fields {:id {:type :id}
@@ -301,24 +301,24 @@
:s3_url {:type 'String} :s3_url {:type 'String}
:check_number {:type 'Int} :check_number {:type 'Int}
:status {:type 'String} :status {:type 'String}
:invoices {:type '(list :invoice_payment)} :invoices {:type '(list :invoice_payment)}}}
}}
:payment {:fields {:id {:type :id} :payment {:fields {:id {:type :id}
:type {:type :payment_type} :type {:type :payment_type}
:original_id {:type 'Int} :original_id {:type 'Int}
:amount {:type 'String} :amount {:type 'String}
:vendor {:type :vendor} :vendor {:type :vendor}
:client {:type :client} :client {:type :client}
:date {:type 'String} :date {:type 'String}
:bank_account {:type :bank_account} :bank_account {:type :bank_account}
:memo {:type 'String} :memo {:type 'String}
:s3_url {:type 'String} :s3_url {:type 'String}
:check_number {:type 'Int} :check_number {:type 'Int}
:status {:type :ident} :status {:type :ident}
:transaction {:type :transaction} :transaction {:type :transaction}
:invoices {:type '(list :invoice_payment)} :invoices {:type '(list :invoice_payment)}}}
}}
:yodlee_merchant {:fields {:id {:type :id} :yodlee_merchant {:fields {:id {:type :id}
:yodlee_id {:type 'String} :yodlee_id {:type 'String}
@@ -432,10 +432,10 @@
:end {:type 'Int}}} :end {:type 'Int}}}
:payment_page {:fields {:payments {:type '(list :payment)} :payment_page {:fields {:payments {:type '(list :payment)}
:count {:type 'Int} :count {:type 'Int}
:total {:type 'Int} :total {:type 'Int}
:start {:type 'Int} :start {:type 'Int}
:end {:type 'Int}}} :end {:type 'Int}}}
:transaction_page {:fields {:data {:type '(list :transaction)} :transaction_page {:fields {:data {:type '(list :transaction)}
:count {:type 'Int} :count {:type 'Int}
@@ -454,12 +454,16 @@
:total {:type 'Int} :total {:type 'Int}
:start {:type 'Int} :start {:type 'Int}
:end {:type 'Int}}} :end {:type 'Int}}}
:sales_order_page {:fields {:sales_orders {:type '(list :sales_order)} :sales_order_page {:fields {:sales_orders {:type '(list :sales_order)}
:count {:type 'Int} :count {:type 'Int}
:total {:type 'Int} :total {:type 'Int}
:start {:type 'Int} :start {:type 'Int}
:end {:type 'Int}}} :end {:type 'Int}
:sales_order_total {:type :money}
:sales_order_tax {:type :money}}}
:expected_deposit_page {:fields {:expected_deposits {:type '(list :expected_deposit)} :expected_deposit_page {:fields {:expected_deposits {:type '(list :expected_deposit)}
:count {:type 'Int} :count {:type 'Int}
@@ -489,8 +493,8 @@
:import_ledger_result {:fields {:successful {:type '(list :import_ledger_entry_result)} :import_ledger_result {:fields {:successful {:type '(list :import_ledger_entry_result)}
:existing {:type '(list :import_ledger_entry_result)} :existing {:type '(list :import_ledger_entry_result)}
:ignored {:type '(list :import_ledger_entry_result)} :ignored {:type '(list :import_ledger_entry_result)}
:errors {:type '(list :import_ledger_entry_result)} :errors {:type '(list :import_ledger_entry_result)}}}
}}
:upcoming_transaction {:fields {:amount {:type :money} :upcoming_transaction {:fields {:amount {:type :money}
:identifier {:type 'String} :identifier {:type 'String}
@@ -500,8 +504,8 @@
:invoices_due_soon {:type '(list :invoice)} :invoices_due_soon {:type '(list :invoice)}
:outstanding_payments {:type :money} :outstanding_payments {:type :money}
:upcoming_credits {:type '(list :upcoming_transaction)} :upcoming_credits {:type '(list :upcoming_transaction)}
:upcoming_debits {:type '(list :upcoming_transaction)}}} :upcoming_debits {:type '(list :upcoming_transaction)}}}}
}
@@ -600,10 +604,10 @@
:resolve :get-all-expected-deposits} :resolve :get-all-expected-deposits}
:all_sales_orders {:type '(list :sales_order) :all_sales_orders {:type '(list :sales_order)
:args {:client_id {:type :id} :args {:client_id {:type :id}
:date_range {:type :date_range} :date_range {:type :date_range}
:client_code {:type 'String}} :client_code {:type 'String}}
:resolve :get-all-sales-orders} :resolve :get-all-sales-orders}
:yodlee_merchants {:type '(list :yodlee_merchant) :yodlee_merchants {:type '(list :yodlee_merchant)
:args {} :args {}
@@ -612,16 +616,16 @@
:transaction_page {:type :transaction_page :transaction_page {:type :transaction_page
:args {:filters {:type :transaction_filters}} :args {:filters {:type :transaction_filters}}
:resolve :get-transaction-page} :resolve :get-transaction-page}
:transaction_rule_page {:type :transaction_rule_page :transaction_rule_page {:type :transaction_rule_page
:args {:client_id {:type :id} :args {:client_id {:type :id}
:vendor_id {:type :id} :vendor_id {:type :id}
:start {:type 'Int} :start {:type 'Int}
:per_page {:type 'Int} :per_page {:type 'Int}
:sort {:type '(list :sort_item)} :sort {:type '(list :sort_item)}
:asc {:type 'Boolean}} :asc {:type 'Boolean}}
:resolve :get-transaction-rule-page} :resolve :get-transaction-rule-page}
:ledger_page {:type :ledger_page :ledger_page {:type :ledger_page
:args {:filters {:type :ledger_filters}} :args {:filters {:type :ledger_filters}}
@@ -632,6 +636,7 @@
:date_range {:type :date_range} :date_range {:type :date_range}
:total_lte {:type :money} :total_lte {:type :money}
:total_gte {:type :money} :total_gte {:type :money}
:processor {:type :processor}
:start {:type 'Int} :start {:type 'Int}
:per_page {:type 'Int} :per_page {:type 'Int}
:sort {:type '(list :sort_item)}} :sort {:type '(list :sort_item)}}
@@ -670,9 +675,9 @@
:vendor {:type '(list :vendor) :vendor {:type '(list :vendor)
:resolve :get-vendor} :resolve :get-vendor}
:user {:type '(list :user) :user {:type '(list :user)
:resolve :get-user} :resolve :get-user}}
}
:input-objects :input-objects
{ {
@@ -756,10 +761,10 @@
:matches {:type '(list String)} :matches {:type '(list String)}
:location_matches {:type '(list :edit_location_match)} :location_matches {:type '(list :edit_location_match)}
:bank_accounts {:type '(list :edit_bank_account)} :bank_accounts {:type '(list :edit_bank_account)}
:forecasted_transactions {:type '(list :edit_forecasted_transaction)} :forecasted_transactions {:type '(list :edit_forecasted_transaction)}}}
}}
:edit_bank_account :edit_bank_account
{:fields {:id {:type :id } {:fields {:id {:type :id}
:code {:type 'String} :code {:type 'String}
:type {:type :bank_account_type} :type {:type :bank_account_type}
:start_date {:type :iso_date} :start_date {:type :iso_date}
@@ -796,8 +801,8 @@
:add_terms_override :add_terms_override
{:fields {:id {:type :id} {:fields {:id {:type :id}
:client_id {:type :id} :client_id {:type :id}
:terms {:type 'Int} :terms {:type 'Int}}}
}}
:add_account_override :add_account_override
{:fields {:id {:type :id} {:fields {:id {:type :id}
@@ -833,8 +838,8 @@
:legal_entity_last_name {:type 'String} :legal_entity_last_name {:type 'String}
:legal_entity_tin {:type 'String} :legal_entity_tin {:type 'String}
:legal_entity_tin_type {:type :tin_type} :legal_entity_tin_type {:type :tin_type}
:legal_entity_1099_type {:type :type_1099} :legal_entity_1099_type {:type :type_1099}}}
}}
:edit_expense_account :edit_expense_account
{:fields {:id {:type :id} {:fields {:id {:type :id}
@@ -944,8 +949,8 @@
:resolve :mutation/reject-invoices} :resolve :mutation/reject-invoices}
:approve_invoices {:type '(list :id) :approve_invoices {:type '(list :id)
:args {:invoices {:type '(list :id)}} :args {:invoices {:type '(list :id)}}
:resolve :mutation/approve-invoices} :resolve :mutation/approve-invoices}
:bulk_change_transaction_status {:type :message :bulk_change_transaction_status {:type :message
:args {:filters {:type :transaction_filters} :args {:filters {:type :transaction_filters}
@@ -987,7 +992,7 @@
:date {:type 'String} :date {:type 'String}
:check_number {:type 'Int} :check_number {:type 'Int}
:bank_account_id {:type :id}} :bank_account_id {:type :id}}
:resolve :mutation/add-handwritten-check} :resolve :mutation/add-handwritten-check}
:edit_user {:type :user :edit_user {:type :user
:args {:edit_user {:type :edit_user}} :args {:edit_user {:type :edit_user}}
:resolve :mutation/edit-user} :resolve :mutation/edit-user}
@@ -1026,9 +1031,9 @@
:resolve :mutation/match-transaction} :resolve :mutation/match-transaction}
:match_transaction_autopay_invoices {:type :transaction :match_transaction_autopay_invoices {:type :transaction
:args {:transaction_id {:type :id} :args {:transaction_id {:type :id}
:autopay_invoice_ids {:type '(list :id)}} :autopay_invoice_ids {:type '(list :id)}}
:resolve :mutation/match-transaction-autopay-invoices} :resolve :mutation/match-transaction-autopay-invoices}
:match_transaction_unpaid_invoices {:type :transaction :match_transaction_unpaid_invoices {:type :transaction
:args {:transaction_id {:type :id} :args {:transaction_id {:type :id}
@@ -1052,8 +1057,8 @@
:resolve :mutation/unvoid-invoice} :resolve :mutation/unvoid-invoice}
:void_payment {:type :payment :void_payment {:type :payment
:args {:payment_id {:type :id}} :args {:payment_id {:type :id}}
:resolve :mutation/void-payment} :resolve :mutation/void-payment}
:edit_expense_accounts {:type :invoice :edit_expense_accounts {:type :invoice
:args {:invoice_id {:type :id} :args {:invoice_id {:type :id}
:expense_accounts {:type '(list :edit_expense_account)}} :expense_accounts {:type '(list :edit_expense_account)}}
@@ -1122,7 +1127,7 @@
(assert-can-see-client (:id context) (:client_id args)) (assert-can-see-client (:id context) (:client_id args))
(->graphql (->graphql
(gq-checks/print-checks (map (fn [i] {:invoice-id (:invoice_id i) (gq-checks/print-checks (map (fn [i] {:invoice-id (:invoice_id i)
:amount (:amount i)}) :amount (:amount i)})
(:invoice_payments args)) (:invoice_payments args))
(:client_id args) (:client_id args)
(:bank_account_id args) (:bank_account_id args)
@@ -1145,9 +1150,9 @@
'[?account :account/name ?account-name] '[?account :account/name ?account-name]
'[?expense-account :invoice-expense-account/amount ?amount]]}}) '[?expense-account :invoice-expense-account/amount ?amount]]}})
true (d/query ))] true (d/query))]
(for [[account-id account-name total] result] (for [[account-id account-name total] result]
{:account {:id account-id :name account-name} :total total }))) {:account {:id account-id :name account-name} :total total})))
(defn categorize [x] (defn categorize [x]
(cond (<= x 0) :due (cond (<= x 0) :due
@@ -1172,10 +1177,10 @@
'[(.between java.time.temporal.ChronoUnit/DAYS (java.time.Instant/now) ?d2 ) ?d3] '[(.between java.time.temporal.ChronoUnit/DAYS (java.time.Instant/now) ?d2 ) ?d3]
'[(auto-ap.graphql/categorize ?d3) ?name]]}}) '[(auto-ap.graphql/categorize ?d3) ?name]]}})
true (d/query )) true (d/query))
result (group-by first result)] result (group-by first result)]
(for [[id name] [[:due "Due"] [:due-30 "0-30 days"] [:due-60 "31-60 days"] [:due-later ">60 days"] ] (for [[id name] [[:due "Due"] [:due-30 "0-30 days"] [:due-60 "31-60 days"] [:due-later ">60 days"]]
:let [[[_ outstanding-balance total] ] (id result nil) :let [[[_ outstanding-balance total] ] (id result nil)
outstanding-balance (or outstanding-balance 0) outstanding-balance (or outstanding-balance 0)
total (or total 0)]] total (or total 0)]]
@@ -1199,7 +1204,7 @@
(defn get-cash-flow [context {:keys [client_id]} value] (defn get-cash-flow [context {:keys [client_id]} value]
(when client_id (when client_id
(let [{:client/keys [week-a-credits week-a-debits week-b-credits week-b-debits forecasted-transactions ]} (d/pull (d/db (d/connect uri)) '[*] client_id ) (let [{:client/keys [week-a-credits week-a-debits week-b-credits week-b-debits forecasted-transactions ]} (d/pull (d/db (d/connect uri)) '[*] client_id)
total-cash (reduce total-cash (reduce
(fn [total [credit debit]] (fn [total [credit debit]]
(- (+ total credit) (- (+ total credit)
@@ -1249,7 +1254,7 @@
:let [next (t/plus (t/local-date (t/year (time/local-now)) :let [next (t/plus (t/local-date (t/year (time/local-now))
(t/month (time/local-now)) (t/month (time/local-now))
(Math/min (Math/max day-of-month 1) (Math/min (Math/max day-of-month 1)
30) ) 30))
(t/months month))] (t/months month))]
:when (not (has-fulfilled? id next recent-fulfillments))] :when (not (has-fulfilled? id next recent-fulfillments))]
{:identifier identifier {:identifier identifier
@@ -1281,8 +1286,8 @@
(or week-b-debits 0))) (or week-b-debits 0)))
:date (coerce/to-date-time date)}) :date (coerce/to-date-time date)})
(take (* 7 4) (time/day-of-week-seq 1))) (take (* 7 4) (time/day-of-week-seq 1)))
(filter #(< (:amount %) 0) forecasted-transactions)) (filter #(< (:amount %) 0) forecasted-transactions))})))
})))
(def schema (def schema
(-> integreat-schema (-> integreat-schema
@@ -1368,7 +1373,7 @@
(defn query (defn query
([id q] ([id q]
(query id q nil )) (query id q nil))
([id q v] ([id q v]
(lc/with-context {:query q} (lc/with-context {:query q}
(log/info "Executing query" q) (log/info "Executing query" q)
@@ -1383,8 +1388,8 @@
(catch Exception e (catch Exception e
(if-let [v (or (:validation-error (ex-data e)) (if-let [v (or (:validation-error (ex-data e))
(:validation-error (ex-data (.getCause e))) (:validation-error (ex-data (.getCause e))))]
)]
(do (do
(warn-event "validation error" {:validation-error v (warn-event "validation error" {:validation-error v
:data (ex-data e)}) :data (ex-data e)})

View File

@@ -4,5 +4,7 @@
(defn get-sales-orders-page [context args value] (defn get-sales-orders-page [context args value]
(let [args (assoc args :id (:id context)) (let [args (assoc args :id (:id context))
[sales-orders sales-orders-count] (d-sales-orders2/get-graphql (<-graphql args))] [sales-orders sales-orders-count {:keys [total tax]}] (d-sales-orders2/get-graphql (<-graphql args))]
(result->page sales-orders sales-orders-count :sales_orders args ))) (assoc (result->page sales-orders sales-orders-count :sales_orders args)
:sales_order_total total
:sales_order_tax tax)))

View File

@@ -25,6 +25,7 @@
:total-gte (:amount-gte (:total-range params)) :total-gte (:amount-gte (:total-range params))
:total-lte (:amount-lte (:total-range params)) :total-lte (:amount-lte (:total-range params))
:date-range (:date-range params) :date-range (:date-range params)
:processor (some-> (:processor params) keyword)
:client-id (:id @(re-frame/subscribe [::subs/client]))} :client-id (:id @(re-frame/subscribe [::subs/client]))}
[[:sales-orders [:id :total :tax :tip :discount :service-charge :returns :date [[:sales-orders [:id :total :tax :tip :discount :service-charge :returns :date
[:charges [:type-name :total :processor :id]] [:charges [:type-name :total :processor :id]]
@@ -32,7 +33,9 @@
[:client [:name :id]]]] [:client [:name :id]]]]
:total :total
:start :start
:end]]]} :end
:sales_order_total
:sales_order_tax]]]}
:on-success (fn [result] :on-success (fn [result]
(let [result (set/rename-keys (:sales-order-page result) (let [result (set/rename-keys (:sales-order-page result)
{:sales-orders :data})] {:sales-orders :data})]
@@ -67,7 +70,6 @@
:reagent-render :reagent-render
(fn [] (fn []
(let [{form-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])] (let [{form-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])]
(println form-active?)
[side-bar-layout {:side-bar [side-bar/side-bar {:data-page ::page}] [side-bar-layout {:side-bar [side-bar/side-bar {:data-page ::page}]
:main [content] :main [content]
:right-side-bar [appearing-side-bar {:visible? form-active?} :right-side-bar [appearing-side-bar {:visible? form-active?}

View File

@@ -1,17 +1,15 @@
(ns auto-ap.views.pages.pos.side-bar (ns auto-ap.views.pages.pos.side-bar
(:require [auto-ap.routes :as routes] (:require [auto-ap.routes :as routes]
[auto-ap.subs :as subs] [auto-ap.subs :as subs]
[auto-ap.views.utils :refer [active-when dispatch-value-change]] [auto-ap.views.utils :refer [active-when dispatch-event]]
[auto-ap.views.components.date-range-filter :refer [date-range-filter]] [auto-ap.views.components.date-range-filter :refer [date-range-filter]]
[auto-ap.views.components.number-filter :refer [number-filter]] [auto-ap.views.components.number-filter :refer [number-filter]]
[auto-ap.views.components.bank-account-filter :refer [bank-account-filter]]
[bidi.bidi :as bidi] [bidi.bidi :as bidi]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[auto-ap.views.pages.data-page :as data-page])) [auto-ap.views.pages.data-page :as data-page]))
(defn side-bar [{:keys [data-page]}] (defn side-bar [{:keys [data-page]}]
(let [ap @(re-frame/subscribe [::subs/active-page]) (let [ap @(re-frame/subscribe [::subs/active-page])]
user @(re-frame/subscribe [::subs/user])]
[:div [:div
[:div [:p.menu-label "Type"] [:div [:p.menu-label "Type"]
[:ul.menu-list [:ul.menu-list
@@ -37,4 +35,21 @@
[:div [:div
[number-filter [number-filter
{:on-change-event [::data-page/filter-changed data-page :total-range] {:on-change-event [::data-page/filter-changed data-page :total-range]
:value @(re-frame/subscribe [::data-page/filter data-page :total-range])}]]]])) :value @(re-frame/subscribe [::data-page/filter data-page :total-range])}]]
(when (= :sales-orders ap)
[:<>
[:p.menu-label "Processor"]
[:div
[:nav.panel
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "doordash"])}
[:span.panel-icon [:img.level-item {:src "/img/doordash.png"}]]
"Doordash"]
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "uber-eats"])}
[:span.panel-icon [:img.level-item {:src "/img/ubereats.png" }]]
"Uber Eats"]
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "grubhub"])}
[:span.panel-icon [:img.level-item {:src "/img/grubhub.png"}]]
"Grubhub"]]]])]]))

View File

@@ -13,10 +13,10 @@
[grid/row {:class (:class sales-order) :id id} [grid/row {:class (:class sales-order) :id id}
(when-not selected-client (when-not selected-client
[grid/cell {} (:name client)]) [grid/cell {} (:name client)])
[grid/cell {} (date->str date) ] [grid/cell {} (date->str date)]
[grid/cell {:class "has-text-right"} (nf total )] [grid/cell {:class "has-text-right"} (nf total)]
[grid/cell {:class "has-text-right"} (nf tax )] [grid/cell {:class "has-text-right"} (nf tax)]
[grid/cell {:class "has-text-right"} (nf tip )] [grid/cell {:class "has-text-right"} (nf tip)]
[grid/cell {} [grid/cell {}
[:div.level [:div.level
[:div.level-left [:div.level-left
@@ -43,22 +43,27 @@
"SQUARE_GIFT_CARD" "SQUARE_GIFT_CARD"
[:span.icon.level-item {:style {:font-size "24px"}} [:span {:class "icon-gift-box" :style {:font-weight "400"}}]] [:span.icon.level-item {:style {:font-size "24px"}} [:span {:class "icon-gift-box" :style {:font-weight "400"}}]]
[:span.level-item "Other (" (:type-name charge) ")"] [:span.level-item "Other (" (:type-name charge) ")"]))
))
{:key (:id charge)}))]] {:key (:id charge)}))]]]
]
[grid/cell {} (str/join ", " (map :item-name line-items))] [grid/cell {} (str/join ", " (map :item-name line-items))]
[grid/button-cell {} [grid/button-cell {}
[:div.buttons [:div.buttons
[buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]]]])) [buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]]]]))
(defn table [{:keys [data-page]}] (defn table [{:keys [data-page]}]
(let [selected-client @(re-frame/subscribe [::subs/client]) (let [selected-client @(re-frame/subscribe [::subs/client])
{:keys [data status]} @(re-frame/subscribe [::data-page/page data-page])] {:keys [data status]} @(re-frame/subscribe [::data-page/page data-page])]
[grid/grid {:data-page data-page [grid/grid {:data-page data-page
:column-count (if selected-client 7 8)} :column-count (if selected-client 7 8)}
[grid/controls data] [grid/controls data
[:div.level-item
[:div.tag "Total: " (nf (:sales-order-total data))]
]
[:div.level-item
[:div.tag " Tax: " (nf (:sales-order-tax data))]]]
[grid/table {:fullwidth true} [grid/table {:fullwidth true}
[grid/header {} [grid/header {}
[grid/row {} [grid/row {}