added ability to unvoid invoice
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
{:venia/queries [[:invoice_page
|
||||
(assoc params
|
||||
:client-id (:id @(re-frame/subscribe [::subs/client])))
|
||||
[[:invoices [:id :total :outstanding-balance :invoice-number :date
|
||||
[[:invoices [:id :total :outstanding-balance :invoice-number :date :status
|
||||
[:vendor [:name :id]]
|
||||
[:expense_accounts [:amount :id :expense_account_id :location
|
||||
[:expense_account [:id :name :location [:parent [:id :name]]]]]]
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
|
||||
(defn invoice-table [{:keys [id invoice-page status on-params-change vendors params check-boxes checked on-check-changed on-edit-invoice on-void-invoice expense-event]}]
|
||||
(defn invoice-table [{:keys [id invoice-page status on-params-change vendors params check-boxes checked on-check-changed on-edit-invoice on-void-invoice on-unvoid-invoice expense-event]}]
|
||||
(let [visible-checks @(re-frame/subscribe [::visible-checks])
|
||||
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
||||
selected-client @(re-frame/subscribe [::subs/client])
|
||||
@@ -133,7 +133,7 @@
|
||||
}
|
||||
""]]]
|
||||
[:tbody
|
||||
(println checked)
|
||||
|
||||
(if (:loading @status)
|
||||
[:tr
|
||||
[:td {:col-span 5}
|
||||
@@ -148,7 +148,7 @@
|
||||
"checked"
|
||||
"")
|
||||
:on-change (fn [x e] (when on-check-changed
|
||||
(println id i)
|
||||
|
||||
(on-check-changed id i)))} ]])
|
||||
(when-not selected-client
|
||||
[:td (:name client)])
|
||||
@@ -184,10 +184,13 @@
|
||||
(when expense-event
|
||||
[:a.dropdown-item.is-primary {:on-click (dispatch-event (conj expense-event i))} "Change"])]]])
|
||||
[:span {:style {:margin-left "1em"}}]
|
||||
(when on-edit-invoice
|
||||
|
||||
(when (and on-edit-invoice (not= ":voided" (:status i)))
|
||||
[:button.button {:on-click (fn [] (on-edit-invoice i))} [:span.icon [:i.fa.fa-pencil]]])
|
||||
(when (and on-void-invoice (= (:outstanding-balance i) (:total i)))
|
||||
(when (and on-void-invoice (= (:outstanding-balance i) (:total i)) (not= ":voided" (:status i)))
|
||||
[:button.button.is-warning.is-outlined {:on-click (fn [] (on-void-invoice i))} [:span [:span.icon [:i.fa.fa-minus-circle]]]])
|
||||
(when (and on-unvoid-invoice (= ":voided" (:status i)))
|
||||
[:button.button.is-outlined {:on-click (fn [] (on-unvoid-invoice i))} [:span [:span.icon [:i.fa.fa-undo]]]])
|
||||
(when (seq payments)
|
||||
|
||||
[:div.dropdown.is-right {:class (if (= id visible-checks)
|
||||
|
||||
Reference in New Issue
Block a user