it's now possible to link across each entity type
This commit is contained in:
@@ -1,22 +1,21 @@
|
||||
(ns auto-ap.views.pages.payments.table
|
||||
(:require [auto-ap.subs :as subs]
|
||||
(:require [auto-ap.events :as events]
|
||||
[auto-ap.routes :as routes]
|
||||
[cemerick.url :as url]
|
||||
[bidi.bidi :as bidi]
|
||||
[auto-ap.views.components.paginator :refer [paginator]]
|
||||
[auto-ap.views.components.sorter :refer [sorted-column]]
|
||||
[auto-ap.views.components.sort-by-list :refer [sort-by-list]]
|
||||
[auto-ap.views.utils :refer [date->str dispatch-event nf]]
|
||||
|
||||
[auto-ap.views.components.dropdown :refer [drop-down drop-down-contents]]
|
||||
[auto-ap.events :as events]
|
||||
[goog.string :as gstring]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.views.components.grid :as grid]
|
||||
[auto-ap.views.components.buttons :as buttons]
|
||||
[auto-ap.status :as status]
|
||||
[auto-ap.views.pages.data-page :as data-page]))
|
||||
|
||||
[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.utils
|
||||
:refer
|
||||
[date->str dispatch-event-with-propagation nf pretty]]
|
||||
[bidi.bidi :as bidi]
|
||||
[cemerick.url :as url]
|
||||
[goog.string :as gstring]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::void-check
|
||||
@@ -42,7 +41,7 @@
|
||||
selected-client :selected-client
|
||||
states :states
|
||||
}]
|
||||
(let [{:keys [client s3-url bank-account payments type check-number date amount id vendor status invoices] :as check} check]
|
||||
(let [{:keys [client s3-url bank-account payments type check-number date amount id vendor status invoices transaction] :as check} check]
|
||||
[grid/row {:class (:class check) :id id}
|
||||
(when-not selected-client
|
||||
[grid/cell {} (:name client)])
|
||||
@@ -61,24 +60,39 @@
|
||||
[grid/button-cell {}
|
||||
[:div.buttons
|
||||
(when (and (seq invoices) (not= :voided status))
|
||||
[drop-down {:id [::invoices id]
|
||||
:header [:button.button.badge {:data-badge (str (clojure.core/count invoices))
|
||||
:aria-haspopup true?
|
||||
:tab-index "0"
|
||||
:on-click (dispatch-event [::events/toggle-menu [::invoices id]])
|
||||
} "Invoices"]}
|
||||
[:div {:style {:max-width "250px"
|
||||
:text-overflow "ellipsis"
|
||||
:white-space "nowrap"
|
||||
|
||||
:overflow "hidden"}}
|
||||
(for [invoice invoices]
|
||||
^{:key (:invoice-number (:invoice invoice))}
|
||||
[:a.dropdown-item {:href (str (bidi/path-for routes/routes :invoices )
|
||||
"?"
|
||||
(url/map->query {:exact-match-id (:id (:invoice invoice))}))
|
||||
:target "_new"}
|
||||
(str " " (:invoice-number (:invoice invoice)))])]])
|
||||
[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 (cond-> (clojure.core/count invoices)
|
||||
transaction inc))
|
||||
:icon "fa-paperclip"}]}
|
||||
[drop-down-contents
|
||||
[:div.dropdown-item
|
||||
[:table.table.grid.compact
|
||||
[:tbody
|
||||
(for [invoice invoices]
|
||||
^{:key (:id invoice)}
|
||||
[:tr
|
||||
[:td
|
||||
"Invoice " (:invoice-number (:invoice invoice))
|
||||
]
|
||||
[:td (gstring/format "$%.2f" (:amount invoice) )]
|
||||
[:td
|
||||
[buttons/fa-icon {:icon "fa-external-link"
|
||||
:href (str (bidi/path-for routes/routes :invoices )
|
||||
"?"
|
||||
(url/map->query {:exact-match-id (:id (:invoice invoice))}))}]]])
|
||||
(when transaction
|
||||
[:tr
|
||||
[:td
|
||||
"Transaction"]
|
||||
[:td (date->str (:date transaction) 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)}))}]]])]]]]])
|
||||
[:span {:style {:margin-left "1em"}}]
|
||||
|
||||
(when (or (= :pending status)
|
||||
|
||||
Reference in New Issue
Block a user