[UPDT] BASE: More conditions for action columns in tables

This commit is contained in:
Horilla
2024-11-06 09:32:21 +05:30
parent ad9dd08fdc
commit d70f36f42b
17 changed files with 1980 additions and 1774 deletions

View File

@@ -38,7 +38,7 @@
<div class="oh-accordion-meta">
<div class="oh-accordion-meta__item">
<div class="oh-accordion-meta__header"
data-field="{{saved_filters.field}}"
data-field="{{saved_filters.field}}"
data-path="{{request.path}}"
data-group="{{forloop.counter}}"
data-open=false
@@ -87,7 +87,7 @@
{% for cell in columns %}
{% with cell_attr=header_attrs|get_item:cell.1 %}
<th {% if cell.2 and not cell_attr %}style="width:220px!important;"{% endif %} {{cell_attr|safe}} id="{{view_id}}-{{ forloop.counter }}-{{cell.1}}-header">
<div
<div
{% for sort_map in sortby_mapping %}
{% if sort_map.0 == cell.0 %}
hx-get="{{search_url}}?{{saved_filters.urlencode}}&{{sortby_key}}={{sort_map.1}}&filter_applied=on"
@@ -123,7 +123,7 @@
</thead>
<tbody>
{% for instance in group.list %}
<tr
<tr
data-instance-id="{{instance.id}}"
{{row_attrs|format:instance|safe}}
>
@@ -152,7 +152,7 @@
</td>
{% endif %}
{% for cell in columns %}
{% with attribute=cell.1 index=forloop.counter %}
{% with attribute=cell.1 index=forloop.counter %}
<td>
{% if not cell.2 %}
{{instance|getattribute:attribute|selected_format:request.user.employee_get.employee_work_info.company_id|safe}}
@@ -218,25 +218,25 @@
$(document).ready(function () {
let thWidth = 0;
const widths = [];
$('.lastTd').each(function () {
widths.push(this.scrollWidth);
$(this).css('overflow', 'hidden');
});
widths.sort().reverse();
if (widths.length) {
thWidth = widths[0];
}
$('.lastTh').css("width", `${thWidth}px`);
});
</script>
</div>
<div class="oh-pagination">
<span class="oh-pagination__page">
{% trans "Page" %} {{ group.list.number }}
{% trans "Page" %} {{ group.list.number }}
{% trans "of" %} {{ group.list.paginator.num_pages }}.
</span>
<nav class="oh-pagination__nav">
@@ -365,9 +365,9 @@
</script>
{% endif %}
{% endif %}
<script>
$(".oh-accordion-meta__header").click(function (e) {
$(".oh-accordion-meta__header").click(function (e) {
var open = $(this).attr("data-open");
open = JSON.parse(open)
if (!$(this).parent().parent().find(".oh-accordion-meta__body.d-none").length && !$(this).find(".oh-accordion-meta__header--show").length) {

View File

@@ -23,7 +23,7 @@
{% include "generic/quick_actions.html" %}
{% endif %}
<div class="oh-table_sticky--wrapper">
{% if show_toggle_form %}
<div class="oh-sticky-dropdown--header" style="z-index: 13;">
@@ -75,7 +75,7 @@
{% for cell in columns %}
{% with cell_attr=header_attrs|get_item:cell.1 %}
<th {% if cell.2 and not cell_attr %}style="width:220px!important;"{% endif %} {{cell_attr|safe}} id="{{view_id}}-{{ forloop.counter }}-{{cell.1}}-header">
<div
<div
{% for sort_map in sortby_mapping %}
{% if sort_map.0 == cell.0 %}
hx-get="{{search_url}}?{{saved_filters.urlencode}}&{{sortby_key}}={{sort_map.1}}&filter_applied=on"
@@ -111,7 +111,7 @@
</thead>
<tbody>
{% for instance in queryset %}
<tr
<tr
data-instance-id="{{instance.id}}"
{{row_attrs|format:instance|safe}}
>
@@ -140,7 +140,7 @@
</td>
{% endif %}
{% for cell in columns %}
{% with attribute=cell.1 index=forloop.counter %}
{% with attribute=cell.1 index=forloop.counter %}
<td>
{% if not cell.2 %}
{{instance|getattribute:attribute|selected_format:request.user.employee_get.employee_work_info.company_id|safe}}
@@ -290,10 +290,10 @@
<script>
selectSelected("#{{view_id|safe}}",'{{selected_instances_key_id}}')
</script>
{% endif %}
{% endif %}
{% endif %}
<script>
$("ul[data-search-url] a").click(function (e) {
$("ul[data-search-url] a").click(function (e) {
e.preventDefault();
const url = $(this).attr("hx-get")
const $urlObj = $('<a>', { href: url });