shows expected deposit totals.

This commit is contained in:
2022-07-04 07:55:10 -07:00
parent 2d5b8eded4
commit be58bcd4a3
6 changed files with 353 additions and 42 deletions

View File

@@ -28,8 +28,9 @@
:date-range (:date-range params)
:client-id (:id @(re-frame/subscribe [::subs/client]))}
[[:expected-deposits [:id :total :fee :location :date :status
[:totals [:date :count :amount]]
[:transaction [:id :date]]
[:client [:name :id]]]]
[:client [:name :id]]]]
:total
:start
:end]]]}

View File

@@ -2,24 +2,23 @@
(ns auto-ap.views.pages.pos.expected-deposits.table
(:require
[auto-ap.events :as events]
[auto-ap.routes :as routes]
[auto-ap.subs :as subs]
[auto-ap.views.components.buttons :as buttons]
[auto-ap.views.components.dropdown
:refer [drop-down drop-down-contents]]
[auto-ap.views.components.grid :as grid]
[auto-ap.views.pages.data-page :as data-page]
[auto-ap.views.pages.pos.form :as form]
[auto-ap.views.utils :refer [date->str nf dispatch-event-with-propagation pretty str->date standard]]
[auto-ap.views.components.dropdown
:refer
[drop-down drop-down-contents]]
[auto-ap.views.utils
:refer [date->str dispatch-event-with-propagation nf pretty ->$]]
[bidi.bidi :as bidi]
[cemerick.url :as url]
[re-frame.core :as re-frame]
[auto-ap.routes :as routes]))
[re-frame.core :as re-frame]))
(defn row [{sales-order :sales-order
selected-client :selected-client}]
(let [{:keys [client transaction status location date total fee id]} sales-order]
(let [{:keys [client transaction status location date total fee id totals]} sales-order]
[grid/row {:class (:class sales-order) :id id}
(when-not selected-client
[grid/cell {} (:name client)])
@@ -30,28 +29,39 @@
[grid/cell {:class "has-text-right"} (nf fee )]
[grid/button-cell {}
[:div.buttons
[buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]]
(when transaction
[drop-down {:id [::links id]
:is-right? true
:header [buttons/fa-icon {:class "badge"
:on-click (dispatch-event-with-propagation [::events/toggle-menu [::links id]])
:data-badge (str 1)
:icon "fa-paperclip"}]}
[drop-down-contents
[:div.dropdown-item
[:table.table.grid.compact
[:tbody
(when transaction
[:tr
[:td
"Transaction"]
[:td (some-> transaction :date (date->str pretty))]
[:td
[buttons/fa-icon {:icon "fa-external-link"
:href (str (bidi/path-for routes/routes :transactions )
"?"
(url/map->query {:exact-match-id (:id transaction)}))}]]])]]]]])]]))
[buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]
(when (or transaction
(seq totals))
[drop-down {:id [::links id]
:is-right? true
:header [buttons/fa-icon {:class "badge"
:on-click (dispatch-event-with-propagation [::events/toggle-menu [::links id]])
:data-badge (str 1)
:icon "fa-paperclip"}]}
[drop-down-contents
[:div.dropdown-item
[:table.table.grid.compact
[:tbody
(when transaction
[:tr
[:td
"Transaction"]
[:td (some-> transaction :date (date->str pretty))]
[:td
[buttons/fa-icon {:icon "fa-external-link"
:href (str (bidi/path-for routes/routes :transactions )
"?"
(url/map->query {:exact-match-id (:id transaction)}))}]]])
(when (seq totals)
(into
[:<>]
(for [t totals]
[:tr
[:td
"Sales"]
[:td (some-> t :date (date->str pretty))]
[:td (str (some-> t :count ) " (" (some-> t :amount ->$) ")")
]])))]]]]])]]]))
(defn table [{:keys [data-page]}]
(let [selected-client @(re-frame/subscribe [::subs/client])