Tweak minor presentation details.

Commit
bc14a885949e00d00d95efa3098d466eb4d98c6e
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
views.rkt
index e46843fb..d914f520 100644..100644
@@ -68,12 +68,12 @@
68 68 (ul ((class "navbar-nav me-auto mb-2 mb-lg-0"))
69 69 (li ((class "nav-item"))
70 70 (a ((class "nav-link disabled") [href "#"] [tabindex "-1"] [aria-disabled "true"])
71 Removed: "Clients"))
71 Added: "Facturation Pro"))
72 72 (li ((class "nav-item"))
73 73 (a ((class "nav-link active") [aria-current "page"] [href "/ferti/index"]) "Ferti"))
74 74 (li ((class "nav-item"))
75 75 (a ((class "nav-link disabled") [href "#"] [tabindex "-1"] [aria-disabled "true"])
76 Removed: "Cultures"))
76 Added: "Inventaire"))
77 77 (li ((class "nav-item")) (a ((class "nav-link") [href "/contact"]) "Contact")))))))
78 78
79 79 ;; Page helpers
@@ -117,7 +117,7 @@
117 117 (define table
118 118 `(table
119 119 ((class "table"))
120 Removed: (thead (tr (th "Date du relevé") (th "Relevé") (th "Cultures") (th "Recette")))
120 Added: (thead (tr (th "Date du relevé") (th "Relevé") (th "Assolement") (th "Recette")))
121 121 (tbody
122 122 ,@
123 123 (for/list ([m measurements])
@@ -144,18 +144,17 @@
144 144 "Ajouter un relevé"))
145 145 ,table)))
146 146
147 Added: ;; TODO: add bar chart for comparing to target concentrations
147 148 (define (ferti-recipe-page recipe-date fertilizer-recipe)
148 149 (define table
149 150 `(table ((class "table"))
150 Removed: (thead (tr (th "Intrant") (th ((class "text-end")) "Quantité (g)")))
151 Added: (thead (tr (th "Intrant") (th "Marque") (th ((class "text-end")) "Quantité (g)")))
151 152 (tbody ,@(for/list ([(fertilizer quantity) (in-hash fertilizer-recipe)]
152 153 #:when (not (zero? quantity)))
153 Removed: `(tr (td ()
154 Removed: ,(let ([canonical-name (fertilizer-product-name fertilizer)]
155 Removed: [brand-name (fertilizer-brand-name fertilizer)])
156 Removed: (if brand-name
157 Removed: (format "~a (~a)" brand-name canonical-name)
158 Removed: canonical-name)))
154 Added: (define canonical-name (fertilizer-product-name fertilizer))
155 Added: (define brand-name (fertilizer-brand-name fertilizer))
156 Added: `(tr (td ,canonical-name)
157 Added: (td ,(if (non-empty-string? brand-name) brand-name "—"))
159 158 (td ((class "text-end font-monospace")) ,(round 2 (* 100 quantity))))))))
160 159 (ferti-template `((h2 () ,(format "Recette du ~a" (normal-date recipe-date)))
161 160 (p "Quantités calculées pour 100'000 L.")
@@ -178,13 +177,14 @@
178 177 (define (ferti-crop-requirements-page crop-requirements)
179 178 (define table
180 179 `(table ((class "table table-striped"))
181 Removed: (tr (th "Culture") (th "Profil"))
180 Added: (tr (th "Profil") (th "Culture"))
182 181 ,@(for/list ([cr crop-requirements])
183 182 (define crop-id (crop-requirement-crop-id cr))
184 Removed: `(tr (td ,(if crop-id
183 Added: `(tr (td (a ((href ,(format "/ferti/crop-requirements/~a" (crop-requirement-id cr))))
184 Added: ,(string-titlecase (crop-requirement-profile cr))))
185 Added: (td ,(if crop-id
185 186 (string-titlecase (crop-name (get-crop #:id crop-id)))
186 Removed: "—"))
187 Removed: (td ,(string-titlecase (crop-requirement-profile cr)))))))
187 Added: "—"))))))
188 188 (ferti-template `((h2 () "Profils de culture")
189 189 (a ((class "btn btn-primary mb-3") [href "/ferti/crop-requirements/new"])
190 190 "Ajouter un profil")
@@ -232,26 +232,27 @@
232 232 (define (show-measurement-page nm)
233 233 (define title (format "Relevé du ~a" (normal-date (nutrient-measurement-date nm))))
234 234 (define table
235 Removed: `(table ((class "table"))
235 Added: `(table ((class "table") (style "max-width: 30em"))
236 236 (thead (tr (th "Nutriment") (th ((class "text-end")) "Concentration (mg/L)")))
237 237 (tbody ,@(for/list ([n (get-nutrients)])
238 238 (define nutrient-value (hash-ref (nutrient-measurement-values nm) n 0))
239 239 `(tr (td ,(nutrient-french-name n))
240 240 (td ((class "text-end font-monospace")) ,(round 2 nutrient-value)))))))
241 241 (define button-group
242 Removed: `(div ((class "btn-group"))
242 Added: `(div ((class "btn-group mb-3"))
243 243 (a ((class "btn btn-primary")
244 244 [href ,(format "/ferti/measurements/~a/edit" (nutrient-measurement-id nm))])
245 Removed: "Modifier relevé")
245 Added: "Modifier")
246 246 (a ((class "btn btn-danger")
247 247 [href ,(format "/ferti/measurements/~a/destroy" (nutrient-measurement-id nm))])
248 Removed: "Supprimer relevé")))
248 Added: "Supprimer")))
249 249 (page-template title `((h1 ((class "display-1 mb-3")) ,title) ,button-group ,table)))
250 250
251 251 (define (show-rotation-page cr)
252 Added: (define id (crop-rotation-id cr))
252 253 (define title (format "Assolement du ~a" (normal-date (crop-rotation-date cr))))
253 254 (define table
254 Removed: `(table ((class "table"))
255 Added: `(table ((class "table") (style "max-width: 30em"))
255 256 (thead (tr (th "Type de culture") (th ((class "text-end")) "Proportion (%)")))
256 257 (tbody ,@(for/list ([requirement (get-crop-requirements)])
257 258 (define requirement-proportion
@@ -259,31 +260,30 @@
259 260 `(tr (td ,(crop-requirement-profile requirement))
260 261 (td ((class "text-end font-monospace"))
261 262 ,(round 2 requirement-proportion)))))))
262 Removed: (page-template title
263 Removed: `((h1 ((class "display-1 mb-3")) ,title)
264 Removed: (a ((class "btn btn-danger")
265 Removed: [href ,(format "/ferti/rotations/~a/destroy" (crop-rotation-id cr))])
266 Removed: "Supprimer assolement")
267 Removed: ,table)))
263 Added: (define button-group
264 Added: `(div ((class "btn-group mb-3"))
265 Added: (a ((class "btn btn-primary") [href ,(format "/ferti/rotations/~a/edit" id)]) "Modifier")
266 Added: (a ((class "btn btn-danger")
267 Added: [href ,(format "/ferti/rotations/~a/destroy" (crop-rotation-id cr))])
268 Added: "Supprimer")))
269 Added: (page-template title `((h1 ((class "display-1 mb-3")) ,title) ,button-group ,table)))
268 270
269 271 (define (show-fertilizer-page fp)
272 Added: (define id (fertilizer-product-id fp))
270 273 (define product-name (fertilizer-product-name fp))
271 274 (define brand-name (fertilizer-brand-name fp))
272 275 (define sorted-nutrient-values (get-sorted-nutrient-values (fertilizer-product-values fp)))
273 276 (define table
274 Removed: `(table ((class "table"))
277 Added: `(table ((class "table") (style "max-width: 30em"))
275 278 (thead (tr (th "Nutriment") (th ((class "text-end")) "Concentration (mg/L)")))
276 279 (tbody ,@(for/list ([nv-pair sorted-nutrient-values])
277 280 (match-define (cons n v) nv-pair)
278 281 `(tr (td ,(nutrient-french-name n))
279 282 (td ((class "text-end font-monospace")) ,(round 2 v)))))))
280 283 (define button-group
281 Removed: `(div ((class "btn-group"))
282 Removed: (a ((class "btn btn-primary")
283 Removed: [href ,(format "/ferti/fertilizers/~a/edit" (fertilizer-product-id fp))])
284 Removed: "Modifier")
285 Removed: (a ((class "btn btn-danger")
286 Removed: [href ,(format "/ferti/fertilizers/~a/destroy" (fertilizer-product-id fp))])
284 Added: `(div ((class "btn-group mb-3"))
285 Added: (a ((class "btn btn-primary") [href ,(format "/ferti/fertilizers/~a/edit" id)]) "Modifier")
286 Added: (a ((class "btn btn-danger") [href ,(format "/ferti/fertilizers/~a/destroy" id)])
287 287 "Supprimer")))
288 288 (page-template product-name
289 289 `((h1 ((class "display-1 mb-3")) ,(or brand-name "Intrant générique"))