0424e0273e
Co-authored-by: Cursor <cursoragent@cursor.com>
124 lines
8.0 KiB
HTML
124 lines
8.0 KiB
HTML
{% load i18n %}
|
|
<div style="background:var(--color-card); border:1px solid var(--color-border); border-radius:0.75rem; padding:1.25rem;">
|
|
<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:0.875rem;">
|
|
<h2 style="font-size:1rem; font-weight:600; color:var(--color-foreground);">{% trans "Документы аптеки" %}</h2>
|
|
<span style="font-size:0.75rem; color:var(--color-muted-foreground);">Nextcloud</span>
|
|
</div>
|
|
|
|
{% if message %}
|
|
<div style="margin-bottom:0.875rem; padding:0.625rem 0.875rem; border-radius:0.5rem; font-size:0.8125rem;
|
|
{% if message_type == 'success' %}color:#137333; background:rgba(19,115,51,0.1); border:1px solid rgba(19,115,51,0.25);
|
|
{% else %}color:#d63333; background:rgba(214,51,51,0.1); border:1px solid rgba(214,51,51,0.25);{% endif %}">
|
|
{{ message }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if error == 'not_configured' %}
|
|
<div style="padding:0.875rem; font-size:0.8125rem; color:var(--color-muted-foreground);">
|
|
{% trans "Файловое хранилище пока не настроено." %}
|
|
</div>
|
|
{% elif error %}
|
|
<div style="padding:0.875rem; font-size:0.8125rem; color:#d63333;">
|
|
{% trans "Не удалось получить список документов." %}
|
|
</div>
|
|
{% else %}
|
|
<div class="{% if can_edit_docs %}nc-browser-drop{% endif %}" {% if can_edit_docs %}data-nc-upload="1"{% endif %}>
|
|
{% if files %}
|
|
<div style="border:1px solid var(--color-border); border-radius:0.5rem; overflow:hidden; margin-bottom:0.875rem;">
|
|
<table style="width:100%; border-collapse:collapse; font-size:0.8125rem;">
|
|
<tbody>
|
|
{% for f in files %}
|
|
<tr style="border-bottom:1px solid var(--color-border);" class="tr-hover">
|
|
<td style="padding:0.5rem 0.75rem;">
|
|
<span style="display:inline-flex; align-items:center; gap:0.5rem;">
|
|
<span class="nc-file-ico {% if f.is_dir %}nc-file-ico-folder{% else %}nc-file-ico-file{% endif %}" aria-hidden="true"></span>
|
|
{% if f.is_dir %}
|
|
<span style="color:var(--color-foreground); font-weight:500;">{{ f.name }}</span>
|
|
{% else %}
|
|
{% if f.is_office and onlyoffice_ready %}
|
|
<a href="/documents/edit/?pharmacy={{ pharmacy.pk }}&name={{ f.name|urlencode }}"
|
|
style="color:var(--color-primary); text-decoration:none;">{{ f.name }}</a>
|
|
{% elif f.is_previewable %}
|
|
<a href="/pharmacies/{{ pharmacy.pk }}/documents/download/?name={{ f.name|urlencode }}&inline=1"
|
|
data-doc-kind="{{ f.preview_kind }}"
|
|
data-doc-title="{{ f.name }}"
|
|
data-doc-full="/pharmacies/{{ pharmacy.pk }}/documents/preview/?name={{ f.name|urlencode }}"
|
|
onclick="return docPreviewOpen(this);"
|
|
style="color:var(--color-primary); text-decoration:none;">{{ f.name }}</a>
|
|
<a href="/pharmacies/{{ pharmacy.pk }}/documents/download/?name={{ f.name|urlencode }}"
|
|
style="color:var(--color-muted-foreground); font-size:0.75rem; text-decoration:none;">{% trans "скачать" %}</a>
|
|
{% else %}
|
|
<a href="/pharmacies/{{ pharmacy.pk }}/documents/download/?name={{ f.name|urlencode }}"
|
|
style="color:var(--color-primary); text-decoration:none;">{{ f.name }}</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
</span>
|
|
</td>
|
|
<td style="padding:0.5rem 0.75rem; text-align:right; color:var(--color-muted-foreground); white-space:nowrap;">
|
|
{% if f.size is not None %}{{ f.size|filesizeformat }}{% endif %}
|
|
</td>
|
|
<td style="padding:0.5rem 0.75rem; text-align:right; width:1%; white-space:nowrap;">
|
|
{% if can_edit_docs %}
|
|
<form method="post" action="/pharmacies/{{ pharmacy.pk }}/documents/rename/"
|
|
hx-post="/pharmacies/{{ pharmacy.pk }}/documents/rename/"
|
|
hx-target="#ph-documents-slot" hx-swap="innerHTML"
|
|
hx-prompt="{% trans 'Новое имя' %}" style="display:inline;">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="name" value="{{ f.name }}">
|
|
<button type="submit" class="nc-file-act">{% trans "Переименовать" %}</button>
|
|
</form>
|
|
<form method="post" action="/pharmacies/{{ pharmacy.pk }}/documents/delete/"
|
|
hx-post="/pharmacies/{{ pharmacy.pk }}/documents/delete/"
|
|
hx-target="#ph-documents-slot" hx-swap="innerHTML"
|
|
hx-confirm="{% if f.is_dir %}{% trans 'Удалить папку и всё содержимое?' %}{% else %}{% trans 'Удалить файл?' %}{% endif %}"
|
|
style="display:inline; margin-left:0.375rem;">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="name" value="{{ f.name }}">
|
|
<button type="submit" class="nc-file-act nc-file-act-danger">{% trans "Удалить" %}</button>
|
|
</form>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div style="padding:0.875rem; font-size:0.8125rem; color:var(--color-muted-foreground); margin-bottom:0.875rem;">
|
|
{% trans "В папке аптеки пока нет файлов." %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if can_edit_docs %}
|
|
<div class="nc-file-toolbar">
|
|
<form method="post" action="/pharmacies/{{ pharmacy.pk }}/documents/upload/"
|
|
hx-post="/pharmacies/{{ pharmacy.pk }}/documents/upload/"
|
|
hx-target="#ph-documents-slot" hx-swap="innerHTML" hx-encoding="multipart/form-data"
|
|
enctype="multipart/form-data"
|
|
class="nc-drop">
|
|
{% csrf_token %}
|
|
<label class="nc-drop-label">
|
|
<input type="file" name="file" class="nc-drop-input" multiple>
|
|
<span class="nc-drop-text">
|
|
<strong class="nc-drop-title">{% trans "Загрузить файл" %}</strong>
|
|
<span class="nc-drop-name">{% trans "или перетащите сюда / в список" %}</span>
|
|
</span>
|
|
</label>
|
|
<button type="submit" class="btn btn-primary"
|
|
style="font-size:0.8125rem; white-space:nowrap;">{% trans "Загрузить" %}</button>
|
|
</form>
|
|
<form method="post" action="/pharmacies/{{ pharmacy.pk }}/documents/mkdir/"
|
|
hx-post="/pharmacies/{{ pharmacy.pk }}/documents/mkdir/"
|
|
hx-target="#ph-documents-slot" hx-swap="innerHTML"
|
|
class="nc-mkdir">
|
|
{% csrf_token %}
|
|
<input type="text" name="name" class="input" required maxlength="120"
|
|
placeholder="{% trans 'Имя новой папки' %}" style="max-width:16rem; font-size:0.8125rem;">
|
|
<button type="submit" class="btn btn-secondary" style="font-size:0.8125rem; white-space:nowrap;">{% trans "Создать папку" %}</button>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|