Adds the company drop down to new pages
This commit is contained in:
25
resources/public/css/bulma.min.css
vendored
25
resources/public/css/bulma.min.css
vendored
@@ -10974,12 +10974,6 @@ span[data-tooltip].has-tooltip-primary-two {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.typeahead input[disabeld] {
|
|
||||||
background-color: whitesmoke;
|
|
||||||
border-color: whitesmoke;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.typeahead-suggestion {
|
.typeahead-suggestion {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
@@ -11043,4 +11037,23 @@ tbody tr.live-added {
|
|||||||
border-width: 2.5px;
|
border-width: 2.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.autocomplete-suggestion {
|
||||||
|
display: block;
|
||||||
|
overflow: visible;
|
||||||
|
padding: 3px 20px;
|
||||||
|
clear: both;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
color: #333333;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete-suggestion.highlighted, .autocomplete-suggestion:hover {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
outline: 0;
|
||||||
|
background-color: #79b52e;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=bulma.min.css.map */
|
/*# sourceMappingURL=bulma.min.css.map */
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -469,3 +469,4 @@ table.balance-sheet th.total {
|
|||||||
border-color: whitesmoke !important;
|
border-color: whitesmoke !important;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
resources/sass/bulma.scss
vendored
20
resources/sass/bulma.scss
vendored
@@ -1,4 +1,3 @@
|
|||||||
@/charset "utf-8";
|
|
||||||
/* latin */
|
/* latin */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Calibri';
|
font-family: 'Calibri';
|
||||||
@@ -165,4 +164,21 @@ tbody tr.live-added {
|
|||||||
border-width: 2.5px;
|
border-width: 2.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For autocompletejs on non-react views
|
||||||
|
.autocomplete-suggestion {
|
||||||
|
display: block;
|
||||||
|
overflow: visible;
|
||||||
|
padding: 3px 20px;
|
||||||
|
clear: both;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
color: #333333;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.autocomplete-suggestion.highlighted, .autocomplete-suggestion:hover {
|
||||||
|
color: $white;
|
||||||
|
text-decoration: none;
|
||||||
|
outline: 0;
|
||||||
|
background-color: $primary;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
[auto-ap.datomic :refer [conn]]
|
[auto-ap.datomic :refer [conn]]
|
||||||
[auto-ap.logging :as alog]
|
[auto-ap.logging :as alog]
|
||||||
[auto-ap.shared-views.admin.side-bar :refer [admin-side-bar]]
|
[auto-ap.shared-views.admin.side-bar :refer [admin-side-bar]]
|
||||||
[auto-ap.ssr.ui :refer [base-page html-response]]
|
[auto-ap.ssr.ui :refer [base-page]]
|
||||||
|
[auto-ap.ssr.utils :refer [html-response]]
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
[clj-time.coerce :as coerce]
|
[clj-time.coerce :as coerce]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
@@ -149,7 +150,7 @@
|
|||||||
(if (get (:headers request) "hx-request")
|
(if (get (:headers request) "hx-request")
|
||||||
(html-response
|
(html-response
|
||||||
(table entity-id best-guess-entity history))
|
(table entity-id best-guess-entity history))
|
||||||
(base-page (page-template :table (table entity-id best-guess-entity history)
|
(base-page request (page-template :table (table entity-id best-guess-entity history)
|
||||||
:entity-id entity-id)
|
:entity-id entity-id)
|
||||||
(admin-side-bar :admin-history))))
|
(admin-side-bar :admin-history))))
|
||||||
(catch NumberFormatException _
|
(catch NumberFormatException _
|
||||||
@@ -189,8 +190,9 @@
|
|||||||
[:div.notification.is-danger.is-light
|
[:div.notification.is-danger.is-light
|
||||||
"Cannot parse the entity-id " entity-id ". It should be a number."]))))
|
"Cannot parse the entity-id " entity-id ". It should be a number."]))))
|
||||||
|
|
||||||
(defn history [{:keys [matched-route]}]
|
(defn history [{:keys [matched-route] :as request}]
|
||||||
(base-page (page-template )
|
(base-page request
|
||||||
|
(page-template )
|
||||||
(admin-side-bar matched-route)))
|
(admin-side-bar matched-route)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
[auto-ap.graphql.utils :refer [can-see-client? is-admin?]]
|
[auto-ap.graphql.utils :refer [can-see-client? is-admin?]]
|
||||||
[auto-ap.shared-views.company.sidebar :refer [company-side-bar]]
|
[auto-ap.shared-views.company.sidebar :refer [company-side-bar]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.ui :refer [base-page html-response]]
|
[auto-ap.ssr.ui :refer [base-page]]
|
||||||
|
[auto-ap.ssr.utils :refer [html-response]]
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[datomic.api :as d]
|
[datomic.api :as d]
|
||||||
@@ -307,6 +308,7 @@
|
|||||||
|
|
||||||
(defn page [{:keys [identity matched-route] :as request}]
|
(defn page [{:keys [identity matched-route] :as request}]
|
||||||
(base-page
|
(base-page
|
||||||
|
request
|
||||||
[:div
|
[:div
|
||||||
[:div#vendor-table {:hx-get (bidi/path-for ssr-routes/only-routes
|
[:div#vendor-table {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||||
:company-1099-vendor-table
|
:company-1099-vendor-table
|
||||||
|
|||||||
@@ -3,12 +3,15 @@
|
|||||||
[auto-ap.routes.utils
|
[auto-ap.routes.utils
|
||||||
:refer [wrap-admin wrap-client-redirect-unauthenticated wrap-secure]]
|
:refer [wrap-admin wrap-client-redirect-unauthenticated wrap-secure]]
|
||||||
[auto-ap.ssr.admin :as admin]
|
[auto-ap.ssr.admin :as admin]
|
||||||
[auto-ap.ssr.company.company-1099 :as company-1099]))
|
[auto-ap.ssr.company.company-1099 :as company-1099]
|
||||||
|
[auto-ap.ssr.company-dropdown :as company-dropdown]))
|
||||||
|
|
||||||
;; from auto-ap.ssr-routes, because they're shared
|
;; from auto-ap.ssr-routes, because they're shared
|
||||||
(def key->handler {:admin-history (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
|
(def key->handler {:admin-history (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
|
||||||
:admin-history-search (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history-search)))
|
:admin-history-search (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history-search)))
|
||||||
:admin-history-inspect (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/inspect)))
|
:admin-history-inspect (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/inspect)))
|
||||||
|
:active-client (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin company-dropdown/active-client)))
|
||||||
|
:company-dropdown-contents (wrap-client-redirect-unauthenticated (wrap-secure company-dropdown/dropdown-contents))
|
||||||
:company-1099 (wrap-client-redirect-unauthenticated (wrap-secure company-1099/page))
|
:company-1099 (wrap-client-redirect-unauthenticated (wrap-secure company-1099/page))
|
||||||
:company-1099-vendor-table (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-table))
|
:company-1099-vendor-table (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-table))
|
||||||
:company-1099-vendor-dialog (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-dialog))
|
:company-1099-vendor-dialog (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-dialog))
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
(ns auto-ap.ssr.ui
|
(ns auto-ap.ssr.ui
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.logging :as alog]
|
[auto-ap.logging :as alog]
|
||||||
|
[auto-ap.ssr.company-dropdown :as company-dropdown]
|
||||||
[config.core :refer [env]]
|
[config.core :refer [env]]
|
||||||
[hiccup2.core :as hiccup]))
|
[hiccup2.core :as hiccup]))
|
||||||
|
|
||||||
@@ -12,41 +13,9 @@
|
|||||||
(hiccup/html
|
(hiccup/html
|
||||||
{}
|
{}
|
||||||
hiccup))})
|
hiccup))})
|
||||||
(defn client-dropdown []
|
|
||||||
(let [client nil
|
|
||||||
matching-clients nil]
|
|
||||||
|
|
||||||
[:div#company-dropdown.navbar-item.has-dropdown
|
|
||||||
[:a.navbar-link {"_" (hiccup/raw "on click toggle .is-active on <#company-dropdown />")} "Company"]
|
|
||||||
[:div.navbar-dropdown
|
|
||||||
[:input.input.navbar-item {:placeholder "Company name"
|
|
||||||
:autoFocus true} ]
|
|
||||||
|
|
||||||
]]
|
(defn base-page [request contents side-bar-contents]
|
||||||
#_[navbar-drop-down {:header (str "Company: " (if @client (:name @client)
|
|
||||||
"All"))
|
|
||||||
:id :select-client}
|
|
||||||
[:div
|
|
||||||
[:a {:class "navbar-item"
|
|
||||||
:on-click (fn []
|
|
||||||
(re-frame/dispatch [:events/toggle-menu :select-client])
|
|
||||||
(re-frame/dispatch [:forms/form-closing :client-search])
|
|
||||||
(re-frame/dispatch [:events/swap-client nil]))} "All" ]
|
|
||||||
[:hr {:class "navbar-divider"}]
|
|
||||||
[form-builder/builder {:id :client-search
|
|
||||||
:submit-event [:client-searched]}
|
|
||||||
[form-builder/raw-field-v2 {:field :value}
|
|
||||||
[:input.input.navbar-item {:placeholder "Company name"
|
|
||||||
:auto-focus true}]]]
|
|
||||||
(for [{:keys [name id] :as client} (take 8 matching-clients)]
|
|
||||||
^{:key id }
|
|
||||||
[:a {:class "navbar-item"
|
|
||||||
:on-click (fn []
|
|
||||||
(re-frame/dispatch [:events/toggle-menu :select-client])
|
|
||||||
(re-frame/dispatch [:events/swap-client client]))
|
|
||||||
} name])]]))
|
|
||||||
|
|
||||||
(defn base-page [contents side-bar-contents]
|
|
||||||
(html-page
|
(html-page
|
||||||
[:html.has-navbar-fixed-top
|
[:html.has-navbar-fixed-top
|
||||||
[:head
|
[:head
|
||||||
@@ -64,13 +33,13 @@
|
|||||||
[:link {:rel "stylesheet", :href "/finance-font/style.css"}]
|
[:link {:rel "stylesheet", :href "/finance-font/style.css"}]
|
||||||
[:link {:rel "stylesheet", :href "/css/main.css"}]
|
[:link {:rel "stylesheet", :href "/css/main.css"}]
|
||||||
[:link {:rel "stylesheet", :href "https://unpkg.com/placeholder-loading/dist/css/placeholder-loading.min.css"}]
|
[:link {:rel "stylesheet", :href "https://unpkg.com/placeholder-loading/dist/css/placeholder-loading.min.css"}]
|
||||||
|
#_[:link {:rel "stylesheet", :href "https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/css/autoComplete.min.css"}]
|
||||||
[:script {:src "https://unpkg.com/hyperscript.org@0.9.7"}]
|
[:script {:src "https://unpkg.com/hyperscript.org@0.9.7"}]
|
||||||
[:script {:src "https://unpkg.com/htmx.org@1.8.4"
|
[:script {:src "https://unpkg.com/htmx.org@1.8.4"
|
||||||
:integrity "sha384-wg5Y/JwF7VxGk4zLsJEcAojRtlVp1FKKdGy1qN+OMtdq72WRvX/EdRdqg/LOhYeV"
|
:integrity "sha384-wg5Y/JwF7VxGk4zLsJEcAojRtlVp1FKKdGy1qN+OMtdq72WRvX/EdRdqg/LOhYeV"
|
||||||
:crossorigin= "anonymous"}]
|
:crossorigin= "anonymous"}]
|
||||||
[:script {:type "text/javascript", :src "https://cdn.yodlee.com/fastlink/v4/initialize.js", :async "async" }]]
|
[:script {:type "text/javascript", :src "https://cdn.yodlee.com/fastlink/v4/initialize.js", :async "async" }]]
|
||||||
|
[:script {:type "text/javascript", :src "https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/autoComplete.min.js"}]
|
||||||
|
|
||||||
[:body
|
[:body
|
||||||
[:div {:id "app"}
|
[:div {:id "app"}
|
||||||
[:div
|
[:div
|
||||||
@@ -94,7 +63,7 @@
|
|||||||
"Transactions" ]
|
"Transactions" ]
|
||||||
[:a.navbar-item {:href "/ledger/"}
|
[:a.navbar-item {:href "/ledger/"}
|
||||||
"Ledger" ]
|
"Ledger" ]
|
||||||
(client-dropdown)]]]]
|
(company-dropdown/dropdown request)]]]]
|
||||||
[:div {:class "columns has-shadow", :id "mail-app", :style "margin-bottom: 0px; height: calc(100vh - 46px);"}
|
[:div {:class "columns has-shadow", :id "mail-app", :style "margin-bottom: 0px; height: calc(100vh - 46px);"}
|
||||||
[:aside {:class "column aside menu is-2 "}
|
[:aside {:class "column aside menu is-2 "}
|
||||||
[:div {:class "main left-nav"}
|
[:div {:class "main left-nav"}
|
||||||
@@ -105,38 +74,3 @@
|
|||||||
[:div]
|
[:div]
|
||||||
[:div {:id "dz-hidden"}]]]
|
[:div {:id "dz-hidden"}]]]
|
||||||
[:div#modal-holder]]]))
|
[:div#modal-holder]]]))
|
||||||
|
|
||||||
(defn html-response [hiccup & {:keys [status] :or {status 200}}]
|
|
||||||
{:status status
|
|
||||||
:headers {"Content-Type" "text/html"}
|
|
||||||
:body (str
|
|
||||||
(hiccup/html
|
|
||||||
{}
|
|
||||||
hiccup))})
|
|
||||||
|
|
||||||
(defn wrap-error-response [handler]
|
|
||||||
(fn [request]
|
|
||||||
(try
|
|
||||||
(handler request)
|
|
||||||
(catch Exception e
|
|
||||||
(if-let [v (or (:validation-error (ex-data e))
|
|
||||||
(:validation-error (ex-data (.getCause e))))]
|
|
||||||
|
|
||||||
(do
|
|
||||||
(alog/warn ::request-validation-error
|
|
||||||
:exception e)
|
|
||||||
(html-response
|
|
||||||
[:div.notification.is-warning.is-light
|
|
||||||
v]
|
|
||||||
:status 400))
|
|
||||||
(do
|
|
||||||
(alog/error ::request-error
|
|
||||||
:exception e)
|
|
||||||
(when (= "dev" (:dd-env env))
|
|
||||||
(println e))
|
|
||||||
(html-response
|
|
||||||
[:div.notification.is-danger.is-light
|
|
||||||
"Server error occured."
|
|
||||||
(ex-message e)]
|
|
||||||
:status 500)))))))
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
#"/search/?" :admin-history-search
|
#"/search/?" :admin-history-search
|
||||||
["/" [#"\d+" :entity-id] #"/?"] :admin-history-search
|
["/" [#"\d+" :entity-id] #"/?"] :admin-history-search
|
||||||
["/inspect/" [#"\d+" :entity-id] #"/?"] :admin-history-inspect}}
|
["/inspect/" [#"\d+" :entity-id] #"/?"] :admin-history-inspect}}
|
||||||
"company" {"/1099" :company-1099
|
"company" {"/dropdown" :company-dropdown-contents
|
||||||
|
"/active" {:put :active-client}
|
||||||
|
"/1099" :company-1099
|
||||||
"/1099/table" {:get :company-1099-vendor-table}
|
"/1099/table" {:get :company-1099-vendor-table}
|
||||||
"/1099/vendor-dialog" {["/" [#"\d+" :vendor-id]] {:get :company-1099-vendor-dialog
|
"/1099/vendor-dialog" {["/" [#"\d+" :vendor-id]] {:get :company-1099-vendor-dialog
|
||||||
:post :company-1099-vendor-save}}}})
|
:post :company-1099-vendor-save}}}})
|
||||||
|
|||||||
Reference in New Issue
Block a user