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" >