[ADD] PMS: Quick filter into objective view

This commit is contained in:
Horilla
2023-10-19 12:39:13 +05:30
parent 77e9ccce4c
commit f9677df794
5 changed files with 49 additions and 13 deletions

View File

@@ -138,6 +138,10 @@ class EmployeeKeyResult(models.Model):
def __str__(self):
return f"{self.key_result} "
def save(self, *args, **kwargs):
if self.employee_id is None:
self.employee_id = self.employee_objective_id.employee_id
super().save(*args, **kwargs)
"""360degree feedback section"""

View File

@@ -1,6 +1,6 @@
.oh-dot--colorOn {
background-color: hsl(148deg, 71%, 44%)
background-color: yellowgreen
}
.oh-dot--colorBehind {
background-color: hsl(40deg, 91%, 60%)

View File

@@ -3,6 +3,7 @@
{% load widget_tweaks %}
{% block content %}
{% load basefilters %}
<script src="{% static 'htmx/htmx.min.js' %}"></script>
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<section class="oh-wrapper oh-main__topbar p-0" x-data="{searchShow: false}">
@@ -34,7 +35,8 @@
data-toggle="oh-modal-toggle"
hx-get="{% url 'key-result-update' id=employee_key_result.id %}"
hx-target="#ObjectiveModalFormTarget"
data-target="#objectiveModalpopup" >
data-target="#objectiveModalpopup"
onclick="$('#objectiveModalpopup').toggleClass('oh-modal--show')">
<ion-icon name="create-outline" class="me-1" ></ion-icon>
{% trans "Edit" %}
</button>
@@ -63,13 +65,13 @@
{% trans "Current Value" %}
</label>
<input
type="number" class="oh-table__editable-input " min="0"
type="number" class="" min="0"
max="{{employee_key_result.target_value}}"
value="{{employee_key_result.current_value}}"
hx-post="{%url 'objective-detailed-view-current-value' kr_id=employee_key_result.id %}"
hx-trigger="change"
hx-target="#objective_detailed_view_activity"
name="current_value" readonly/>
hx-target="#ObjectiveModalFormTarget"
name="current_value" />
</div>
</div>
@@ -91,9 +93,9 @@
<label class="oh-label my-2 my-2 me-2" for="status">{% trans "Status" %}</label>
<select
id="status" name="key_result_status"
hx-post=""
hx-post="{%url 'objective-detailed-view-key-result-status' obj_id=employee_key_result.employee_objective_id.id kr_id=employee_key_result.id %}"
hx-trigger="change" class="oh-select oh-select--sm"
hx-target="#objective_detailed_view_activity">
hx-target="#ObjectiveModalFormTarget">
<option value="{{employee_key_result.status}}" selected>
{{employee_key_result.get_status_display }}
</option>
@@ -101,7 +103,6 @@
{% if employee_key_result.status != value %}
<option value="{{value}}">{{label}}</option>
{% endif%}
^^^^^^^^^^
{% endfor %}
</select>
</div>
@@ -123,10 +124,18 @@
<!-- end of activity -->
</div>
</div>
<div class="oh-modal" id="objectiveModalpopup" role="dialog" aria-labelledby="objectiveModal" aria-hidden="true">
<div class="oh-modal__dialog" id="ObjectiveModalFormTarget">
<div
class="oh-modal"
id="objectiveModalpopup"
role="dialog"
aria-labelledby="objectiveModal"
aria-hidden="true"
>
<div class="oh-modal__dialog">
<div class="oh-modal__dialog" id="ObjectiveModalFormTarget">aaaaaaaaaaaaaaaaaaaaa
</div>
</div>
</div>
</main>
{% endblock %}
{% endblock %}

View File

@@ -2,6 +2,28 @@
{% load basefilters %}
<!-- filter items showing here -->
{% include 'filter_tags.html' %}
<div class="d-flex flex-row-reverse">
<span class="m-3 review_ongoing" hx-get="{% url "objective-list-search" %}?{{pd}}&status=At Risk" hx-target="#objective_list" style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color:red"></span>
{% trans "At Risk" %}
</span>
<span class="m-3 review_ongoing" hx-get="{% url "objective-list-search" %}?{{pd}}&status=Not Started" hx-target="#objective_list" style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color:grey"></span>
{% trans "Not Started" %}
</span>
<span class="m-3 paid" hx-get="{% url "objective-list-search" %}?{{pd}}&status=Behind" hx-target="#objective_list" style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color:orange"></span>
{% trans "Behind" %}
</span>
<span class="m-3 confirmed" hx-get="{% url "objective-list-search" %}?{{pd}}&status=Closed" hx-target="#objective_list" style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color:rgb(103, 171, 238)"></span>
{% trans "Closed" %}
</span>
<span class="m-3 paid" hx-get="{% url "objective-list-search" %}?{{pd}}&status=On Track" hx-target="#objective_list" style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color:yellowgreen"></span>
{% trans "On Track" %}
</span>
</div>
<div class="oh-tabs" >
<ul class="oh-tabs__tablist" >
@@ -39,7 +61,7 @@
<a
style="color: inherit; text-decoration: none"
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
class="oh-sticky-table__sd"
class="oh-sticky-table__sd {% if own_objective.status == 'Closed' %}row-status--blue {% elif own_objective.status == 'On Track' %}row-status--yellow {% elif own_objective.status == 'Not Started' %}row-status--gray {% elif own_objective.status == 'Behind' %}row-status--orange {% elif own_objective.status == 'At Risk' %}row-status--red{% endif %}"
>
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
@@ -241,7 +263,7 @@
<a
style="color: inherit; text-decoration: none"
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
class="oh-sticky-table__sd"
class="oh-sticky-table__sd {% if all_objective.status == 'Closed' %}row-status--blue {% elif all_objective.status == 'On Track' %}row-status--yellow {% elif all_objective.status == 'Not Started' %}row-status--gray {% elif all_objective.status == 'Behind' %}row-status--orange {% elif all_objective.status == 'At Risk' %}row-status--red{% endif %}"
>
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">

View File

@@ -614,6 +614,7 @@ def key_result_view(request):
key_results = KeyResultFilter(request.GET).qs
context = {
"key_results": key_results,
"objective_key_result_status": EmployeeKeyResult.STATUS_CHOICES,
}
return render(request,"okr/key_result/key_result_view.html", context=context)