Minor fixes
This commit is contained in:
@@ -61,7 +61,8 @@
|
||||
[:vendor
|
||||
vendor-query]
|
||||
[:accounts [:numeric-code :location :name :type :account_set :applicability :id [:client-overrides [:name :id [:client [:name :id]]]]]]]}
|
||||
:on-success [::received-initial]}}))))
|
||||
:on-success [::received-initial]
|
||||
:on-error [::failed-initial]}}))))
|
||||
|
||||
|
||||
(re-frame/reg-event-db
|
||||
@@ -82,7 +83,8 @@
|
||||
vendor-query]
|
||||
[:accounts [:numeric-code :name :location :type :account_set :applicability :id [:client-overrides [:name [:client [:name :id]]]]]]]}
|
||||
|
||||
:on-success [::received-initial]}
|
||||
:on-success [::received-initial]
|
||||
:on-error [::failed-initial]}
|
||||
:db (assoc db
|
||||
:user (assoc user :token token)
|
||||
:is-initial-loading? true)}))
|
||||
@@ -102,6 +104,14 @@
|
||||
(filter #(= % (:last-client-id db)))
|
||||
first))))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::failed-initial
|
||||
(fn [db [_ e]]
|
||||
(assoc db :initial-error e
|
||||
|
||||
:is-initial-loading? false
|
||||
:active-page :initial-error)))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::swap-client
|
||||
(fn [db [_ client]]
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
[auto-ap.views.pages.needs-activation :refer [needs-activation-page]]
|
||||
[auto-ap.views.pages.transactions :refer [transactions-page]]
|
||||
[auto-ap.views.pages.ledger :refer [ledger-page]]
|
||||
[auto-ap.views.pages.error :refer [error-page]]
|
||||
[auto-ap.views.pages.ledger.balance-sheet :refer [balance-sheet-page]]
|
||||
[auto-ap.views.pages.ledger.external-import :refer [external-import-page]]
|
||||
[auto-ap.views.pages.ledger.profit-and-loss :refer [profit-and-loss-page]]
|
||||
@@ -120,6 +121,9 @@
|
||||
(defmethod page :admin-excel-import [_]
|
||||
[admin-excel-import-page])
|
||||
|
||||
(defmethod page :initial-error [_]
|
||||
[error-page])
|
||||
|
||||
(defn active-page []
|
||||
(let [ap (re-frame/subscribe [::subs/active-page])
|
||||
current-client @(re-frame/subscribe [::subs/client])
|
||||
|
||||
24
src/cljs/auto_ap/views/pages/error.cljs
Normal file
24
src/cljs/auto_ap/views/pages/error.cljs
Normal file
@@ -0,0 +1,24 @@
|
||||
(ns auto-ap.views.pages.error
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout]]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::error
|
||||
(fn [db]
|
||||
(:initial-error db)))
|
||||
|
||||
(defn error-page []
|
||||
[:div.container
|
||||
[:section.is-fullheight.hero
|
||||
[:div.hero-body
|
||||
[:div.container
|
||||
[:div.column.is-8.is-offset-2.has-text-centered
|
||||
|
||||
[:div.box.slideInFromBelow
|
||||
[:img {:src "http://www.integreatconsult.com/wp-content/uploads/2016/11/logo.png"}]
|
||||
[:div.notification.is-danger.is-light "An unexpected error has occured. "
|
||||
[:a {:on-click #(.reload (.-location js/document )) } "Click here"]
|
||||
" to try again."]]
|
||||
[:p.has-text-gray
|
||||
"Copyright Integreat 2020"]]]]]]
|
||||
)
|
||||
@@ -15,7 +15,9 @@
|
||||
[cljs-time.core :as c]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]
|
||||
[re-frame.core :as re-frame]))
|
||||
[re-frame.core :as re-frame]
|
||||
[vimsical.re-frame.fx.track :as track]
|
||||
[reagent.core :as r]))
|
||||
|
||||
;; SUBS
|
||||
(re-frame/reg-sub
|
||||
@@ -228,7 +230,20 @@
|
||||
:submit-event [::saving ]
|
||||
:id ::form}))
|
||||
|
||||
(defn form [{:keys [can-change-amount?] :as params}]
|
||||
(re-frame/reg-event-fx
|
||||
::mounted
|
||||
(fn []
|
||||
{::track/register [{:id ::client
|
||||
:subscription [::subs/client]
|
||||
:event-fn (fn [c]
|
||||
[::changed [:client] c])}]}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::unmounted
|
||||
(fn []
|
||||
{::track/dispose [{:id ::client}]}))
|
||||
|
||||
(defn form-content [{:keys [can-change-amount?] :as params}]
|
||||
[layouts/side-bar {:on-close (dispatch-event [::forms/form-closing ::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
|
||||
@@ -349,3 +364,12 @@
|
||||
|
||||
(submit-button "Save")]]])
|
||||
{:key id}))])
|
||||
|
||||
|
||||
(defn form [p]
|
||||
(r/create-class
|
||||
{:display-name "invoice-form"
|
||||
:component-did-mount #(re-frame/dispatch [::mounted])
|
||||
:component-will-unmount #(re-frame/dispatch [::unmounted])
|
||||
:reagent-render (fn [p]
|
||||
[form-content p])}))
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
(mapcat second)
|
||||
(map :location)
|
||||
(map not-empty)
|
||||
(filter #(not= "A" %))
|
||||
(filter identity)
|
||||
(set)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user