From 3d4e787a20529a8a5351b3ead6687c686e02b1eb Mon Sep 17 00:00:00 2001 From: Garrett Edel Date: Thu, 25 Jul 2024 09:09:39 -0400 Subject: [PATCH] Fixed table highlighting issue --- api/forms.py | 2 +- api/views/journal_entry_views.py | 7 ++++++- .../api/filter_forms/transactions-filter-form.html | 1 + ledger/templates/api/tables/transactions-table-new.html | 4 +++- ledger/templates/api/views/journal-entry-view.html | 7 +++---- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/api/forms.py b/api/forms.py index d00b7c5..23c8f71 100644 --- a/api/forms.py +++ b/api/forms.py @@ -288,7 +288,7 @@ def save(self): return hero_transaction class JournalEntryMetadataForm(forms.Form): - index = forms.CharField(widget=forms.HiddenInput()) + index = forms.IntegerField(min_value=0, widget=forms.HiddenInput()) paystub_id = forms.CharField(widget=forms.HiddenInput(), required=False) diff --git a/api/views/journal_entry_views.py b/api/views/journal_entry_views.py index ba6825b..f064215 100644 --- a/api/views/journal_entry_views.py +++ b/api/views/journal_entry_views.py @@ -158,10 +158,14 @@ def get(self, request, *args, **kwargs): entry_form_html = self.get_journal_entry_form_html( transaction=transaction ) + paystubs_table_html = self.get_paystubs_table_html() view_template = 'api/views/journal-entry-view.html' context = { 'entry_form': entry_form_html, - 'table': table_html + 'table': table_html, + 'paystubs_table': paystubs_table_html, + 'transaction_id': transaction.id, + 'index': 0 } html = render_to_string(view_template, context) @@ -169,6 +173,7 @@ def get(self, request, *args, **kwargs): # Called every time a table row is clicked +# TODO: WTF shoudl I do here class JournalEntryFormView(TransactionsViewMixin, JournalEntryViewMixin, LoginRequiredMixin, View): login_url = '/login/' redirect_field_name = 'next' diff --git a/ledger/templates/api/filter_forms/transactions-filter-form.html b/ledger/templates/api/filter_forms/transactions-filter-form.html index 5e8f778..25e3acb 100644 --- a/ledger/templates/api/filter_forms/transactions-filter-form.html +++ b/ledger/templates/api/filter_forms/transactions-filter-form.html @@ -4,6 +4,7 @@ hx-get="{{ get_url }}" hx-target="#table-and-form" hx-trigger="submit" + hx-swap="outerHTML" class="mb-3 form-sm" >
diff --git a/ledger/templates/api/tables/transactions-table-new.html b/ledger/templates/api/tables/transactions-table-new.html index 35d7d5b..d2d7d04 100644 --- a/ledger/templates/api/tables/transactions-table-new.html +++ b/ledger/templates/api/tables/transactions-table-new.html @@ -34,4 +34,6 @@
- \ No newline at end of file + +{% include "api/components/clickable-row-script.html" %} +{% include "api/components/transactions-scroll.html" %} \ No newline at end of file diff --git a/ledger/templates/api/views/journal-entry-view.html b/ledger/templates/api/views/journal-entry-view.html index 65d37b4..5e5a9bf 100644 --- a/ledger/templates/api/views/journal-entry-view.html +++ b/ledger/templates/api/views/journal-entry-view.html @@ -1,12 +1,11 @@ {% if is_initial_load %} - {% include "api/components/clickable-row-script.html" %} - {% include "api/components/transactions-scroll.html" %}

Journal Entries

{% endif %} {{ filter_form }} -
-
+ +
+