|
1 | 1 | {% load humanize %}
|
2 | 2 | {% load mathfilters %}
|
3 | 3 | <tbody id="table_body">
|
4 |
| -{% for invoice in invoices %} |
5 |
| - <tr> |
6 |
| - <td class="link link-primary"> |
7 |
| - <a href="{% url "invoices dashboard preview" invoice_id=invoice.id %}">{{ invoice.id }}</a> |
8 |
| - </td> |
9 |
| - <td>{{ invoice.date_due | date:"d/m/Y" }}</td> |
10 |
| - <td> |
11 |
| - <div class="flex items-center text-sm"> |
12 |
| - <div> |
13 |
| - {% with cli_name=invoice.client_to.name|default:invoice.client_name %} |
14 |
| - {% if cli_name %} |
15 |
| - <p class="font-semibold">{{ cli_name }}</p> |
16 |
| - {% else %} |
17 |
| - <p class="font-thin">No Client</p> |
18 |
| - {% endif %} |
19 |
| - {% endwith %} |
| 4 | + {% for invoice in invoices %} |
| 5 | + <tr> |
| 6 | + <td class="link link-primary"> |
| 7 | + <a href="{% url "invoices dashboard preview" invoice_id=invoice.id %}">{{ invoice.id }}</a> |
| 8 | + </td> |
| 9 | + <td>{{ invoice.date_due | date:"d/m/Y" }}</td> |
| 10 | + <td> |
| 11 | + <div class="flex items-center text-sm"> |
| 12 | + <div> |
| 13 | + {% with cli_name=invoice.client_to.name|default:invoice.client_name %} |
| 14 | + {% if cli_name %} |
| 15 | + <p class="font-semibold">{{ cli_name }}</p> |
| 16 | + {% else %} |
| 17 | + <p class="font-thin">No Client</p> |
| 18 | + {% endif %} |
| 19 | + {% endwith %} |
| 20 | + </div> |
20 | 21 | </div>
|
21 |
| - </div> |
22 |
| - </td> |
23 |
| - <td>£{{ invoice.amount | floatformat:2 | intcomma }}</td> |
24 |
| - <td> |
25 |
| - {% component "pages:invoices:dashboard:payment_status_badge" status=invoice.payment_status inv_id=invoice.id %} |
26 |
| - </td> |
27 |
| - <td colspan="2"> |
28 |
| - {# The if statement for dropdown top goes as followes #} |
29 |
| - {# Use dropdown on top if these: #} |
30 |
| - {# - is second to last item (and not first item) #} |
31 |
| - {# - is last item (and not first item) #} |
32 |
| - <div class="dropdown dropdown-left {% if forloop.last and invoices.count > 1 or forloop.counter == invoices.count|sub:1 and not forloop.first %}dropdown-top {% endif %}"> |
33 |
| - <label tabindex="0" class="btn btn-primary btn-outline btn-sm"> |
34 |
| - <i class="fa-solid fa-ellipsis-vertical"></i> |
35 |
| - </label> |
36 |
| - <ul tabindex="0" |
37 |
| - class="dropdown-content z-[1] menu wp-2 shadow-2xl bg-base-200 rounded-box w-52"> |
38 |
| - <li> |
39 |
| - <a href="{% url "invoices dashboard preview" invoice_id=invoice.id %}"> |
40 |
| - <i class="fa-solid fa-file-pdf"></i> |
41 |
| - Preview |
42 |
| - </a> |
43 |
| - </li> |
44 |
| - <li> |
45 |
| - <a href="{% url "invoices dashboard manage_access" id=invoice.id %}"> |
46 |
| - <i class="fa-solid fa-key"></i> |
47 |
| - Manage Access |
48 |
| - </a> |
49 |
| - </li> |
50 |
| - <li> |
51 |
| - <a href="{% url "invoices dashboard edit" id=invoice.id %}"> |
52 |
| - <i class="fa-solid fa-pencil"></i> |
53 |
| - Edit |
54 |
| - </a> |
55 |
| - </li> |
56 |
| - <li> |
57 |
| - <details open> |
58 |
| - <summary> |
59 |
| - <i class="fa-solid fa-flag"></i> |
60 |
| - Mark As |
61 |
| - </summary> |
62 |
| - <ul> |
63 |
| - <li> |
64 |
| - <button hx-swap="none" |
65 |
| - hx-post="{% url "api:invoices:edit status" invoice_id=invoice.id status='pending' %}"> |
66 |
| - <i class="fa-solid fa-hourglass-half"></i> |
67 |
| - Pending |
68 |
| - </button> |
69 |
| - </li> |
70 |
| - <li> |
71 |
| - <button hx-swap="none" |
72 |
| - hx-post="{% url "api:invoices:edit status" invoice_id=invoice.id status='paid' %}"> |
73 |
| - <i class="fa-solid fa-circle-check"></i> |
74 |
| - Paid |
75 |
| - </button> |
76 |
| - </li> |
77 |
| - <li> |
78 |
| - <button hx-swap="none" |
79 |
| - hx-post="{% url "api:invoices:edit status" invoice_id=invoice.id status='overdue' %}"> |
80 |
| - <i class="fa-solid fa-exclamation-triangle"></i> |
81 |
| - Overdue |
82 |
| - </button> |
83 |
| - </li> |
84 |
| - </ul> |
85 |
| - </details> |
86 |
| - </li> |
87 |
| - <li> |
88 |
| - <button hx-delete="{% url 'api:invoices:delete' %}" |
89 |
| - hx-target="closest tr" |
90 |
| - hx-confirm="Are you sure you would like to delete invoice #{{ invoice.id }}?" |
91 |
| - hx-vals='{"invoice": "{{ invoice.id }}" }'> |
92 |
| - <i class="fa-solid fa-trash"></i> |
93 |
| - Delete |
94 |
| - </button> |
95 |
| - </li> |
96 |
| - </ul> |
97 |
| - </div> |
98 |
| - </td> |
99 |
| - </tr> |
100 |
| -{% empty %} |
101 |
| - <td colspan="100%" class="text-center">No Invoices Found</td> |
102 |
| -{% endfor %} |
| 22 | + </td> |
| 23 | + <td>£{{ invoice.amount | floatformat:2 | intcomma }}</td> |
| 24 | + <td> |
| 25 | + {% component "pages:invoices:dashboard:payment_status_badge" status=invoice.payment_status inv_id=invoice.id %} |
| 26 | + </td> |
| 27 | + <td colspan="2"> |
| 28 | + {# The if statement for dropdown top goes as followes #} |
| 29 | + {# Use dropdown on top if these: #} |
| 30 | + {# - is second to last item (and not first item) #} |
| 31 | + {# - is last item (and not first item) #} |
| 32 | + <div class="dropdown dropdown-left {% if forloop.last and invoices.count > 1 or forloop.counter == invoices.count|sub:1 and not forloop.first %}dropdown-top {% endif %}"> |
| 33 | + <label tabindex="0" class="btn btn-primary btn-outline btn-sm"> |
| 34 | + <i class="fa-solid fa-ellipsis-vertical"></i> |
| 35 | + </label> |
| 36 | + <ul tabindex="0" |
| 37 | + class="dropdown-content z-[1] menu wp-2 shadow-2xl bg-base-200 rounded-box w-52"> |
| 38 | + <li> |
| 39 | + <a href="{% url "invoices dashboard preview" invoice_id=invoice.id %}"> |
| 40 | + <i class="fa-solid fa-file-pdf"></i> |
| 41 | + Preview |
| 42 | + </a> |
| 43 | + </li> |
| 44 | + <li> |
| 45 | + <a href="{% url "invoices dashboard manage_access" id=invoice.id %}"> |
| 46 | + <i class="fa-solid fa-key"></i> |
| 47 | + Manage Access |
| 48 | + </a> |
| 49 | + </li> |
| 50 | + <li> |
| 51 | + <a href="{% url "invoices dashboard edit" id=invoice.id %}"> |
| 52 | + <i class="fa-solid fa-pencil"></i> |
| 53 | + Edit |
| 54 | + </a> |
| 55 | + </li> |
| 56 | + <li> |
| 57 | + <details open> |
| 58 | + <summary> |
| 59 | + <i class="fa-solid fa-flag"></i> |
| 60 | + Mark As |
| 61 | + </summary> |
| 62 | + <ul> |
| 63 | + <li> |
| 64 | + <button hx-swap="none" |
| 65 | + hx-post="{% url "api:invoices:edit status" invoice_id=invoice.id status='pending' %}"> |
| 66 | + <i class="fa-solid fa-hourglass-half"></i> |
| 67 | + Pending |
| 68 | + </button> |
| 69 | + </li> |
| 70 | + <li> |
| 71 | + <button hx-swap="none" |
| 72 | + hx-post="{% url "api:invoices:edit status" invoice_id=invoice.id status='paid' %}"> |
| 73 | + <i class="fa-solid fa-circle-check"></i> |
| 74 | + Paid |
| 75 | + </button> |
| 76 | + </li> |
| 77 | + <li> |
| 78 | + <button hx-swap="none" |
| 79 | + hx-post="{% url "api:invoices:edit status" invoice_id=invoice.id status='overdue' %}"> |
| 80 | + <i class="fa-solid fa-exclamation-triangle"></i> |
| 81 | + Overdue |
| 82 | + </button> |
| 83 | + </li> |
| 84 | + </ul> |
| 85 | + </details> |
| 86 | + </li> |
| 87 | + <li> |
| 88 | + <button hx-delete="{% url 'api:invoices:delete' %}" |
| 89 | + hx-target="closest tr" |
| 90 | + hx-confirm="Are you sure you would like to delete invoice #{{ invoice.id }}?" |
| 91 | + hx-vals='{"invoice": "{{ invoice.id }}" }'> |
| 92 | + <i class="fa-solid fa-trash"></i> |
| 93 | + Delete |
| 94 | + </button> |
| 95 | + </li> |
| 96 | + </ul> |
| 97 | + </div> |
| 98 | + </td> |
| 99 | + </tr> |
| 100 | + {% empty %} |
| 101 | + <td colspan="100%" class="text-center">No Invoices Found</td> |
| 102 | + {% endfor %} |
103 | 103 | </tbody>
|
104 | 104 | {% for option in all_sort_options %}
|
105 | 105 | <div hx-swap-oob="innerHTML:li[data-sort='{{ option }}'] button">
|
|
0 commit comments