This commit is contained in:
Bryce Covert
2020-08-22 17:14:21 -07:00
parent dc57fd7d0c
commit 25477d07f7
16 changed files with 9593 additions and 158 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,6 @@
form.dz .notification { border: 2px dashed lightgray;} form.dz .notification { border: 2px dashed lightgray;}
html,body { html,body {
font-family: 'Open Sans', serif;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
height: 100%; height: 100%;
@@ -43,38 +42,6 @@
translateY(-100%); } translateY(-100%); }
} }
@keyframes flashWarning {
from {
background-color: hsl(348, 100%, 61%);
}
to {
background-color: inherit;
}
}
@keyframes flashPrimary {
from {
background-color: #00d1b2;
}
to {
background-color: inherit;
}
}
tbody tr.live-removed {
animation: flashWarning 1.0s ease both;
animation-fill-mode: forwards;
}
tbody tr.live-added {
animation: flashPrimary 1.0s ease both;
animation-fill-mode: forwards;
}
.nav.is-dark { .nav.is-dark {
background-color: #232B2D; background-color: #232B2D;
color: #F6F7F7; color: #F6F7F7;
@@ -382,56 +349,6 @@ nav.navbar .navbar-item.is-active {
overflow: visible; overflow: visible;
} }
.typeahead-menu {
position:absolute;
display: inline-block;
width: 100%;
top: 100%;
left: 0;
z-index: 10000;
overflow: auto;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
font-size: 14px;
text-align: left;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
/* background-clip: padding-box; */
}
.modal-card {
overflow: auto;
}
.typeahead-suggestion {
display: block;
overflow: visible;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333333;
white-space: nowrap;
}
.typeahead-suggestion:hover,
.typeahead-suggestion:focus,
.typeahead-menu:not(:hover) .typeahead-highlighted
{
color: #ffffff;
text-decoration: none;
outline: 0;
background-color: #00d1b2;
cursor: pointer;
}
.buttons .dropdown:not(:last-child):not(.is-fullwidth) .button { .buttons .dropdown:not(:last-child):not(.is-fullwidth) .button {
margin-right: 0.5em; margin-right: 0.5em;
@@ -486,22 +403,6 @@ table.balance-sheet th.total {
} }
.loader.big {
height: 150px !important;
width: 150px !important;
border: 4px solid #00d1b2;
border-right-color: transparent;
border-top-color: transparent;
}
.loader.is-table-loader {
height: 30px !important;
width: 30px !important;
border: 2px solid #00d1b2;
border-right-color: transparent;
border-top-color: transparent;
}
.ph-item { .ph-item {
border: 0px !important; border: 0px !important;

View File

@@ -421,7 +421,9 @@
(POST "/batch-upload" (POST "/batch-upload"
{{:keys [data]} :edn-params user :identity} {{:keys [data]} :edn-params user :identity}
(assert-admin user) (assert-admin user)
(try (try
#_(throw (Exception. "Unexpected error"))
(let [columns [:status :raw-date :description-original :high-level-category nil nil :amount nil nil nil nil nil :bank-account-code :client-code] (let [columns [:status :raw-date :description-original :high-level-category nil nil :amount nil nil nil nil nil :bank-account-code :client-code]
all-clients (d-clients/get-all) all-clients (d-clients/get-all)
all-bank-accounts (mapcat :client/bank-accounts all-clients) all-bank-accounts (mapcat :client/bank-accounts all-clients)

View File

@@ -197,7 +197,7 @@
(fn [] (fn []
(when-let [error (:error @(re-frame/subscribe [::form id]))] (when-let [error (:error @(re-frame/subscribe [::form id]))]
^{:key error} ^{:key error}
[:div.notification.is-warning.animated.fadeInUp {} error])) [:div.has-text-danger.animated.fadeInUp {} error]))
:submit-button (fn [child] :submit-button (fn [child]
(let [error (:error @(re-frame/subscribe [::form id])) (let [error (:error @(re-frame/subscribe [::form id]))
status @(re-frame/subscribe [::status/single id]) status @(re-frame/subscribe [::status/single id])

View File

@@ -125,7 +125,7 @@
(->> states (filter #(:info %)))] (->> states (filter #(:info %)))]
[:<> [:<>
(if (seq error-states) (if (seq error-states)
[:div.notification.is-warning [:div.notification.is-danger.is-light
(for [state states (for [state states
state (:error state)] state (:error state)]
(do (do

View File

@@ -107,7 +107,7 @@
(reduce + 0))] (reduce + 0))]
[:div [:div
[:div [:div
[:a.button.is-primary {:on-click (dispatch-event [::add-split])} "Add split"]] [:a.button.is-outlined {:on-click (dispatch-event [::add-split])} "Add split"]]
(form-inline {} (form-inline {}
[:table.table [:table.table
[:thead [:thead

View File

@@ -57,7 +57,7 @@
(let [per-page 100 (let [per-page 100
max-buttons 5 max-buttons 5
buttons-before (Math/floor (/ max-buttons 2)) buttons-before (Math/floor (/ max-buttons 2))
total-pages (Math/ceil (/ total per-page)) total-pages (Math/max 1 (Math/ceil (/ total per-page)))
current-page (Math/floor (/ start per-page)) current-page (Math/floor (/ start per-page))
first-page-button (bound 0 (- current-page buttons-before) (- total-pages max-buttons)) first-page-button (bound 0 (- current-page buttons-before) (- total-pages max-buttons))
all-buttons (into [] (for [x (range total-pages)] all-buttons (into [] (for [x (range total-pages)]

View File

@@ -91,7 +91,8 @@
menu (re-frame/subscribe [::subs/menu]) menu (re-frame/subscribe [::subs/menu])
client-search @(re-frame/subscribe [::client-search]) client-search @(re-frame/subscribe [::client-search])
is-initial-loading @(re-frame/subscribe [::subs/is-initial-loading?])] is-initial-loading @(re-frame/subscribe [::subs/is-initial-loading?])]
[:nav {:class "navbar has-shadow is-fixed-top"} [:nav {:class "navbar has-shadow is-fixed-top is-grey"}
[:div {:class "container"} [:div {:class "container"}
[:div {:class "navbar-brand"} [:div {:class "navbar-brand"}
[:a {:class "navbar-item", :href "../"} [:a {:class "navbar-item", :href "../"}
@@ -161,7 +162,10 @@
(re-frame/dispatch [::events/swap-client client])) (re-frame/dispatch [::events/swap-client client]))
} name])]])])] } name])]])])]
(when-not is-initial-loading (when-not is-initial-loading
[login-dropdown])]])) [login-dropdown])]
]))
(defn footer [] (defn footer []

View File

@@ -87,7 +87,7 @@
:timeout 200 :timeout 200
:enter-class "appear" :enter-class "appear"
:exit-class "disappear"} :exit-class "disappear"}
[:div.notification.is-warning (:message (first (:error status)))]] [:div.has-text-danger (:message (first (:error status)))]]
[:div.buttons [:div.buttons
(when confirm (when confirm

View File

@@ -179,26 +179,29 @@
(let [{:keys [form field raw-field error-notification submit-button ]} client-form] (let [{:keys [form field raw-field error-notification submit-button ]} client-form]
[:div.card {:style {:margin-bottom "1em"}} [:div.card {:style {:margin-bottom "1em"}}
[:header.card-header [:header.card-header
[:p.card-header-title {:style {:text-overflow "ellipsis"}} [:div.card-header-title {:style {:text-overflow "ellipsis"}}
[:div.level {:style {:width "100%"}}
[:div.level-left
[:div.level-item
[:span.icon.inline [:span.icon.inline
(cond (cond
(#{:check ":check"} type) [:span.icon-check-payment-sign] (#{:check ":check"} type) [:span.icon-check-payment-sign]
(#{:credit ":credit"} type) [:span.icon-credit-card-1] (#{:credit ":credit"} type) [:span.icon-credit-card-1]
:else [:span.icon-accounting-bill])] :else [:span.icon-accounting-bill])]]
code ": " name] [:div.level-item code ": " name]]
[:p {:style {:padding "0.75em 0.25em"}} [:div.level-right
[:a.button.is-outlined {:on-click (dispatch-event [::toggle-visible sort-order])} [:span.icon (if visible [:div.level-item
[:div.buttons
[:a.button {:on-click (dispatch-event [::toggle-visible sort-order])} [:span.icon (if visible
[:span.fa.fa-eye] [:span.fa.fa-eye]
[:span.fa.fa-eye-slash] [:span.fa.fa-eye-slash]
)]]] )]]
(when-not last? (when-not last?
[:p {:style {:padding "0.75em 0.25em"}} [:a.button {:on-click (dispatch-event [::sort-swapped sort-order (inc sort-order)])} [:span.icon [:span.fa.fa-sort-down]]])
[:a.button.is-primary.is-outlined {:on-click (dispatch-event [::sort-swapped sort-order (inc sort-order)])} [:span.icon [:span.fa.fa-sort-down]]]])
(when-not first? (when-not first?
[:p {:style {:padding "0.75em 0.25em"}} [:a.button {:on-click (dispatch-event [::sort-swapped sort-order (dec sort-order)])} [:span.icon [:span.fa.fa-sort-up]]])]]]]]
[:a.button.is-primary.is-outlined {:on-click (dispatch-event [::sort-swapped sort-order (dec sort-order)])} [:span.icon [:span.fa.fa-sort-up]]]])
(if active? (if active?
[:a.card-header-icon [:a.card-header-icon
{:on-click (dispatch-event [::bank-account-deactivated sort-order])} {:on-click (dispatch-event [::bank-account-deactivated sort-order])}
@@ -443,13 +446,17 @@
:field :forecasted-transactions :field :forecasted-transactions
:template [[:input.input {:type "text" :template [[:input.input {:type "text"
:placeholder "Identifier" :placeholder "Identifier"
:style {:width "10em"}
:field [ :identifier]}] :field [ :identifier]}]
[:input.input {:type "number" [:input.input {:type "number"
:style {:width "4em"}
:placeholder "Day of month" :placeholder "Day of month"
:step "1" :step "1"
:field [:day-of-month]}] :field [:day-of-month]}]
[:input.input {:type "number" [:input.input {:type "number"
:placeholder "250.00" :placeholder "250.00"
:class "has-text-right"
:style {:width "7em"}
:field [:amount] :field [:amount]
:step "0.01"}]]}])]] :step "0.01"}]]}])]]
(error-notification) (error-notification)

View File

@@ -31,7 +31,11 @@
:component-did-mount (fn [this] :component-did-mount (fn [this]
(js/Dropzone. (rdom/dom-node this) (js/Dropzone. (rdom/dom-node this)
(clj->js {:init (fn [] (clj->js {:init (fn []
(.on (js-this) "addedfiles"
(fn []
(re-frame/dispatch [::status/completed ::import])))
(.on (js-this) "success" (fn [_ files] (.on (js-this) "success" (fn [_ files]
(re-frame/dispatch [::invalidated]))) (re-frame/dispatch [::invalidated])))
(.on (js-this) "error" (fn [_ error] (.on (js-this) "error" (fn [_ error]
(re-frame/dispatch [::status/error ::import [(edn/read-string error)]])))) (re-frame/dispatch [::status/error ::import [(edn/read-string error)]]))))
@@ -83,8 +87,7 @@
(fn [{:keys [db]} [_ params]] (fn [{:keys [db]} [_ params]]
{:dispatch-n [[::params-change @(re-frame/subscribe [::data-page/params :import-invoices])] {:dispatch-n [[::params-change @(re-frame/subscribe [::data-page/params :import-invoices])]
[::data-page/reset-checked :import-invoices]] [::data-page/reset-checked :import-invoices]]
:db (update db ::batch inc)} :db (update db ::batch inc)}))
))
(re-frame/reg-event-fx (re-frame/reg-event-fx
::mounted ::mounted
@@ -161,23 +164,21 @@
:on-success on-success}})) :on-success on-success}}))
(defn approve-reject-button [checked] (defn approve-reject-button [checked]
[:div.is-pulled-right [:div.buttons
[:button.button.is-success {:on-click (dispatch-event [::approve-invoices-clicked checked]) [:button.button.is-primary {:on-click (dispatch-event [::approve-invoices-clicked checked])
:class (status/class-for @(re-frame/subscribe [::status/single ::approve])) :class (status/class-for @(re-frame/subscribe [::status/single ::approve]))
:disabled (if (seq checked) :disabled (or (not (boolean (seq checked)))
"" (status/disabled-for @(re-frame/subscribe [::status/single ::approve])))}
"disabled")}
"Approve " "Approve "
(when (> (count checked )) (when (> (count checked ))
(str (str
(count checked) (count checked)
" invoices")) " invoices"))
[:span " "]] [:span " "]]
[:button.button.is-danger {:on-click (dispatch-event [::reject-invoices-clicked checked]) [:button.button.is-warning {:on-click (dispatch-event [::reject-invoices-clicked checked])
:class (status/class-for @(re-frame/subscribe [::status/single ::reject])) :class (status/class-for @(re-frame/subscribe [::status/single ::reject]))
:disabled (if (seq checked) :disabled (or (not (boolean (seq checked)))
"" (status/disabled-for @(re-frame/subscribe [::status/single ::reject])))}
"disabled")}
"Reject " "Reject "
(when (> (count checked )) (when (> (count checked ))
(str (str
@@ -199,6 +200,7 @@
[::status/single ::import]]}] [::status/single ::import]]}]
^{:key (str batch)} ^{:key (str batch)}
[dropzone] [dropzone]
[:div.mb-4]
[:div {:class "card found-invoices",} [:div {:class "card found-invoices",}
[:div {:class "card-header"} [:div {:class "card-header"}
[:span {:class "card-header-title"} "Found Invoices"]] [:span {:class "card-header-title"} "Found Invoices"]]

View File

@@ -232,6 +232,7 @@
[layouts/side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])} [layouts/side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])}
(let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::form]) (let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::form])
{:keys [form-inline field raw-field error-notification submit-button ]} invoice-form {:keys [form-inline field raw-field error-notification submit-button ]} invoice-form
can-submit? (boolean @(re-frame/subscribe [::can-submit]))
status @(re-frame/subscribe [::status/single ::form]) status @(re-frame/subscribe [::status/single ::form])
exists? (:id data) exists? (:id data)
can-change-amount? (#{:unpaid ":unpaid"} (:status data)) can-change-amount? (#{:unpaid ":unpaid"} (:status data))
@@ -325,14 +326,15 @@
[:div.columns [:div.columns
(when-not exists? (when-not exists?
[:div.column [:div.column
[drop-down {:header [:button.button.is-info.is-outlined.is-medium.is-fullwidth {:aria-haspopup true [drop-down {:header [:button.button.is-primary-two.is-medium.is-fullwidth {:aria-haspopup true
:type "button" :type "button"
:on-click (dispatch-event [::events/toggle-menu ::add-and-print-invoice ]) :on-click (dispatch-event [::events/toggle-menu ::add-and-print-invoice ])
:disabled (status/disabled-for status) :disabled (or (status/disabled-for status)
(not can-submit?))
:class (status/class-for status)} :class (status/class-for status)}
"Save & Pay " "Pay "
[:span " "] [:span " "]
[:span.icon.is-small [:i.fa.fa-angle-down {:aria-hidden "true"}]]] [:span.icon [:i.fa.fa-angle-down {:aria-hidden "true"}]]]
:class "is-fullwidth" :class "is-fullwidth"
:id ::add-and-print-invoice} :id ::add-and-print-invoice}
[:div [:div

View File

@@ -114,7 +114,7 @@
[:div.buttons [:div.buttons
[:button.button.is-outlined.is-primary {:on-click (dispatch-event [::manual/opening])} [:button.button.is-outlined.is-primary {:on-click (dispatch-event [::manual/opening])}
"Manual Yodlee Import"] "Manual Yodlee Import"]
[:button.button.is-outlined.is-danger {:on-click (dispatch-event [::unapprove-all params]) [:button.button.is-warning {:on-click (dispatch-event [::unapprove-all params])
:class (status/class-for @(re-frame/subscribe [::status/single ::unapprove-all])) :class (status/class-for @(re-frame/subscribe [::status/single ::unapprove-all]))
:disabled (status/disabled-for @(re-frame/subscribe [::status/single ::unapprove-all]))} :disabled (status/disabled-for @(re-frame/subscribe [::status/single ::unapprove-all]))}
"Unapprove all"]]]) "Unapprove all"]]])

View File

@@ -273,7 +273,6 @@
:type "typeahead-entity" :type "typeahead-entity"
:field [:forecast-match]}]] :field [:forecast-match]}]]
[:hr]
[error-notification] [error-notification]
(when-not should-disable-for-client? (when-not should-disable-for-client?
@@ -298,9 +297,6 @@
:type "typeahead-entity" :type "typeahead-entity"
:field [:forecast-match]}]] :field [:forecast-match]}]]
[:hr]
[error-notification] [error-notification]
(when-not should-disable-for-client? (when-not should-disable-for-client?
[submit-button "Save"])] [submit-button "Save"])])])])
)])])

View File

@@ -89,10 +89,13 @@
{:token (-> db :user) {:token (-> db :user)
:owns-state {:single ::print-checks} :owns-state {:single ::print-checks}
:query-obj (print-checks-query (map (fn [{:keys [id outstanding-balance] }] :query-obj (print-checks-query (->> @(re-frame/subscribe [::data-page/checked :invoices])
(vals )
(filter (fn [{:keys [id outstanding-balance] }]
(and id outstanding-balance)))
(map (fn [{:keys [id outstanding-balance] }]
{:invoice-id id {:invoice-id id
:amount outstanding-balance}) :amount outstanding-balance})))
(vals @(re-frame/subscribe [::data-page/checked :invoices])))
bank-account-id bank-account-id
type type
(:client db)) (:client db))
@@ -132,9 +135,9 @@
[:div [:div
[:div.is-pulled-right [:div.is-pulled-right
[:div.buttons [:div.buttons
[:button.button.is-success {:on-click (dispatch-event [::new-invoice-clicked])} "New Invoice"] [:button.button.is-outlined.is-primary {:on-click (dispatch-event [::new-invoice-clicked])} "New Invoice"]
(when current-client (when current-client
[drop-down {:header [:button.button.is-success {:aria-haspopup true [drop-down {:header [:button.button.is-primary {:aria-haspopup true
:on-click (dispatch-event [::events/toggle-menu ::print-checks ]) :on-click (dispatch-event [::events/toggle-menu ::print-checks ])
:disabled (if (and (seq checked-invoices)) :disabled (if (and (seq checked-invoices))
"" ""

View File

@@ -163,7 +163,7 @@
@value-repr)))]]) @value-repr)))]])
] ]
[:div.level-item [:div.level-item
[:a.button [:a.button.level-item
{:disabled is-disabled? {:disabled is-disabled?
:on-click (fn [] :on-click (fn []