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 { ?>
<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">
items
|> List.map (journalCard now tz)
hx-swap="outerHTML" aria-label="Prayer Requests"><?php
foreach ($requests as $request) {
echo app()->template->render('components/journal_card', [ 'request' => $request ]);
} ?>
</section><?php
}

View File

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