Skip to content

Commit 2d4e381

Browse files
committed
enhancement - contract info table now show button to create new version from active version of contract
1 parent 7526195 commit 2d4e381

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cesnet_service_path_plugin/tables/contract_info.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,21 @@ class ContractInfoTable(NetBoxTable):
122122
attrs={"td": {"class": "text-end"}},
123123
)
124124

125+
# Actions column with custom "New Version" button for active contracts
126+
actions = columns.ActionsColumn(
127+
extra_buttons="""
128+
{% load helpers %}
129+
{% if record.is_active and perms.cesnet_service_path_plugin.add_contractinfo %}
130+
{% action_url record 'add' as clone_url %}
131+
<a href="{{ clone_url }}?previous_version={{ record.pk }}&contract_number={{ record.contract_number|urlencode }}&charge_currency={{ record.charge_currency }}&recurring_charge={{ record.recurring_charge }}&recurring_charge_period={{ record.recurring_charge_period }}&number_of_recurring_charges={{ record.number_of_recurring_charges }}&non_recurring_charge={{ record.non_recurring_charge }}{% if record.start_date %}&start_date={{ record.start_date|date:'Y-m-d' }}{% endif %}{% if record.end_date %}&end_date={{ record.end_date|date:'Y-m-d' }}{% endif %}{% if record.notes %}&notes={{ record.notes|urlencode }}{% endif %}{% for segment in record.segments.all %}&segments={{ segment.pk }}{% endfor %}"
132+
title="Create New Version"
133+
class="btn btn-sm btn-success">
134+
<i class="mdi mdi-content-copy" aria-hidden="true"></i>
135+
</a>
136+
{% endif %}
137+
"""
138+
)
139+
125140
class Meta(NetBoxTable.Meta):
126141
model = ContractInfo
127142
fields = (

0 commit comments

Comments
 (0)