- Added sharing feature for table owners to share their tables with other registered users. - Fixed a bug where the wrong entries would be deleted or modified when searching or filtering.
115 lines
3.5 KiB
HTML
115 lines
3.5 KiB
HTML
{# vim: set filetype=html: #}
|
|
{% extends "base" %}
|
|
|
|
{# This file is part of inventur.
|
|
# inventur is a simple web app using rocket to help maintain inventory data.
|
|
# Copyright (C) 2024 Johannes Randerath
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
#}
|
|
|
|
{% block body %}
|
|
<!-- Accordions of owned tables to get a preview and to choos -->
|
|
<div class="accordion" id="my_tables">
|
|
{% for tname in tnames %}
|
|
{% set clms = columns[loop.index0] %}
|
|
{% set rws = rows[loop.index0] %}
|
|
{% set tid = tids[loop.index0] %}
|
|
<div class="accordion-item">
|
|
<h2 class="accordion-header">
|
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#acc_{{ tid }}" aria-expanded="false" aria-controls="acc_{{ tid }}">
|
|
{{ tname }}
|
|
</button>
|
|
</h2>
|
|
<div id="acc_{{ tid }}" class="accordion-collapse collapse" data-bs-parent="#my_tables">
|
|
<div class="accordion-body">
|
|
<div class="row justify-content-between">
|
|
<div class="col-auto"><h3>{{ tname }}</h3></div><div class="col-auto"><a class="btn btn-primary" href="/table/{{ tid }}">Open</a></div>
|
|
</div>
|
|
<!-- Preview -->
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
{% for clm in clms %}
|
|
<th>{{ clm }}</th>
|
|
{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for row in rws %}
|
|
<tr>
|
|
<td>{{ loop.index }}</td>
|
|
{% for clm in clms %}
|
|
<td>{{ row[loop.index0] }}</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<hr>
|
|
{% if sharednms |length > 1 %}
|
|
<div class="accordion" id="shared_tables">
|
|
{% for tname in sharednms %}
|
|
{% set clms = sharedcols[loop.index0] %}
|
|
{% set rws = sharedrows[loop.index0] %}
|
|
{% set tid = sharedtblids[loop.index0] %}
|
|
<div class="accordion-item">
|
|
<h2 class="accordion-header">
|
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#acc_shared_{{ tid }}" aria-expanded="false" aria-controls="acc_shared_{{ tid }}">
|
|
{{ tname }}
|
|
</button>
|
|
</h2>
|
|
<div id="acc_shared_{{ tid }}" class="accordion-collapse collapse" data-bs-parent="#shared_tables">
|
|
<div class="accordion-body">
|
|
<div class="row justify-content-between">
|
|
<div class="col-auto"><h3>{{ tname }}</h3></div><div class="col-auto"><a class="btn btn-primary" href="/table/{{ tid }}">Open</a></div>
|
|
</div>
|
|
<!-- Preview -->
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
{% for clm in clms %}
|
|
<th>{{ clm }}</th>
|
|
{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for row in rws %}
|
|
<tr>
|
|
<td>{{ loop.index }}</td>
|
|
{% for clm in clms %}
|
|
<td>{{ row[loop.index0] }}</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endblock body %}
|
|
|