xref: /webtrees/resources/views/modules/favorites/favorites.phtml (revision 36779af1bd0601de7819554b13a393f6edb92507)
18ec20abdSGreg Roach<?php
28ec20abdSGreg Roach
38ec20abdSGreg Roachuse Fisharebest\Webtrees\I18N;
48ec20abdSGreg Roachuse Fisharebest\Webtrees\Individual;
54062e425SGreg Roachuse Fisharebest\Webtrees\Tree;
68ec20abdSGreg Roachuse Illuminate\Support\Collection;
78ec20abdSGreg Roach
88ec20abdSGreg Roach/**
98ec20abdSGreg Roach * @var int                    $block_id
108ec20abdSGreg Roach * @var bool                   $can_edit
11*36779af1SGreg Roach * @var Collection<int,object> $favorites
128ec20abdSGreg Roach * @var string                 $module_name
134062e425SGreg Roach * @var Tree                   $tree
148ec20abdSGreg Roach */
158ec20abdSGreg Roach?>
168ec20abdSGreg Roach
178ec20abdSGreg Roach<?php foreach ($favorites as $favorite) : ?>
188ec20abdSGreg Roach    <div class="person_box action_header<?= $favorite->record instanceof Individual ? $favorite->record->sex() : '' ?>">
198ec20abdSGreg Roach        <?php if ($favorite->favorite_type === 'URL') : ?>
208ec20abdSGreg Roach            <a href="<?= e($favorite->url) ?>"><b><?= e($favorite->title) ?></b></a>
218ec20abdSGreg Roach        <?php elseif ($favorite->record instanceof Individual) : ?>
22516bb6deSGreg Roach            <?= view('chart-box', ['individual' => $favorite->record]) ?>
238ec20abdSGreg Roach        <?php elseif ($favorite->record !== null) : ?>
248ec20abdSGreg Roach            <?= $favorite->record->formatList() ?>
258ec20abdSGreg Roach        <?php endif ?>
268ec20abdSGreg Roach
278ec20abdSGreg Roach        <div class="wt-favorites-block-note">
288ec20abdSGreg Roach            <?= e((string) $favorite->note) ?>
298ec20abdSGreg Roach        </div>
308ec20abdSGreg Roach    </div>
318ec20abdSGreg Roach
328ec20abdSGreg Roach    <?php if ($can_edit) : ?>
33d72b284aSGreg Roach        <form method="post" action="<?= e(route('module', ['module' => $module_name, 'action' => 'DeleteFavorite', 'tree' => $tree->name(), 'favorite_id' => $favorite->favorite_id])) ?>">
348ec20abdSGreg Roach            <?= csrf_field() ?>
35d4786c66SGreg Roach            <button type="submit" class="btn btn-link" data-wt-confirm="<?= I18N::translate('Are you sure you want to remove this item from your list of favorites?') ?>" onclick="return confirm(this.dataset.confirm);">
368ec20abdSGreg Roach                <?= I18N::translate('Remove') ?>
378ec20abdSGreg Roach            </button>
388ec20abdSGreg Roach        </form>
398ec20abdSGreg Roach    <?php endif ?>
408ec20abdSGreg Roach<?php endforeach ?>
418ec20abdSGreg Roach
428ec20abdSGreg Roach<?php if ($can_edit) : ?>
43315eb316SGreg Roach    <button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#favorite-form-<?= e($block_id) ?>">
448ec20abdSGreg Roach        <?= I18N::translate('Add a favorite') ?>
458ec20abdSGreg Roach    </button>
468ec20abdSGreg Roach
478ec20abdSGreg Roach    <div class="modal fade" id="favorite-form-<?= e($block_id) ?>" tabindex="-1" role="dialog" aria-labelledby="favorite-form-<?= e($block_id) ?>-label" aria-hidden="true">
488ec20abdSGreg Roach        <div class="modal-dialog modal-xl" role="document">
498ec20abdSGreg Roach            <div class="modal-content">
50d72b284aSGreg Roach                <form method="post" action="<?= e(route('module', ['module' => $module_name, 'action' => 'AddFavorite', 'tree' => $tree->name()])) ?>">
518ec20abdSGreg Roach                    <?= csrf_field() ?>
528ec20abdSGreg Roach                    <div class="modal-header">
538ec20abdSGreg Roach                        <h5 class="modal-title" id="favorite-form-<?= e($block_id) ?>-label">
548ec20abdSGreg Roach                            <?= I18N::translate('Add a favorite') ?>
558ec20abdSGreg Roach                        </h5>
56b854e1f1SGreg Roach                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="<?= I18N::translate('close') ?>">
578ec20abdSGreg Roach                        </button>
588ec20abdSGreg Roach                    </div>
594062e425SGreg Roach                    <div class="modal-body">
60afc2d190SGreg Roach                        <div class="row form-group mb-3">
618ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
628ec20abdSGreg Roach                                <div class="form-check">
638ec20abdSGreg Roach                                    <input class="form-check-input" type="radio" name="type" value="indi" id="fav-indi-<?= e($block_id) ?>" checked>
644062e425SGreg Roach                                    <label class="form-check-label" for="fav-indi-<?= e($block_id) ?>">
658ec20abdSGreg Roach                                        <?= I18N::translate('Individual') ?>
668ec20abdSGreg Roach                                    </label>
678ec20abdSGreg Roach                                </div>
688ec20abdSGreg Roach                            </div>
698ec20abdSGreg Roach                            <div class="col-sm-8 col-md-9">
70b6c326d8SGreg Roach                                <?= view('components/select-individual', ['name' => 'indi-xref', 'tree' => $tree]) ?>
718ec20abdSGreg Roach                            </div>
724062e425SGreg Roach                        </div>
738ec20abdSGreg Roach
74afc2d190SGreg Roach                        <div class="row form-group mb-3">
758ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
768ec20abdSGreg Roach                                <div class="form-check">
778ec20abdSGreg Roach                                    <input class="form-check-input" type="radio" name="type" value="fam" id="fav-fam-<?= e($block_id) ?>">
784062e425SGreg Roach                                    <label class="form-check-label" for="fav-fam-<?= e($block_id) ?>">
798ec20abdSGreg Roach                                        <?= I18N::translate('Family') ?>
808ec20abdSGreg Roach                                    </label>
818ec20abdSGreg Roach                                </div>
828ec20abdSGreg Roach                            </div>
838ec20abdSGreg Roach                            <div class="col-sm-8 col-md-9">
84b6c326d8SGreg Roach                                <?= view('components/select-family', ['name' => 'fam-xref', 'tree' => $tree]) ?>
858ec20abdSGreg Roach                            </div>
864062e425SGreg Roach                        </div>
878ec20abdSGreg Roach
88afc2d190SGreg Roach                        <div class="row form-group mb-3">
898ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
908ec20abdSGreg Roach                                <div class="form-check">
918ec20abdSGreg Roach                                    <input class="form-check-input" type="radio" name="type" value="obje" id="fav-obje-<?= e($block_id) ?>">
924062e425SGreg Roach                                    <label class="form-check-label" for="fav-obje-<?= e($block_id) ?>">
938ec20abdSGreg Roach                                        <?= I18N::translate('Media object') ?>
948ec20abdSGreg Roach                                    </label>
958ec20abdSGreg Roach                                </div>
968ec20abdSGreg Roach                            </div>
978ec20abdSGreg Roach                            <div class="col-sm-8 col-md-9">
98b6c326d8SGreg Roach                                <?= view('components/select-media', ['name' => 'obje-xref', 'tree' => $tree]) ?>
998ec20abdSGreg Roach                            </div>
1004062e425SGreg Roach                        </div>
1018ec20abdSGreg Roach
102afc2d190SGreg Roach                        <div class="row form-group mb-3">
1038ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
1048ec20abdSGreg Roach                                <div class="form-check">
1058ec20abdSGreg Roach                                    <input class="form-check-input" type="radio" name="type" value="sour" id="fav-sour-<?= e($block_id) ?>">
1064062e425SGreg Roach                                    <label class="form-check-label" for="fav-sour-<?= e($block_id) ?>">
1078ec20abdSGreg Roach                                        <?= I18N::translate('Source') ?>
1088ec20abdSGreg Roach                                    </label>
1098ec20abdSGreg Roach                                </div>
1108ec20abdSGreg Roach                            </div>
1118ec20abdSGreg Roach                            <div class="col-sm-8 col-md-9">
112b6c326d8SGreg Roach                                <?= view('components/select-source', ['name' => 'sour-xref', 'tree' => $tree]) ?>
1138ec20abdSGreg Roach                            </div>
1144062e425SGreg Roach                        </div>
1158ec20abdSGreg Roach
116afc2d190SGreg Roach                        <div class="row form-group mb-3">
1178ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
1188ec20abdSGreg Roach                                <div class="form-check">
1198ec20abdSGreg Roach                                    <input class="form-check-input" type="radio" name="type" value="repo" id="fav-repo-<?= e($block_id) ?>">
1204062e425SGreg Roach                                    <label class="form-check-label" for="fav-repo-<?= e($block_id) ?>">
1218ec20abdSGreg Roach                                        <?= I18N::translate('Repository') ?>
1228ec20abdSGreg Roach                                    </label>
1238ec20abdSGreg Roach                                </div>
1248ec20abdSGreg Roach                            </div>
125b6c326d8SGreg Roach                            <div class="col-sm-8 col-md-9">
126b6c326d8SGreg Roach                                <?= view('components/select-repository', ['name' => 'repo-xref', 'tree' => $tree]) ?>
1278ec20abdSGreg Roach                            </div>
1284062e425SGreg Roach                        </div>
1298ec20abdSGreg Roach
130afc2d190SGreg Roach                        <div class="row form-group mb-3">
1318ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
1328ec20abdSGreg Roach                                <div class="form-check">
1338ec20abdSGreg Roach                                    <input class="form-check-input" type="radio" name="type" value="url" id="fav-url-<?= e($block_id) ?>">
1344062e425SGreg Roach                                    <label class="form-check-label" for="fav-url-<?= e($block_id) ?>">
1358ec20abdSGreg Roach                                        <?= I18N::translate('URL') ?>
1368ec20abdSGreg Roach                                    </label>
1378ec20abdSGreg Roach                                </div>
1388ec20abdSGreg Roach                            </div>
139b51c2707SGreg Roach                            <div class="col-sm-8 col-md-9">
1404062e425SGreg Roach                                <label>
141315eb316SGreg Roach                                    <span class="visually-hidden">
1424062e425SGreg Roach                                        <?= I18N::translate('URL') ?>
1434062e425SGreg Roach                                    </span>
1444062e425SGreg Roach                                    <input type="text" class="form-control" name="url" id="url" value="" placeholder="<?= I18N::translate('URL') ?>">
1454062e425SGreg Roach                                </label>
1464062e425SGreg Roach                                <label>
147315eb316SGreg Roach                                    <span class="visually-hidden">
1484062e425SGreg Roach                                        <?= I18N::translate('Title') ?>
1494062e425SGreg Roach                                    </span>
1504062e425SGreg Roach                                    <input type="text" class="form-control" name="title" id="title" value="" placeholder="<?= I18N::translate('Title') ?>">
1514062e425SGreg Roach                                </label>
1524062e425SGreg Roach                            </div>
1538ec20abdSGreg Roach                        </div>
1548ec20abdSGreg Roach
155afc2d190SGreg Roach                        <div class="row form-group mb-3">
1568ec20abdSGreg Roach                            <div class="col-sm-4 col-md-3">
1578ec20abdSGreg Roach                                <label for="fav-note-<?= e($block_id) ?>">
1588ec20abdSGreg Roach                                    <?= I18N::translate('Note') ?>
1598ec20abdSGreg Roach                                </label>
1608ec20abdSGreg Roach                            </div>
161b51c2707SGreg Roach                            <div class="col-sm-8 col-md-9">
1624062e425SGreg Roach                                <textarea name="note" id="fav-note-<?= e($block_id) ?>" class="form-control" placeholder="<?= I18N::translate('Enter an optional note about this favorite') ?>" rows="3" dir="auto"></textarea>
1634062e425SGreg Roach                            </div>
1648ec20abdSGreg Roach                        </div>
1658ec20abdSGreg Roach                    </div>
1668ec20abdSGreg Roach
1678ec20abdSGreg Roach                    <div class="modal-footer">
168315eb316SGreg Roach                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
1698ec20abdSGreg Roach                            <?= view('icons/cancel') ?>
1708ec20abdSGreg Roach                            <?= I18N::translate('cancel') ?>
1718ec20abdSGreg Roach                        </button>
1728ec20abdSGreg Roach                        <button type="submit" class="btn btn-primary">
1738ec20abdSGreg Roach                            <?= view('icons/save') ?>
1748ec20abdSGreg Roach                            <?= I18N::translate('save') ?>
1758ec20abdSGreg Roach                        </button>
1768ec20abdSGreg Roach                    </div>
1778ec20abdSGreg Roach                </form>
1788ec20abdSGreg Roach            </div>
1798ec20abdSGreg Roach        </div>
1808ec20abdSGreg Roach    </div>
1818ec20abdSGreg Roach<?php endif ?>
182