[ADD] PMS: Added company fields and updated the views based on company change for period and question templates
This commit is contained in:
@@ -855,6 +855,7 @@ class QuestionTemplateForm(ModelForm):
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
reload_queryset(self.fields)
|
||||
self.fields["company_id"].required = True
|
||||
self.fields["company_id"].widget.attrs.update(
|
||||
{
|
||||
"class": "oh-select oh-select-2 w-100",
|
||||
@@ -1018,6 +1019,7 @@ class PeriodForm(ModelForm):
|
||||
kwargs["initial"] = set_date_field_initial(instance)
|
||||
super().__init__(*args, **kwargs)
|
||||
reload_queryset(self.fields)
|
||||
self.fields["company_id"].required = True
|
||||
self.fields["company_id"].widget.attrs.update(
|
||||
{
|
||||
"class": "oh-select oh-select-2 w-100",
|
||||
|
||||
@@ -432,7 +432,7 @@ class QuestionTemplate(HorillaModel):
|
||||
)
|
||||
company_id = models.ManyToManyField(Company, blank=True, verbose_name=_("Company"))
|
||||
|
||||
objects = HorillaCompanyManager()
|
||||
objects = HorillaCompanyManager("company_id")
|
||||
|
||||
def __str__(self):
|
||||
return self.question_template
|
||||
@@ -811,6 +811,7 @@ class EmployeeBonusPoint(HorillaModel):
|
||||
on_delete=models.CASCADE,
|
||||
related_name="employeebonuspoint_set",
|
||||
)
|
||||
objects = HorillaCompanyManager("employee_id__employee_work_info__company_id")
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.employee_id.employee_first_name} - {self.bonus_point}"
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Title" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Total Question" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Company" %}</div>
|
||||
{% if perms.pms.change_questiontemplate or perms.pms.delete_questiontemplate or request.user|filtersubordinates %}
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,6 +48,20 @@
|
||||
class="oh-sticky-table__td"
|
||||
>{{question_template.question.count}}</a
|
||||
>
|
||||
<a
|
||||
style="color: inherit; text-decoration: none"
|
||||
href="{% url 'question-template-detailed-view' template_id=question_template.id %}"
|
||||
class="oh-sticky-table__td"
|
||||
>
|
||||
{% for cmp in question_template.company_id.all %}
|
||||
{% if cmp.company %}
|
||||
{{cmp.company}} ,
|
||||
{% endif %}
|
||||
{% empty %}
|
||||
{% trans "None." %}
|
||||
{% endfor %}
|
||||
</a
|
||||
>
|
||||
|
||||
{% if perms.pms.change_questiontemplate or perms.pms.delete_questiontemplate or request.user|filtersubordinates %}
|
||||
<div class="oh-sticky-table__td">
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<div data-cell-index="2" data-cell-title="{% trans 'Target Value' %}" class="oh-sticky-table__th">{% trans "Target Value" %}</div>
|
||||
<div data-cell-index="3" data-cell-title="{% trans 'Duration' %}" class="oh-sticky-table__th">{% trans "Duration" %}</div>
|
||||
<div data-cell-index="4" data-cell-title="{% trans 'Descrption' %}" class="oh-sticky-table__th">{% trans "Descrption" %}</div>
|
||||
<div data-cell-index="5" data-cell-title="{% trans 'Company' %}" class="oh-sticky-table__th">{% trans "Company" %}</div>
|
||||
{% comment %} <div data-cell-index="5" data-cell-title="{% trans 'Is Active' %}" class="oh-sticky-table__th">{% trans "Is Active" %}</div> {% endcomment %}
|
||||
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right">{% trans "Actions" %}</div>
|
||||
@@ -98,10 +99,9 @@
|
||||
<div data-cell-index="4" class="oh-sticky-table__td">
|
||||
{{kr.description}}
|
||||
</div>
|
||||
{% comment %} <div data-cell-index="5" class="oh-sticky-table__td">
|
||||
{{kr.target_value}}
|
||||
</div> {% endcomment %}
|
||||
|
||||
<div data-cell-index="5" class="oh-sticky-table__td">
|
||||
{{kr.company_id}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right">
|
||||
<div class="oh-btn-group">
|
||||
<a
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
<div class="oh-sticky-table__th">{% trans "Title" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Start Date" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "End Date" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Company" %}</div>
|
||||
{% if perms.pms.change_period or perms.pms.delete_period or request.user|filtersubordinates %}
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,6 +38,15 @@
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{period.end_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{% for p in period.company_id.all %}
|
||||
{% if p.company %}
|
||||
{{p.company}} ,
|
||||
{% endif %}
|
||||
{% empty %}
|
||||
{% trans "None." %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if perms.pms.change_period or perms.pms.delete_period or request.user|filtersubordinates %}
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
|
||||
Reference in New Issue
Block a user