Files
ihrm/employee/templates/policies/attachments.html

27 lines
1.4 KiB
HTML

{% load static %}
<form hx-post="{% url 'add-attachment-policy' %}?policy_id={{policy.id}}" hx-target="#attachmentContainer" class="add-files-form d-flex" method="post"
hx-encoding="multipart/form-data">
{% for attachment in policy.attachments.all %}
<a href="{{ attachment.attachment.url }}" rel="noopener noreferrer" target="_blank"><span
class="oh-file-icon oh-file-icon--pdf" onmouseover="enlargeImage('{{ attachment.attachment.url }}')"
style="width:40px;height:40px"><img src="{% static '/images/ui/minus-icon.png' %}"
style="display:block;width:50%;height:50%"
hx-get="{% url 'remove-attachment-policy' %}?ids={{ attachment.id }}&policy_id={{ policy.id }}"
hx-target="#attachmentContainer"
onclick="event.stopPropagation();event.preventDefault()" />
</span>
</a>
{% endfor %}
{% if perms.employee.add_policy %}
<input type="hidden" name="csrfmiddlewaretoken"/>
<input type="file" name="files" class="d-none" multiple="true" id="addFile_18" onchange="submitForm(this)" />
<input type="submit" class="d-none add_more_submit" value="save" />
<label for="addFile_18" title="Add Files" onclick="console.log($(this).closest('[type=file]'));"
style="cursor: pointer;">
<ion-icon name="add-outline" style="font-size: 24px" role="img" class="md hydrated"
aria-label="add outline"></ion-icon>
</label>
{% endif %}
</form>