{% load admin_modify admin_urls i18n %}

{% if inline_admin_form.original or inline_admin_form.show_url %}
    <tr class="border-b border-base-200 dark:border-base-800 bg-base-50 dark:bg-white/[.02] lg:bg-transparent lg:border-0 dark:lg:bg-transparent!">
        <td class="original" colspan="{{ inline_admin_form|cell_count }}">
            {% if not inline_admin_formset.opts.hide_title %}
                {% if inline_admin_form.original or inline_admin_form.show_url %}
                    <p class="flex font-medium items-center px-3 text-xs py-2 lg:pb-0 lg:pt-2">
                        {% if inline_admin_form.original %}
                            <span>
                                {% with inline_title=inline_admin_form.original.get_inline_title %}
                                    {% if inline_title %}
                                        {{ inline_title }}
                                    {% else %}
                                        {{ inline_admin_form.original }}
                                    {% endif %}
                                {% endwith %}
                            </span>

                            {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}
                                <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{{ inline_admin_formset.has_change_permission|yesno:'inlinechangelink,inlineviewlink' }} ml-2 text-primary-600 dark:text-primary-500">
                                    {% if inline_admin_formset.has_change_permission %}
                                        {% translate "Change" %}
                                    {% else %}
                                        {% translate "View" %}
                                    {% endif %}
                                </a>
                            {% endif %}
                        {% endif %}

                        {% if inline_admin_form.show_url %}
                            <a href="{{ inline_admin_form.absolute_url }}" class="font-medium ml-2 text-primary-600 dark:text-primary-500">
                                {% translate "View on site" %}
                            </a>
                        {% endif %}
                    </p>
                {% endif %}
            {% endif %}

            {% if inline_admin_form.needs_explicit_pk_field %}
                {{ inline_admin_form.pk_field.field }}
            {% endif %}

            {% if inline_admin_form.fk_field %}
                {{ inline_admin_form.fk_field.field }}
            {% endif %}
        </td>
    </tr>
{% endif %}
