-
Notifications
You must be signed in to change notification settings - Fork 2
Base tailwind table and styling and Opportunity List Table #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to fully understand without seeing it in use in an example table, but this looks reasonable
@@ -0,0 +1,18 @@ | |||
<div class="flex items-center gap-2 max-w-fit text-brand-deep-purple text-sm"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this used? basically how would we make a paginated table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the code. This is now removed with pagination now going into base_table itself
commcare_connect/utils/tables.py
Outdated
import django_tables2 as tables | ||
|
||
|
||
class BaseTailwindTable(tables.Table): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this applies to most of the code, and can be done at the end if easier, but I don't think we want everything named tailwind like it is now. Much like we don't call existing tables "BootstrapTable," I don't think it adds anything, because when this gets merged, it will be the only table type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we don't need it in the end. I have removed it and just declared the base-template in the settings.
Should I club this with an OpportunityList page for the above reason? |
{tooltip_text} | ||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could potentially be turned into a component by introducing classes like tooltip-wrapper, tooltip-content
etc. But this is the only place its used.
orderable=False, | ||
template_code=""" | ||
<div class="flex justify-start text-sm font-normal text-brand-deep-purple w-fit" | ||
x-data="{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could potentially be turned into an alpinejs/tailwind plugin, but this is also the only place it's used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit and a few questions but this generally seems fine.
@@ -0,0 +1,29 @@ | |||
{% extends 'tailwind/base.html' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: template name change (opportunity -> opportunities) seems unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I will try to be wary of these for next pages
@@ -151,3 +172,92 @@ def get_payment_report_data(opportunity: Opportunity): | |||
PaymentReportData(payment_unit.name, completed_work_count, user_payment_accrued, nm_payment_accrued) | |||
) | |||
return data, total_user_payment_accrued, total_nm_payment_accrued | |||
|
|||
|
|||
def get_opportunity_list_data(organization, program_manager=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this performant? just making sure we aren't building something that will get too slow very quickly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's likely this is not performant enough. We are setting aside time to look into this and other places with these kind of queries
{ | ||
"title": "View Workers", | ||
"url": reverse("opportunity:detail", args=[record.organization.slug, record.id]), | ||
# "url": reverse("opportunity:tw_worker_list", args=[record.organization.slug, record.id]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the commented out code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is updated in the followup PR here
template_name = "tailwind/pages/opportunities_list.html" | ||
paginate_by = 15 | ||
base_columns = ["program", "start_date", "end_date", "status", "opportunity"] | ||
pm_columns = ["active_workers", "total_deliveries", "verified_deliveries", "worker_earnings"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these for PMs only? They seem useful to everyone
added opportunity order
|
||
if program_manager: | ||
queryset = queryset.annotate( | ||
active_workers=Count( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QFR: Why not include active_workers for NM as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFR: NM needs to see action oriented columns, PM needs to see performance columns
This implements the base utils required to create a tailwind table