[FIX] PMS: Objective count when filtering in objective view
This commit is contained in:
@@ -2,409 +2,425 @@
|
||||
{% load basefilters %}
|
||||
<!-- filter items showing here -->
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-tabs__contents">
|
||||
<!-- own objective-->
|
||||
<div class="oh-tabs__content" id="tab_1">
|
||||
{% if own_objectives.object_list %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Owner" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Objective" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for own_objective in own_objectives.object_list %}
|
||||
<div class="oh-sticky-table__tr" draggable="true">
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__sd"
|
||||
>
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="https://ui-avatars.com/api/?name={{own_objective.employee_id}}&background=random"
|
||||
class="oh-profile__image"
|
||||
alt="Mary Magdalene"
|
||||
/>
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark"
|
||||
>{{own_objective.employee_id.employee_first_name|title}}
|
||||
{{own_objective.employee_id.employee_last_name}}</span
|
||||
>
|
||||
</div>
|
||||
</a>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>{{own_objective.objective}}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
{{ current_date|timesince:own_objective.end_date }}
|
||||
</a>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
<div class="d-flex align-items-center">
|
||||
<span
|
||||
class="oh-dot oh-dot--small me-1 oh-dot--color{{own_objective.status}}"
|
||||
></span
|
||||
><span>{{own_objective.get_status_display}}</span>
|
||||
</div>
|
||||
</a>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if own_objective.archive %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=own_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want un-archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Un-archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=own_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %} {% if perms.pms.delete_employeeobjective %}
|
||||
<form
|
||||
action="{% url 'objective-delete' obj_id=own_objective.id %}"
|
||||
onsubmit="return confirm('{% trans "Do you want Delete this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- pagination start -->
|
||||
<div class="oh-pagination">
|
||||
<span
|
||||
class="oh-pagination__page"
|
||||
data-toggle="modal"
|
||||
data-target="#addEmployeeModal"
|
||||
></span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{own_objectives.number }}"
|
||||
min="1"
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}"
|
||||
hx-target="#objective_list"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %} {{ own_objectives.paginator.num_pages }}</span
|
||||
>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if own_objectives.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ own_objectives.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{%endif %} {% if own_objectives.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ own_objectives.next_page_number }}"
|
||||
class="btn btn-outline-secondary"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ own_objectives.paginator.num_pages }}"
|
||||
hx-target="#objective_list"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- end of pagination -->
|
||||
<!-- end of own objective -->
|
||||
{% else %}
|
||||
<div class="d-flex justify-content-center align-items-center" style="height:60vh">
|
||||
<h5 class="oh-404__subtitle">{% trans "There are no Objectives at the moment." %}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="oh-tabs__content" id="tab_2">
|
||||
<!-- all objectives -->
|
||||
{% if all_objectives.object_list %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Owner" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Objective" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for all_objective in all_objectives.object_list %}
|
||||
<div class="oh-sticky-table__tr" draggable="true">
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__sd"
|
||||
>
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="https://ui-avatars.com/api/?name={{all_objective.employee_id}}&background=random"
|
||||
class="oh-profile__image"
|
||||
alt="O.V. Vijayan"
|
||||
/>
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark"
|
||||
>{{all_objective.employee_id.employee_first_name|title}}
|
||||
{{all_objective.employee_id.employee_last_name}}</span
|
||||
>
|
||||
</div>
|
||||
</a>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>{{all_objective.objective}}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
{{ current_date|timesince:all_objective.end_date }}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
<div class="d-flex align-items-center">
|
||||
<span
|
||||
class="oh-dot oh-dot--small me-1 oh-dot--color{{all_objective.status}}"
|
||||
></span
|
||||
><span>{{all_objective.get_status_display}}</span>
|
||||
</div>
|
||||
</a>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if all_objective.archive %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=all_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want un-archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Un-archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=all_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %} {% if perms.pms.delete_employeeobjective %}
|
||||
<form
|
||||
action="{% url 'objective-delete' obj_id=all_objective.id %}"
|
||||
onsubmit="return confirm('{% trans "Do you want delete this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<ul class="oh-tabs__tablist" >
|
||||
<li class="oh-tabs__tab " data-target="#tab_1">
|
||||
{% trans "Self Objective" %}
|
||||
<span class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2" id="" data-category-id="1" title="{{own_objectives|length}} objective" onclick="event.stopPropagation()">{{own_objectives|length}}</span>
|
||||
</li>
|
||||
<!-- normal user can't view all objective -->
|
||||
{% if perms.pms.view_employeeeobjective or request.user|filtersubordinates %}
|
||||
<li class="oh-tabs__tab" data-target="#tab_2">
|
||||
{% trans "All Objective" %}
|
||||
<span class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2" id="" data-category-id="1" title="{{all_objectives|length}} objective" onclick="event.stopPropagation()">{{all_objectives|length}}</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div >
|
||||
<div class="oh-tabs__contents">
|
||||
<!-- own objective-->
|
||||
<div class="oh-tabs__content" id="tab_1">
|
||||
{% if own_objectives.object_list %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Owner" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Objective" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for own_objective in own_objectives.object_list %}
|
||||
<div class="oh-sticky-table__tr" draggable="true">
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__sd"
|
||||
>
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="https://ui-avatars.com/api/?name={{own_objective.employee_id}}&background=random"
|
||||
class="oh-profile__image"
|
||||
alt="Mary Magdalene"
|
||||
/>
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark"
|
||||
>{{own_objective.employee_id.employee_first_name|title}}
|
||||
{{own_objective.employee_id.employee_last_name}}</span
|
||||
>
|
||||
</div>
|
||||
</a>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>{{own_objective.objective}}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
{{ current_date|timesince:own_objective.end_date }}
|
||||
</a>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
<div class="d-flex align-items-center">
|
||||
<span
|
||||
class="oh-dot oh-dot--small me-1 oh-dot--color{{own_objective.status}}"
|
||||
></span
|
||||
><span>{{own_objective.get_status_display}}</span>
|
||||
</div>
|
||||
</a>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if own_objective.archive %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=own_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want un-archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Un-archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=own_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %} {% if perms.pms.delete_employeeobjective %}
|
||||
<form
|
||||
action="{% url 'objective-delete' obj_id=own_objective.id %}"
|
||||
onsubmit="return confirm('{% trans "Do you want Delete this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- pagination start -->
|
||||
<div class="oh-pagination">
|
||||
<span
|
||||
class="oh-pagination__page"
|
||||
data-toggle="modal"
|
||||
data-target="#addEmployeeModal"
|
||||
></span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{own_objectives.number }}"
|
||||
min="1"
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}"
|
||||
hx-target="#objective_list"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %} {{ own_objectives.paginator.num_pages }}</span
|
||||
>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if own_objectives.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ own_objectives.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{%endif %} {% if own_objectives.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ own_objectives.next_page_number }}"
|
||||
class="btn btn-outline-secondary"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ own_objectives.paginator.num_pages }}"
|
||||
hx-target="#objective_list"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- end of pagination -->
|
||||
<!-- end of own objective -->
|
||||
{% else %}
|
||||
<div class="d-flex justify-content-center align-items-center" style="height:60vh">
|
||||
<h5 class="oh-404__subtitle">{% trans "There are no Objectives at the moment." %}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- pagination start -->
|
||||
<div class="oh-pagination">
|
||||
<span
|
||||
class="oh-pagination__page"
|
||||
data-toggle="modal"
|
||||
data-target="#addEmployeeModal"
|
||||
></span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{all_objectives.number }}"
|
||||
min="1"
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}"
|
||||
hx-target="#objective_list"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %} {{ all_objectives.paginator.num_pages }}</span
|
||||
>
|
||||
|
||||
<div class="oh-tabs__content" id="tab_2">
|
||||
<!-- all objectives -->
|
||||
{% if all_objectives.object_list %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Owner" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Objective" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for all_objective in all_objectives.object_list %}
|
||||
<div class="oh-sticky-table__tr" draggable="true">
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__sd"
|
||||
>
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="https://ui-avatars.com/api/?name={{all_objective.employee_id}}&background=random"
|
||||
class="oh-profile__image"
|
||||
alt="O.V. Vijayan"
|
||||
/>
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark"
|
||||
>{{all_objective.employee_id.employee_first_name|title}}
|
||||
{{all_objective.employee_id.employee_last_name}}</span
|
||||
>
|
||||
</div>
|
||||
</a>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>{{all_objective.objective}}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
{{ current_date|timesince:all_objective.end_date }}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
<div class="d-flex align-items-center">
|
||||
<span
|
||||
class="oh-dot oh-dot--small me-1 oh-dot--color{{all_objective.status}}"
|
||||
></span
|
||||
><span>{{all_objective.get_status_display}}</span>
|
||||
</div>
|
||||
</a>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if all_objective.archive %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=all_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want un-archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Un-archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form
|
||||
action="{%url 'objective-archive' id=all_objective.id %}?{{pg}}"
|
||||
onsubmit="return confirm('{% trans "Do you want archive this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Archive' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="archive-sharp"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="archive sharp"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %} {% if perms.pms.delete_employeeobjective %}
|
||||
<form
|
||||
action="{% url 'objective-delete' obj_id=all_objective.id %}"
|
||||
onsubmit="return confirm('{% trans "Do you want delete this OKR ?" %}')"
|
||||
method="post"
|
||||
style="display: contents"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button
|
||||
class="oh-btn oh-btn--danger-outline w-100"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon
|
||||
name="trash-outline"
|
||||
role="img"
|
||||
class="md hydrated"
|
||||
aria-label="trash outline"
|
||||
></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if all_objectives.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
</div>
|
||||
<!-- pagination start -->
|
||||
<div class="oh-pagination">
|
||||
<span
|
||||
class="oh-pagination__page"
|
||||
data-toggle="modal"
|
||||
data-target="#addEmployeeModal"
|
||||
></span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{all_objectives.number }}"
|
||||
min="1"
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "First" %}</a
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %} {{ all_objectives.paginator.num_pages }}</span
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ all_objectives.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{%endif %} {% if all_objectives.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ all_objectives.next_page_number }}"
|
||||
class="btn btn-outline-secondary"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ all_objectives.paginator.num_pages }}"
|
||||
hx-target="#objective_list"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if all_objectives.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ all_objectives.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{%endif %} {% if all_objectives.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ all_objectives.next_page_number }}"
|
||||
class="btn btn-outline-secondary"
|
||||
hx-target="#objective_list"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'objective-list-search' %}?{{pg}}&page={{ all_objectives.paginator.num_pages }}"
|
||||
hx-target="#objective_list"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- end of pagination -->
|
||||
<!-- end of all objectives -->
|
||||
{% else %}
|
||||
<div class="d-flex justify-content-center align-items-center" style="height:60vh">
|
||||
<h5 class="oh-404__subtitle">{% trans "There are no Objectives at the moment." %}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- end of pagination -->
|
||||
<!-- end of all objectives -->
|
||||
{% else %}
|
||||
<div class="d-flex justify-content-center align-items-center" style="height:60vh">
|
||||
<h5 class="oh-404__subtitle">{% trans "There are no Objectives at the moment." %}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -415,8 +431,8 @@
|
||||
if (activeTab != null) {
|
||||
var tab = $(`[data-target="${activeTab}"]`);
|
||||
var tabContent = $(activeTab);
|
||||
$(tab).attr("class", "oh-tabs__tab oh-tabs__tab--active");
|
||||
$(tabContent).attr("class", "oh-tabs__content oh-tabs__content--active");
|
||||
$(tab).addClass( "oh-tabs__tab--active");
|
||||
$(tabContent).addClass( "oh-tabs__content--active");
|
||||
} else {
|
||||
$('[data-target="#tab_1"]').attr(
|
||||
"class",
|
||||
@@ -426,6 +442,10 @@
|
||||
}
|
||||
$(".oh-tabs__tab").click(function (e) {
|
||||
var activeTab = $(this).attr("data-target");
|
||||
$(".oh-tabs__content--active").toggleClass('oh-tabs__content--active');
|
||||
$(".oh-tabs__tab--active").toggleClass('oh-tabs__tab--active');
|
||||
$(`[data-target="${activeTab}"]`).toggleClass("oh-tabs__tab--active");
|
||||
$(activeTab).toggleClass("oh-tabs__content--active");
|
||||
localStorage.setItem("activeTabPms", activeTab);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -153,23 +153,8 @@
|
||||
</div>
|
||||
</section>
|
||||
<div class="oh-wrapper">
|
||||
<div class="oh-tabs">
|
||||
<ul class="oh-tabs__tablist">
|
||||
<li class="oh-tabs__tab " data-target="#tab_1">
|
||||
{% trans "Self Objective" %}
|
||||
<span class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2" id="" data-category-id="1" title="{{own_objectives|length}} objective" onclick="event.stopPropagation()">{{own_objectives|length}}</span>
|
||||
</li>
|
||||
<!-- normal user can't view all objective -->
|
||||
{% if perms.pms.view_employeeeobjective or request.user|filtersubordinates %}
|
||||
<li class="oh-tabs__tab" data-target="#tab_2">
|
||||
{% trans "All Objective" %}
|
||||
<span class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2" id="" data-category-id="1" title="{{all_objectives|length}} objective" onclick="event.stopPropagation()">{{all_objectives|length}}</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div id="objective_list">
|
||||
<div class="oh-tabs" id="objective_list">
|
||||
{% include 'okr/objective_list.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user