diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-12-14 11:09:12 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-12-14 11:19:32 +0100 |
| commit | 081f38f2c1c442daea714651093dbdd4d441f38f (patch) | |
| tree | 0d0b71d39ca8c0e5becdc19686f4b27ae38fe467 | |
| parent | 1e98c940c5a133fc20a05ea9cd5b4a6cf561c349 (diff) | |
Tweak minor presentation details.
| -rw-r--r-- | views.rkt | 66 |
1 files changed, 33 insertions, 33 deletions
@@ -68,12 +68,12 @@ (ul ((class "navbar-nav me-auto mb-2 mb-lg-0")) (li ((class "nav-item")) (a ((class "nav-link disabled") [href "#"] [tabindex "-1"] [aria-disabled "true"]) - "Clients")) + "Facturation Pro")) (li ((class "nav-item")) (a ((class "nav-link active") [aria-current "page"] [href "/ferti/index"]) "Ferti")) (li ((class "nav-item")) (a ((class "nav-link disabled") [href "#"] [tabindex "-1"] [aria-disabled "true"]) - "Cultures")) + "Inventaire")) (li ((class "nav-item")) (a ((class "nav-link") [href "/contact"]) "Contact"))))))) ;; Page helpers @@ -117,12 +117,12 @@ (define table `(table ((class "table")) - (thead (tr (th "Date du relevé") (th "Relevé") (th "Cultures") (th "Recette"))) + (thead (tr (th "Date du relevé") (th "Relevé") (th "Assolement") (th "Recette"))) (tbody ,@ (for/list ([m measurements]) (define maybe-rotation (maybe-rotation-for-measurement m)) - `(tr (td ((class "font-monospace")) ,(normal-date (nutrient-measurement-date m))) + `(tr (td ((class "font-monospace align-middle")) ,(normal-date (nutrient-measurement-date m))) (td (a ((class "btn btn-outline-secondary btn-sm") (href ,(format "/ferti/measurements/~a" (nutrient-measurement-id m)))) "Voir")) @@ -144,18 +144,17 @@ "Ajouter un relevé")) ,table))) +;; TODO: add bar chart for comparing to target concentrations (define (ferti-recipe-page recipe-date fertilizer-recipe) (define table `(table ((class "table")) - (thead (tr (th "Intrant") (th ((class "text-end")) "Quantité (g)"))) + (thead (tr (th "Intrant") (th "Marque") (th ((class "text-end")) "Quantité (g)"))) (tbody ,@(for/list ([(fertilizer quantity) (in-hash fertilizer-recipe)] #:when (not (zero? quantity))) - `(tr (td () - ,(let ([canonical-name (fertilizer-product-name fertilizer)] - [brand-name (fertilizer-brand-name fertilizer)]) - (if brand-name - (format "~a (~a)" brand-name canonical-name) - canonical-name))) + (define canonical-name (fertilizer-product-name fertilizer)) + (define brand-name (fertilizer-brand-name fertilizer)) + `(tr (td ,canonical-name) + (td ,(if (non-empty-string? brand-name) brand-name "—")) (td ((class "text-end font-monospace")) ,(round 2 (* 100 quantity)))))))) (ferti-template `((h2 () ,(format "Recette du ~a" (normal-date recipe-date))) (p "Quantités calculées pour 100'000 L.") @@ -178,13 +177,14 @@ (define (ferti-crop-requirements-page crop-requirements) (define table `(table ((class "table table-striped")) - (tr (th "Culture") (th "Profil")) + (tr (th "Profil") (th "Culture")) ,@(for/list ([cr crop-requirements]) (define crop-id (crop-requirement-crop-id cr)) - `(tr (td ,(if crop-id + `(tr (td (a ((href ,(format "/ferti/crop-requirements/~a" (crop-requirement-id cr)))) + ,(string-titlecase (crop-requirement-profile cr)))) + (td ,(if crop-id (string-titlecase (crop-name (get-crop #:id crop-id))) - "—")) - (td ,(string-titlecase (crop-requirement-profile cr))))))) + "—")))))) (ferti-template `((h2 () "Profils de culture") (a ((class "btn btn-primary mb-3") [href "/ferti/crop-requirements/new"]) "Ajouter un profil") @@ -232,26 +232,27 @@ (define (show-measurement-page nm) (define title (format "Relevé du ~a" (normal-date (nutrient-measurement-date nm)))) (define table - `(table ((class "table")) + `(table ((class "table") (style "max-width: 30em")) (thead (tr (th "Nutriment") (th ((class "text-end")) "Concentration (mg/L)"))) (tbody ,@(for/list ([n (get-nutrients)]) (define nutrient-value (hash-ref (nutrient-measurement-values nm) n 0)) `(tr (td ,(nutrient-french-name n)) (td ((class "text-end font-monospace")) ,(round 2 nutrient-value))))))) (define button-group - `(div ((class "btn-group")) + `(div ((class "btn-group mb-3")) (a ((class "btn btn-primary") [href ,(format "/ferti/measurements/~a/edit" (nutrient-measurement-id nm))]) - "Modifier relevé") + "Modifier") (a ((class "btn btn-danger") [href ,(format "/ferti/measurements/~a/destroy" (nutrient-measurement-id nm))]) - "Supprimer relevé"))) + "Supprimer"))) (page-template title `((h1 ((class "display-1 mb-3")) ,title) ,button-group ,table))) (define (show-rotation-page cr) + (define id (crop-rotation-id cr)) (define title (format "Assolement du ~a" (normal-date (crop-rotation-date cr)))) (define table - `(table ((class "table")) + `(table ((class "table") (style "max-width: 30em")) (thead (tr (th "Type de culture") (th ((class "text-end")) "Proportion (%)"))) (tbody ,@(for/list ([requirement (get-crop-requirements)]) (define requirement-proportion @@ -259,31 +260,30 @@ `(tr (td ,(crop-requirement-profile requirement)) (td ((class "text-end font-monospace")) ,(round 2 requirement-proportion))))))) - (page-template title - `((h1 ((class "display-1 mb-3")) ,title) - (a ((class "btn btn-danger") - [href ,(format "/ferti/rotations/~a/destroy" (crop-rotation-id cr))]) - "Supprimer assolement") - ,table))) + (define button-group + `(div ((class "btn-group mb-3")) + (a ((class "btn btn-primary") [href ,(format "/ferti/rotations/~a/edit" id)]) "Modifier") + (a ((class "btn btn-danger") + [href ,(format "/ferti/rotations/~a/destroy" (crop-rotation-id cr))]) + "Supprimer"))) + (page-template title `((h1 ((class "display-1 mb-3")) ,title) ,button-group ,table))) (define (show-fertilizer-page fp) + (define id (fertilizer-product-id fp)) (define product-name (fertilizer-product-name fp)) (define brand-name (fertilizer-brand-name fp)) (define sorted-nutrient-values (get-sorted-nutrient-values (fertilizer-product-values fp))) (define table - `(table ((class "table")) + `(table ((class "table") (style "max-width: 30em")) (thead (tr (th "Nutriment") (th ((class "text-end")) "Concentration (mg/L)"))) (tbody ,@(for/list ([nv-pair sorted-nutrient-values]) (match-define (cons n v) nv-pair) `(tr (td ,(nutrient-french-name n)) (td ((class "text-end font-monospace")) ,(round 2 v))))))) (define button-group - `(div ((class "btn-group")) - (a ((class "btn btn-primary") - [href ,(format "/ferti/fertilizers/~a/edit" (fertilizer-product-id fp))]) - "Modifier") - (a ((class "btn btn-danger") - [href ,(format "/ferti/fertilizers/~a/destroy" (fertilizer-product-id fp))]) + `(div ((class "btn-group mb-3")) + (a ((class "btn btn-primary") [href ,(format "/ferti/fertilizers/~a/edit" id)]) "Modifier") + (a ((class "btn btn-danger") [href ,(format "/ferti/fertilizers/~a/destroy" id)]) "Supprimer"))) (page-template product-name `((h1 ((class "display-1 mb-3")) ,(or brand-name "Intrant générique")) |