File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
cesnet_service_path_plugin/tables Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff 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 %}¬es={{ 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 = (
You can’t perform that action at this time.
0 commit comments