-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add reports to user-admin panel #43
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
268b503
Rename view utility module to match the convention of the store utility.
kjcioffi 41c70cf
Implement Mixin for handling CSV reports.
kjcioffi 21cba22
Implement DownloadCustomerReport. View will eventually handle PDFs too.
kjcioffi 9b74225
Add DownloadCustomerReport view to store url patterns in store/urls.py.
kjcioffi a4c8766
Update Customer CSV timestamp in filename to be snake case rather tha…
kjcioffi c26e8ce
Customer CSV URL path changed to better support PDF files.
kjcioffi d54fe26
Implement functionality in ReportingMixin to support PDF generation.
kjcioffi 6a042d1
Implement Product Listing CSV reports.
kjcioffi 257a168
Finish URL path for customer CSV reports.
kjcioffi afaafa3
Implement CSV Sales Report for user-admin.
kjcioffi 845d6e5
Implement Customer Report in PDF format.
kjcioffi de541b6
Implement Product report in PDF format.
kjcioffi 9602e6a
Improve CSV sales report.
kjcioffi 0024304
Implement Sales PDF report.
kjcioffi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends "store/base.html" %} | ||
|
||
{% block content %} | ||
<table> | ||
<caption><h1>{{ store }}</h1></caption> | ||
<thead> | ||
<tr> | ||
<th>First Name | ||
<th>Last Name | ||
<th>Email | ||
<th>Phone Number | ||
{% for customer in customers %} | ||
<tr> | ||
<td>{{ customer.first_name}} | ||
<td>{{ customer.last_name}} | ||
<td>{{ customer.email}} | ||
{% if customer.phone_number %}<td>{{ customer.phone_number}}{% endif %} | ||
<tr> | ||
{% endfor %} | ||
</table> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends "store/base.html" %} | ||
|
||
{% block content %} | ||
<table> | ||
<caption><h1>Product List for {{ store }}</h1></caption> | ||
<thead> | ||
<tr> | ||
<th>Product Name | ||
<th>Rating | ||
<th>Price | ||
<th>Description | ||
{% for product in products %} | ||
<tr> | ||
<td>{{ product.name }} | ||
<td>{{ product.rating }} | ||
<td>{{ product.price }} | ||
<td>{{ product.description }} | ||
<tr> | ||
{% endfor %} | ||
</table> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% extends "store/base.html" %} | ||
|
||
{% block content %} | ||
<h1>Sales Report</h1> | ||
<p>Store: {{ store.name }}</p> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Order ID</th> | ||
<th>Product Name</th> | ||
<th>Product Rating</th> | ||
<th>Product Price</th> | ||
<th>Quantity</th> | ||
<th>Total Quantity Cost</th> | ||
<th>Percent Of Total Order</th> | ||
<th>Total Cost Of Order</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for order_item in order_item_data %} | ||
<tr> | ||
<td>{{ order_item.order_id }}</td> | ||
<td>{{ order_item.product_name }}</td> | ||
<td>{{ order_item.product_rating }}/10</td> | ||
<td>${{ order_item.product_price }}</td> | ||
<td>{{ order_item.quantity }}</td> | ||
<td>{{ order_item.total_quantity_cost }}</td> | ||
<td>{{ order_item.percent_of_total_order }}%</td> | ||
<td>${{ order_item.order_cost }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
you might consider creating reports_base.html. This is so that you can set reports up independent of the base.html with its navigation etc that will not make much sense on a pdf report.
We see from he weasyprint documentation that using
@page
we can create a block rules that weasyprint will respond to. A practical example could beHere's an example of a reports_base.html taken from bits and pieces of their documentation and a bit of regular html/django:
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 wasn't aware these features existed, thanks! I will add this suggestion to #3 for my sanity as this seems more related to that issue. That way I can also close and complete this PR.