CBV code updates: 4th August
This commit is contained in:
@@ -66,8 +66,7 @@ class CompanyListView(HorillaListView):
|
||||
|
||||
model = Company
|
||||
filter_class = CompanyFilter
|
||||
|
||||
bulk_template = "cbv/settings/company_bulk_update.html"
|
||||
selected_instances_key_id = "selectedInstance"
|
||||
bulk_update_fields = ["country", "state", "city", "zip"]
|
||||
|
||||
def get_bulk_form(self):
|
||||
@@ -161,7 +160,6 @@ class CompanyCreateForm(HorillaFormView):
|
||||
|
||||
model = Company
|
||||
form_class = CompanyForm
|
||||
template_name = "cbv/settings/company_inherit.html"
|
||||
new_display_title = _("Create Company")
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
|
||||
@@ -1,34 +1,9 @@
|
||||
{% extends 'settings.html' %} {% load i18n %} {% block settings %}{% load static %}
|
||||
{% include "generic/components.html" %}
|
||||
<meta name="csrf-token" content="{{ csrf_token }}">
|
||||
|
||||
<div id="selectedInstance" data-ids="[]"></div>
|
||||
<div class="oh-inner-sidebar-content">
|
||||
{% if perms.base.view_company %}
|
||||
<div
|
||||
class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center"
|
||||
>
|
||||
<h2 class="oh-inner-sidebar-content__title">{{model.get_verbose_name}}</h2>
|
||||
{% if perms.base.add_company %}
|
||||
<button
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'company-create' %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
>
|
||||
<ion-icon name="add-outline" class="me-1"></ion-icon>
|
||||
{% trans "Create" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if companies %}
|
||||
{% include 'base/company/company_view.html' %}
|
||||
{% else %}
|
||||
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
|
||||
<img style="display: block; width: 15%; margin: 20px auto; filter: opacity(0.5);" src="{% static 'images/ui/company.png' %}" class="" alt="Page not found. 404." />
|
||||
<h5 class="oh-404__subtitle">{% trans "There is no companies at this moment." %}</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div hx-get="{% url 'company-navbar' %}" hx-trigger="load"></div>
|
||||
<div hx-get="{% url 'company-list' %}" hx-trigger="load"></div>
|
||||
</div>
|
||||
{% endblock settings %}
|
||||
|
||||
@@ -1,61 +1,3 @@
|
||||
{% load i18n %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Company" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Is Hq" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Address" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Country" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "State" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "City" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Zip" %}</div>
|
||||
{% if perms.base.change_company or perms.base.delete_company %}
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for company in companies %}
|
||||
<div class="oh-sticky-table__tr" draggable="true">
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="mr-1">
|
||||
<img src="{{company.icon.url}}" style="width: 30px; border-radius: 100%"
|
||||
class="oh-profile__image" alt="Username" />{{company.company}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">{{company.hq}}</div>
|
||||
<div class="oh-sticky-table__td">{{company.address}}</div>
|
||||
<div class="oh-sticky-table__td">{{company.country}}</div>
|
||||
<div class="oh-sticky-table__td">{{company.state}}</div>
|
||||
<div class="oh-sticky-table__td">{{company.city}}</div>
|
||||
<div class="oh-sticky-table__td">{{company.zip}}</div>
|
||||
{% if perms.base.change_company or perms.base.delete_company %}
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right">
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.base.change_company %}
|
||||
<button data-toggle="oh-modal-toggle" data-target="#objectUpdateModal"
|
||||
hx-get="{% url 'company-update' company.id %}" hx-target="#objectUpdateModalTarget"
|
||||
class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}">
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.base.delete_company %}
|
||||
<form action="{% url 'company-delete' company.id %}"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to delete this company?" %}');"
|
||||
method='post' class='w-50'>
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
title="{% trans 'Remove' %}">
|
||||
<ion-icon name="trash-outline"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div hx-get="{% url 'company-list' %}">
|
||||
</div>
|
||||
|
||||
@@ -3,16 +3,8 @@
|
||||
class="oh-label"
|
||||
for="id_{{ form.job_position_id.title }}"
|
||||
title="{{ form.job_position_id.help_text|safe }}"
|
||||
>{% trans form.job_position_id.label %}</label
|
||||
>{% trans form.job_position_id.label %} New</label
|
||||
>
|
||||
<div id ="dynamic_field_job_position_id">
|
||||
{{form.job_position_id}}
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -8,11 +8,3 @@
|
||||
<div id ="dynamic_field_job_role_id">
|
||||
{{form.job_role_id}}
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -3,25 +3,17 @@
|
||||
{% include "generic/components.html" %}
|
||||
<div id="formContainer">
|
||||
{% include "generic/horilla_form.html" %}
|
||||
|
||||
<button
|
||||
hidden
|
||||
hx-target="#multiApprovalManager_0"
|
||||
hx-swap="outerHTML"
|
||||
hx-get="{% url 'add-more-approval-managers' %}"
|
||||
role="button"
|
||||
id = "addmangerButton"
|
||||
style="color: green"
|
||||
>{% trans "Add more managers.." %}</button>
|
||||
<button hidden hx-target="#multiApprovalManager_0" hx-swap="outerHTML"
|
||||
hx-get="{% url 'add-more-approval-managers' %}" role="button" id="addmangerButton" style="color: green">
|
||||
{% trans "Add more managers.." %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
$("#id_condition_start_value_parent_div").hide();
|
||||
$("#id_condition_end_value_parent_div").hide();
|
||||
$("#id_condition_operator").change(function() {
|
||||
$("#id_condition_operator").change(function () {
|
||||
var selectedValue = $(this).val();
|
||||
if (selectedValue === "range") {
|
||||
$("#id_condition_start_value_parent_div").remove();
|
||||
@@ -48,27 +40,8 @@
|
||||
console.error("Parent div with ID 'id_multi_approval_manager_parent_div' not found.");
|
||||
}
|
||||
|
||||
$(document).off('click', '#addmanger').on('click', '#addmanger', function(event) {
|
||||
$(document).off('click', '#addmanger').on('click', '#addmanger', function (event) {
|
||||
$('#addmangerButton').trigger('click');
|
||||
});
|
||||
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{% comment %} <script>
|
||||
$(document).ready(function () {
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
});
|
||||
</script> {% endcomment %}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
role="button"
|
||||
id = "addmangerButton"
|
||||
style="color: green"
|
||||
>{% trans "Add more managers.." %}</button>
|
||||
>{% trans "Add more managers.. 321" %}</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -22,9 +22,6 @@
|
||||
$('#addmangerButton').trigger('click');
|
||||
});
|
||||
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
|
||||
var managersCount = {{ managers_count }};
|
||||
|
||||
|
||||
@@ -175,10 +175,3 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -8,11 +8,3 @@
|
||||
<div id ="dynamic_field_task_id">
|
||||
{{form.reallocate_to}}
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$("select").on("select2:select", function (e) {
|
||||
$(this).closest("select")[0].dispatchEvent(new Event("change"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user