aboutsummaryrefslogtreecommitdiff
path: root/app/views/shared/form_dokumente.php
blob: 48c64edea385b64ed9fb3d4c9f479b489d4225d9 (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
95
96
97
98
99
100
101
102
103
<? $perm_dokumente = isset($perm_dokumente) ? $perm_dokumente : true; ?>
<fieldset>
    <legend><?= _('Referenzierte Dokumente und Materialien') ?></legend>
    <? if ($perm_dokumente) : ?>
        <div class="mvv-item-list-properties" style="display: none;">
            <div class="mvv-property-de"></div>
            <div class="mvv-property-en"></div>
        </div>
        <div>
            <?= $search_dokumente['html']->render(); ?>
            <? if (Request::submitted('search_dokumente')) : ?>
                <?= Icon::create(
                    'refresh',
                    Icon::ROLE_CLICKABLE,
                    [
                        'name'       => 'reset_dokumente',
                        'data-qs_id' => $search_dokumente['id']
                    ]
                )->asInput(); ?>
            <? else : ?>
                <?= Icon::create(
                    'search',
                    Icon::ROLE_CLICKABLE,
                    [
                        'name'         => 'search_dokumente',
                        'data-qs_id'   => $search_dokumente['id'],
                        'data-qs_name' => $search_dokumente['html']->getId(),
                        'class'        => 'mvv-qs-button'
                    ]
                )->asInput(); ?>
            <? endif; ?>
        </div>
    <? endif; ?>
    <ul id="dokumente_target" class="mvv-assigned-items mvv-with-properties mvv-dokumente sortable">
        <? if ($perm_dokumente) : ?>
            <li class="mvv-item-list-placeholder"<?= (empty($dokumente) ? '' : ' style="display: none;"') ?>><?= _('Fügen Sie Dokumente und Materialien hinzu.') ?></li>
        <? elseif (empty($dokumente)) : ?>
            <li class="mvv-item-list-placeholder"><?= _('Es wurden keine Dokumente zugeordnet.') ?></li>
        <? endif; ?>
        <? foreach ($dokumente as $dokument) : ?>
            <? if ($perm_dokumente) : ?>
                <li id="dokumente_<?= $dokument->dokument_id ?>" class="drag-handle">
                    <div style="flex: 9;">
                        <?= htmlReady($dokument->document->isI18nField('name')
                            ? $dokument->document->name->original()
                            : $dokument->document->name) ?>
                    </div>
                    <div style="flex: 1; text-align: right;" class="mvv-item-list-buttons">
                        <a href="#" class="mvv-item-remove">
                            <?= Icon::create(
                                'trash',
                                Icon::ROLE_CLICKABLE,
                                ['title' => _('Dokument entfernen')]
                            )->asSvg(); ?>
                        </a>
                        <a href="#" class="mvv-item-edit-properties">
                            <?= Icon::create(
                                'edit',
                                Icon::ROLE_CLICKABLE,
                                ['title' => _('Kommentar bearbeiten')]
                            )->asSvg(); ?>
                        </a>
                    </div>
                    <fieldset class="mvv-item-document-comments" style="display: none;">
                        <label><?= _('Anmerkungen/Kommentare') ?>
                            <?= MvvI18N::textarea(
                                'beschreibung',
                                $dokument->kommentar,
                                ['class' => 'wysiwyg']
                            ) ?>
                        </label>
                        <?= _('Die Änderungen werden erst gespeichert, wenn das Hauptformular gespeichert wurde!') ?>
                    </fieldset>
                    <input type="hidden" name="dokumente_items[]" value="<?= $dokument->dokument_id ?>">
                </li>
            <? else : ?>
                <li id="dokumente_<?= $dokument->dokument_id ?>">
                    <div style="flex: 1;">
                        <?= htmlReady($dokument->document->isI18nField('name')
                            ? $dokument->document->name->original()
                            : $dokument->document->name) ?>
                    </div>
                    <input type="hidden" name="dokumente_items[]" value="<?= $dokument->dokument_id ?>">
                </li>
            <? endif; ?>
        <? endforeach; ?>
    </ul>
    <? if ($perm_dokumente) : ?>
        <div id="dokumente_edit-form-new">
            <?= _('Neues Dokument anlegen und hinzufügen') ?>
            <a data-dialog href="<?= URLHelper::getLink($controller->url_for('materialien/dokumente/dokument/')) ?>">
                <?= Icon::create(
                    'add',
                    Icon::ROLE_CLICKABLE,
                    ['title' => _('Neues Dokument anlegen')]
                )->asSvg(); ?>
            </a>
        </div>
        <div style="padding-top: 15px; width: 100%; max-width: 48em;">
            <?= _('Die Reihenfolge der zugeordneten Dokumente kann durch Anklicken und Ziehen geändert werden. Für die Zuordnung eines Dokumentes kann ein zusätzlicher Text angegeben werden.') ?>
        </div>
    <? endif; ?>
</fieldset>