diff --git a/resources/input.css b/resources/input.css index b3a7437d..921b1ff9 100644 --- a/resources/input.css +++ b/resources/input.css @@ -109,7 +109,7 @@ .choices__list--multiple { } .choices__inner { - @apply bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:bg-gray-700 p-1 !important; + @apply bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:bg-gray-700 p-1 group-[.has-error]:bg-red-50 group-[.has-error]:border-red-500 group-[.has-error]:text-red-900 group-[.has-error]:placeholder-red-700 group-[.has-error]:focus:ring-red-500 group-[.has-error]:dark:bg-gray-700 group-[.has-error]:focus:border-red-500 group-[.has-error]:dark:text-red-500 group-[.has-error]:dark:placeholder-red-500 group-[.has-error]:dark:border-red-500 !important; } .choices:focus-within .choices__inner { diff --git a/resources/public/output.css b/resources/public/output.css index 63b80bcc..fd7ea057 100644 --- a/resources/public/output.css +++ b/resources/public/output.css @@ -2571,6 +2571,32 @@ input:checked + .toggle-bg { --tw-ring-color: rgb(0 156 234 / var(--tw-ring-opacity)) !important; } +.group.has-error .choices__inner { + --tw-border-opacity: 1 !important; + border-color: rgb(255 3 3 / var(--tw-border-opacity)) !important; + --tw-bg-opacity: 1 !important; + background-color: rgb(255 230 230 / var(--tw-bg-opacity)) !important; + --tw-text-opacity: 1 !important; + color: rgb(51 1 1 / var(--tw-text-opacity)) !important; +} + +.group.has-error .choices__inner::-moz-placeholder { + --tw-placeholder-opacity: 1 !important; + color: rgb(153 2 2 / var(--tw-placeholder-opacity)) !important; +} + +.group.has-error .choices__inner::placeholder { + --tw-placeholder-opacity: 1 !important; + color: rgb(153 2 2 / var(--tw-placeholder-opacity)) !important; +} + +.group.has-error .choices__inner:focus { + --tw-border-opacity: 1 !important; + border-color: rgb(255 3 3 / var(--tw-border-opacity)) !important; + --tw-ring-opacity: 1 !important; + --tw-ring-color: rgb(255 3 3 / var(--tw-ring-opacity)) !important; +} + :is(.dark .choices__inner) { --tw-border-opacity: 1 !important; border-color: rgb(75 85 99 / var(--tw-border-opacity)) !important; @@ -2597,6 +2623,25 @@ input:checked + .toggle-bg { --tw-ring-color: rgb(0 156 234 / var(--tw-ring-opacity)) !important; } +.group.has-error :is(.dark .choices__inner) { + --tw-border-opacity: 1 !important; + border-color: rgb(255 3 3 / var(--tw-border-opacity)) !important; + --tw-bg-opacity: 1 !important; + background-color: rgb(55 65 81 / var(--tw-bg-opacity)) !important; + --tw-text-opacity: 1 !important; + color: rgb(255 3 3 / var(--tw-text-opacity)) !important; +} + +.group.has-error :is(.dark .choices__inner)::-moz-placeholder { + --tw-placeholder-opacity: 1 !important; + color: rgb(255 3 3 / var(--tw-placeholder-opacity)) !important; +} + +.group.has-error :is(.dark .choices__inner)::placeholder { + --tw-placeholder-opacity: 1 !important; + color: rgb(255 3 3 / var(--tw-placeholder-opacity)) !important; +} + .choices:focus-within .choices__inner { --tw-border-opacity: 1 !important; border-color: rgb(0 156 234 / var(--tw-border-opacity)) !important; @@ -2945,6 +2990,41 @@ input:checked + .toggle-bg { color: rgb(17 24 39 / var(--tw-text-opacity)); } +.group.has-error .group-\[\.has-error\]\:border-red-500 { + --tw-border-opacity: 1; + border-color: rgb(255 3 3 / var(--tw-border-opacity)); +} + +.group.has-error .group-\[\.has-error\]\:bg-red-50 { + --tw-bg-opacity: 1; + background-color: rgb(255 230 230 / var(--tw-bg-opacity)); +} + +.group.has-error .group-\[\.has-error\]\:text-red-900 { + --tw-text-opacity: 1; + color: rgb(51 1 1 / var(--tw-text-opacity)); +} + +.group.has-error .group-\[\.has-error\]\:placeholder-red-700::-moz-placeholder { + --tw-placeholder-opacity: 1; + color: rgb(153 2 2 / var(--tw-placeholder-opacity)); +} + +.group.has-error .group-\[\.has-error\]\:placeholder-red-700::placeholder { + --tw-placeholder-opacity: 1; + color: rgb(153 2 2 / var(--tw-placeholder-opacity)); +} + +.group.has-error .group-\[\.has-error\]\:focus\:border-red-500:focus { + --tw-border-opacity: 1; + border-color: rgb(255 3 3 / var(--tw-border-opacity)); +} + +.group.has-error .group-\[\.has-error\]\:focus\:ring-red-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(255 3 3 / var(--tw-ring-opacity)); +} + :is(.dark .dark\:block) { display: block; } @@ -3125,6 +3205,11 @@ input:checked + .toggle-bg { color: rgb(255 53 53 / var(--tw-text-opacity)); } +:is(.dark .dark\:text-red-500) { + --tw-text-opacity: 1; + color: rgb(255 3 3 / var(--tw-text-opacity)); +} + :is(.dark .dark\:text-white) { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); @@ -3135,11 +3220,6 @@ input:checked + .toggle-bg { color: rgb(250 202 21 / var(--tw-text-opacity)); } -:is(.dark .dark\:text-red-500) { - --tw-text-opacity: 1; - color: rgb(255 3 3 / var(--tw-text-opacity)); -} - :is(.dark .dark\:placeholder-gray-400)::-moz-placeholder { --tw-placeholder-opacity: 1; color: rgb(156 163 175 / var(--tw-placeholder-opacity)); @@ -3282,6 +3362,31 @@ input:checked + .toggle-bg { color: rgb(255 255 255 / var(--tw-text-opacity)); } +.group.has-error :is(.dark .group-\[\.has-error\]\:dark\:border-red-500) { + --tw-border-opacity: 1; + border-color: rgb(255 3 3 / var(--tw-border-opacity)); +} + +.group.has-error :is(.dark .group-\[\.has-error\]\:dark\:bg-gray-700) { + --tw-bg-opacity: 1; + background-color: rgb(55 65 81 / var(--tw-bg-opacity)); +} + +.group.has-error :is(.dark .group-\[\.has-error\]\:dark\:text-red-500) { + --tw-text-opacity: 1; + color: rgb(255 3 3 / var(--tw-text-opacity)); +} + +.group.has-error :is(.dark .group-\[\.has-error\]\:dark\:placeholder-red-500)::-moz-placeholder { + --tw-placeholder-opacity: 1; + color: rgb(255 3 3 / var(--tw-placeholder-opacity)); +} + +.group.has-error :is(.dark .group-\[\.has-error\]\:dark\:placeholder-red-500)::placeholder { + --tw-placeholder-opacity: 1; + color: rgb(255 3 3 / var(--tw-placeholder-opacity)); +} + @media (min-width: 640px) { .sm\:block { display: block; diff --git a/src/clj/auto_ap/ssr/admin/transaction_rules.clj b/src/clj/auto_ap/ssr/admin/transaction_rules.clj index ed4a4622..17b95695 100644 --- a/src/clj/auto_ap/ssr/admin/transaction_rules.clj +++ b/src/clj/auto_ap/ssr/admin/transaction_rules.clj @@ -341,8 +341,6 @@ (nat-int? value) (dc/pull (dc/db conn) d-accounts/default-read)) client-id)))})]) - - (defn- transaction-rule-account-row* [transaction-rule account] (com/data-grid-row {} @@ -352,56 +350,58 @@ (com/hidden {:name (fc/field-name) :value (fc/field-value)})) (fc/with-field :transaction-rule-account/account - (com/data-grid-cell {} - [:div {:hx-trigger (hx/trigger-field-change :name "transaction-rule/client" - :from "#edit-form") - :hx-include "#edit-form" - :hx-vals (hx/vals {:name account-name}) - :hx-ext "rename-params" - :hx-rename-params-ex (hx/json {:transaction-rule/client "client-id" - :name "name" - account-name "value"}) - :hx-get (str (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-account-typeahead)) - :hx-swap "innerHTML"} - (account-typeahead* {:value (fc/field-value) - :client-id (:db/id (:transaction-rule/client transaction-rule)) - :name (fc/field-name)}) - (println "HERE" (cursor/path fc/*current*)) - (println "DATA "fc/*form-data*) - (println "ERR" fc/*form-errors*) - (println (fc/field-errors)) - (com/errors {:errors (fc/field-errors)})])) + (com/data-grid-cell + {} + (com/validated-field + {:errors (fc/field-errors)} + [:div {:hx-trigger (hx/trigger-field-change :name "transaction-rule/client" + :from "#edit-form") + :hx-include "#edit-form" + :hx-vals (hx/vals {:name account-name}) + :hx-ext "rename-params" + :hx-rename-params-ex (hx/json {:transaction-rule/client "client-id" + :name "name" + account-name "value"}) + :hx-get (str (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-account-typeahead)) + :hx-swap "innerHTML"} + (account-typeahead* {:value (fc/field-value) + :client-id (:db/id (:transaction-rule/client transaction-rule)) + :name (fc/field-name)})]))) (fc/with-field :transaction-rule-account/location - (com/data-grid-cell {} - [:div [:div {:hx-trigger (hx/triggers - (hx/trigger-field-change :name "transaction-rule/client" - :from "#edit-form") - (hx/trigger-field-change :name account-name - :from "#edit-form")) - :hx-include "#edit-form" - :hx-vals (hx/vals {:name (fc/field-name)}) - :hx-ext "rename-params" - :hx-rename-params-ex (hx/json {"transaction-rule/client" "client-id" - account-name "account-id" - "name" "name" - (fc/field-name) "value"}) - :hx-get (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-location-select) - :hx-swap "innerHTML"} - (location-select* {:name (fc/field-name) - :account-location (:account/location (cond->> (:transaction-rule-account/account @account) - (nat-int? (:transaction-rule-account/account @account)) (dc/pull (dc/db conn) - '[:account/location]))) - :client-locations (:client/locations (:transaction-rule/client transaction-rule)) - :value (fc/field-value)})] - (com/errors {:errors (fc/field-errors)})] - )) + (com/data-grid-cell + {} + (com/validated-field + {:errors (fc/field-errors)} + [:div [:div {:hx-trigger (hx/triggers + (hx/trigger-field-change :name "transaction-rule/client" + :from "#edit-form") + (hx/trigger-field-change :name account-name + :from "#edit-form")) + :hx-include "#edit-form" + :hx-vals (hx/vals {:name (fc/field-name)}) + :hx-ext "rename-params" + :hx-rename-params-ex (hx/json {"transaction-rule/client" "client-id" + account-name "account-id" + "name" "name" + (fc/field-name) "value"}) + :hx-get (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-location-select) + :hx-swap "innerHTML"} + (location-select* {:name (fc/field-name) + :account-location (:account/location (cond->> (:transaction-rule-account/account @account) + (nat-int? (:transaction-rule-account/account @account)) (dc/pull (dc/db conn) + '[:account/location]))) + :client-locations (:client/locations (:transaction-rule/client transaction-rule)) + :value (fc/field-value)})]]))) (fc/with-field :transaction-rule-account/percentage - (com/data-grid-cell (com/money-input {:name (fc/field-name) - :class "w-16" - :value (some-> (fc/field-value) - (* 100 ) - (long ))}) - (com/errors {:errors (fc/field-errors)}))))) + (com/data-grid-cell + {} + (com/validated-field + {:errors (fc/field-errors)} + (com/money-input {:name (fc/field-name) + :class "w-16" + :value (some-> (fc/field-value) + (* 100 ) + (long ))})))))) (com/data-grid-cell (com/a-icon-button {"_" (hiccup/raw "on click halt the event then transition the closest