File tree Expand file tree Collapse file tree 3 files changed +24
-8
lines changed
resources/public/less/page Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 9595 }
9696 }
9797
98- > .max-available > div {
99- display : inline ;
100- margin-left : 0.3rem ;
98+ > .max-available {
99+ & .not-enough {
100+ color : red ;
101+ }
102+ > div {
103+ margin-bottom : 0.3rem ;
104+ > div {
105+ display : inline ;
106+ margin-left : 0.3rem ;
107+ }
108+ }
101109 }
102110 }
103111
Original file line number Diff line number Diff line change 7474 no-job-selected? (nil? @*invoiced-job)
7575 focus-on-element (fn [id _event] (.focus (.getElementById js/document id)))
7676 validations (re/subscribe [:page.new-invoice/validations ])
77+ enough-funding? (:invoice-amount-enough @validations)
7778 tx-in-progress? @(re/subscribe [:page.new-invoice/tx-in-progress? ])
7879 button-disabled? (not (every? true ? (vals @validations)))]
7980 [c-main-layout {:container-opts {:class :new-invoice-main-container }}
120121 [:div.post-label token-display-name]]
121122 [:div.usd-estimate @estimated-usd]
122123 (when show-balance-left?
123- [:div.max-available " Max available:" [c-token-info balance-left job-token-details]])]
124+ [:div.max-available
125+ {:class (when-not enough-funding? " not-enough" )}
126+ [:div " Max available:" [c-token-info balance-left job-token-details]]
127+ [:div.warning
128+ {:style {:visibility (if enough-funding? " hidden" " visible" )}}
129+ " You cannot create an invoice that exceeds the available funds for the job." ]])]
124130 [:div.right-form
125131 [:div.label " Message" ]
126132 [c-textarea-input
Original file line number Diff line number Diff line change 6464 :page.new-invoice/validations
6565 :<- [::form-fields ]
6666 (fn [{:keys [invoiced-job invoice-amount]}]
67- (let [balance-left (get-in invoiced-job [:job :balance-left ])]
67+ (let [balance-left (get-in invoiced-job [:job :balance-left ])
68+ positive-invoice-amount? (and (not (nil? (get invoice-amount :token-amount )))
69+ (> (:token-amount invoice-amount) 0 ))]
6870 {:invoiced-job (not (nil? invoiced-job))
69- :invoice-amount ( and ( not ( nil? ( get invoice-amount :token-amount )))
70- ( > ( :token-amount invoice-amount) 0 )
71- (<= (:token-amount invoice-amount) balance-left))})))
71+ :invoice-amount positive- invoice-amount?
72+ :invoice-amount-enough ( or ( not positive- invoice-amount? )
73+ (<= (:token-amount invoice-amount) balance-left))})))
You can’t perform that action at this time.
0 commit comments