summaryrefslogtreecommitdiff
path: root/resources/views/edit/add-fact.php
blob: 834042279eb52c494d93a071034e7c4583f40f5e (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php use Fisharebest\Webtrees\Auth; ?>
<?php use Fisharebest\Webtrees\Bootstrap4; ?>
<?php use Fisharebest\Webtrees\Config; ?>
<?php use Fisharebest\Webtrees\FontAwesome; ?>
<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
<?php use Fisharebest\Webtrees\GedcomTag; ?>
<?php use Fisharebest\Webtrees\I18N; ?>
<?php use Ramsey\Uuid\Uuid; ?>

<h2 class="wt-page-title"><?= $title ?></h2>

<form class="wt-page-content" action="<?= e(route('update-fact', ['ged' => $tree->getName(), 'xref' => $record->getXref()])) ?>" method="post">
	<?= csrf_field() ?>

	<?php FunctionsEdit::createAddForm($tree, $fact) ?>

	<?php if (($record::RECORD_TYPE === 'INDI' || $record::RECORD_TYPE === 'FAM') && $fact !== 'OBJE' && $fact !== 'NOTE' && $fact !== 'SHARED_NOTE' && $fact !== 'REPO' && $fact !== 'SOUR' && $fact !== 'SUBM' && $fact !== 'ASSO' && $fact !== 'ALIA' && $fact !== 'SEX'): ?>
		<?= view('cards/add-source-citation', [
			'level'          => 2,
			'full_citations' => $tree->getPreference('FULL_SOURCES'),
			'tree'           => $tree,
		]); ?>

		<?php if ($tree->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($tree)): ?>
			<?= view('cards/add-media-object', [
			'level' => 2,
			'tree' => $tree,
			]) ?>
		<?php endif ?>

		<?php if ($fact !== 'NOTE'): ?>
			<?= view('cards/add-note', [
				'level' => 2,
				'tree' => $tree,
			]) ?>

			<?= view('cards/add-shared-note', [
				'level' => 2,
				'tree' => $tree,
			]) ?>
		<?php endif ?>

		<?= view('cards/add-associate', [
			'id'    => Uuid::uuid4()->toString(),
			'level' => 2,
			'tree' => $tree,
		]) ?>
		<?php if (in_array($fact, Config::twoAssociates())): ?>
			<?= view('cards/add-associate', [
				'id'    => Uuid::uuid4()->toString(),
				'level' => 2,
				'tree' => $tree,
			]) ?>
		<?php endif ?>

		<?= view('cards/add-restriction', [
			'level' => 2,
			'tree' => $tree,
		]) ?>
	<?php endif ?>

	<div class="form-group row">
		<label class="col-sm-3 col-form-label" for="keep_chan">
			<?= I18N::translate('Last change') ?>
		</label>
		<div class="col-sm-9">
			<?= Bootstrap4::checkbox(I18N::translate('Keep the existing “last change” information'), true, ['name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?>
			<?= GedcomTag::getLabelValue('DATE', $record->lastChangeTimestamp()) ?>
			<?= GedcomTag::getLabelValue('_WT_USER', e($record->lastChangeUser())) ?>
		</div>
	</div>

	<div class="form-group row">
		<div class="col-sm-3 wt-page-options-label">
		</div>
		<div class="col-sm-9 wt-page-options-value">
			<button class="btn btn-primary" type="submit">
				<?= FontAwesome::decorativeIcon('save') ?>
				<?= /* I18N: A button label. */
				I18N::translate('save') ?>
			</button>
			<a class="btn btn-secondary" href="<?= e($record->url()) ?>">
				<?= FontAwesome::decorativeIcon('cancel') ?>
				<?= /* I18N: A button label. */
				I18N::translate('cancel') ?>
			</a>
		</div>
	</div>
</form>

<?= view('modals/on-screen-keyboard') ?>
<?= view('modals/ajax') ?>
<?php FunctionsPrint::initializeCalendarPopup(); ?>