[FIX] BASE: #715
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
{% load i18n %}
|
||||
{% if messages %}
|
||||
<script>reloadMessage();</script>
|
||||
<span hx-get="{% url 'announcement-list' %}" hx-trigger="load" hx-target="#announcementListCard"
|
||||
hx-on-htmx-after-request="setTimeout(() => {$('.oh-modal__close').click();}, 500);"></span>
|
||||
<script>reloadMessage();</script>
|
||||
<span hx-get="{% url 'announcement-list' %}" hx-trigger="load" hx-target="#announcementListCard"
|
||||
hx-on-htmx-after-request="setTimeout(() => {$('.oh-modal__close').click();}, 500);"></span>
|
||||
{% endif %}
|
||||
{% if form.errors %}
|
||||
<div class="oh-wrapper">
|
||||
<div class="oh-alert-container">
|
||||
{% for error in form.non_field_errors %}
|
||||
<div class="oh-alert oh-alert--animated oh-alert--danger">
|
||||
{{ error }}
|
||||
<div class="oh-wrapper">
|
||||
<div class="oh-alert-container">
|
||||
{% for error in form.non_field_errors %}
|
||||
<div class="oh-alert oh-alert--animated oh-alert--danger">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<h2 class="oh-modal__dialog-title" id="createModalTitle">
|
||||
{% trans "Create Announcements." %}
|
||||
{% trans "Create " %} {{form.verbose_name}}
|
||||
</h2>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<button class="oh-modal__close" aria-label="Close"
|
||||
onclick="setTimeout(function () { $('#objectCreateModalTarget').empty(); }, 200);">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="oh-modal__dialog-header pb-4">
|
||||
|
||||
<div class="oh-main__titlebar oh-main__titlebar--left">
|
||||
<span class="oh-main__titlebar-title fw-bold mb-0 text-dark">{% trans "Announcement." %} </span>
|
||||
<span class="oh-main__titlebar-title fw-bold mb-0 text-dark">{% trans "Announcement" %} </span>
|
||||
</div>
|
||||
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{% load i18n %}
|
||||
{% if messages %}
|
||||
<script>reloadMessage();</script>
|
||||
|
||||
<span hx-get="{% url 'announcement-single-view' form.instance.id %}?instance_ids={{instance_ids}}"
|
||||
hx-target="#objectDetailsModalTarget" hx-trigger="load"></span>
|
||||
|
||||
@@ -12,20 +11,21 @@
|
||||
<div class="oh-wrapper">
|
||||
<div class="oh-alert-container">
|
||||
{% for error in form.non_field_errors %}
|
||||
<div class="oh-alert oh-alert--animated oh-alert--danger">
|
||||
{{ error }}
|
||||
</div>
|
||||
<div class="oh-alert oh-alert--animated oh-alert--danger">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header">
|
||||
<h5 class="oh-modal__dialog-title" id="announcementUpdateModalLabel">{% trans "Update" %} {{form.verbose_name}}
|
||||
|
||||
<button type="button" class="oh-modal_close--custom"
|
||||
onclick="$(this).closest('.oh-modal--show').removeClass('oh-modal--show');">
|
||||
<ion-icon name="close-outline" role="img" aria-label="close outline"></ion-icon>
|
||||
</button>
|
||||
<h2 class="oh-modal__dialog-title" id="createModalTitle">
|
||||
{% trans "Update" %} {{form.verbose_name}}
|
||||
</h2>
|
||||
<button type="button" class="oh-modal_close--custom"
|
||||
onclick="$(this).closest('.oh-modal--show').removeClass('oh-modal--show');setTimeout(function () { $('#{{hx_target}}').empty(); }, 200);">
|
||||
<ion-icon name="close-outline" role="img" aria-label="close outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body">
|
||||
<form hx-post="{{request.get_full_path}}" hx-target="#{{hx_target}}" hx-encoding="multipart/form-data"
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load widget_tweaks %}
|
||||
<div class="oh-profile-section__card">
|
||||
<div class="row">
|
||||
<div class="col-12">{{ form.non_field_errors }}</div>
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="col-12" id="id_{{field.name}}_parent_div">
|
||||
{% load static i18n widget_tweaks %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">{{ form.non_field_errors }}</div>
|
||||
{% for field in form.visible_fields %}
|
||||
{% if field.field.widget.input_type != "checkbox" %}
|
||||
<div class="col-12 mb-3" id="id_{{ field.name }}_parent_div">
|
||||
<div class="oh-label__info" for="id_{{ field.name }}">
|
||||
<label class="oh-label {% if field.field.required %} required-star{% endif %}"
|
||||
for="id_{{ field.name }}">{% trans field.label %}</label>
|
||||
{% if field.help_text != '' %}
|
||||
<label class="oh-label {% if field.field.required %}required-star{% endif %}" for="id_{{ field.name }}">{% trans field.label %}</label>
|
||||
{% if field.help_text %}
|
||||
<span class="oh-info mr-2" title="{{ field.help_text|safe }}"></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if field.field.widget.input_type == 'checkbox' %}
|
||||
<div class="oh-switch" style="width: 30px;">{{ field|add_class:'oh-switch__checkbox' }}</div>
|
||||
{% else %}
|
||||
{{ field|add_class:'form-control' }}
|
||||
{% endif %}
|
||||
{{ field|add_class:"form-control" }}
|
||||
{{ field.errors }}
|
||||
|
||||
{% if field.name == "attachments" and field.field.widget.input_type == "file" and field.field.widget.attrs.multiple %}
|
||||
{% if form.instance.pk %}
|
||||
<div class="d-flex mt-2 mb-2">
|
||||
{% for file in form.instance.attachments.all %}
|
||||
<a href="{{ file.file.url }}" rel="noopener noreferrer" target="_blank"
|
||||
id="objectFileItem{{ file.id }}">
|
||||
<span class="oh-file-icon oh-file-icon--pdf"
|
||||
onmouseover="enlargeImage('{{ file.file.url }}',$(this))" style="width: 40px; height: 40px">
|
||||
<img src="{% static 'images/ui/minus-icon.png' %}"
|
||||
style="display: block; width: 50%; height: 50%"
|
||||
<a href="{{ file.file.url }}" rel="noopener noreferrer" target="_blank" id="objectFileItem{{ file.id }}">
|
||||
<span class="oh-file-icon oh-file-icon--pdf" onmouseover="enlargeImage('{{ file.file.url }}',$(this))"
|
||||
style="width: 40px; height: 40px">
|
||||
<img src="{% static 'images/ui/minus-icon.png' %}" style="display: block; width: 50%; height: 50%"
|
||||
hx-confirm="{% trans 'Are you sure do you want to delete this file ?' %}"
|
||||
hx-post="{% url 'remove-announcement-file' form.instance.pk file.id %}"
|
||||
hx-target="#objectFileItem{{ file.id }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#objectFileItem{{ file.id }}" hx-swap="outerHTML"
|
||||
onclick="event.stopPropagation();event.preventDefault()" />
|
||||
</span>
|
||||
</a>
|
||||
@@ -41,9 +33,30 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="col-12 d-flex mb-3">
|
||||
{% for field in form.visible_fields %}
|
||||
{% if field.field.widget.input_type == "checkbox" %}
|
||||
<div class="col-6" id="id_{{ field.name }}_parent_div">
|
||||
<div class="oh-label__info" for="id_{{ field.name }}">
|
||||
<label class="oh-label {% if field.field.required %}required-star{% endif %}"
|
||||
for="id_{{ field.name }}">{% trans field.label %}</label>
|
||||
{% if field.help_text %}
|
||||
<span class="oh-info mr-2" title="{{ field.help_text|safe }}"></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-switch" style="width: 30px;">
|
||||
{{ field|add_class:"oh-switch__checkbox" }}
|
||||
</div>
|
||||
{{ field.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% for field in form.hidden_fields %}
|
||||
{{ field }}
|
||||
|
||||
{# hidden fields #}
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{ hidden }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -4,95 +4,97 @@
|
||||
|
||||
{% if messages %}
|
||||
<div class="oh-alert-container">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-activity-sidebar__header">
|
||||
<a style="cursor: pointer;" onclick="$('.oh-activity-sidebar--show').removeClass('oh-activity-sidebar--show');">
|
||||
<ion-icon name="chevron-forward-outline"
|
||||
class="oh-activity-sidebar__header-icon me-2 oh-activity-sidebar__close"
|
||||
data-target="#activitySidebar"></ion-icon>
|
||||
</a>
|
||||
<span class="oh-activity-sidebar__title"> {{announcement.title}}{% trans "'s comments" %} </span>
|
||||
</div>
|
||||
|
||||
<div class="oh-activity-sidebar__header">
|
||||
<a
|
||||
style="cursor: pointer;"
|
||||
onclick="$('.oh-activity-sidebar--show').removeClass('oh-activity-sidebar--show');">
|
||||
<ion-icon
|
||||
name="chevron-forward-outline"
|
||||
class="oh-activity-sidebar__header-icon me-2 oh-activity-sidebar__close"
|
||||
data-target="#activitySidebar"
|
||||
></ion-icon>
|
||||
</a>
|
||||
<span class="oh-activity-sidebar__title"> {{announcement.title}}{% trans "'s comments" %} </span>
|
||||
</div>
|
||||
|
||||
<form
|
||||
hx-post="{% url 'announcement-add-comment' request_id %}"
|
||||
hx-target="#commentContainer"
|
||||
{% if not announcement.disable_comments %}
|
||||
<form hx-post="{% url 'announcement-add-comment' request_id %}" hx-target="#commentContainer"
|
||||
hx-encoding="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
|
||||
<div>
|
||||
<input type="text" name="comment" id="commentInput" hx-on:keyup="toggleCommentButton(this);" class="oh-input w-100" placeholder="Comment here">
|
||||
<button type="submit" id="commentButton" class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp" style="display: none;">
|
||||
{% trans "Comment" %}
|
||||
</button>
|
||||
</div>
|
||||
<input type="text" name="comment" id="commentInput" hx-on:keyup="toggleCommentButton(this);"
|
||||
class="oh-input w-100" placeholder="Comment here">
|
||||
<button type="submit" id="commentButton" class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp"
|
||||
style="display: none;">
|
||||
{% trans "Comment" %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="oh-inner-sidebar-content__footer"></div>
|
||||
<div class="oh-inner-sidebar-content__footer"></div>
|
||||
</form>
|
||||
|
||||
{% if no_comments %}
|
||||
{% if no_comments %}
|
||||
|
||||
<div class="oh-timeoff-modal__profile-content">
|
||||
<div class="oh-404">
|
||||
<div class="">
|
||||
<span class="oh-timeoff-title fw-bold" style="display: block"
|
||||
>{% trans "There are no comments to show." %}</span
|
||||
>
|
||||
<img
|
||||
style="display: block; width: 100px; margin: 20px auto"
|
||||
src="{% static "/images/ui/comment.png" %}"
|
||||
class=""
|
||||
/>
|
||||
<span class="oh-timeoff-title fw-bold" style="display: block">{% trans "There are no comments to show."
|
||||
%}</span>
|
||||
<img style="display: block; width: 100px; margin: 20px auto" src="{% static '/images/ui/comment.png' %}"
|
||||
class="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
{% else %}
|
||||
|
||||
<ol class="oh-activity-sidebar__qa-list" role="list">
|
||||
{% for comment in comments %}
|
||||
<li class="oh-activity-sidebar__qa-item" id="announCommentCard{{comment.id}}">
|
||||
{% for comment in comments %}
|
||||
<li class="oh-activity-sidebar__qa-item" id="announCommentCard{{comment.id}}">
|
||||
<span class="oh-activity-sidebar__q" style="font-size:16px;">{{ comment.comment }}
|
||||
{% if perms.base.delete_announcementcomment or request.user == comment.created_by %}
|
||||
<span class="oh-activity-sidebar__q" style="font-size:16px;">{{ comment.comment }}
|
||||
<span class="float-end" hx-get="{% url 'announcement-delete-comment' comment.id %}"
|
||||
hx-swap="delete" hx-target="#announCommentCard{{comment.id}}" hx-on:click="setTimeout(() => {reloadMessage(this);},100);">
|
||||
<ion-icon name="close-outline" style="font-size: 24px" role="img" class="md hydrated" aria-label="close outline"></ion-icon></span>
|
||||
</span>
|
||||
<span class="float-end" hx-get="{% url 'announcement-delete-comment' comment.id %}" hx-swap="delete"
|
||||
hx-target="#announCommentCard{{comment.id}}"
|
||||
hx-on:click="setTimeout(() => {reloadMessage(this);},100);">
|
||||
<ion-icon name="close-outline" style="font-size: 24px" role="img" class="md hydrated"
|
||||
aria-label="close outline"></ion-icon></span>
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
<span class="d-flex mt-3">
|
||||
<div>
|
||||
<span class="oh-timeoff-modal__stat-title fw-bold">{% trans "By" %}</span>
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img src="{{comment.employee_id.get_avatar}}" class="oh-profile__image">
|
||||
</div>
|
||||
<span class="oh-timeoff-modal__stat-title fw-bold mt-2">
|
||||
{{ comment.employee_id }}
|
||||
</span>
|
||||
<span class="d-flex mt-3">
|
||||
<div>
|
||||
<span class="oh-timeoff-modal__stat-title fw-bold">{% trans "By" %}</span>
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img src="{{comment.employee_id.get_avatar}}" class="oh-profile__image">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="float-end" style="margin-left: 50px;">
|
||||
<span class="oh-timeoff-modal__stat-title fw-bold mb-2">{% trans "Date & Time" %}</span>
|
||||
<span class="oh-timeoff-modal__stat-title">
|
||||
{% trans "on" %}  <span class="dateformat_changer">{{ comment.created_at|date:"F j, Y" }}</span>  
|
||||
{% trans "at" %}   <span class="timeformat_changer">{{ comment.created_at|time:"g:i A" }}</span>
|
||||
<span class="oh-timeoff-modal__stat-title fw-bold mt-2">
|
||||
{{ comment.employee_id }}
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<div class="float-end" style="margin-left: 50px;">
|
||||
<span class="oh-timeoff-modal__stat-title fw-bold mb-2">{% trans "Date & Time" %}</span>
|
||||
<span class="oh-timeoff-modal__stat-title">
|
||||
{% trans "on" %}  <span class="dateformat_changer">{{ comment.created_at|date:"F j, Y" }}</span>
|
||||
 
|
||||
{% trans "at" %}   <span class="timeformat_changer">{{ comment.created_at|time:"g:i A" }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
</ol>
|
||||
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="oh-404">
|
||||
<img src="{% static 'images/ui/no_comments.png' %}" class="oh-404__image mb-4"
|
||||
alt="Page not found. 404." />
|
||||
<h5 class="oh-404__subtitle">{% trans "Comments have been disabled for this announcement." %}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user