removed redundant stuff.
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
[vimsical.re-frame.fx.track :as track]
|
||||
[vimsical.re-frame.cofx.inject :as inject]
|
||||
[auto-ap.views.pages.ledger.report-table :as rtable]
|
||||
[auto-ap.forms.builder :as form-builder]))
|
||||
[auto-ap.forms.builder :as form-builder]
|
||||
[auto-ap.views.components :as com]))
|
||||
|
||||
(defn data-params->query-params [params]
|
||||
(when params
|
||||
@@ -190,26 +191,20 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
[:div.level-left
|
||||
[:div.level-item
|
||||
[:div.control
|
||||
[form-builder/field
|
||||
[form-builder/field-v2 {:field :date}
|
||||
"Date"
|
||||
[date-picker {:output :cljs-date
|
||||
:type "date"
|
||||
:field [:date]}]]]]
|
||||
[date-picker {:output :cljs-date}]]]]
|
||||
[:div.level-item
|
||||
[form-builder/field
|
||||
[form-builder/field-v2 {:field :include-comparison}
|
||||
[:div.mt-5]
|
||||
[switch-field {:id "include-comparison"
|
||||
:field [:include-comparison]
|
||||
:label "Include compariison"
|
||||
:type "checkbox"}]]]
|
||||
[com/switch-input {:id "include-comparison"
|
||||
:label "Include compariison"}]]]
|
||||
[:div.level-item
|
||||
|
||||
(when (boolean (:include-comparison data))
|
||||
[form-builder/field
|
||||
[form-builder/field-v2 {:field :comparison-date}
|
||||
"Comparison Date"
|
||||
[date-picker {:output :cljs-date
|
||||
:type "date"
|
||||
:field [:comparison-date]}]])]]
|
||||
[date-picker {:output :cljs-date}]])]]
|
||||
[:div.level-right
|
||||
[:div.buttons
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
[reagent.core :as reagent]
|
||||
[vimsical.re-frame.cofx.inject :as inject]
|
||||
[vimsical.re-frame.fx.track :as track]
|
||||
[auto-ap.forms.builder :as form-builder]))
|
||||
[auto-ap.forms.builder :as form-builder]
|
||||
[auto-ap.views.components :as com]))
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +74,7 @@
|
||||
(cond-> {:graphql {:token user
|
||||
:owns-state {:single ::page}
|
||||
:query-obj {:venia/queries [[:profit-and-loss
|
||||
{:client-ids (map :id (:clients (:data db)))
|
||||
{:client-ids (map (comp :id :client) (:clients (:data db)))
|
||||
:periods (mapv #(select-keys % #{:start :end} ) (:periods (:data db)))
|
||||
:include-deltas (:include-deltas (:data db))
|
||||
:column-per-location (:column-per-location (:data db))}
|
||||
@@ -82,7 +83,7 @@
|
||||
:set-uri-params {:periods (mapv
|
||||
encode-period
|
||||
(:periods (:data db)))
|
||||
:clients (mapv #(select-keys % [:name :id]) (:clients (:data db))) }
|
||||
:clients (mapv #(select-keys (:client %) [:name :id]) (:clients (:data db))) }
|
||||
:db (-> db
|
||||
(dissoc :report)
|
||||
(update-in [:data :clients] #(into [] (filter seq %))))})))
|
||||
@@ -127,14 +128,14 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
(cond-> {:graphql {:token user
|
||||
:owns-state {:single ::page}
|
||||
:query-obj {:venia/queries [[:profit-and-loss-pdf
|
||||
{:client-ids (map :id (:clients (:data db)))
|
||||
{:client-ids (map (:comp :id :client) (:clients (:data db)))
|
||||
:include-deltas (:include-deltas (:data db))
|
||||
:column-per-location (:column-per-location (:data db))
|
||||
:periods (mapv #(select-keys % #{:start :end}) (:periods (:data db)))}
|
||||
[:url :name]]]}
|
||||
:on-success [::received-pdf]}
|
||||
:set-uri-params {:periods (mapv encode-period (:periods (:data db)))
|
||||
:clients (mapv #(select-keys % [:name :id]) (:clients (:data db))) }
|
||||
:clients (mapv #(select-keys (:client %) [:name :id]) (:clients (:data db))) }
|
||||
:db (dissoc db :report)})))
|
||||
|
||||
|
||||
@@ -228,7 +229,6 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
(defn report-control-detail [{:keys [active box which]} children]
|
||||
(when (and @box
|
||||
(= which @active))
|
||||
(println @box)
|
||||
(react-dom/createPortal (reagent/as-element
|
||||
[:div.notification.is-light
|
||||
[:a.delete {:on-click (fn [] (reset! active nil))}]
|
||||
@@ -268,17 +268,17 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
[buttons/dropdown {:on-click (fn [] (reset! active :clients))}
|
||||
[:span (str "Companies"
|
||||
(when-let [clients (:clients data)]
|
||||
(str " (" (str/join ", " (map :name clients)) ")")))]]
|
||||
(str " (" (str/join ", " (map (comp :name :client) clients)) ")")))]]
|
||||
[report-control-detail {:active active :box !box :which :clients}
|
||||
[:div {:style {:width "20em"}}
|
||||
[:h4.subtitle "Companies"]
|
||||
[form-builder/raw-field
|
||||
[multi-field {:type "multi-field"
|
||||
:field [:clients]
|
||||
:template [[typeahead-v3 {:entities @(re-frame/subscribe [::subs/clients])
|
||||
:style {:width "18em"}
|
||||
:entity->text :name
|
||||
:type "typeahead-v3"}]]}]]]]]
|
||||
[form-builder/raw-field-v2 {:field :clients}
|
||||
[com/multi-field-v2 {:new-text "Add another company"
|
||||
:template [[form-builder/raw-field-v2 {:field :client}
|
||||
[com/entity-typeahead {:entities @(re-frame/subscribe [::subs/clients])
|
||||
:style {:width "18em"}
|
||||
:entity->text :name}]]]
|
||||
:key-fn :id}]]]]]
|
||||
[:div.level-item
|
||||
[buttons/dropdown {:on-click (fn [] (reset! active :range))}
|
||||
[:span (str "Range"
|
||||
@@ -291,11 +291,9 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
[:div.control
|
||||
[:div.field.has-addons
|
||||
[:div.control
|
||||
[form-builder/raw-field
|
||||
[form-builder/raw-field-v2 {:field :thirteen-periods-end}
|
||||
[date-picker {:placeholder "End date"
|
||||
:type "date"
|
||||
:output :cljs-date
|
||||
:field [:thirteen-periods-end]}]]]
|
||||
:output :cljs-date}]]]
|
||||
[period-preset-button {:title "13 periods"
|
||||
:periods (let [today (or (some-> (:thirteen-periods-end data))
|
||||
(local-today))]
|
||||
@@ -312,11 +310,9 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
[:div.control
|
||||
[:div.field.has-addons
|
||||
[:div.control
|
||||
[form-builder/raw-field
|
||||
[form-builder/raw-field-v2 {:field :twelve-periods-end}
|
||||
[date-picker {:placeholder "End date"
|
||||
:output :cljs-date
|
||||
:type "date"
|
||||
:field [:twelve-periods-end]}]]]
|
||||
:output :cljs-date}]]]
|
||||
[period-preset-button {:title "12 months"
|
||||
:periods (let [end-date (or (some-> (:twelve-periods-end data))
|
||||
(local-today))
|
||||
@@ -378,22 +374,15 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
:end (local-today)})
|
||||
:title "Full year"}]]
|
||||
[:div
|
||||
[:div.field
|
||||
[:label.checkbox
|
||||
[form-builder/raw-field
|
||||
[:input {:type "checkbox"
|
||||
:field [:show-advanced?]}]]
|
||||
" Show Advanced"]]]
|
||||
[form-builder/raw-field-v2 {:field :show-advanced?}
|
||||
[com/checkbox {:label "Show Advanced"}]
|
||||
]]
|
||||
(when (:show-advanced? data)
|
||||
[form-builder/raw-field
|
||||
[multi-field {:type "multi-field"
|
||||
:field [:periods]
|
||||
:template [[date-picker {:type "date"
|
||||
:output :cljs-date
|
||||
:field [:start]}]
|
||||
[date-picker {:type "date"
|
||||
:output :cljs-date
|
||||
:field [:end]}]]}]])]]]
|
||||
[form-builder/raw-field-v2 {:field :periods}
|
||||
[com/multi-field-v2 {:template [[form-builder/raw-field-v2 {:field :start}
|
||||
[date-picker {:output :cljs-date}]]
|
||||
[form-builder/raw-field-v2 {:field :end}
|
||||
[date-picker {:output :cljs-date}]]]}]])]]]
|
||||
|
||||
[:div.level-item
|
||||
[:div
|
||||
@@ -446,7 +435,7 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
report (l-reports/summarize-pnl pnl-data)
|
||||
table (rtable/concat-tables (concat (:summaries report) (:details report)))]
|
||||
[:div
|
||||
[:h1.title "Profit and Loss - " (str/join ", " (map :name (:clients args)))]
|
||||
[:h1.title "Profit and Loss - " (str/join ", " (map (comp :name :client) (:clients args)))]
|
||||
(when (:warning report)
|
||||
[:div.notification.is-warning.is-light
|
||||
(:warning report)])
|
||||
@@ -487,8 +476,9 @@ NOTE: Please review the transactions we may have question for you here: https://
|
||||
(mapv (fn [period]
|
||||
{:start (str->date (:start period) standard)
|
||||
:end (str->date (:end period) standard)})))
|
||||
:clients (or (:clients qp)
|
||||
[(some-> @(re-frame/subscribe [::subs/client]) (select-keys [:name :id]))])
|
||||
:clients (mapv (fn [c] {:client c :id (random-uuid)})
|
||||
(or (:clients qp)
|
||||
[(some-> @(re-frame/subscribe [::subs/client]) (select-keys [:name :id]) )]))
|
||||
:include-deltas false})
|
||||
::track/register {:id ::ledger-params
|
||||
:subscription [::data-page/params ::ledger]
|
||||
|
||||
Reference in New Issue
Block a user