1<?php 2 3use Fisharebest\Webtrees\Fact; 4use Fisharebest\Webtrees\I18N; 5use Fisharebest\Webtrees\Individual; 6use Illuminate\Support\Collection; 7 8/** 9 * @var Collection<Fact> $facts 10 * @var Individual $record 11 * @var string $url 12 */ 13 14?> 15<div class="input-group mb-3"> 16 <div class="input-group-prepend"> 17 <span class="input-group-text" dir="ltr">iCalendar</span> 18 </div> 19 <select class="custom-select" id="share-anniversary-select" aria-label=" <?= I18N::translate('Anniversary') ?>" name="fact_id"> 20 <?php foreach ($facts as $url => $label): ?> 21 <option value="<?= e($url) ?>"><?= $label ?></option> 22 <?php endforeach ?> 23 </select> 24 <div class="input-group-append"> 25 <button class="btn btn-primary" type="button" id="share-anniversary-button"><?= view('icons/download') ?><?= I18N::translate('Download') ?></button> 26 </div> 27</div> 28<form id="share-anniversary-form"></form> 29<script> 30 document.getElementById('share-anniversary-button').addEventListener('click', function () { 31 console.log('clicked'); 32 const select = document.getElementById('share-anniversary-select'); 33 let form = document.getElementById('share-anniversary-form'); 34 form.action = select.options[select.selectedIndex].value;; 35 form.submit(); 36 console.log('submitted'); 37 }); 38</script> 39