feat: add import error tracking and translation tabs

Import Error Tracking:
- Add MarketplaceImportError model to store detailed error information
- Store row number, identifier, error type, message, and row data for each error
- Add API endpoint GET /admin/marketplace-import-jobs/{job_id}/errors
- Add UI to view and browse import errors in job details modal
- Support pagination and error type filtering

Translation Tabs:
- Replace flat translation list with tabbed interface on product detail page
- Add language tabs with full language names
- Add copy-to-clipboard functionality for translation content
- Improved UX with better visual separation of translations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-13 13:33:03 +01:00
parent 3316894c27
commit c2f42c2913
14 changed files with 542 additions and 44 deletions

View File

@@ -625,11 +625,64 @@
</div>
</div>
{# Error Details #}
<div x-show="{{ job_var }}?.error_details?.length > 0">
<p class="text-sm font-medium text-gray-600 dark:text-gray-400 mb-2">Error Details</p>
<div class="p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg max-h-48 overflow-y-auto">
<pre class="text-xs text-red-700 dark:text-red-300 whitespace-pre-wrap font-mono" x-text="JSON.stringify({{ job_var }}?.error_details, null, 2)"></pre>
{# Detailed Import Errors #}
<div x-show="{{ job_var }}?.error_count > 0">
<div class="flex items-center justify-between mb-2">
<p class="text-sm font-medium text-gray-600 dark:text-gray-400">Import Errors</p>
<button
x-show="!jobErrors || jobErrors.length === 0"
@click="loadJobErrors({{ job_var }}?.id)"
:disabled="loadingErrors"
class="px-3 py-1 text-xs font-medium text-purple-600 dark:text-purple-400 border border-purple-300 dark:border-purple-600 rounded-lg hover:bg-purple-50 dark:hover:bg-purple-900/20 disabled:opacity-50"
>
<span x-show="loadingErrors" x-html="$icon('spinner', 'w-3 h-3 mr-1 inline')"></span>
<span x-text="loadingErrors ? 'Loading...' : 'View Errors'"></span>
</button>
</div>
{# Errors List #}
<div x-show="jobErrors && jobErrors.length > 0" class="space-y-2 max-h-64 overflow-y-auto">
<template x-for="error in jobErrors" :key="error.id">
<div class="p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">
<div class="flex items-start justify-between">
<div class="flex-1">
<div class="flex items-center gap-2 mb-1">
<span class="px-2 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-800 text-red-700 dark:text-red-300 rounded" x-text="error.error_type"></span>
<span class="text-xs text-gray-500 dark:text-gray-400">Row <span x-text="error.row_number"></span></span>
</div>
<p class="text-sm text-red-700 dark:text-red-300" x-text="error.error_message"></p>
<p x-show="error.identifier" class="text-xs text-gray-500 dark:text-gray-400 mt-1">
ID: <span class="font-mono" x-text="error.identifier"></span>
</p>
</div>
<button
x-show="error.row_data"
@click="error._expanded = !error._expanded"
class="ml-2 p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"
:title="error._expanded ? 'Hide row data' : 'Show row data'"
>
<span x-html="$icon(error._expanded ? 'chevron-up' : 'chevron-down', 'w-4 h-4')"></span>
</button>
</div>
{# Expandable row data #}
<div x-show="error._expanded && error.row_data" x-collapse class="mt-2 pt-2 border-t border-red-200 dark:border-red-700">
<p class="text-xs text-gray-500 dark:text-gray-400 mb-1">Row Data:</p>
<pre class="text-xs text-gray-600 dark:text-gray-300 font-mono whitespace-pre-wrap bg-white dark:bg-gray-800 p-2 rounded" x-text="JSON.stringify(error.row_data, null, 2)"></pre>
</div>
</div>
</template>
</div>
{# Pagination for errors #}
<div x-show="jobErrorsTotal > jobErrors?.length" class="mt-3 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400">
<span>Showing <span x-text="jobErrors?.length"></span> of <span x-text="jobErrorsTotal"></span> errors</span>
<button
@click="loadMoreJobErrors({{ job_var }}?.id)"
:disabled="loadingErrors"
class="text-purple-600 dark:text-purple-400 hover:underline disabled:opacity-50"
>
Load more
</button>
</div>
</div>
</div>