blob: 173554c80ed5f63d8313b2cef635a053f1ba6b14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php use Fisharebest\Webtrees\FontAwesome; ?>
<?php use Fisharebest\Webtrees\I18N; ?>
<?php use Fisharebest\Webtrees\View; ?>
<h2 class="wt-page-title"><?= $title ?></h2>
<form class="wt-page-content" method="post">
<?= csrf_field() ?>
<div class="wt-sortable-list">
<?php foreach ($family->getFacts('CHIL') as $fact) : ?>
<div class="card mb-2 wt-sortable-item" data-sortbydate="<?= $fact->target()->getBirthDate()->julianDay() ?>">
<input type="hidden" name="order[]" value="<?= $fact->getFactId() ?>">
<h3 class="card-header">
<?= FontAwesome::semanticIcon('drag-handle', '') ?>
<?= $fact->target()->getFullName() ?>
</h3>
<div class="card-body">
<?= $fact->target()->formatFirstMajorFact(WT_EVENTS_BIRT, 2) ?>
<?= $fact->target()->formatFirstMajorFact(WT_EVENTS_DEAT, 2) ?>
</div>
</div>
<?php endforeach ?>
</div>
<p>
<button class="btn btn-primary" type="submit">
<?= FontAwesome::decorativeIcon('save') ?>
<?= /* I18N: A button label. */ I18N::translate('save') ?>
</button>
<button class="btn btn-secondary" id="btn-default-order" type="button">
<?= FontAwesome::decorativeIcon('sort') ?>
<?= /* I18N: A button label. */ I18N::translate('sort by date of birth') ?>
</button>
<a class="btn btn-secondary" href="<?= e($family->url()) ?>">
<?= FontAwesome::decorativeIcon('cancel') ?>
<?= /* I18N: A button label. */ I18N::translate('cancel') ?>
</a>
</p>
</form>
<?php View::push('javascript') ?>
<script>
new Sortable(document.querySelector(".wt-sortable-list"), {});
$("#btn-default-order").on("click", function() {
$(".wt-sortable-list .wt-sortable-item").sort(function(x, y) {
return Math.sign(x.dataset.sortbydate - y.dataset.sortbydate);
}).appendTo(".wt-sortable-list");
});
</script>
<?php View::endpush() ?>
|