[UPDT] PMS: Action button on self and all objective view
This commit is contained in:
@@ -213,7 +213,6 @@
|
|||||||
{% if employee_key_result.status != value %}
|
{% if employee_key_result.status != value %}
|
||||||
<option value="{{value}}">{{label}}</option>
|
<option value="{{value}}">{{label}}</option>
|
||||||
{% endif%}
|
{% endif%}
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
{% load basefilters %}
|
{% load basefilters %}
|
||||||
<!-- filter items showing here -->
|
<!-- filter items showing here -->
|
||||||
{% include 'filter_tags.html' %}
|
{% include 'filter_tags.html' %}
|
||||||
@@ -48,6 +49,14 @@
|
|||||||
<div class="oh-sticky-table__table">
|
<div class="oh-sticky-table__table">
|
||||||
<div class="oh-sticky-table__thead">
|
<div class="oh-sticky-table__thead">
|
||||||
<div class="oh-sticky-table__tr">
|
<div class="oh-sticky-table__tr">
|
||||||
|
<div class="oh-sticky-table__th" style="width:10px;">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="own-objects oh-input oh-input__checkbox"
|
||||||
|
id = "Ownobjectives"
|
||||||
|
title='{% trans "Select All" %}'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="oh-sticky-table__th">{% trans "Owner" %}</div>
|
<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 "Objective" %}</div>
|
||||||
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
||||||
@@ -58,23 +67,28 @@
|
|||||||
<div class="oh-sticky-table__tbody">
|
<div class="oh-sticky-table__tbody">
|
||||||
{% for own_objective in own_objectives.object_list %}
|
{% for own_objective in own_objectives.object_list %}
|
||||||
<div class="oh-sticky-table__tr" draggable="true">
|
<div class="oh-sticky-table__tr" draggable="true">
|
||||||
<a
|
<div 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 %}">
|
||||||
style="color: inherit; text-decoration: none"
|
<div class="d-flex">
|
||||||
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} "
|
<div>
|
||||||
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 %}"
|
<input
|
||||||
>
|
type="checkbox"
|
||||||
|
id="{{own_objective.id}}"
|
||||||
|
value="{{own_objective.id}}"
|
||||||
|
class="oh-input payslip-checkbox oh-input__checkbox own-objects-row ms-2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="oh-sticky-table__td" style="color: inherit; text-decoration: none"
|
||||||
|
href="{% url 'objective-detailed-view' emp_obj_id=own_objective.id %} ">
|
||||||
<div class="oh-profile oh-profile--md">
|
<div class="oh-profile oh-profile--md">
|
||||||
<div class="oh-profile__avatar mr-1">
|
<div class="oh-profile__avatar mr-1">
|
||||||
<img
|
<img
|
||||||
src="https://ui-avatars.com/api/?name={{own_objective.employee_id}}&background=random"
|
src="https://ui-avatars.com/api/?name={{own_objective.employee_id}}&background=random"
|
||||||
class="oh-profile__image"
|
class="oh-profile__image"
|
||||||
alt="Mary Magdalene"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span class="oh-profile__name oh-text--dark"
|
<span class="oh-profile__name oh-text--dark">{{own_objective.employee_id}}</span>
|
||||||
>{{own_objective.employee_id.employee_first_name|title}}
|
|
||||||
{{own_objective.employee_id.employee_last_name}}</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
@@ -250,6 +264,14 @@
|
|||||||
<div class="oh-sticky-table__table">
|
<div class="oh-sticky-table__table">
|
||||||
<div class="oh-sticky-table__thead">
|
<div class="oh-sticky-table__thead">
|
||||||
<div class="oh-sticky-table__tr">
|
<div class="oh-sticky-table__tr">
|
||||||
|
<div class="oh-sticky-table__th" style="width:10px;">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="all-objects oh-input oh-input__checkbox"
|
||||||
|
id = "Allobjectives"
|
||||||
|
title='{% trans "Select All" %}'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="oh-sticky-table__th">{% trans "Owner" %}</div>
|
<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 "Objective" %}</div>
|
||||||
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
<div class="oh-sticky-table__th">{% trans "Due In" %}</div>
|
||||||
@@ -260,23 +282,29 @@
|
|||||||
<div class="oh-sticky-table__tbody">
|
<div class="oh-sticky-table__tbody">
|
||||||
{% for all_objective in all_objectives.object_list %}
|
{% for all_objective in all_objectives.object_list %}
|
||||||
<div class="oh-sticky-table__tr" draggable="true">
|
<div class="oh-sticky-table__tr" draggable="true">
|
||||||
<a
|
<div 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 %}">
|
||||||
style="color: inherit; text-decoration: none"
|
<div class="d-flex">
|
||||||
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
<div>
|
||||||
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 %}"
|
<input
|
||||||
>
|
type="checkbox"
|
||||||
|
id="{{all_objective.id}}"
|
||||||
|
value="{{all_objective.id}}"
|
||||||
|
class="oh-input payslip-checkbox oh-input__checkbox all-objects-row ms-2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="oh-sticky-table__td" style="color: inherit; text-decoration: none"
|
||||||
|
href="{% url 'objective-detailed-view' emp_obj_id=all_objective.id %} "
|
||||||
|
>
|
||||||
<div class="oh-profile oh-profile--md">
|
<div class="oh-profile oh-profile--md">
|
||||||
<div class="oh-profile__avatar mr-1">
|
<div class="oh-profile__avatar mr-1">
|
||||||
<img
|
<img
|
||||||
src="https://ui-avatars.com/api/?name={{all_objective.employee_id}}&background=random"
|
src="https://ui-avatars.com/api/?name={{all_objective.employee_id}}&background=random"
|
||||||
class="oh-profile__image"
|
class="oh-profile__image"
|
||||||
alt="O.V. Vijayan"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span class="oh-profile__name oh-text--dark"
|
<span class="oh-profile__name oh-text--dark">{{all_objective.employee_id}}</span>
|
||||||
>{{all_objective.employee_id.employee_first_name|title}}
|
|
||||||
{{all_objective.employee_id.employee_last_name}}</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
@@ -448,6 +476,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="{% static 'src/okr/action.js' %}"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// TO recogonise recently used tab
|
// TO recogonise recently used tab
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
@@ -473,4 +503,23 @@
|
|||||||
localStorage.setItem("activeTabPms", activeTab);
|
localStorage.setItem("activeTabPms", activeTab);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#Allobjectives").click(function (e) {
|
||||||
|
var is_checked = $(this).is(":checked");
|
||||||
|
if (is_checked) {
|
||||||
|
$(".all-objects-row").prop("checked", true);
|
||||||
|
} else {
|
||||||
|
$(".all-objects-row").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#Ownobjectives").click(function (e) {
|
||||||
|
var is_checked = $(this).is(":checked");
|
||||||
|
if (is_checked) {
|
||||||
|
$(".own-objects-row").prop("checked", true);
|
||||||
|
} else {
|
||||||
|
$(".own-objects-row").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -138,6 +138,52 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="oh-btn-group ml-2">
|
||||||
|
<div class="oh-dropdown" x-data="{open: false}">
|
||||||
|
<button
|
||||||
|
class="oh-btn oh-btn--dropdown oh-btn oh-btn--shadow"
|
||||||
|
@click="open = !open"
|
||||||
|
@click.outside="open = false"
|
||||||
|
>
|
||||||
|
{% trans "Actions" %}
|
||||||
|
</button>
|
||||||
|
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open"
|
||||||
|
style="display: none;"
|
||||||
|
>
|
||||||
|
<ul class="oh-dropdown__items">
|
||||||
|
|
||||||
|
<li class="oh-dropdown__item">
|
||||||
|
<a href="#" class="oh-dropdown__link " id="archiveObjectives"
|
||||||
|
|
||||||
|
>{% trans "Archive" %}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="oh-dropdown__item">
|
||||||
|
<a href="#" class="oh-dropdown__link "
|
||||||
|
|
||||||
|
id="unArchiveObjectives"
|
||||||
|
>{% trans "Un-Archive" %}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% if perms.pms.delete_employeeobjective %}
|
||||||
|
<li class="oh-dropdown__item">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="oh-dropdown__link oh-dropdown__link--danger"
|
||||||
|
id="deleteObjectives"
|
||||||
|
>{% trans "Delete" %}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- checking user permission for objective creation -->
|
<!-- checking user permission for objective creation -->
|
||||||
{% if perms.pms.view_questiontemplate or request.user|filtersubordinates %}
|
{% if perms.pms.view_questiontemplate or request.user|filtersubordinates %}
|
||||||
<div class="oh-btn-group ml-2">
|
<div class="oh-btn-group ml-2">
|
||||||
@@ -159,6 +205,7 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script src="{% static '/base/filter.js' %}"></script>
|
<script src="{% static '/base/filter.js' %}"></script>
|
||||||
|
<script src="{% static 'src/okr/action.js' %}"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(".fil").click(function() {
|
$(".fil").click(function() {
|
||||||
|
|||||||
10
pms/urls.py
10
pms/urls.py
@@ -172,4 +172,14 @@ urlpatterns = [
|
|||||||
views.create_period,
|
views.create_period,
|
||||||
name="create-period",
|
name="create-period",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"objective-bulk-archive",
|
||||||
|
views.objective_bulk_archive,
|
||||||
|
name="objective-bulk-archive",
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
"objective-bulk-delete",
|
||||||
|
views.objective_bulk_delete,
|
||||||
|
name="objective-bulk-delete",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
61
pms/views.py
61
pms/views.py
@@ -1831,7 +1831,7 @@ def dashboard_objective_status(request):
|
|||||||
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
|
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
|
||||||
if is_ajax and request.method == "GET":
|
if is_ajax and request.method == "GET":
|
||||||
objective_status = EmployeeObjective.STATUS_CHOICES
|
objective_status = EmployeeObjective.STATUS_CHOICES
|
||||||
data = {}
|
data = {"message":_("No data Found...")}
|
||||||
for status in objective_status:
|
for status in objective_status:
|
||||||
objectives = EmployeeObjective.objects.filter(status=status[0])
|
objectives = EmployeeObjective.objects.filter(status=status[0])
|
||||||
objectives_count = filtersubordinates(
|
objectives_count = filtersubordinates(
|
||||||
@@ -1850,7 +1850,7 @@ def dashboard_key_result_status(request):
|
|||||||
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
|
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
|
||||||
if is_ajax and request.method == "GET":
|
if is_ajax and request.method == "GET":
|
||||||
key_result_status = EmployeeKeyResult.STATUS_CHOICES
|
key_result_status = EmployeeKeyResult.STATUS_CHOICES
|
||||||
data = {}
|
data = {"message":_("No data Found...")}
|
||||||
for i in key_result_status:
|
for i in key_result_status:
|
||||||
key_results = EmployeeKeyResult.objects.filter(status=i[0])
|
key_results = EmployeeKeyResult.objects.filter(status=i[0])
|
||||||
key_results_count = filtersubordinates(
|
key_results_count = filtersubordinates(
|
||||||
@@ -1867,7 +1867,7 @@ def dashboard_feedback_status(request):
|
|||||||
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
|
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
|
||||||
if is_ajax and request.method == "GET":
|
if is_ajax and request.method == "GET":
|
||||||
feedback_status = Feedback.STATUS_CHOICES
|
feedback_status = Feedback.STATUS_CHOICES
|
||||||
data = {}
|
data = {"message":_("No data Found...")}
|
||||||
for i in feedback_status:
|
for i in feedback_status:
|
||||||
feedbacks = Feedback.objects.filter(status=i[0])
|
feedbacks = Feedback.objects.filter(status=i[0])
|
||||||
feedback_count = filtersubordinates(
|
feedback_count = filtersubordinates(
|
||||||
@@ -1911,7 +1911,58 @@ def create_period(request):
|
|||||||
instance = form.save()
|
instance = form.save()
|
||||||
return JsonResponse({"id": instance.id, "name": instance.period_name, "start_date": instance.start_date, "end_date": instance.end_date})
|
return JsonResponse({"id": instance.id, "name": instance.period_name, "start_date": instance.start_date, "end_date": instance.end_date})
|
||||||
errors = form.errors.as_json()
|
errors = form.errors.as_json()
|
||||||
print('-------------------------------------')
|
|
||||||
print(errors)
|
|
||||||
return JsonResponse({"errors": errors})
|
return JsonResponse({"errors": errors})
|
||||||
return render(request,"okr/create_period.html",context={"form": form})
|
return render(request,"okr/create_period.html",context={"form": form})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def objective_bulk_archive(request):
|
||||||
|
"""
|
||||||
|
This method is used to archive/un-archive bulk objectivs
|
||||||
|
"""
|
||||||
|
ids = request.POST["ids"]
|
||||||
|
ids = json.loads(ids)
|
||||||
|
is_active = False
|
||||||
|
message = _("un-archived")
|
||||||
|
if request.GET.get("is_active") == "False":
|
||||||
|
is_active = True
|
||||||
|
message = _("archived")
|
||||||
|
for objective_id in ids:
|
||||||
|
objective_obj = EmployeeObjective.objects.get(id=objective_id)
|
||||||
|
objective_obj.archive = is_active
|
||||||
|
objective_obj.save()
|
||||||
|
messages.success(
|
||||||
|
request,
|
||||||
|
_("{objective} is {message}").format(
|
||||||
|
objective=objective_obj, message=message
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return JsonResponse({"message": "Success"})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@manager_can_enter(perm="pms.delete_employeeobjective")
|
||||||
|
def objective_bulk_delete(request):
|
||||||
|
"""
|
||||||
|
This method is used to bulk delete objective
|
||||||
|
"""
|
||||||
|
ids = request.POST["ids"]
|
||||||
|
ids = json.loads(ids)
|
||||||
|
for objective_id in ids:
|
||||||
|
try:
|
||||||
|
objective = EmployeeObjective.objects.get(id=objective_id)
|
||||||
|
if objective.status == 'Not Started' or objective.status == 'Closed' :
|
||||||
|
objective.delete()
|
||||||
|
messages.success(
|
||||||
|
request,
|
||||||
|
_("%(employee)s's %(objective)s deleted") % {"objective": objective.objective, "employee":objective.employee_id},
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
messages.warning(
|
||||||
|
request,
|
||||||
|
_("You can't delete objective %(objective)s with status %(status)s") % {"objective": objective.objective, "status": objective.status},
|
||||||
|
)
|
||||||
|
except EmployeeObjective.DoesNotExist:
|
||||||
|
messages.error(request, _("Objective not found."))
|
||||||
|
|
||||||
|
return JsonResponse({"message": "Success"})
|
||||||
|
|||||||
Reference in New Issue
Block a user