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: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true
volumes: volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro - /var/run/docker.sock:/tmp/docker.sock:ro
- /opt/integreat/prod/certs/:/etc/nginx/certs:ro - /opt/integreat/prod/certs/:/etc/nginx/certs:ro

View File

@@ -55,31 +55,35 @@
@keyframes flashWarning { @keyframes flashWarning {
from { from {
background-color: #00d1b2;
} }
to { to {
background-color: inherit;
background-color: #00d1b2;
} }
} }
@keyframes flashPrimary { @keyframes flashPrimary {
from { from {
transform: translateY(100%); background-color: #00d1b2;
opacity: 0;
} }
to { to {
background-color: #00d1b2; background-color: inherit;
} }
} }
tbody tr.live-removed { tbody tr.live-removed {
animation: flashWarning 1.0s ease both; animation: flashWarning 1.0s ease both;
animation-fill-mode: forwards;
} }
tbody tr.live-added { tbody tr.live-added {
animation: flashPrimary 1.0s ease both; animation: flashPrimary 1.0s ease both;
animation-fill-mode: forwards;
} }
.left-nav { .left-nav {
width: 300px; width: 300px;

View File

@@ -16,9 +16,11 @@
(when (seq (invoices/find-conflicting {:invoice-number invoice_number (when (seq (invoices/find-conflicting {:invoice-number invoice_number
:vendor-id vendor_id :vendor-id vendor_id
:company-id company_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) (let [vendor (-create-or-get-vendor vendor_id vendor_name)
_ (assert-can-see-company (:id context) company_id) _ (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) company (companies/get-by-id company_id)
[invoice] (invoices/insert-multi! [{:invoice-number invoice_number [invoice] (invoices/insert-multi! [{:invoice-number invoice_number
@@ -44,7 +46,7 @@
:invoice-number invoice_number :invoice-number invoice_number
:vendor-id (:vendor-id invoice) :vendor-id (:vendor-id invoice)
:company-id (:company-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)) paid-amount (- (:total invoice) (:outstanding-balance invoice))
_ (assert-can-see-company (:id context) (:company-id invoice)) _ (assert-can-see-company (:id context) (:company-id invoice))
updated-invoice (invoices/update (-> in updated-invoice (invoices/update (-> in

View File

@@ -16,9 +16,14 @@
(when (= "none" (:role (:identity r))) (when (= "none" (:role (:identity r)))
(throw-unauthorized)) (throw-unauthorized))
(let [variables (some-> (query-params "variables") (try
edn/read-string)] (let [variables (some-> (query-params "variables")
{:status 200 edn/read-string)]
:body (pr-str (ql/query (:identity r) (query-params "query") variables )) {:status 200
:headers {"Content-Type" "application/edn"}}))) :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)) wrap-secure))

View File

@@ -34,7 +34,8 @@
nil)) nil))
(defn extract-check-number [{{description-original :original} :description}] (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 (try
(Integer/parseInt check-number) (Integer/parseInt check-number)
(catch NumberFormatException e (catch NumberFormatException e
@@ -98,7 +99,7 @@
(mapcat (fn [transaction-group] (mapcat (fn [transaction-group]
(map (map
(fn [index {:keys [date description-original high-level-category amount account-id] :as transaction}] (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 :bank-account-id account-id
:date (time/unparse date "YYYY-MM-dd") :date (time/unparse date "YYYY-MM-dd")
:amount {:amount amount} :amount {:amount amount}

View File

@@ -29,7 +29,8 @@
(s/def ::code (s/nilable string?)) (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 :opt-un [::code
::id ::id
::print-as ::print-as
@@ -41,7 +42,7 @@
::secondary-email ::secondary-email
::secondary-phone ::secondary-phone
::address ::address
::default-expense-account
])) ]))

View File

@@ -169,7 +169,7 @@
:aria-haspopup true :aria-haspopup true
:tab-index "0" :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]) :on-focus (dispatch-event [::toggle-expense-accounts id])
} "Accounts"]] } "Accounts"]]
[:div.dropdown-menu {:role "menu"} [:div.dropdown-menu {:role "menu"}

View File

@@ -344,7 +344,7 @@
(re-frame/reg-event-fx (re-frame/reg-event-fx
::invoice-create-failed ::invoice-create-failed
(fn [{:keys [db]} [_ data]] (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 (re-frame/reg-event-fx
::invoice-created ::invoice-created
@@ -531,6 +531,14 @@
(when shown? (when shown?
[modal {:title "Print Checks" [modal {:title "Print Checks"
:foot [:button.button.is-primary {:on-click (dispatch-event [::advanced-print-checks-submitted]) :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" "")} :class (if printing? "is-loading" "")}
[:span "Print"]] [:span "Print"]]
:hide-event [::cancel-advanced-print]} :hide-event [::cancel-advanced-print]}