Skip to content

Commit

Permalink
Merge pull request #149 from mlebreuil/148-update-tables-to-match-the…
Browse files Browse the repository at this point in the history
…-new-netbox-format

Close issue 148
  • Loading branch information
mlebreuil authored Aug 12, 2024
2 parents c4ace51 + e230c5f commit 922c9ed
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

* [142](https://github.com/mlebreuil/netbox-contract/issues/142) Gives the option to enter contract yearly recuring costs instead of only monthly recuring costs.
Corresponding value is used to calculate the invoices amount without rounding approximations.
* [148](https://github.com/mlebreuil/netbox-contract/issues/148) Update tables format to match the new Netbox UI design.

### Version 2.2.0

Expand Down
5 changes: 3 additions & 2 deletions src/netbox_contract/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ class Meta(NetBoxTable.Meta):
class ContractAssignmentObjectTable(NetBoxTable):
contract = tables.Column(linkify=True)
actions = columns.ActionsColumn(actions=('edit', 'delete'))
contract__external_partie_object = tables.Column(linkify=True)
contract__external_partie_object = tables.Column(
verbose_name='Partner', linkify=True
)

class Meta(NetBoxTable.Meta):
model = ContractAssignment
fields = (
'pk',
'contract',
'contract__external_partie_object_type',
'contract__external_partie_object',
'contract__status',
'contract__start_date',
Expand Down
20 changes: 11 additions & 9 deletions src/netbox_contract/templates/contract_assignments_bottom.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
<div class="row">
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">Contracts Assignments</h5>
<h5 class="card-header">
Contracts Assignments
{% if perms.netbox_contract.add_contractassignment %}
<div class="card-actions">
<a href="{% url 'plugins:netbox_contract:contractassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
Add assignment
</a>
</div>
{% endif %}
</h5>
{% if assignments_table %}
{% render_table assignments_table %}
{% endif %}
{% if perms.netbox_contract.add_contractassignment %}
<div class="card-footer text-end noprint">
<a href="{% url 'plugins:netbox_contract:contractassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
Add assignment
</a>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down
23 changes: 0 additions & 23 deletions src/netbox_contract/templates/contract_assignments_bottom_old.html

This file was deleted.

16 changes: 9 additions & 7 deletions src/netbox_contract/templates/netbox_contract/contract.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,18 @@ <h5 class="card-header">childs</h5>
<div class="row">
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">Invoices</h5>
{% render_table invoices_table %}
{% if perms.netbox_contract.add_invoice %}
<div class="card-footer text-end noprint">
<a href="{% url 'plugins:netbox_contract:invoice_add' %}?contracts={{ object.pk }}" class="btn btn-primary">
<h5 class="card-header">
Invoices
{% if perms.netbox_contract.add_invoice %}
<div class="card-actions">
<a href="{% url 'plugins:netbox_contract:invoice_add' %}?contracts={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
Add an invoice
</a>
</div>
{% endif %}
</div>
{% endif %}
</h5>
{% render_table invoices_table %}
</div>
</div>
</div>
Expand Down

0 comments on commit 922c9ed

Please sign in to comment.