Merge branch 'master' of bitbucket.org:brycecovertoperations/integreat

This commit is contained in:
Bryce Covert
2018-08-02 07:32:48 -07:00
8 changed files with 40 additions and 17 deletions

View File

@@ -5,6 +5,8 @@ services:
ports:
- "80:80"
- "443:443"
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /opt/integreat/prod/certs/:/etc/nginx/certs:ro

View File

@@ -55,31 +55,35 @@
@keyframes flashWarning {
from {
background-color: #00d1b2;
}
to {
background-color: inherit;
background-color: #00d1b2;
}
}
@keyframes flashPrimary {
from {
transform: translateY(100%);
opacity: 0;
background-color: #00d1b2;
}
to {
background-color: #00d1b2;
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;
}
.left-nav {
width: 300px;

View File

@@ -16,9 +16,11 @@
(when (seq (invoices/find-conflicting {:invoice-number invoice_number
:vendor-id vendor_id
:company-id company_id}))
(throw (ex-info "that invoice already exists" {:invoice-number invoice_number})))
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
(let [vendor (-create-or-get-vendor vendor_id vendor_name)
_ (assert-can-see-company (:id context) company_id)
_ (when-not (:default-expense-account vendor)
(throw (ex-info (str "Vendor '" (:name vendor) "' does not have a default expense acount.") {:vendor-id vendor_id} )))
company (companies/get-by-id company_id)
[invoice] (invoices/insert-multi! [{:invoice-number invoice_number
@@ -44,7 +46,7 @@
:invoice-number invoice_number
:vendor-id (:vendor-id invoice)
:company-id (:company-id invoice)}))
(throw (ex-info "that invoice already exists" {:invoice-number invoice_number})))
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
paid-amount (- (:total invoice) (:outstanding-balance invoice))
_ (assert-can-see-company (:id context) (:company-id invoice))
updated-invoice (invoices/update (-> in

View File

@@ -16,9 +16,14 @@
(when (= "none" (:role (:identity r)))
(throw-unauthorized))
(let [variables (some-> (query-params "variables")
edn/read-string)]
{:status 200
:body (pr-str (ql/query (:identity r) (query-params "query") variables ))
:headers {"Content-Type" "application/edn"}})))
(try
(let [variables (some-> (query-params "variables")
edn/read-string)]
{:status 200
:body (pr-str (ql/query (:identity r) (query-params "query") variables ))
:headers {"Content-Type" "application/edn"}})
(catch Exception e
{:status 400
:body (pr-str {:data (merge {:message (.getMessage e)} (ex-data e))})
:headers {"Content-Type" "application/edn"}}))))
wrap-secure))

View File

@@ -34,7 +34,8 @@
nil))
(defn extract-check-number [{{description-original :original} :description}]
(if-let [[_ check-number] (re-find #"(?i)check[^0-9]+([0-9]*)" description-original)]
(if-let [[_ _ check-number] (re-find #"(?i)check(card|[^0-9]+([0-9]*))" description-original)]
(try
(Integer/parseInt check-number)
(catch NumberFormatException e
@@ -98,7 +99,7 @@
(mapcat (fn [transaction-group]
(map
(fn [index {:keys [date description-original high-level-category amount account-id] :as transaction}]
{:id (str date "-" description-original "-" amount "-" index)
{:id (str date "-" description-original "-" amount "-" index "-" company-id)
:bank-account-id account-id
:date (time/unparse date "YYYY-MM-dd")
:amount {:amount amount}

View File

@@ -29,7 +29,8 @@
(s/def ::code (s/nilable string?))
(s/def ::vendor (s/keys :req-un [::name]
(s/def ::vendor (s/keys :req-un [::name
::default-expense-account]
:opt-un [::code
::id
::print-as
@@ -41,7 +42,7 @@
::secondary-email
::secondary-phone
::address
::default-expense-account
]))

View File

@@ -169,7 +169,7 @@
:aria-haspopup true
:tab-index "0"
:on-blur (delayed-dispatch [::toggle-expense-accounts id])
#_#_:on-blur (delayed-dispatch [::toggle-expense-accounts id])
:on-focus (dispatch-event [::toggle-expense-accounts id])
} "Accounts"]]
[:div.dropdown-menu {:role "menu"}

View File

@@ -344,7 +344,7 @@
(re-frame/reg-event-fx
::invoice-create-failed
(fn [{:keys [db]} [_ data]]
{:dispatch [::events/modal-failed ::new-invoice "That invoice already exists."]}))
{:dispatch [::events/modal-failed ::new-invoice (:message data)]}))
(re-frame/reg-event-fx
::invoice-created
@@ -531,6 +531,14 @@
(when shown?
[modal {:title "Print Checks"
:foot [:button.button.is-primary {:on-click (dispatch-event [::advanced-print-checks-submitted])
:disabled (cond printing?
"disabled"
(seq (filter #(> (js/parseFloat (:amount %)) (js/parseFloat (:outstanding-balance %))) invoices))
"disabled"
:else
"")
:class (if printing? "is-loading" "")}
[:span "Print"]]
:hide-event [::cancel-advanced-print]}