<div class="mini-liturgies">
    <div class="tab-resources">

        <div class="karmapoints">
            <label>KaP:</label>
            <input type="number" name="system.kap.aktuell" value="{{system.kap.aktuell}}"/>
            <span class="inline">von</span>
            <input type="number" disabled value="{{derived.kap.max}}"/>
        </div>
    </div>
    <div class="scroll-y">
        {{#each this.liturgies}}
            <table class="{{this.deity}}">
                <thead class="liturgy-header">
                <tr class="liturgy-header">
                    <th style="width: 0"></th>
                    <th class="banner-top" style="width: 90px"><img
                            src="systems/DSA_4-1/assets/deities/{{this.deity}}.png"/></th>
                    <th class="lkp" colspan="2">Liturgiekenntnis: {{this.lkp}}</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <th rowspan="{{this.total}}" class="background"></th>
                    <th class="banner-mid" rowspan="{{countO}}">
                        <div>
                            <div class="rank-label">{{#if this.count0}}0{{/if}}</div>
                        </div>
                    </th>
                </tr>
                {{#each this.O}}
                    <tr>
                        <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                            data-rank="{{this.rank}}"
                            data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                            {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                        </td>
                        <td class="clickable" data-id="{{this.id}}" data-action="openEmbeddedDocument">
                            {{this.name}}</td>
                        <td></td>
                    </tr>
                {{/each}}
                {{#if this.countI}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countI}}">
                            <div>
                                <div class="rank-label">{{#if this.countI}}I{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.I}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}" data-action="openEmbeddedDocument">
                                {{this.name}}</td>
                            <td></td>
                        </tr>
                    {{/each}}
                {{/if}}
                {{#if this.countII}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countII}}">
                            <div>
                                <div class="rank-label">{{#if this.countII}}II{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.II}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}
                {{/if}}
                {{#if this.countIII}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countIII}}">
                            <div>
                                <div class="rank-label">{{#if this.countIII}}III{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.III}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}
                {{/if}}
                {{#if this.countIV}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countIV}}">
                            <div>
                                <div class="rank-label">{{#if this.countIV}}IV{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.IV}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}{{/if}}
                {{#if this.countV}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countV}}">
                            <div>
                                <div class="rank-label">{{#if this.countV}}V{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.V}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}
                {{/if}}
                {{#if this.countVI}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countVI}}">
                            <div>
                                <div class="rank-label">{{#if this.countVI}}VI{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.VI}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}
                {{/if}}{{#if this.countVII}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countVII}}">
                            <div>
                                <div class="rank-label">{{#if this.countVII}}VII{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.VII}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}
                {{/if}}{{#if this.countVIII}}
                    <tr>
                        <th class="banner-mid" rowspan="{{countVIII}}">
                            <div>
                                <div class="rank-label">{{#if this.countVIII}}VIII{{/if}}</div>
                            </div>
                        </th>
                    </tr>
                    {{#each this.VIII}}
                        <tr>
                            <td class="liturgy rollable" data-action="openLiturgyDialog" data-id="{{this.id}}"
                                data-rank="{{this.rank}}"
                                data-lkp="{{../lkp}}" data-deity="{{../deity}}">
                                {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
                            </td>
                            <td class="clickable" data-id="{{this.id}}"
                                data-action="openEmbeddedDocument">{{this.name}}</td>
                        </tr>
                    {{/each}}
                {{/if}}
                </tbody>
            </table>
        {{/each}}
    </div>