big ui improvemet
This commit is contained in:
@@ -196,7 +196,7 @@
|
||||
:action-buttons (fn [request]
|
||||
[(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-new-dialog))
|
||||
:hx-target "#modal-holder"
|
||||
:hx-target "#modal-content"
|
||||
:hx-swap "innerHTML"
|
||||
:color :primary}
|
||||
"New Transaction Rule")])
|
||||
@@ -204,7 +204,7 @@
|
||||
[(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-edit-dialog
|
||||
:db/id (:db/id entity)))
|
||||
:hx-target "#modal-holder"
|
||||
:hx-target "#modal-content"
|
||||
:hx-swap "innerHTML"}
|
||||
svg/pencil)])
|
||||
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
@@ -409,154 +409,153 @@
|
||||
svg/x))))
|
||||
|
||||
;; TODO dialog is no longer closeable
|
||||
(defn dialog* [& {:keys [ entity form-params form-errors]}]
|
||||
(defn dialog* [& {:keys [entity form-params form-errors]}]
|
||||
(com/modal
|
||||
{:modal-class "max-w-4xl"}
|
||||
(com/modal-card
|
||||
{}
|
||||
[:div.flex [:div.p-2 "Transaction Rule"] ]
|
||||
[:form#edit-form (merge {:hx-ext "response-targets"
|
||||
:hx-swap "outerHTML swap:300ms"
|
||||
:hx-target "#modal-holder"
|
||||
:hx-target-400 "#form-errors .error-content"
|
||||
#_#_:x-trap "true"}
|
||||
form-params)
|
||||
[:fieldset {:class "hx-disable" :hx-disinherit "hx-target"}
|
||||
|
||||
(fc/start-form entity form-errors
|
||||
[:div.space-y-2
|
||||
(when-let [id (:db/id entity)]
|
||||
(com/hidden {:name "db/id"
|
||||
:value id}))
|
||||
{:modal-class "max-w-4xl"}
|
||||
(com/modal-card
|
||||
{}
|
||||
[:div.flex [:div.p-2 "Transaction Rule"]]
|
||||
[:form#edit-form (merge {:hx-ext "response-targets"
|
||||
:hx-swap "outerHTML swap:300ms"
|
||||
:hx-target "#modal-holder"
|
||||
:hx-target-400 "#form-errors .error-content"
|
||||
:x-trap "true"}
|
||||
form-params)
|
||||
[:fieldset {:class "hx-disable" :hx-disinherit "hx-target"}
|
||||
|
||||
(fc/with-field :transaction-rule/client
|
||||
(fc/start-form entity form-errors
|
||||
[:div.space-y-2
|
||||
(when-let [id (:db/id entity)]
|
||||
(com/hidden {:name "db/id"
|
||||
:value id}))
|
||||
|
||||
(com/validated-field
|
||||
{:label "Client"
|
||||
:errors (fc/field-errors)}
|
||||
[:div.w-96
|
||||
(com/typeahead-2 {:name (fc/field-name)
|
||||
:x-init "$el.focus()"
|
||||
:error? (fc/error?)
|
||||
:class "w-96"
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :company-search)
|
||||
:id (str "form-client-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (fn [c] (cond->> c
|
||||
(nat-int? c) (dc/pull (dc/db conn) '[:client/name])
|
||||
true :client/name))})]))
|
||||
|
||||
(fc/with-field :transaction-rule/client
|
||||
|
||||
(fc/with-field :transaction-rule/bank-account
|
||||
(com/validated-field {:label "Bank Account"
|
||||
:errors (fc/field-errors)}
|
||||
[:div#bank-account-spot.w-96 {:hx-get (bidi/path-for ssr-routes/only-routes :bank-account-typeahead)
|
||||
:hx-trigger (hx/trigger-field-change :name "transaction-rule/client"
|
||||
:from "#edit-form")
|
||||
:hx-swap "innerHTML"
|
||||
:hx-ext "rename-params"
|
||||
:hx-include "#edit-form"
|
||||
:hx-vals (hx/vals {:name (fc/field-name)})
|
||||
:hx-rename-params-ex (cheshire/generate-string {"transaction-rule/client" "client-id"
|
||||
"name" "name"})}
|
||||
(bank-account-typeahead* {:client-id ((some-fn :db/id identity) (:transaction-rule/client entity))
|
||||
:name (fc/field-name)
|
||||
:value (fc/field-value)})]))
|
||||
(com/validated-field
|
||||
{:label "Client"
|
||||
:errors (fc/field-errors)}
|
||||
[:div.w-96
|
||||
(com/typeahead-2 {:name (fc/field-name)
|
||||
:x-init "$el.focus()"
|
||||
:error? (fc/error?)
|
||||
:class "w-96"
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :company-search)
|
||||
:id (str "form-client-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (fn [c] (cond->> c
|
||||
(nat-int? c) (dc/pull (dc/db conn) '[:client/name])
|
||||
true :client/name))})]))
|
||||
|
||||
(fc/with-field :transaction-rule/description
|
||||
(com/validated-field {:label "Description"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:error? (fc/error?)
|
||||
:placeholder "HOME DEPOT"
|
||||
:class "w-96"
|
||||
:value (fc/field-value)})))
|
||||
(fc/with-field :transaction-rule/bank-account
|
||||
(com/validated-field {:label "Bank Account"
|
||||
:errors (fc/field-errors)}
|
||||
[:div#bank-account-spot.w-96 {:hx-get (bidi/path-for ssr-routes/only-routes :bank-account-typeahead)
|
||||
:hx-trigger (hx/trigger-field-change :name "transaction-rule/client"
|
||||
:from "#edit-form")
|
||||
:hx-swap "innerHTML"
|
||||
:hx-ext "rename-params"
|
||||
:hx-include "#edit-form"
|
||||
:hx-vals (hx/vals {:name (fc/field-name)})
|
||||
:hx-rename-params-ex (cheshire/generate-string {"transaction-rule/client" "client-id"
|
||||
"name" "name"})}
|
||||
(bank-account-typeahead* {:client-id ((some-fn :db/id identity) (:transaction-rule/client entity))
|
||||
:name (fc/field-name)
|
||||
:value (fc/field-value)})]))
|
||||
|
||||
(com/field {:label "Amount"}
|
||||
[:div.flex.gap-2
|
||||
(fc/with-field :transaction-rule/amount-gte
|
||||
[:div.flex.flex-col
|
||||
(com/money-input {:name (fc/field-name)
|
||||
:placeholder ">="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})
|
||||
(com/errors {:errors (fc/field-errors)})])
|
||||
(fc/with-field :transaction-rule/amount-lte
|
||||
[:div.flex.flex-col
|
||||
(com/money-input {:name (fc/field-name)
|
||||
:placeholder "<="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})
|
||||
(com/errors {:errors (fc/field-errors)})])])
|
||||
(fc/with-field :transaction-rule/description
|
||||
(com/validated-field {:label "Description"
|
||||
:errors (fc/field-errors)}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:error? (fc/error?)
|
||||
:placeholder "HOME DEPOT"
|
||||
:class "w-96"
|
||||
:value (fc/field-value)})))
|
||||
|
||||
(com/field {:label "Day of month"}
|
||||
[:div.flex.gap-2
|
||||
(fc/with-field :transaction-rule/dom-gte
|
||||
(com/validated-field
|
||||
{:errors (fc/field-errors)}
|
||||
(com/int-input {:name (fc/field-name)
|
||||
:placeholder ">="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})))
|
||||
(fc/with-field :transaction-rule/dom-lte
|
||||
(com/validated-field
|
||||
{:errors (fc/field-errors)}
|
||||
(com/int-input {:name (fc/field-name)
|
||||
:placeholder ">="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})))])
|
||||
(com/field {:label "Amount"}
|
||||
[:div.flex.gap-2
|
||||
(fc/with-field :transaction-rule/amount-gte
|
||||
[:div.flex.flex-col
|
||||
(com/money-input {:name (fc/field-name)
|
||||
:placeholder ">="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})
|
||||
(com/errors {:errors (fc/field-errors)})])
|
||||
(fc/with-field :transaction-rule/amount-lte
|
||||
[:div.flex.flex-col
|
||||
(com/money-input {:name (fc/field-name)
|
||||
:placeholder "<="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})
|
||||
(com/errors {:errors (fc/field-errors)})])])
|
||||
|
||||
[:h2.text-lg "Outcomes"]
|
||||
(fc/with-field :transaction-rule/vendor
|
||||
(com/validated-field {:label "Assign Vendor"
|
||||
:errors (fc/field-errors)}
|
||||
[:div.w-96
|
||||
(com/typeahead-2 {:name (fc/field-name)
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||
:id (str "form-vendor-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (some-fn :vendor/name #(pull-attr (dc/db conn) :vendor/name %))})]))
|
||||
(com/field {:label "Day of month"}
|
||||
[:div.flex.gap-2
|
||||
(fc/with-field :transaction-rule/dom-gte
|
||||
(com/validated-field
|
||||
{:errors (fc/field-errors)}
|
||||
(com/int-input {:name (fc/field-name)
|
||||
:placeholder ">="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})))
|
||||
(fc/with-field :transaction-rule/dom-lte
|
||||
(com/validated-field
|
||||
{:errors (fc/field-errors)}
|
||||
(com/int-input {:name (fc/field-name)
|
||||
:placeholder ">="
|
||||
:class "w-24"
|
||||
:value (fc/field-value)})))])
|
||||
|
||||
(fc/with-field :transaction-rule/accounts
|
||||
(list
|
||||
(com/data-grid {:headers [(com/data-grid-header {}
|
||||
"Account")
|
||||
(com/data-grid-header {:class "w-32"} "Location")
|
||||
(com/data-grid-header {:class "w-16"} "%")
|
||||
(com/data-grid-header {:class "w-16"})]
|
||||
:id "transaction-rule-account-table"}
|
||||
(when @fc/*current*
|
||||
(doall (for [tra fc/*current*]
|
||||
(fc/with-cursor tra
|
||||
(transaction-rule-account-row* entity tra))))))
|
||||
(com/errors {:errors (fc/field-errors)})))
|
||||
(com/a-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-new-account)
|
||||
:hx-include "#edit-form"
|
||||
:hx-ext "rename-params"
|
||||
:hx-rename-params-ex (cheshire/generate-string {"transaction-rule/client" "client-id"
|
||||
"index" "index"})
|
||||
:hx-vals (hiccup/raw "js:{index: countRows(\"#transaction-rule-account-table\")}")
|
||||
:hx-target "#transaction-rule-account-table tbody"
|
||||
:hx-swap "beforeend"}
|
||||
"New account")
|
||||
(fc/with-field :transaction-rule/transaction-approval-status
|
||||
(com/validated-field {:label "Approval status"
|
||||
:errors (fc/field-errors)}
|
||||
(com/radio {:options (ref->radio-options "transaction-approval-status")
|
||||
:value (fc/field-value)
|
||||
:name (fc/field-name)
|
||||
:orientation :horizontal})))
|
||||
|
||||
[:div#form-errors [:span.error-content
|
||||
(com/errors {:errors (:errors fc/*form-errors*)})]]
|
||||
(com/button {:color :primary :form "edit-form" :type "submit"}
|
||||
"Save")])]]
|
||||
[:div])))
|
||||
[:h2.text-lg "Outcomes"]
|
||||
(fc/with-field :transaction-rule/vendor
|
||||
(com/validated-field {:label "Assign Vendor"
|
||||
:errors (fc/field-errors)}
|
||||
[:div.w-96
|
||||
(com/typeahead-2 {:name (fc/field-name)
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||
:id (str "form-vendor-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (some-fn :vendor/name #(pull-attr (dc/db conn) :vendor/name %))})]))
|
||||
|
||||
(fc/with-field :transaction-rule/accounts
|
||||
(list
|
||||
(com/data-grid {:headers [(com/data-grid-header {}
|
||||
"Account")
|
||||
(com/data-grid-header {:class "w-32"} "Location")
|
||||
(com/data-grid-header {:class "w-16"} "%")
|
||||
(com/data-grid-header {:class "w-16"})]
|
||||
:id "transaction-rule-account-table"}
|
||||
(when @fc/*current*
|
||||
(doall (for [tra fc/*current*]
|
||||
(fc/with-cursor tra
|
||||
(transaction-rule-account-row* entity tra))))))
|
||||
(com/errors {:errors (fc/field-errors)})))
|
||||
(com/a-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-new-account)
|
||||
:hx-include "#edit-form"
|
||||
:hx-ext "rename-params"
|
||||
:hx-rename-params-ex (cheshire/generate-string {"transaction-rule/client" "client-id"
|
||||
"index" "index"})
|
||||
:hx-vals (hiccup/raw "js:{index: countRows(\"#transaction-rule-account-table\")}")
|
||||
:hx-target "#transaction-rule-account-table tbody"
|
||||
:hx-swap "beforeend"}
|
||||
"New account")
|
||||
(fc/with-field :transaction-rule/transaction-approval-status
|
||||
(com/validated-field {:label "Approval status"
|
||||
:errors (fc/field-errors)}
|
||||
(com/radio {:options (ref->radio-options "transaction-approval-status")
|
||||
:value (fc/field-value)
|
||||
:name (fc/field-name)
|
||||
:orientation :horizontal})))
|
||||
|
||||
[:div#form-errors [:span.error-content
|
||||
(com/errors {:errors (:errors fc/*form-errors*)})]]
|
||||
(com/button {:color :primary :form "edit-form" :type "submit" :class "w-32"}
|
||||
"Save")])]]
|
||||
[:div])))
|
||||
|
||||
|
||||
;; TODO Should forms have some kind of helper to render an individual field? saving
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
(ns auto-ap.ssr.components.dialog
|
||||
(:require [hiccup2.core :as hiccup]))
|
||||
(:require [hiccup2.core :as hiccup]
|
||||
[auto-ap.ssr.hx :as hx]))
|
||||
|
||||
(defn modal- [params & children]
|
||||
[:div {:class (str "relative w-full max-h-full " (or (:modal-class params) " max-w-2xl "))
|
||||
"@click.outside" "open=false"}
|
||||
(into [:div#modal-content]
|
||||
children)])
|
||||
[:div#modal-content {:class "flex items-center justify-between pb-2"}
|
||||
children])
|
||||
|
||||
(defn modal-card- [params header content footer]
|
||||
[:div#modal-card params
|
||||
[:div {:class "relative bg-white rounded-lg shadow dark:bg-gray-700 dark:text-white fade-in-settle slide-up-settle duration-300 transition-all modal-content"}
|
||||
[:div {:class "relative bg-white rounded-lg shadow dark:bg-gray-700 dark:text-white modal-content"}
|
||||
[:div {:class "flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600"} header]
|
||||
[:div {:class "p-6 space-y-6"}
|
||||
content]
|
||||
[:div footer]]])
|
||||
|
||||
;; fade-in-settle slide-up-settle duration-300 transition-all
|
||||
|
||||
@@ -80,31 +80,30 @@ c.clearChoices();
|
||||
:active 0
|
||||
:elements (if (:value params)
|
||||
[{:value ((:value-fn params first) (:value params)) :label ((:content-fn params second) (:value params))}]
|
||||
[])})
|
||||
}
|
||||
[])})}
|
||||
[:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes)
|
||||
(hh/add-class "cursor-pointer"))
|
||||
(hh/add-class "cursor-pointer"))
|
||||
"@click.prevent.stop" "open = !open;"
|
||||
"@keydown.enter.prevent.stop" "open = !open;"
|
||||
:x-init (:x-init params)
|
||||
:tabindex 0}
|
||||
:tabindex 0
|
||||
:x-init (:x-init params)}
|
||||
[:input (-> params
|
||||
(dissoc :class)
|
||||
(dissoc :value-fn)
|
||||
(dissoc :content-fn)
|
||||
(dissoc :x-init)
|
||||
|
||||
(dissoc :placeholder)
|
||||
(assoc
|
||||
"x-ref" "hidden"
|
||||
:type "hidden"
|
||||
":value" "value.value"
|
||||
:x-init "$watch('value', v => $dispatch('change'))"))]
|
||||
[:div.flex.w-full.justify-items-stretch
|
||||
(assoc
|
||||
"x-ref" "hidden"
|
||||
:type "hidden"
|
||||
":value" "value.value"
|
||||
:x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))]
|
||||
[:div.flex.w-full.justify-items-stretch
|
||||
[:span.flex-grow.text-left {"x-text" "value.label"}]
|
||||
[:div {:class "w-5 h-5 inline ml-1 justify-self-end"}
|
||||
svg/drop-down]]]
|
||||
|
||||
[:ul.dropdown-contents {:class "absolute bg-white rounded-lg shadow-lg py-1 w-max z-10 mt-1"
|
||||
|
||||
[:ul.dropdown-contents {:class "absolute bg-gray-50 dark:bg-gray-600 rounded-lg shadow-lg py-1 w-max z-10 mt-1"
|
||||
"@keydown.escape.window" "open = false"
|
||||
"x-transition:enter" "ease-[cubic-bezier(.3,2.3,.6,1)] duration-200"
|
||||
"x-transition:enter-start" "!opacity-0 !mt-0"
|
||||
@@ -112,9 +111,9 @@ c.clearChoices();
|
||||
"x-transition:leave" "ease-out duration-200"
|
||||
"x-transition:leave-start" "!opacity-1 !mt-1"
|
||||
"x-transition:leave-end" "!opacity-0 !mt-0"
|
||||
"x-show ""open"
|
||||
"x-show " "open"
|
||||
"x-trap" "open"
|
||||
"@click.outside" "open=false"}
|
||||
"@click.outside" "open=false; console.log('is this ihid')"}
|
||||
[:input {:type "text" :class (hh/add-class (or (:class params) "") default-input-classes)
|
||||
"x-model" "search"
|
||||
"placeholder" (:placeholder params)
|
||||
@@ -124,16 +123,15 @@ c.clearChoices();
|
||||
"x-init" "$watch('search', s => { if($el.value.length > 2) {fetch(baseUrl + s).then(data=>data.json()).then(data => {elements = data; active=-1}) }})"}]
|
||||
[:div.dropdown-options
|
||||
[:template {:x-for "(element, index) in elements"}
|
||||
[:li [:a {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500"
|
||||
[:li [:a {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-300 [&.active]:dark:bg-primary-700 text-gray-800 dark:text-gray-100"
|
||||
:href "#"
|
||||
":class" "active == index ? 'active' : ''"
|
||||
"@mouseover" "active = index"
|
||||
"@mouseout" "active = -1"
|
||||
"@click.prevent" "value = element; open=false; "
|
||||
"x-html" "element.label"
|
||||
}]]]
|
||||
"x-html" "element.label"}]]]
|
||||
[:template {:x-if "elements.length == 0"}
|
||||
[:li {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500 text-gray-500 text-xs "}
|
||||
[:li {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500 text-gray-800 dark:text-gray-100 text-xs "}
|
||||
"No results found"]]]]])
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
[:script {:type "text/javascript" :src "https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/js/datepicker-full.min.js"}]
|
||||
|
||||
|
||||
[:link {:rel "stylesheet" :href "https://cdn.jsdelivr.net/npm/choices.js@9.0.1/public/assets/styles/choices.min.css"}]
|
||||
[:script {:src "https://cdn.jsdelivr.net/npm/choices.js@9.0.1/public/assets/scripts/choices.min.js"}]
|
||||
[:script {:src "https://unpkg.com/htmx.org/dist/ext/response-targets.js"}]
|
||||
@@ -55,46 +54,39 @@ input::-webkit-inner-spin-button {
|
||||
}
|
||||
input[type=number] {
|
||||
-moz-appearance:textfield; /* Firefox */
|
||||
}
|
||||
} "]
|
||||
|
||||
"
|
||||
|
||||
]
|
||||
[:body {:hx-ext "disable-submit"
|
||||
"x-data" (hx/json {:modalOpen false})}
|
||||
[:body {:hx-ext "disable-submit"}
|
||||
contents
|
||||
[:script {:src "/js/flowbite.min.js"}]
|
||||
[:div
|
||||
{"x-data" (hx/json {"open" false})
|
||||
[:div#modal-holder
|
||||
{:tabindex "-1", :class "fixed top-0 left-0 z-[99] flex items-center justify-center w-screen h-screen"
|
||||
"x-show" "open"
|
||||
":aria-hidden" "!open"
|
||||
"x-data" (hx/json {"open" false})
|
||||
"@modalopen.document" "open=true"
|
||||
"@modalclose.document" "open=false"}
|
||||
|
||||
[:div#modal-holder
|
||||
{ :tabindex "-1", :class "fixed top-0 left-0 right-0 z-50 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full flex justify-center"
|
||||
":class" "open ? '' : 'hidden'"
|
||||
":aria-hidden" "!open"
|
||||
}]
|
||||
[:div {:class " bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40"
|
||||
":class" "open ? '' : 'hidden'"
|
||||
|
||||
[:div {:class "bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40"
|
||||
"x-show" "open"
|
||||
":aria-hidden" "!open"
|
||||
}]
|
||||
#_[:script {:lang "text/javascript"}
|
||||
(hiccup/raw "
|
||||
var modal_element = document.getElementById('modal-holder');
|
||||
var modal_options = {
|
||||
placement: 'center',
|
||||
backdrop: 'dynamic',
|
||||
backdropClasess: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40',
|
||||
closable: false,
|
||||
onOpen: function() {
|
||||
htmx.trigger(document.getElementById('modal-holder'), 'modalOpened', {});
|
||||
"x-transition:enter" "duration-300"
|
||||
"x-transition:enter-start" "!bg-opacity-0"
|
||||
"x-transition:enter-end" "!bg-opacity-50"
|
||||
"x-transition:leave" "duration-300"
|
||||
"x-transition:leave-start" "!bg-opacity-50"
|
||||
"x-transition:leave-end" "!bg-opacity-0"}
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
htmx.trigger(document.getElementById('modal-holder'), 'modalClosed', {});
|
||||
},
|
||||
};
|
||||
var curModal = new Modal(modal_element, modal_options);
|
||||
")
|
||||
[:div.flex.place-items-center.place-content-center.w-full.h-full.p-12
|
||||
[:div {:class (str "w-full sm:max-w-4xl sm:rounded-lg overflow-scroll max-h-full sm:max-h-[80vh]")
|
||||
"@click.outside" "open=false"
|
||||
"x-trap.inert" "open"
|
||||
"x-show" "open"
|
||||
"x-transition:enter" "ease-out duration-300"
|
||||
"x-transition:enter-start" "!bg-opacity-0 !translate-y-32"
|
||||
"x-transition:enter-end" "!bg-opacity-100 !translate-y-0"
|
||||
"x-transition:leave" "duration-300"
|
||||
"x-transition:leave-start" "!opacity-100 !translate-y-0"
|
||||
"x-transition:leave-end" "!opacity-0 !translate-y-32"}
|
||||
|
||||
]]]]))
|
||||
[:div#modal-content {:class "flex items-center justify-between pb-2"}]]]]]]]))
|
||||
|
||||
31
src/cljc/auto_ap/extract-line-items-from-invoice.repl
Normal file
31
src/cljc/auto_ap/extract-line-items-from-invoice.repl
Normal file
@@ -0,0 +1,31 @@
|
||||
;; This buffer is for Clojure experiments and evaluation.
|
||||
|
||||
;; Press C-j to evaluate the last expression.
|
||||
|
||||
;; You can also press C-u C-j to evaluate the expression and pretty-print its result.
|
||||
|
||||
(user/init-repl)
|
||||
|
||||
(dc/q '[:find ?nc
|
||||
:in $ ?c
|
||||
:where
|
||||
[?je :journal-entry/client ?c]
|
||||
]
|
||||
[:client/code "NGOP"])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(->>
|
||||
(:line-items (first (:line-item-groups (first p))))
|
||||
(map (fn [li]
|
||||
(->> (:line-item-expense-fields li)
|
||||
(map
|
||||
(fn [field]
|
||||
[(:text (:label-detection field)) (:text (:value-detection field))])
|
||||
)
|
||||
(filter first)
|
||||
(into {}))))
|
||||
(clojure.data.json/pprint))
|
||||
|
||||
Reference in New Issue
Block a user