Skip to content

Commit

Permalink
Fixed table highlighting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
edelgm6 committed Jul 25, 2024
1 parent 12659f9 commit 3d4e787
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
7 changes: 6 additions & 1 deletion api/views/journal_entry_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,22 @@ 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)
return HttpResponse(html)


# 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
hx-get="{{ get_url }}"
hx-target="#table-and-form"
hx-trigger="submit"
hx-swap="outerHTML"
class="mb-3 form-sm"
>
<div class="row g-3">
Expand Down
4 changes: 3 additions & 1 deletion ledger/templates/api/tables/transactions-table-new.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@
</table>
</div>
</div>
</div>
</div>
{% include "api/components/clickable-row-script.html" %}
{% include "api/components/transactions-scroll.html" %}
7 changes: 3 additions & 4 deletions ledger/templates/api/views/journal-entry-view.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{% if is_initial_load %}
{% include "api/components/clickable-row-script.html" %}
{% include "api/components/transactions-scroll.html" %}
<h2>Journal Entries</h2>
{% endif %}

{{ filter_form }}
<div x-data="{ selectedRowId: {{transaction_id}}, rowIndex: {{index}} }">
<div id="table-and-form">

<div id="table-and-form">
<div x-data="{ selectedRowId: {{transaction_id}}, rowIndex: {{index}} }">
<div class="row">
<div class="col-md-12">
<div id="table">
Expand Down

0 comments on commit 3d4e787

Please sign in to comment.