diff --git a/src/clj/auto_ap/ssr/ledger/profit_and_loss.clj b/src/clj/auto_ap/ssr/ledger/profit_and_loss.clj index bc65ddf4..e869355c 100644 --- a/src/clj/auto_ap/ssr/ledger/profit_and_loss.clj +++ b/src/clj/auto_ap/ssr/ledger/profit_and_loss.clj @@ -129,7 +129,17 @@ (let [{:keys [client warning]} (maybe-trim-clients request client) {:keys [data report]} (get-report (assoc-in request [:form-params :client] client)) client-count (count (set (map :client-id (:data data)))) - table-contents (concat-tables (concat (:summaries report) (:details report)))] + table-contents (concat-tables (concat (:summaries report) (:details report))) + warning-text (not-empty (str/join "\n " (filter not-empty [warning (:warning report)]))) + sample-links (when (can? (:identity request) + {:subject :history + :activity :view}) + (seq (for [n (:invalid-ids report)] + [:div + (com/link {:href (str (bidi/path-for ssr-routes/only-routes + :admin-history) + "/" n)} + "Sample")])))] (list [:div.text-2xl.font-bold.text-gray-600 (str "Profit and loss - " (str/join ", " (map :client/name client)))] (table {:widths (into [20] (take (dec (cell-count table-contents)) @@ -140,18 +150,8 @@ [13 6]))))) :investigate-url (bidi.bidi/path-for ssr-routes/only-routes ::route/investigate) :table table-contents - :warning [:div - (not-empty (str (str/join "\n " (filter not-empty [warning (:warning report)])))) - - (when (can? (:identity request) - {:subject :history - :activity :view}) - (for [n (:invalid-ids report)] - [:div - (com/link {:href (str (bidi/path-for ssr-routes/only-routes - :admin-history) - "/" n)} - "Sample")]))]}))))]) + :warning (when (or warning-text sample-links) + [:div warning-text sample-links])}))))]) (defn form* [request & children] (let [params (or (:query-params request) {})]