{# app/templates/admin/merchant-detail.html #}
{# noqa: fe-004 - Alpine.js x-model bindings incompatible with standard form macros #}
{# noqa: fe-008 - Alpine.js x-model bindings incompatible with standard form macros #}
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/headers.html' import detail_page_header %}
{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}

{% block title %}Merchant Details{% endblock %}

{% block alpine_data %}adminMerchantDetail(){% endblock %}

{% block content %}
{% call detail_page_header("merchant?.name || 'Merchant Details'", request.query_params.get('back', '/admin/merchants'), subtitle_show='merchant') %}
    ID: <span x-text="merchantId"></span>
    <span class="text-gray-400 mx-2">|</span>
    <span x-text="merchant?.store_count || 0"></span> store(s)
{% endcall %}

{{ loading_state('Loading merchant details...') }}

{{ error_state('Error loading merchant') }}

<!-- Merchant Details -->
<div x-show="!loading && merchant">
    <!-- Quick Actions Card -->
    <div class="px-4 py-3 mb-6 bg-white rounded-lg shadow-md dark:bg-gray-800">
        <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
            Quick Actions
        </h3>
        <div class="flex flex-wrap items-center gap-3">
            <a
                :href="`/admin/merchants/${merchantId}/edit`"
                class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
                <span x-html="$icon('edit', 'w-4 h-4 mr-2')"></span>
                Edit Merchant
            </a>
            <button
                @click="openCreateSubscriptionModal()"
                x-show="platforms.length > 0"
                class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-lg hover:bg-green-700 focus:outline-none focus:shadow-outline-green">
                <span x-html="$icon('plus', 'w-4 h-4 mr-2')"></span>
                Create Subscription
            </button>
            <button
                @click="promptDeleteMerchant()"
                :disabled="merchant?.store_count > 0"
                class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-red-600 border border-transparent rounded-lg hover:bg-red-700 focus:outline-none focus:shadow-outline-red disabled:opacity-50 disabled:cursor-not-allowed"
                :title="merchant?.store_count > 0 ? 'Cannot delete merchant with stores' : 'Delete merchant'">
                <span x-html="$icon('delete', 'w-4 h-4 mr-2')"></span>
                Delete Merchant
            </button>
        </div>
    </div>

    <!-- Status Cards -->
    <div class="grid gap-6 mb-8 md:grid-cols-4">
        <!-- Verification Status -->
        <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
            <div class="p-3 mr-4 rounded-full"
                 :class="merchant?.is_verified ? 'text-green-500 bg-green-100 dark:text-green-100 dark:bg-green-500' : 'text-orange-500 bg-orange-100 dark:text-orange-100 dark:bg-orange-500'">
                <span x-html="$icon(merchant?.is_verified ? 'badge-check' : 'clock', 'w-5 h-5')"></span>
            </div>
            <div>
                <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
                    Verification
                </p>
                <p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="merchant?.is_verified ? 'Verified' : 'Pending'">
                    -
                </p>
            </div>
        </div>

        <!-- Active Status -->
        <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
            <div class="p-3 mr-4 rounded-full"
                 :class="merchant?.is_active ? 'text-green-500 bg-green-100 dark:text-green-100 dark:bg-green-500' : 'text-red-500 bg-red-100 dark:text-red-100 dark:bg-red-500'">
                <span x-html="$icon(merchant?.is_active ? 'check-circle' : 'x-circle', 'w-5 h-5')"></span>
            </div>
            <div>
                <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
                    Status
                </p>
                <p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="merchant?.is_active ? 'Active' : 'Inactive'">
                    -
                </p>
            </div>
        </div>

        <!-- Store Count -->
        <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
            <div class="p-3 mr-4 text-blue-500 bg-blue-100 rounded-full dark:text-blue-100 dark:bg-blue-500">
                <span x-html="$icon('shopping-bag', 'w-5 h-5')"></span>
            </div>
            <div>
                <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
                    Stores
                </p>
                <p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="merchant?.store_count || 0">
                    0
                </p>
            </div>
        </div>

        <!-- Created Date -->
        <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
            <div class="p-3 mr-4 text-purple-500 bg-purple-100 rounded-full dark:text-purple-100 dark:bg-purple-500">
                <span x-html="$icon('calendar', 'w-5 h-5')"></span>
            </div>
            <div>
                <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
                    Created
                </p>
                <p class="text-sm font-semibold text-gray-700 dark:text-gray-200" x-text="formatDate(merchant?.created_at)">
                    -
                </p>
            </div>
        </div>
    </div>

    <!-- Main Info Cards -->
    <div class="grid gap-6 mb-8 md:grid-cols-2">
        <!-- Basic Information -->
        <div class="px-4 py-3 bg-white rounded-lg shadow-md dark:bg-gray-800">
            <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
                Basic Information
            </h3>
            <div class="space-y-3">
                <div>
                    <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase">Merchant Name</p>
                    <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.name || '-'">-</p>
                </div>
                <div>
                    <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase">Description</p>
                    <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.description || 'No description provided'">-</p>
                </div>
            </div>
        </div>

        <!-- Contact Information -->
        <div class="px-4 py-3 bg-white rounded-lg shadow-md dark:bg-gray-800">
            <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
                Contact Information
            </h3>
            <div class="space-y-3">
                <div>
                    <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase">Contact Email</p>
                    <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.contact_email || '-'">-</p>
                </div>
                <div>
                    <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase">Phone</p>
                    <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.contact_phone || '-'">-</p>
                </div>
                <div>
                    <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase">Website</p>
                    <a
                        x-show="merchant?.website"
                        :href="merchant?.website"
                        target="_blank"
                        class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400"
                        x-text="merchant?.website">
                    </a>
                    <span x-show="!merchant?.website" class="text-sm text-gray-700 dark:text-gray-300">-</span>
                </div>
            </div>
        </div>
    </div>

    <!-- Business Details -->
    <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
        <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
            Business Details
        </h3>
        <div class="grid gap-6 md:grid-cols-2">
            <div>
                <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase mb-2">Business Address</p>
                <p class="text-sm text-gray-700 dark:text-gray-300 whitespace-pre-line" x-text="merchant?.business_address || 'No address provided'">-</p>
            </div>
            <div>
                <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase mb-2">Tax Number</p>
                <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.tax_number || 'Not provided'">-</p>
            </div>
        </div>
    </div>

    <!-- Owner Information -->
    <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
        <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
            Owner Information
        </h3>
        <div class="grid gap-6 md:grid-cols-3">
            <div>
                <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase mb-2">Owner User ID</p>
                <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.owner_user_id || '-'">-</p>
            </div>
            <div>
                <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase mb-2">Owner Username</p>
                <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.owner_username || '-'">-</p>
            </div>
            <div>
                <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase mb-2">Owner Email</p>
                <p class="text-sm text-gray-700 dark:text-gray-300" x-text="merchant?.owner_email || '-'">-</p>
            </div>
        </div>
    </div>

    <!-- Subscription Cards -->
    <template x-for="entry in subscriptions" :key="entry.subscription.id">
        <div class="px-4 py-3 mb-6 bg-white rounded-lg shadow-md dark:bg-gray-800">
            <div class="flex items-center justify-between mb-4">
                <h3 class="text-lg font-semibold text-gray-700 dark:text-gray-200">
                    Subscription
                    <span x-show="entry.platform_name" class="text-sm font-normal text-gray-500 dark:text-gray-400">
                        — <span x-text="entry.platform_name"></span>
                    </span>
                </h3>
            </div>

            <!-- Tier and Status -->
            <div class="flex flex-wrap items-center gap-4 mb-4">
                <div class="flex items-center gap-2">
                    <span class="text-sm text-gray-600 dark:text-gray-400">Tier:</span>
                    <span class="px-2.5 py-0.5 text-sm font-medium rounded-full"
                          :class="{
                              'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300': entry.subscription?.tier === 'essential',
                              'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300': entry.subscription?.tier === 'professional',
                              'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300': entry.subscription?.tier === 'business',
                              'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300': entry.subscription?.tier === 'enterprise'
                          }"
                          x-text="entry.subscription?.tier ? entry.subscription.tier.charAt(0).toUpperCase() + entry.subscription.tier.slice(1) : '-'">
                    </span>
                </div>
                <div class="flex items-center gap-2">
                    <span class="text-sm text-gray-600 dark:text-gray-400">Status:</span>
                    <span class="px-2.5 py-0.5 text-sm font-medium rounded-full"
                          :class="{
                              'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300': entry.subscription?.status === 'active',
                              'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300': entry.subscription?.status === 'trial',
                              'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300': entry.subscription?.status === 'past_due',
                              'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300': entry.subscription?.status === 'cancelled' || entry.subscription?.status === 'expired'
                          }"
                          x-text="entry.subscription?.status ? entry.subscription.status.replace('_', ' ').charAt(0).toUpperCase() + entry.subscription.status.slice(1) : '-'">
                    </span>
                </div>
                <template x-if="entry.subscription?.is_annual">
                    <span class="px-2.5 py-0.5 text-xs font-medium text-purple-800 bg-purple-100 rounded-full dark:bg-purple-900 dark:text-purple-300">
                        Annual
                    </span>
                </template>
            </div>

            <!-- Period Info -->
            <div class="flex flex-wrap gap-4 mb-4 text-sm">
                <div>
                    <span class="text-gray-600 dark:text-gray-400">Period:</span>
                    <span class="ml-1 text-gray-700 dark:text-gray-300" x-text="formatDate(entry.subscription?.period_start)"></span>
                    <span class="text-gray-400">&rarr;</span>
                    <span class="text-gray-700 dark:text-gray-300" x-text="formatDate(entry.subscription?.period_end)"></span>
                </div>
                <template x-if="entry.subscription?.trial_ends_at">
                    <div>
                        <span class="text-gray-600 dark:text-gray-400">Trial ends:</span>
                        <span class="ml-1 text-gray-700 dark:text-gray-300" x-text="formatDate(entry.subscription?.trial_ends_at)"></span>
                    </div>
                </template>
            </div>

            <!-- Usage Meters -->
            <div class="grid gap-4 md:grid-cols-3">
                <template x-for="metric in entry.features" :key="metric.name">
                    <div class="p-3 bg-gray-50 rounded-lg dark:bg-gray-700">
                        <div class="flex items-center justify-between mb-2">
                            <span class="text-xs font-medium text-gray-600 dark:text-gray-400 uppercase" x-text="metric.name"></span>
                        </div>
                        <div class="flex items-baseline gap-1">
                            <span class="text-xl font-bold text-gray-700 dark:text-gray-200" x-text="metric.current"></span>
                            <span class="text-sm text-gray-500 dark:text-gray-400">
                                / <span x-text="metric.is_unlimited ? '∞' : metric.limit"></span>
                            </span>
                        </div>
                        <div class="mt-2 h-1.5 bg-gray-200 rounded-full dark:bg-gray-600" x-show="!metric.is_unlimited">
                            <div class="h-1.5 rounded-full transition-all"
                                 :class="getUsageBarColor(metric.current, metric.limit)"
                                 :style="`width: ${Math.min(100, metric.percentage || 0)}%`">
                            </div>
                        </div>
                    </div>
                </template>
                <template x-if="entry.features.length === 0">
                    <div class="p-3 bg-gray-50 rounded-lg dark:bg-gray-700 md:col-span-3">
                        <p class="text-sm text-gray-500 dark:text-gray-400 text-center">No usage data available</p>
                    </div>
                </template>
            </div>
        </div>
    </template>

    <!-- No Subscription Notice -->
    <div class="px-4 py-3 mb-6 bg-yellow-50 border border-yellow-200 rounded-lg dark:bg-yellow-900/20 dark:border-yellow-800" x-show="subscriptions.length === 0 && !loading && platforms.length > 0">
        <div class="flex items-center gap-3">
            <span x-html="$icon('exclamation', 'w-5 h-5 text-yellow-600 dark:text-yellow-400')"></span>
            <div>
                <p class="text-sm font-medium text-yellow-800 dark:text-yellow-200">No Subscription Found</p>
                <p class="text-sm text-yellow-700 dark:text-yellow-300">This merchant doesn't have a subscription yet.</p>
            </div>
            <button
                @click="openCreateSubscriptionModal()"
                class="ml-auto px-3 py-1.5 text-sm font-medium text-white bg-yellow-600 rounded-lg hover:bg-yellow-700">
                Create Subscription
            </button>
        </div>
    </div>

    <!-- Create Subscription Modal -->
    <div x-show="showCreateSubscriptionModal" class="fixed inset-0 z-50 flex items-center justify-center" x-cloak>
        <div class="fixed inset-0 bg-black bg-opacity-50" @click="showCreateSubscriptionModal = false"></div>
        <div class="relative z-10 w-full max-w-md p-6 bg-white rounded-lg shadow-xl dark:bg-gray-800">
            <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">Create Subscription</h3>

            <!-- Platform Selector -->
            <div class="mb-4">
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Platform</label>
                <select x-model="createForm.platform_id"
                        @change="onCreatePlatformChange()"
                        class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500">
                    <template x-for="p in platforms.filter(p => !subscriptions.some(s => s.platform_id === p.id))" :key="p.id">
                        <option :value="p.id" x-text="p.name"></option>
                    </template>
                </select>
            </div>

            <!-- Tier Selector -->
            <div class="mb-4">
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Subscription Tier</label>
                <template x-if="tiers.length > 0">
                    <select x-model="createForm.tier_code"
                            class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500">
                        <template x-for="tier in tiers" :key="tier.code">
                            <option :value="tier.code" x-text="tier.name + ' — ' + formatTierPrice(tier)"></option>
                        </template>
                    </select>
                </template>
                <template x-if="tiers.length === 0">
                    <div class="p-3 text-sm text-amber-700 bg-amber-50 border border-amber-200 rounded-lg dark:text-amber-300 dark:bg-amber-900/20 dark:border-amber-800">
                        No tiers configured for this platform.
                        <a href="/admin/subscription-tiers" class="underline font-medium hover:text-amber-900 dark:hover:text-amber-100">Create a tier first</a>.
                    </div>
                </template>
            </div>

            <!-- Status -->
            <div class="mb-4">
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Status</label>
                <select x-model="createForm.status"
                        class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500">
                    <option value="trial">Trial</option>
                    <option value="active">Active</option>
                </select>
            </div>

            <!-- Trial Days (shown only when status=trial) -->
            <div class="mb-4" x-show="createForm.status === 'trial'">
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Trial Days</label>
                <input type="number" x-model="createForm.trial_days" min="1" max="90"
                       class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500">
            </div>

            <!-- Annual Billing -->
            <div class="mb-6">
                <label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300">
                    <input type="checkbox" x-model="createForm.is_annual"
                           class="rounded border-gray-300 text-purple-600 focus:ring-purple-500 dark:border-gray-600 dark:bg-gray-700">
                    Annual billing
                </label>
            </div>

            <!-- Actions -->
            <div class="flex justify-end gap-3">
                <button @click="showCreateSubscriptionModal = false"
                        class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600">
                    Cancel
                </button>
                <button @click="createSubscription()"
                        :disabled="creatingSubscription || tiers.length === 0"
                        class="px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed">
                    <span x-show="!creatingSubscription">Create</span>
                    <span x-show="creatingSubscription">Creating...</span>
                </button>
            </div>
        </div>
    </div>

    <!-- Stores Section -->
    <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800" x-show="merchant?.stores && merchant?.stores.length > 0">
        <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
            <span x-html="$icon('shopping-bag', 'inline w-5 h-5 mr-2')"></span>
            Stores (<span x-text="merchant?.stores?.length || 0"></span>)
        </h3>
        <div class="overflow-x-auto">
            <table class="w-full whitespace-no-wrap">
                <thead>
                    <tr class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-700">
                        <th class="px-4 py-3">Store</th>
                        <th class="px-4 py-3">Subdomain</th>
                        <th class="px-4 py-3">Status</th>
                        <th class="px-4 py-3">Actions</th>
                    </tr>
                </thead>
                <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
                    <template x-for="store in merchant?.stores || []" :key="store.id">
                        <tr class="text-gray-700 dark:text-gray-400">
                            <td class="px-4 py-3">
                                <div class="flex items-center text-sm">
                                    <div>
                                        <p class="font-semibold" x-text="store.name"></p>
                                        <p class="text-xs text-gray-600 dark:text-gray-400" x-text="store.store_code"></p>
                                    </div>
                                </div>
                            </td>
                            <td class="px-4 py-3 text-sm" x-text="store.subdomain"></td>
                            <td class="px-4 py-3 text-xs">
                                <span class="px-2 py-1 font-semibold leading-tight rounded-full"
                                      :class="store.is_active ? 'text-green-700 bg-green-100 dark:bg-green-700 dark:text-green-100' : 'text-red-700 bg-red-100 dark:bg-red-700 dark:text-red-100'"
                                      x-text="store.is_active ? 'Active' : 'Inactive'">
                                </span>
                            </td>
                            <td class="px-4 py-3">
                                <a :href="'/admin/stores/' + store.store_code"
                                   class="text-blue-600 hover:text-blue-700 dark:text-blue-400 text-sm">
                                    View
                                </a>
                            </td>
                        </tr>
                    </template>
                </tbody>
            </table>
        </div>
    </div>

    <!-- More Actions -->
    <div class="px-4 py-3 bg-white rounded-lg shadow-md dark:bg-gray-800">
        <h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
            More Actions
        </h3>
        <div class="flex flex-wrap gap-3">
            <!-- Create Store Button -->
            <a
                href="/admin/stores/create"
                class="inline-flex items-center px-4 py-2 text-sm font-medium text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-lg hover:bg-green-700 focus:outline-none focus:shadow-outline-green"
            >
                <span x-html="$icon('plus', 'w-4 h-4 mr-2')"></span>
                Create Store
            </a>
        </div>
        <p class="mt-3 text-xs text-gray-500 dark:text-gray-400">
            <span x-html="$icon('information-circle', 'w-4 h-4 inline mr-1')"></span>
            Stores created will be associated with this merchant.
        </p>
    </div>

    {{ confirm_modal_dynamic(
        'deleteMerchantModal',
        'Delete Merchant',
        "'Are you sure you want to delete merchant \"' + (merchant?.name || '') + '\"? This action cannot be undone.'",
        'confirmDeleteMerchantStep()',
        'showDeleteMerchantModal',
        'Continue',
        'Cancel',
        'danger'
    ) }}

    {{ confirm_modal_dynamic(
        'deleteMerchantFinalModal',
        'Final Confirmation',
        "'Are you absolutely sure you want to delete \"' + (merchant?.name || '') + '\"?'",
        'deleteMerchant()',
        'showDeleteMerchantFinalModal',
        'Delete Permanently',
        'Cancel',
        'danger'
    ) }}
</div>
{% endblock %}

{% block extra_scripts %}
<script defer src="{{ url_for('tenancy_static', path='admin/js/merchant-detail.js') }}"></script>
{% endblock %}
