Improves IOL. Adds saved queries. Adds expected deposits in app.

This commit is contained in:
2021-06-04 10:50:27 -07:00
parent 311b07543c
commit 922c449bb0
15 changed files with 256 additions and 82 deletions

View File

@@ -0,0 +1,48 @@
(ns auto-ap.views.pages.pos.table
(:require [auto-ap.subs :as subs]
[auto-ap.views.components.buttons :as buttons] [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]]
[clojure.string :as str]
[re-frame.core :as re-frame]))
(defn row [{sales-order :sales-order
selected-client :selected-client}]
(let [{:keys [client date total tax tip charges line-items id]} sales-order]
[grid/row {:class (:class sales-order) :id id}
(when-not selected-client
[grid/cell {} (:name client)])
[grid/cell {} (date->str date) ]
[grid/cell {:class "has-text-right"} (nf total )]
[grid/cell {:class "has-text-right"} (nf tax )]
[grid/cell {:class "has-text-right"} (nf tip )]
[grid/cell {} (str/join ", " (map :type-name charges))]
[grid/cell {} (str/join ", " (map :item-name line-items))]
[grid/button-cell {}
[:div.buttons
[buttons/fa-icon {:event [::form/editing sales-order] :icon "fa-pencil"}]]]]))
(defn table [{:keys [data-page]}]
(let [selected-client @(re-frame/subscribe [::subs/client])
{:keys [data status]} @(re-frame/subscribe [::data-page/page data-page])]
[grid/grid {:data-page data-page
:column-count (if selected-client 7 8)}
[grid/controls data]
[grid/table {:fullwidth true}
[grid/header {}
[grid/row {}
(when-not selected-client
[grid/sortable-header-cell {:sort-key "client" :sort-name "Client"} "Client"])
[grid/sortable-header-cell {:sort-key "date" :sort-name "Date" :style {:width "8em"}} "Date"]
[grid/sortable-header-cell {:sort-key "total" :sort-name "Total" :class "has-text-right" :style {:width "8em"}} "Total"]
[grid/sortable-header-cell {:sort-key "tax" :sort-name "Tax" :class "has-text-right" :style {:width "7em"}} "Tax"]
[grid/sortable-header-cell {:sort-key "tip" :sort-name "Tip" :class "has-text-right" :style {:width "7em"}} "Tip"]
[grid/header-cell {} "Payment Methods"]
[grid/header-cell {} "Line Items"]
[grid/header-cell {:style {:width "4em"}}]]]
[grid/body
(for [sales-order (:data data)]
^{:key (:id sales-order)}
[row {:sales-order sales-order
:selected-client selected-client}])]]]))