company 1099 works
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,17 +1,32 @@
|
||||
(ns auto-ap.ssr.company.company-1099
|
||||
(:require
|
||||
[auto-ap.datomic :refer [apply-pagination-raw conn remove-nils]]
|
||||
[auto-ap.graphql.utils
|
||||
:refer [assert-can-see-client extract-client-ids is-admin?]]
|
||||
[auto-ap.datomic :refer [apply-pagination-raw conn]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client]]
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-client-redirect-unauthenticated wrap-secure]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.form-cursor :as fc]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.nested-form-params :refer [wrap-nested-form-params]]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [form-data->map html-response path->name]]
|
||||
[auto-ap.ssr.utils
|
||||
:refer [apply-middleware-to-all-handlers
|
||||
entity-id
|
||||
html-response
|
||||
main-transformer
|
||||
modal-response
|
||||
ref->enum-schema
|
||||
ref->select-options
|
||||
strip
|
||||
wrap-entity
|
||||
wrap-form-4xx-2
|
||||
wrap-schema-decode]]
|
||||
[bidi.bidi :as bidi]
|
||||
[cemerick.url :as url]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]))
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :refer [url]]
|
||||
[malli.core :as mc]))
|
||||
|
||||
(def vendor-read '[:db/id
|
||||
:vendor/name
|
||||
@@ -74,7 +89,7 @@
|
||||
|
||||
(def grid-page
|
||||
(helper/build
|
||||
{:id "vendor-table"
|
||||
{:id "entity-table"
|
||||
:nav (com/company-aside-nav)
|
||||
:id-fn (comp :db/id second)
|
||||
:fetch-page fetch-page
|
||||
@@ -89,14 +104,10 @@
|
||||
:entity-name "Vendors"
|
||||
:route :company-1099-vendor-table
|
||||
:row-buttons (fn [request e]
|
||||
[(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
||||
[(com/icon-button {:hx-get (url (bidi/path-for ssr-routes/only-routes
|
||||
:company-1099-vendor-dialog
|
||||
:vendor-id (:db/id (second e)))
|
||||
"?"
|
||||
(url/map->query {:client-id (:db/id (first e))}))
|
||||
:hx-ext "debug"
|
||||
:hx-target "#modal-holder"
|
||||
:hx-swap "outerHTML"}
|
||||
{:client-id (:db/id (first e))})}
|
||||
svg/pencil)])
|
||||
:headers [{:key "Client"
|
||||
:name "Client"
|
||||
@@ -161,117 +172,200 @@
|
||||
(def table* (partial helper/table* grid-page))
|
||||
(def row* (partial helper/row* grid-page))
|
||||
|
||||
(defn vendor-save [{:keys [form-params identity route-params query-params] :as request}]
|
||||
(let [client-id (Long/parseLong (get query-params "client-id"))
|
||||
vendor-id (Long/parseLong (:vendor-id route-params))]
|
||||
(assert-can-see-client identity client-id)
|
||||
@(dc/transact conn [(remove-nils
|
||||
(-> (form-data->map form-params)
|
||||
(assoc :db/id (Long/parseLong (:vendor-id route-params)))
|
||||
(update :vendor/legal-entity-1099-type #(some->> % not-empty (keyword "legal-entity-1099-type")))
|
||||
(update :vendor/legal-entity-tin-type #(some->> % not-empty (keyword "legal-entity-tin-type")))))])
|
||||
(html-response
|
||||
(defn vendor-save [{:keys [form-params identity route-params query-params request-method] :as request
|
||||
{:keys [vendor-id]} :route-params
|
||||
{:keys [client-id]} :query-params}]
|
||||
|
||||
(row* identity [(dc/pull (dc/db conn) [:db/id :client/code] client-id)
|
||||
(dc/pull (dc/db conn) vendor-read vendor-id)
|
||||
(sum-for-client-vendor client-id vendor-id)
|
||||
] {:flash? true})
|
||||
:headers {"hx-trigger" "closeModal"})))
|
||||
(assert-can-see-client identity client-id)
|
||||
@(dc/transact conn [[:upsert-entity (assoc form-params :db/id (:vendor-id route-params))]])
|
||||
(html-response
|
||||
|
||||
(defn vendor-dialog [request]
|
||||
(let [vendor (dc/pull (dc/db conn) '[* {:vendor/legal-entity-1099-type [:db/ident]
|
||||
:vendor/legal-entity-tin-type [:db/ident]}] (Long/parseLong (:vendor-id (:params request))))] ;; TODO perms
|
||||
(html-response
|
||||
(row* identity [(dc/pull (dc/db conn) [:db/id :client/code] client-id)
|
||||
(dc/pull (dc/db conn) vendor-read vendor-id)
|
||||
(sum-for-client-vendor client-id vendor-id)
|
||||
] {:flash? true})
|
||||
:headers {"hx-trigger" "modalclose"
|
||||
"hx-retarget" (format "#entity-table tr[data-id=\"%d\"]" vendor-id)}))
|
||||
|
||||
(def default-vendor-read '[* {[:vendor/legal-entity-1099-type :xform iol-ion.query/ident] [:db/ident]
|
||||
[:vendor/legal-entity-tin-type :xform iol-ion.query/ident] [:db/ident]}])
|
||||
|
||||
|
||||
(def form-schema (mc/schema [:map
|
||||
[:vendor/address {:default {} }
|
||||
[:maybe
|
||||
[:map
|
||||
[:db/id {:optional true} [:maybe entity-id]]
|
||||
[:address/street1 {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:address/street2 {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:address/city {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:address/state {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:address/zip {:optional true} [:maybe [:re { :error/message "invalid zip"
|
||||
:decode/string strip} #"^(\d{5}|)$"]]]]]]
|
||||
[:vendor/legal-entity-name {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:vendor/legal-entity-first-name {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:vendor/legal-entity-middle-name {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:vendor/legal-entity-last-name {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:vendor/legal-entity-tin {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||
[:vendor/legal-entity-tin-type {:optional true} [:maybe (ref->enum-schema "legal-entity-tin-type")]]
|
||||
[:vendor/legal-entity-1099-type {:optional true} [:maybe (ref->enum-schema "legal-entity-1099-type")]]]))
|
||||
|
||||
(defn vendor-dialog [{{:keys [client-id]} :query-params {:keys [vendor-id]} :route-params :keys [entity form-params form-errors]}]
|
||||
(fc/start-form (or (when (seq form-params)
|
||||
form-params)
|
||||
(when entity
|
||||
(mc/decode form-schema entity main-transformer))
|
||||
{})
|
||||
form-errors
|
||||
(modal-response
|
||||
(com/modal
|
||||
{}
|
||||
[:form {:hx-post (str (bidi/path-for ssr-routes/only-routes
|
||||
:company-1099-vendor-save
|
||||
:request-method :post
|
||||
:vendor-id (Long/parseLong (:vendor-id (:params request))))
|
||||
"?"
|
||||
(url/map->query {:client-id (:client-id (:params request))}))
|
||||
:hx-target (format "#vendor-table tr[data-id=\"%d\"]" (:db/id vendor))
|
||||
:hx-swap "outerHTML swap:300ms"}
|
||||
[:fieldset {:class "hx-disable"}
|
||||
[:form {:hx-post (url (bidi/path-for ssr-routes/only-routes
|
||||
:company-1099-vendor-save
|
||||
:request-method :post
|
||||
:vendor-id vendor-id)
|
||||
{:client-id client-id})
|
||||
:class "w-full h-full max-w-2xl"
|
||||
:hx-swap "outerHTML swap:300ms"}
|
||||
|
||||
[:fieldset {:class "hx-disable w-full h-full"}
|
||||
(com/modal-card
|
||||
{}
|
||||
[:div.flex [:div.p-2 "Vendor 1099 Info"] [:p.ml-2.rounded.bg-gray-200.p-2.dark:bg-gray-600 (:vendor/name vendor)]]
|
||||
[:div.space-y-6
|
||||
[:div.grid.grid-cols-6.gap-4
|
||||
|
||||
[:h4.text-xl.border-b.col-span-6 "Address"]
|
||||
[:div.col-span-6
|
||||
(com/field {:label "Street 1"}
|
||||
(com/text-input {:name (path->name [:vendor/address :address/street1])
|
||||
:value (-> vendor :vendor/address :address/street1)
|
||||
:placeholder "1700 Pennsylvania Ave"
|
||||
:autofocus true}))]
|
||||
[:div.col-span-6
|
||||
(com/field {:label "Street 2"}
|
||||
(com/text-input {:name (path->name [:vendor/address :address/street2])
|
||||
:value (-> vendor :vendor/address :address/street2)
|
||||
:placeholder "Suite 200"}))]
|
||||
[:div.col-span-3
|
||||
(com/field {:label "City"}
|
||||
(com/text-input {:name (path->name [:vendor/address :address/city])
|
||||
:value (-> vendor :vendor/address :address/city)
|
||||
:placeholder "Cupertino"}))]
|
||||
[:div.col-span-1
|
||||
(com/field {:label "State"}
|
||||
(com/text-input {:name (path->name [:vendor/address :address/state])
|
||||
:value (-> vendor :vendor/address :address/state)
|
||||
:placeholder "CA"}))]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "Zip"}
|
||||
(com/text-input {:name (path->name [:vendor/address :address/zip])
|
||||
:value (-> vendor :vendor/address :address/zip)
|
||||
:placeholder "98102"}))]
|
||||
[:h4.text-xl.border-b.col-span-6 "Legal Entity"]
|
||||
[:div.col-span-6
|
||||
(com/field {:label "Legal Entity Name"}
|
||||
(com/text-input {:name (path->name [:vendor/legal-entity-name])
|
||||
:value (-> vendor :vendor/legal-entity-name)
|
||||
:placeholder "Good Restaurant LLC"}))]
|
||||
[:div.col-span-6.text-center " - OR -"]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "First Name"}
|
||||
(com/text-input {:name (path->name [:vendor/legal-entity-first-name])
|
||||
:value (-> vendor :vendor/legal-entity-first-name)
|
||||
:placeholder "John"}))]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "Middle Name"}
|
||||
(com/text-input {:name (path->name [:vendor/legal-entity-middle-name])
|
||||
:value (-> vendor :vendor/legal-entity-middle-name)
|
||||
:placeholder "C."}))]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "Last Name"}
|
||||
(com/text-input {:name (path->name [:vendor/legal-entity-last-name])
|
||||
:value (-> vendor :vendor/legal-entity-last-name)
|
||||
:placeholder "Riley"}))]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "TIN"}
|
||||
(com/text-input {:name (path->name [:vendor/legal-entity-tin])
|
||||
:value (-> vendor :vendor/legal-entity-tin)
|
||||
:placeholder "John"}))]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "TIN Type"}
|
||||
(com/select {:name (path->name [:vendor/legal-entity-tin-type])
|
||||
:allow-blank? true
|
||||
:value (some-> vendor :vendor/legal-entity-tin-type :db/ident name)
|
||||
:options [["ein" "EIN"]
|
||||
["ssn" "SSN"]]}))]
|
||||
[:div.col-span-2
|
||||
(com/field {:label "1099 Type"}
|
||||
(com/select {:name (path->name [:vendor/legal-entity-1099-type])
|
||||
:allow-blank? true
|
||||
:value (some-> vendor :vendor/legal-entity-1099-type :db/ident name)
|
||||
:options [["none" "None"]
|
||||
["misc" "Misc"]
|
||||
["landlord" "Landlord"]]}))]
|
||||
[:div.col-span-6
|
||||
(com/button {:color :primary}
|
||||
"Save")]]]
|
||||
[:div])]]))))
|
||||
[:div.flex [:div.p-2 "Vendor 1099 Info"] [:p.ml-2.rounded.bg-gray-200.p-2.dark:bg-gray-600 (:vendor/name entity)]]
|
||||
[:div.grid.grid-cols-6.gap-x-4.gap-y-2
|
||||
|
||||
(fc/with-field :vendor/address ;; TODO support default
|
||||
(list [:h4.text-xl.border-b.col-span-6 "Address"]
|
||||
[:div.col-span-6
|
||||
(fc/with-field :db/id
|
||||
(com/hidden {:name (fc/field-name)
|
||||
:value (fc/field-value)}))
|
||||
|
||||
(fc/with-field :address/street1
|
||||
(com/validated-field {:label "Street 1"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:class "w-full"
|
||||
:value (fc/field-value)
|
||||
:placeholder "1700 Pennsylvania Ave"
|
||||
:autofocus true})))]
|
||||
[:div.col-span-6
|
||||
(fc/with-field :address/street2
|
||||
(com/validated-field {:label "Street 2"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:class "w-full"
|
||||
:value (fc/field-value)
|
||||
:placeholder "Suite 200"})))]
|
||||
[:div.col-span-3
|
||||
(fc/with-field :address/city
|
||||
(com/validated-field {:label "City"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:class "w-full"
|
||||
:value (fc/field-value)
|
||||
:placeholder "Cupertino"})))]
|
||||
[:div.col-span-1
|
||||
(fc/with-field :address/state
|
||||
(com/validated-field {:label "State"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:class "w-full"
|
||||
:value (fc/field-value)
|
||||
:placeholder "CA"})))]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :address/zip
|
||||
(com/validated-field {:label "Zip"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:class "w-full"
|
||||
:value (fc/field-value)
|
||||
:placeholder "98102"})))]))
|
||||
|
||||
[:h4.text-xl.border-b.col-span-6 "Legal Entity"]
|
||||
[:div.col-span-6
|
||||
(fc/with-field :vendor/legal-entity-name
|
||||
(com/validated-field {:label "Legal Entity Name"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:class "w-full"
|
||||
:value (fc/field-value)
|
||||
:placeholder "Good Restaurant LLC"})))]
|
||||
[:div.col-span-6.text-center " - OR -"]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :vendor/legal-entity-first-name
|
||||
(com/validated-field {:label "First Name"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:value (fc/field-value)
|
||||
:placeholder "John"})))]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :vendor/legal-entity-middle-name
|
||||
(com/validated-field {:label "Middle Name"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:value (fc/field-value)
|
||||
:placeholder "C."})))]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :vendor/legal-entity-last-name
|
||||
(com/validated-field {:label "Last Name"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:value (fc/field-value)
|
||||
:placeholder "Riley"})))]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :vendor/legal-entity-tin
|
||||
(com/validated-field {:label "TIN"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:value (fc/field-value)
|
||||
:placeholder "John"})))]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :vendor/legal-entity-tin-type
|
||||
(com/validated-field {:label "TIN Type"
|
||||
:errors (fc/field-errors)}
|
||||
(com/select {:name (fc/field-name)
|
||||
:allow-blank? true
|
||||
:value (some-> (fc/field-value) name)
|
||||
:options [["ein" "EIN"]
|
||||
["ssn" "SSN"]]})))]
|
||||
[:div.col-span-2
|
||||
(fc/with-field :vendor/legal-entity-1099-type
|
||||
(com/validated-field {:label "1099 Type"
|
||||
:errors (fc/field-errors)}
|
||||
(com/select {:name (fc/field-name)
|
||||
:allow-blank? true
|
||||
:value (some-> (fc/field-value) name) ;; TODO use ref stuff
|
||||
:options (ref->select-options "legal-entity-1099-type")})))]]
|
||||
[:div
|
||||
(com/form-errors {:errors (:errors fc/*form-errors*)})
|
||||
(com/validated-save-button {:errors form-errors} "Save rule")])]]))))
|
||||
|
||||
(def vendor-table (helper/table-route grid-page))
|
||||
(def page (helper/page-route grid-page))
|
||||
|
||||
(def key->handler
|
||||
(apply-middleware-to-all-handlers
|
||||
(->>
|
||||
{
|
||||
:company-1099 page
|
||||
:company-1099-vendor-table vendor-table
|
||||
:company-1099-vendor-dialog (-> vendor-dialog
|
||||
(wrap-entity [:route-params :vendor-id] default-vendor-read)
|
||||
(wrap-schema-decode :route-schema [:map [:vendor-id entity-id]]
|
||||
:query-schema [:map [:client-id entity-id]]))
|
||||
:company-1099-vendor-save (-> vendor-save
|
||||
(wrap-entity [:form-params :db/id] default-vendor-read)
|
||||
(wrap-schema-decode :form-schema form-schema
|
||||
:route-schema [:map [:vendor-id entity-id]]
|
||||
:query-schema [:map [:client-id entity-id]])
|
||||
(wrap-nested-form-params)
|
||||
(wrap-form-4xx-2 (-> vendor-dialog
|
||||
(wrap-entity [:form-params :db/id] default-vendor-read)
|
||||
(wrap-entity [:route-params :vendor-id] default-vendor-read)
|
||||
(wrap-schema-decode :route-schema [:map [:vendor-id entity-id]]
|
||||
:query-schema [:map [:client-id entity-id]]))))})
|
||||
(fn [h]
|
||||
(-> h
|
||||
(wrap-secure)
|
||||
(wrap-client-redirect-unauthenticated)))))
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
[hiccup2.core :as hiccup]
|
||||
[bidi.bidi :as bidi]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.client-routes :as client-routes]))
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.hiccup-helper :as hh]))
|
||||
|
||||
(defn menu-button- [params & children]
|
||||
[:div
|
||||
@@ -13,140 +15,47 @@
|
||||
(update :class str " cursor-pointer flex items-center p-2 w-full text-xs text-gray-600 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700")
|
||||
(assoc :hx-indicator "find .htmx-indicator")
|
||||
(assoc :hx-boost "true")
|
||||
(assoc :hx-select "#app-contents")
|
||||
(assoc :hx-target "#app-contents")
|
||||
(assoc :hx-swap "outerHTML"))
|
||||
(assoc :hx-select "#app")
|
||||
(assoc :hx-target "#app")
|
||||
(assoc :hx-swap "innerHTML"))
|
||||
|
||||
(when (:icon params)
|
||||
[:span {:class "flex-shrink-0 w-6 h-6 text-gray-400 transition duration-75 group-hover:text-blue-500 dark:text-gray-400 group-hover:scale-110 dark:group-hover:text-white mr-3"}
|
||||
(:icon params)])
|
||||
|
||||
(into [:span {:class "flex-1 text-left whitespace-nowrap text-gray-600 dark:text-white"}] children)
|
||||
(when (:data-collapse-toggle params)
|
||||
(when (get params "@click")
|
||||
[:svg {:aria-hidden "true", :class "w-6 h-6", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:fill-rule "evenodd", :d "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", :clip-rule "evenodd"}]])
|
||||
[:div.htmx-indicator.flex.items-center
|
||||
(svg/spinner-primary {:class "inline w-4 h-4 text-white"})]]])
|
||||
|
||||
(defn sub-menu- [params & children]
|
||||
[:ul {:id (:id params) :class "hidden py-2 space-y-1.5"}
|
||||
[:ul (update params
|
||||
:class (fnil hh/add-class "")"py-2 space-y-1.5")
|
||||
(for [c children]
|
||||
[:li
|
||||
(update-in c [1 1 :class ] str " flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700")])])
|
||||
|
||||
(defn left-aside- [{:keys [nav page-specific]} & children]
|
||||
[:aside {:id "left-nav", :class "fixed top-0 left-0 pt-16 z-20 w-64 h-screen transition-transform -translate-x-full lg:translate-x-0", :aria-labelledby "left-nav" :aria-hidden "true"
|
||||
"_" (hiccup/raw "init call initSidebarToggle()")}
|
||||
[:aside {:id "left-nav",
|
||||
:class "fixed top-0 left-0 pt-16 z-20 w-64 h-screen transition-transform -translate-x-full lg:translate-x-0",
|
||||
"x-transition:enter" "transition duration-500"
|
||||
"x-transition:enter-start" "lg:-translate-x-full"
|
||||
"x-transition:enter-end" " lg:translate-x-0"
|
||||
"x-transition:leave" "transition duration-500"
|
||||
"x-transition:leave-start" "lg:translate-x-0"
|
||||
"x-transition:leave-end" " lg:-translate-x-full"
|
||||
|
||||
:aria-labelledby "left-nav"
|
||||
:x-show "leftNavShow"
|
||||
":aria-hidden" "leftNavShow ? 'false' : 'true'"}
|
||||
|
||||
[:div {:class "overflow-y-auto py-5 px-3 h-full bg-gray-50 border-r border-gray-200 dark:bg-gray-800 dark:border-gray-700"}
|
||||
nav
|
||||
|
||||
[:ul {:class "pt-5 mt-5 space-y-2 border-t border-gray-200 dark:border-gray-700"}
|
||||
#_[:li
|
||||
[:a {:href "#", :class "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg transition duration-75 hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white group"}
|
||||
[:svg {:aria-hidden "true", :class "flex-shrink-0 w-6 h-6 text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:d "M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}]
|
||||
[:path {:fill-rule "evenodd", :d "M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm3 4a1 1 0 000 2h.01a1 1 0 100-2H7zm3 0a1 1 0 000 2h3a1 1 0 100-2h-3zm-3 4a1 1 0 100 2h.01a1 1 0 100-2H7zm3 0a1 1 0 100 2h3a1 1 0 100-2h-3z", :clip-rule "evenodd"}]]
|
||||
[:span {:class "ml-3"} "Docs"]]]
|
||||
#_[:li
|
||||
[:a {:href "#", :class "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg transition duration-75 hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white group"}
|
||||
[:svg {:aria-hidden "true", :class "flex-shrink-0 w-6 h-6 text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:d "M7 3a1 1 0 000 2h6a1 1 0 100-2H7zM4 7a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1zM2 11a2 2 0 012-2h12a2 2 0 012 2v4a2 2 0 01-2 2H4a2 2 0 01-2-2v-4z"}]]
|
||||
[:span {:class "ml-3"} "Components"]]]
|
||||
#_[:li
|
||||
[:a {:href "#", :class "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg transition duration-75 hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white group"}
|
||||
[:svg {:aria-hidden "true", :class "flex-shrink-0 w-6 h-6 text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:fill-rule "evenodd", :d "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-2 0c0 .993-.241 1.929-.668 2.754l-1.524-1.525a3.997 3.997 0 00.078-2.183l1.562-1.562C15.802 8.249 16 9.1 16 10zm-5.165 3.913l1.58 1.58A5.98 5.98 0 0110 16a5.976 5.976 0 01-2.516-.552l1.562-1.562a4.006 4.006 0 001.789.027zm-4.677-2.796a4.002 4.002 0 01-.041-2.08l-.08.08-1.53-1.533A5.98 5.98 0 004 10c0 .954.223 1.856.619 2.657l1.54-1.54zm1.088-6.45A5.974 5.974 0 0110 4c.954 0 1.856.223 2.657.619l-1.54 1.54a4.002 4.002 0 00-2.346.033L7.246 4.668zM12 10a2 2 0 11-4 0 2 2 0 014 0z", :clip-rule "evenodd"}]]
|
||||
[:span {:class "ml-3"} "Help"]]]]
|
||||
page-specific]
|
||||
#_[:div {:class "hidden absolute bottom-0 left-0 justify-center p-4 space-x-4 w-full lg:flex bg-white dark:bg-gray-800 z-20 border-r border-gray-200 dark:border-gray-700"}
|
||||
[:a {:href "#", :class "inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-600"}
|
||||
[:svg {:aria-hidden "true", :class "w-6 h-6", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:d "M5 4a1 1 0 00-2 0v7.268a2 2 0 000 3.464V16a1 1 0 102 0v-1.268a2 2 0 000-3.464V4zM11 4a1 1 0 10-2 0v1.268a2 2 0 000 3.464V16a1 1 0 102 0V8.732a2 2 0 000-3.464V4zM16 3a1 1 0 011 1v7.268a2 2 0 010 3.464V16a1 1 0 11-2 0v-1.268a2 2 0 010-3.464V4a1 1 0 011-1z"}]]]
|
||||
[:a {:href "#", :data-tooltip-target "tooltip-settings", :class "inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:text-gray-400 dark:hover:text-white hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-600"}
|
||||
[:svg {:aria-hidden "true", :class "w-6 h-6", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:fill-rule "evenodd", :d "M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z", :clip-rule "evenodd"}]]]
|
||||
[:div {:id "tooltip-settings", :role "tooltip", :class "inline-block absolute invisible z-10 py-2 px-3 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 transition-opacity duration-300 tooltip"} "Settings page"]
|
||||
[:button {:type "button", :data-dropdown-toggle "language-dropdown", :class "inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:hover:text-white dark:text-gray-400 hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-600"}
|
||||
[:svg {:aria-hidden "true", :class "h-5 w-5 rounded-full mt-0.5", :xmlns "http://www.w3.org/2000/svg", :xmlns:xlink "http://www.w3.org/1999/xlink", :viewbox "0 0 3900 3900"}
|
||||
[:path {:fill "#b22234", :d "M0 0h7410v3900H0z"}]
|
||||
[:path {:d "M0 450h7410m0 600H0m0 600h7410m0 600H0m0 600h7410m0 600H0", :stroke "#fff", :stroke-width "300"}]
|
||||
[:path {:fill "#3c3b6e", :d "M0 0h2964v2100H0z"}]
|
||||
[:g {:fill "#fff"}
|
||||
[:g {:id "d"}
|
||||
[:g {:id "c"}
|
||||
[:g {:id "e"}
|
||||
[:g {:id "b"}
|
||||
[:path {:id "a", :d "M247 90l70.534 217.082-184.66-134.164h228.253L176.466 307.082z"}]
|
||||
[:use {:xlink:href "#a", :y "420"}]
|
||||
[:use {:xlink:href "#a", :y "840"}]
|
||||
[:use {:xlink:href "#a", :y "1260"}]]
|
||||
[:use {:xlink:href "#a", :y "1680"}]]
|
||||
[:use {:xlink:href "#b", :x "247", :y "210"}]]
|
||||
[:use {:xlink:href "#c", :x "494"}]]
|
||||
[:use {:xlink:href "#d", :x "988"}]
|
||||
[:use {:xlink:href "#c", :x "1976"}]
|
||||
[:use {:xlink:href "#e", :x "2470"}]]]]
|
||||
[:div {:class "hidden z-50 my-4 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700", :id "language-dropdown"}
|
||||
[:ul {:class "py-1", :role "none"}
|
||||
[:li
|
||||
[:a {:href "#", :class "block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:hover:text-white dark:text-gray-300 dark:hover:bg-gray-600", :role "menuitem"}
|
||||
[:div {:class "inline-flex items-center"}
|
||||
[:svg {:aria-hidden "true", :class "h-3.5 w-3.5 rounded-full mr-2", :xmlns "http://www.w3.org/2000/svg", :id "flag-icon-css-us", :viewbox "0 0 512 512"}
|
||||
[:g {:fill-rule "evenodd"}
|
||||
[:g {:stroke-width "1pt"}
|
||||
[:path {:fill "#bd3d44", :d "M0 0h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0z", :transform "scale(3.9385)"}]
|
||||
[:path {:fill "#fff", :d "M0 10h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 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-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 63.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9z", :transform "scale(3.9385)"}]]] " \n English (US)"]]]
|
||||
[:li
|
||||
[:a {:href "#", :class "block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:text-white dark:hover:bg-gray-600", :role "menuitem"}
|
||||
[:div {:class "inline-flex items-center"}
|
||||
[:svg {:aria-hidden "true", :class "h-3.5 w-3.5 rounded-full mr-2", :xmlns "http://www.w3.org/2000/svg", :id "flag-icon-css-de", :viewbox "0 0 512 512"}
|
||||
[:path {:fill "#ffce00", :d "M0 341.3h512V512H0z"}]
|
||||
[:path {:d "M0 0h512v170.7H0z"}]
|
||||
[:path {:fill "#d00", :d "M0 170.7h512v170.6H0z"}]]]]]
|
||||
[:li
|
||||
[:a {:href "#", :class "block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:text-white dark:hover:bg-gray-600", :role "menuitem"}
|
||||
[:div {:class "inline-flex items-center"}
|
||||
[:svg {:aria-hidden "true", :class "h-3.5 w-3.5 rounded-full mr-2", :xmlns "http://www.w3.org/2000/svg", :id "flag-icon-css-it", :viewbox "0 0 512 512"}
|
||||
[:g {:fill-rule "evenodd", :stroke-width "1pt"}
|
||||
[:path {:fill "#fff", :d "M0 0h512v512H0z"}]
|
||||
[:path {:fill "#009246", :d "M0 0h170.7v512H0z"}]
|
||||
[:path {:fill "#ce2b37", :d "M341.3 0H512v512H341.3z"}]]]]]]
|
||||
[:li
|
||||
[:a {:href "#", :class "block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:hover:text-white dark:text-gray-300 dark:hover:bg-gray-600", :role "menuitem"}
|
||||
[:div {:class "inline-flex items-center"}
|
||||
[:svg {:aria-hidden "true", :class "h-3.5 w-3.5 rounded-full mr-2", :xmlns "http://www.w3.org/2000/svg", :xmlns:xlink "http://www.w3.org/1999/xlink", :id "flag-icon-css-cn", :viewbox "0 0 512 512"}
|
||||
[:defs
|
||||
[:path {:id "a", :fill "#ffde00", :d "M1-.3L-.7.8 0-1 .6.8-1-.3z"}]]
|
||||
[:path {:fill "#de2910", :d "M0 0h512v512H0z"}]
|
||||
[:use {:width "30", :height "20", :transform "matrix(76.8 0 0 76.8 128 128)", :xlink:href "#a"}]
|
||||
[:use {:width "30", :height "20", :transform "rotate(-121 142.6 -47) scale(25.5827)", :xlink:href "#a"}]
|
||||
[:use {:width "30", :height "20", :transform "rotate(-98.1 198 -82) scale(25.6)", :xlink:href "#a"}]
|
||||
[:use {:width "30", :height "20", :transform "rotate(-74 272.4 -114) scale(25.6137)", :xlink:href "#a"}]
|
||||
[:use {:width "30", :height "20", :transform "matrix(16 -19.968 19.968 16 256 230.4)", :xlink:href "#a"}]] "中文 (繁體)"]]]]]]
|
||||
[:script {:lang "text/javascript"}
|
||||
(hiccup/raw "
|
||||
function initSidebarToggle() {
|
||||
var $targetEl = document.getElementById('left-nav');
|
||||
|
||||
var $triggerEl = document.getElementById('left-nav-toggle');
|
||||
|
||||
var options = {
|
||||
onCollapse: () => {
|
||||
document.getElementById('main-content').classList.remove('lg:pl-64')
|
||||
},
|
||||
onExpand: () => {
|
||||
document.getElementById('main-content').classList.add('lg:pl-64')
|
||||
},
|
||||
onToggle: () => {
|
||||
}
|
||||
};
|
||||
|
||||
var collapse = new Collapse($targetEl, $triggerEl, options);
|
||||
}
|
||||
")]])
|
||||
|
||||
page-specific]])
|
||||
|
||||
(defn main-aside-nav- []
|
||||
[:ul {:class "space-y-1"}
|
||||
@@ -155,12 +64,11 @@
|
||||
(menu-button- {:icon svg/pie
|
||||
:href "/"}
|
||||
"Dashboard")]
|
||||
[:li
|
||||
(menu-button- {:aria-controls "dropdown-invoices",
|
||||
:data-collapse-toggle "dropdown-invoices"
|
||||
[:li {:x-data (hx/json {:open false})}
|
||||
(menu-button- {"@click" "open = !open"
|
||||
:icon svg/accounting-invoice-mail}
|
||||
"Invoices")
|
||||
(sub-menu- {:id "dropdown-invoices"}
|
||||
(sub-menu- {:x-show "open"}
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:invoices)}
|
||||
"All")
|
||||
@@ -173,12 +81,11 @@
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:voided-invoices)}
|
||||
"Voided"))]
|
||||
[:li
|
||||
(menu-button- {:aria-controls "dropdown-sales",
|
||||
:data-collapse-toggle "dropdown-sales"
|
||||
:icon svg/receipt-register-1}
|
||||
[:li {:x-data (hx/json {:open false})}
|
||||
(menu-button- {:icon svg/receipt-register-1
|
||||
"@click" "open = !open"}
|
||||
"Sales")
|
||||
(sub-menu- {:id "dropdown-sales"}
|
||||
(sub-menu- {:x-show "open"}
|
||||
(menu-button- {:href (str (bidi/path-for ssr-routes/only-routes
|
||||
:pos-sales)
|
||||
"?date-range=week")} "Sales")
|
||||
@@ -197,12 +104,11 @@
|
||||
"?date-range=week")} "Cash drawer shifts")
|
||||
#_(menu-button- {:href "Sales"} "Cash Shifts")
|
||||
#_(menu-button- {:href "Sales"} "Tenders"))]
|
||||
[:li
|
||||
(menu-button- {:aria-controls "dropdown-payments"
|
||||
:data-collapse-toggle "dropdown-payments"
|
||||
[:li {:x-data (hx/json {:open false})}
|
||||
(menu-button- {"@click" "open = !open"
|
||||
:icon svg/payments}
|
||||
"Payments")
|
||||
(sub-menu- {:id "dropdown-payments"}
|
||||
(sub-menu- {:x-show "open"}
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:payments)} "All")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
@@ -212,13 +118,12 @@
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:payments)} "Voided"))]
|
||||
|
||||
[:li
|
||||
(menu-button- {:aria-controls "dropdown-transactions"
|
||||
:data-collapse-toggle "dropdown-transactions"
|
||||
[:li {:x-data (hx/json {:open false})}
|
||||
(menu-button- {"@click" "open = !open"
|
||||
:icon svg/bank}
|
||||
"Transactions")
|
||||
|
||||
(sub-menu- {:id "dropdown-transactions"}
|
||||
(sub-menu- {:x-show "open"}
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:transactions)} "All")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
@@ -229,12 +134,11 @@
|
||||
:approved-transactions)} "Approved")
|
||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insights)} "Insights"))]
|
||||
[:li
|
||||
(menu-button- {:aria-controls "dropdown-ledger"
|
||||
:data-collapse-toggle "dropdown-ledger"
|
||||
[:li {:x-data (hx/json {:open false})}
|
||||
(menu-button- {"@click" "open = !open"
|
||||
:icon svg/receipt}
|
||||
"Ledger")
|
||||
(sub-menu- {:id "dropdown-ledger"}
|
||||
(sub-menu- {:x-show "open"}
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:ledger)} "Register")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
[:div {:class "px-3 py-3 lg:px-5 lg:pl-3"}
|
||||
[:div {:class "flex items-center justify-between"}
|
||||
[:div {:class "flex items-center justify-start"}
|
||||
[:button {:aria-controls "left-nav", :id "left-nav-toggle" :type "button", :class "inline-flex items-center p-2 mt-2 ml-2 mr-2 text-sm text-gray-500 rounded-lg hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"}
|
||||
[:button {:aria-controls "left-nav", :id "left-nav-toggle" :type "button", :class "inline-flex items-center p-2 mt-2 ml-2 mr-2 text-sm text-gray-500 rounded-lg hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
||||
"@click" "leftNavShow = !leftNavShow"}
|
||||
[:span {:class "sr-only"} "Open sidebar"]
|
||||
[:svg {:class "w-6 h-6", :aria-hidden "true", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:clip-rule "evenodd", :fill-rule "evenodd", :d "M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"}]]]
|
||||
|
||||
@@ -3,20 +3,26 @@
|
||||
[auto-ap.ssr.components.aside :refer [left-aside-]]
|
||||
[auto-ap.ssr.components.navbar :refer [navbar-]]
|
||||
[hiccup2.core :as hiccup]
|
||||
[auto-ap.ssr.svg :as svg]))
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.hx :as hx]))
|
||||
|
||||
(defn page- [{:keys [nav page-specific client client-selection identity app-params] :or {app-params {}}} & children]
|
||||
[:div#app {"_" (hiccup/raw "
|
||||
on notification put event.detail.value into #notification-details then add .htmx-added to #notification-holder then remove .hidden from #notification-holder then wait 30ms then remove .htmx-added from #notification-holder
|
||||
on htmx:responseError put event.detail.xhr.response into #error-details then add .htmx-added to #error-holder then remove .hidden from #error-holder then wait 30ms then remove .htmx-added from #error-holder"
|
||||
)}
|
||||
)
|
||||
:x-data (hx/json {:leftNavShow true})}
|
||||
(navbar- {:client-selection client-selection
|
||||
:client client
|
||||
:identity identity})
|
||||
[:div#app-contents.flex.pt-16.overflow-hidden (assoc app-params :hx-disinherit "*")
|
||||
(left-aside- {:nav nav
|
||||
:client client
|
||||
:identity identity})
|
||||
[:div#app-contents.flex.pt-16.overflow-hidden (assoc app-params
|
||||
:hx-disinherit "*"
|
||||
:x-init "leftNavShow = true")
|
||||
(left-aside- {:nav nav
|
||||
:page-specific page-specific})
|
||||
[:div#main-content {:class "relative w-full h-full lg:pl-64 overflow-y-auto px-4 bg-gray-100 dark:bg-gray-900 min-h-content "
|
||||
[:div#main-content {:class "relative w-full h-full overflow-y-auto px-4 bg-gray-100 dark:bg-gray-900 min-h-content lg:pl-64"
|
||||
":class" "leftNavShow ? 'lg:pl-64' : ''"
|
||||
:x-effect "leftNavShow ? $el.classList.add('lg:pl-64') : $el.classList.remove('lg:pl-64')"
|
||||
}
|
||||
[:div#notification-holder.hidden
|
||||
[:div.fixed.top-0.right-0.left-0.z-30.mx-auto.max-w-screen-lg.w-screen-lg.my-0.pt-8.rounded-lg
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
:bank-account-typeahead (wrap-client-redirect-unauthenticated (wrap-secure company/bank-account-typeahead))
|
||||
|
||||
:company (wrap-client-redirect-unauthenticated (wrap-secure company/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-dialog (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-dialog))
|
||||
:company-1099-vendor-save (wrap-client-redirect-unauthenticated (wrap-secure company-1099/vendor-save))
|
||||
:company-plaid (wrap-client-redirect-unauthenticated (wrap-secure company-plaid/page))
|
||||
:company-plaid-table (wrap-client-redirect-unauthenticated (wrap-secure company-plaid/table))
|
||||
:company-plaid-link (wrap-client-redirect-unauthenticated (wrap-secure company-plaid/link))
|
||||
@@ -76,6 +72,7 @@
|
||||
:transaction-insight-explain (wrap-client-redirect-unauthenticated (wrap-admin insights/explain))
|
||||
:admin-ezcater-xls (wrap-client-redirect-unauthenticated (wrap-admin ezcater-xls/page))
|
||||
:search (wrap-client-redirect-unauthenticated (wrap-secure search/dialog-contents))}
|
||||
(into company-1099/key->handler)
|
||||
(into pos-sales/key->handler)
|
||||
(into pos-expected-deposits/key->handler)
|
||||
(into pos-tenders/key->handler)
|
||||
|
||||
@@ -30,6 +30,15 @@
|
||||
`(with-cursor (get *current* ~field )
|
||||
~@rest))
|
||||
|
||||
(defmacro with-field-default [field default & rest]
|
||||
`(let [next-cursor# (get *current* ~field )
|
||||
next-cursor# (if (nil? @next-cursor#)
|
||||
(cursor/update! next-cursor# default)
|
||||
next-cursor#)]
|
||||
(with-cursor next-cursor#
|
||||
~@rest)))
|
||||
|
||||
|
||||
(defn field-name
|
||||
([] (field-name *current*))
|
||||
([cursor]
|
||||
|
||||
@@ -243,7 +243,8 @@
|
||||
(defn ref->enum-schema [n]
|
||||
(into [:enum {:decode/string #(if (keyword? %)
|
||||
%
|
||||
(keyword n %)
|
||||
(when (not-empty %)
|
||||
(keyword n %))
|
||||
)}]
|
||||
(for [{:db/keys [ident]} (all-schema)
|
||||
:when (= n (namespace ident))]
|
||||
@@ -266,20 +267,6 @@
|
||||
{:value (name ident) :content (str/replace (str/capitalize (name ident)) "-" " ")})))
|
||||
|
||||
|
||||
|
||||
|
||||
(defn wrap-form-4xx [handler]
|
||||
(fn [request]
|
||||
(try+
|
||||
(handler request)
|
||||
|
||||
|
||||
(catch [:type :validation] e
|
||||
(alog/warn ::form-4xx :error e)
|
||||
(html-response [:span.error-content.text-red-500 (:message &throw-context)]
|
||||
:status 400)))))
|
||||
|
||||
|
||||
(defn wrap-form-4xx-2 [handler form-handler]
|
||||
(fn [request]
|
||||
(try+
|
||||
|
||||
Reference in New Issue
Block a user