Files
orion/app/templates/admin/platforms.html
Samir Boulahtit 3d3b8cae22 feat: add platform detail/edit admin UI and service enhancements
- Add platform detail and edit admin pages with templates and JS
- Add ContentPageService methods: list_all_platform_pages, list_all_vendor_defaults
- Deprecate /admin/platform-homepage route (redirects to /admin/platforms)
- Add migration to fix content_page nullable columns
- Refine platform and vendor context middleware
- Add platform context middleware unit tests
- Update platforms.js with improved functionality
- Add section-based homepage plan documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 14:08:02 +01:00

163 lines
8.9 KiB
HTML

{# app/templates/admin/platforms.html #}
{% extends "admin/base.html" %}
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% block title %}Platforms{% endblock %}
{% block alpine_data %}platformsManager(){% endblock %}
{% block content %}
{{ page_header('Platforms', subtitle='Manage platform configurations for OMS, Loyalty, and other business offerings') }}
{{ loading_state('Loading platforms...') }}
{{ error_state('Error loading platforms') }}
<!-- Platforms Grid -->
<div x-show="!loading && platforms.length > 0" class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-3">
<template x-for="platform in platforms" :key="platform.id">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
<!-- Platform Header -->
<div class="p-6 border-b border-gray-200 dark:border-gray-700">
<div class="flex items-center justify-between">
<div class="flex items-center">
<!-- Platform Icon -->
<div class="flex items-center justify-center w-12 h-12 rounded-lg bg-purple-100 dark:bg-purple-900/50">
<span x-html="$icon(getPlatformIcon(platform.code), 'w-6 h-6 text-purple-600 dark:text-purple-400')"></span>
</div>
<div class="ml-4">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white" x-text="platform.name"></h3>
<code class="text-xs bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded" x-text="platform.code"></code>
</div>
</div>
<!-- Status Badge -->
<span
class="px-3 py-1 text-xs font-semibold rounded-full"
:class="platform.is_active ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' : 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300'"
x-text="platform.is_active ? 'Active' : 'Inactive'"
></span>
</div>
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400" x-text="platform.description || 'No description'"></p>
</div>
<!-- Platform Stats -->
<div class="px-6 py-4 bg-gray-50 dark:bg-gray-800/50">
<div class="grid grid-cols-3 gap-4 text-center">
<div>
<p class="text-2xl font-bold text-purple-600 dark:text-purple-400" x-text="platform.vendor_count"></p>
<p class="text-xs text-gray-500 dark:text-gray-400">Vendors</p>
</div>
<div>
<p class="text-2xl font-bold text-blue-600 dark:text-blue-400" x-text="platform.platform_pages_count"></p>
<p class="text-xs text-gray-500 dark:text-gray-400">Marketing Pages</p>
</div>
<div>
<p class="text-2xl font-bold text-teal-600 dark:text-teal-400" x-text="platform.vendor_defaults_count"></p>
<p class="text-xs text-gray-500 dark:text-gray-400">Vendor Defaults</p>
</div>
</div>
</div>
<!-- Platform Info -->
<div class="px-6 py-4 border-t border-gray-200 dark:border-gray-700">
<div class="space-y-2 text-sm">
<div class="flex justify-between" x-show="platform.domain">
<span class="text-gray-500 dark:text-gray-400">Domain:</span>
<span class="text-gray-900 dark:text-white" x-text="platform.domain"></span>
</div>
<div class="flex justify-between" x-show="platform.path_prefix">
<span class="text-gray-500 dark:text-gray-400">Path Prefix:</span>
<code class="text-xs bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded" x-text="platform.path_prefix"></code>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Language:</span>
<span class="text-gray-900 dark:text-white" x-text="platform.default_language.toUpperCase()"></span>
</div>
</div>
</div>
<!-- Platform Actions -->
<div class="px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50">
<div class="flex justify-between items-center">
<a
:href="`/admin/platforms/${platform.code}`"
class="inline-flex items-center text-sm font-medium text-purple-600 hover:text-purple-700 dark:text-purple-400 dark:hover:text-purple-300"
>
<span x-html="$icon('eye', 'w-4 h-4 mr-1')"></span>
View Details
</a>
<div class="flex space-x-2">
<a
:href="`/admin/content-pages?platform_code=${platform.code}&slug=home`"
class="inline-flex items-center px-3 py-1.5 text-xs font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-600"
title="Edit platform homepage"
>
<span x-html="$icon('home', 'w-4 h-4 mr-1')"></span>
Homepage
</a>
<a
:href="`/admin/content-pages?platform_code=${platform.code}`"
class="inline-flex items-center px-3 py-1.5 text-xs font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-600"
title="View all content pages for this platform"
>
<span x-html="$icon('document-text', 'w-4 h-4 mr-1')"></span>
Pages
</a>
<a
:href="`/admin/platforms/${platform.code}/edit`"
class="inline-flex items-center px-3 py-1.5 text-xs font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700"
title="Edit platform settings"
>
<span x-html="$icon('cog', 'w-4 h-4 mr-1')"></span>
Settings
</a>
</div>
</div>
</div>
</div>
</template>
</div>
<!-- Empty State -->
<div x-show="!loading && platforms.length === 0" class="text-center py-12 bg-white dark:bg-gray-800 rounded-lg shadow-md">
<span x-html="$icon('globe-alt', 'inline w-16 h-16 text-gray-400 mb-4')"></span>
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2">No platforms found</h3>
<p class="text-gray-500 dark:text-gray-400 mb-4">
No platforms have been configured yet.
</p>
</div>
<!-- Page Tier Legend -->
<div x-show="!loading && platforms.length > 0" class="mt-8 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
<h4 class="text-sm font-semibold text-gray-900 dark:text-white mb-4">Content Page Tiers</h4>
<div class="grid md:grid-cols-3 gap-6">
<div class="flex items-start">
<span class="inline-block w-3 h-3 rounded-full bg-blue-500 mt-1.5 mr-3"></span>
<div>
<p class="font-medium text-gray-900 dark:text-white">Platform Marketing Pages</p>
<p class="text-sm text-gray-500 dark:text-gray-400">Public pages like homepage, pricing, features. Not inherited by vendors.</p>
</div>
</div>
<div class="flex items-start">
<span class="inline-block w-3 h-3 rounded-full bg-teal-500 mt-1.5 mr-3"></span>
<div>
<p class="font-medium text-gray-900 dark:text-white">Vendor Defaults</p>
<p class="text-sm text-gray-500 dark:text-gray-400">Default pages inherited by all vendors (about, terms, privacy).</p>
</div>
</div>
<div class="flex items-start">
<span class="inline-block w-3 h-3 rounded-full bg-purple-500 mt-1.5 mr-3"></span>
<div>
<p class="font-medium text-gray-900 dark:text-white">Vendor Overrides</p>
<p class="text-sm text-gray-500 dark:text-gray-400">Custom pages created by individual vendors.</p>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('static', path='admin/js/platforms.js') }}"></script>
{% endblock %}