You can now see cash flow details

This commit is contained in:
Bryce Covert
2020-08-23 07:42:12 -07:00
parent 3a2351aa41
commit edbc9f85c4
9 changed files with 144 additions and 35 deletions

View File

@@ -1,12 +1,23 @@
(ns auto-ap.views.components.buttons
(:require [auto-ap.views.utils :refer [dispatch-event]]))
(:require [auto-ap.views.utils :refer [dispatch-event]]
[reagent.core :as r]))
(defn fa-icon [{:keys [event icon class]}]
[:a.button {:class class
:on-click (dispatch-event event)} [:span.icon [:i.fa {:class icon}]]])
:on-click (dispatch-event event)} (into
[:<>
[:span.icon [:i.fa {:class icon}]]
]
(r/children (r/current-component)))])
(defn sl-icon [{:keys [event icon class] :as params}]
[:a.button (-> params
(dissoc :event :icon)
(assoc :on-click (dispatch-event event)))
[:span.icon [:span {:class icon :style {:font-weight "400"}}]]])
(defn new-button [{:keys [event name class ]}]
[:a.button.is-outlined {:class class
:on-click (dispatch-event event)}
[:span.icon [:i.fa.fa-plus]]
[:span name]])

View File

@@ -121,12 +121,13 @@
(mapv (fn [c]
[:div.level-item c]) children))]]))))]))
(defn table [{:keys [fullwidth class]}]
(defn table [{:keys [fullwidth class style]}]
(into
[:table.table.compact.grid {:class (cond-> []
fullwidth (conj "is-fullwidth")
class (into class))}]
class (into class))
:style style}]
(r/children (r/current-component))))
(defn header []

View File

@@ -9,7 +9,7 @@
[auto-ap.views.components.grid :as grid]
[auto-ap.views.pages.invoices.form :as form]
[auto-ap.views.pages.invoices.common :refer [invoice-read]]
[auto-ap.views.utils :refer [date->str dispatch-event nf]]
[auto-ap.views.utils :refer [date->str dispatch-event nf days-until]]
[bidi.bidi :as bidi]
[cemerick.url :as url]
[cljs-time.core :as t]
@@ -106,11 +106,7 @@
[grid/cell {} (date->str date) ]
[grid/cell {}
(when due
(let [today (t/at-midnight (t/now))
due (t/at-midnight due)
due-in (if (t/after? today due)
(- (t/in-days (t/interval (t/minus due (t/days 1)) today)))
(t/in-days (t/interval today due )))]
(let [due-in (days-until due)]
(if (> due-in 0)
[:span.has-text-success due-in " days"]
[:span.has-text-danger due-in " days"])

View File

@@ -12,7 +12,8 @@
[auto-ap.entities.vendors :as vendor]
[clojure.string :as str]
[reagent.core :as r]
[auto-ap.views.components.vendor-dialog :as vendor-dialog]))
[auto-ap.views.components.vendor-dialog :as vendor-dialog]
[auto-ap.views.components.buttons :as buttons]))
(defn navbar-drop-down-contents [{:keys [id]} children ]
@@ -128,9 +129,9 @@
(when-not is-initial-loading
[:div.navbar-end
[:div.navbar-item
[:a.button.is-primary.is-outlined
{:on-click (dispatch-event [::vendor-dialog/started {}])}
[:span.icon [:i.fa.fa-plus] ] [:span "Vendor"]]]
[buttons/new-button {:event [::vendor-dialog/started {}]
:name "Vendor"
:class "is-primary"}]]
(when (> (count @clients) 1)