Migrate journal cards

This commit is contained in:
Daniel J. Summers 2023-08-27 23:05:04 -04:00
parent 907d759a23
commit 00034c0a26
3 changed files with 76 additions and 50 deletions

View File

@ -0,0 +1,40 @@
<?php
$spacer = '<span>&nbsp;</span>'; ?>
<div class="col">
<div class="card h-100">
<div class="card-header p-0 d-flex" role="tool-bar">
<a <?php $page_link("/request/{$request->id}/edit"); ?> class="btn btn-secondary" title="Edit Request">
<span class="material-icons">edit</span>
</a><?php echo $spacer; ?>
<button type="button" class="btn btn-secondary" title="Add Notes" data-bs-toggle="modal"
data-bs-target="#notesModal" hx-get="/components/request/<?php echo $request->id; ?>/add-notes"
hx-target="#notesBody" hx-swap="innerHTML">
<span class="material-icons">comment</span>
</button><?php echo $spacer; ?>
<button type="button" class="btn btn-secondary" title="Snooze Request" data-bs-toggle="modal"
data-bs-target="#snoozeModal" hx-get="/components/request/<?php echo $request->id; ?>/snooze"
hx-target="#snoozeBody" hx-swap="innerHTML">
<span class="material-icons">schedule</span>
</button>
<div class="flex-grow-1"></div>
<button type="button" class="btn btn-success w-25" hx-patch="/request/<?php echo $request->id; ?>/prayed"
title="Mark as Prayed">
<span class="material-icons">done</span>
</button>
</div>
<div class="card-body">
<p class="request-text"><?php echo htmlentities($request->text); ?></p>
</div>
<div class="card-footer text-end text-muted px-1 py-0">
<em><?php
// TODO: relative time, time zone handling, etc.
if (is_null($request->lastPrayed)) {
echo "last activity {$request->asOf}";
} else {
echo "last prayed {$request->lastPrayed}";
} ?>
</em>
</div>
</div>
</div>

View File

@ -9,8 +9,9 @@ if (count($requests) == 0) {
]); ]);
} else { ?> } else { ?>
<section id="journalItems" class="row row-cols-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-4 g-3" hx-target="this" <section id="journalItems" class="row row-cols-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-4 g-3" hx-target="this"
hx-swap="outerHTML" aria-label="Prayer Requests"> hx-swap="outerHTML" aria-label="Prayer Requests"><?php
items foreach ($requests as $request) {
|> List.map (journalCard now tz) echo app()->template->render('components/journal_card', [ 'request' => $request ]);
} ?>
</section><?php </section><?php
} }

View File

@ -8,51 +8,36 @@
<p hx-get="/components/journal-items" hx-swap="outerHTML" hx-trigger="load"> <p hx-get="/components/journal-items" hx-swap="outerHTML" hx-trigger="load">
Loading your prayer journal&hellip; Loading your prayer journal&hellip;
</p> </p>
<!-- <div id="notesModal" class="modal fade" tabindex="-1" aria-labelled-by="nodesModalLabel" aria-hidden="true">
div [ _id "notesModal" <div class="modal-dialog modal-dialog-scrollable">
_class "modal fade" <div class="modal-content">
_tabindex "-1" <div class="modal-header">
_ariaLabelledBy "nodesModalLabel" <h5 class="modal-title" id="nodesModalLabel">Add Notes to Prayer Request</h5>
_ariaHidden "true" ] [ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
div [ _class "modal-dialog modal-dialog-scrollable" ] [ </div>
div [ _class "modal-content" ] [ <div class="modal-body" id="notesBody"></div>
div [ _class "modal-header" ] [ <div class="modal-footer">
h5 [ _class "modal-title"; _id "nodesModalLabel" ] [ str "Add Notes to Prayer Request" ] <button type="button" id="notesDismiss" class="btn btn-secondary" data-bs-dismiss="modal">
button [ _type "button"; _class "btn-close"; _data "bs-dismiss" "modal"; _ariaLabel "Close" ] [] Close
] </button>
div [ _class "modal-body"; _id "notesBody" ] [ ] </div>
div [ _class "modal-footer" ] [ </div>
button [ _type "button" </div>
_id "notesDismiss" </div>
_class "btn btn-secondary" <div id="snoozeModal" class="modal fade" tabindex="-1" aria-labelled-by="snoozeModalLabel" aria-hidden="true">
_data "bs-dismiss" "modal" ] [ <div class="modal-dialog modal-sm">
str "Close" <div class="modal-content">
] <div class="modal-header">
] <h5 class="modal-title" id="snoozeModalLabel">Snooze Prayer Request</h5>
] <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
] </div>
] <div class="modal-body" id="snoozeBody"></div>
div [ _id "snoozeModal" <div class="modal-footer">
_class "modal fade" <button type="button" id="snoozeDismiss" class="btn btn-secondary" data-bs-dismiss="modal">
_tabindex "-1" Close
_ariaLabelledBy "snoozeModalLabel" </button>
_ariaHidden "true" ] [ </div>
div [ _class "modal-dialog modal-sm" ] [ </div>
div [ _class "modal-content" ] [ </div>
div [ _class "modal-header" ] [ </div>
h5 [ _class "modal-title"; _id "snoozeModalLabel" ] [ str "Snooze Prayer Request" ]
button [ _type "button"; _class "btn-close"; _data "bs-dismiss" "modal"; _ariaLabel "Close" ] []
]
div [ _class "modal-body"; _id "snoozeBody" ] [ ]
div [ _class "modal-footer" ] [
button [ _type "button"
_id "snoozeDismiss"
_class "btn btn-secondary"
_data "bs-dismiss" "modal" ] [
str "Close"
]
]
]
]
] -->
</article> </article>