Files
orion/app/templates/shared/macros/modals.html
Samir Boulahtit c2f42c2913 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>
2025-12-13 13:33:03 +01:00

702 lines
33 KiB
HTML

{#
Modal Macros
============
Reusable modal dialog components with Alpine.js integration.
Usage:
{% from 'shared/macros/modals.html' import modal, confirm_modal, form_modal %}
Basic modal:
{% call modal('editModal', 'Edit User', 'isEditModalOpen') %}
<p>Modal content here</p>
{% endcall %}
Confirmation modal:
{{ confirm_modal('deleteModal', 'Delete User', 'Are you sure?', 'deleteUser()', 'isDeleteModalOpen') }}
Required Alpine.js:
x-data="{ isModalOpen: false }"
#}
{#
Modal
=====
A flexible modal dialog component.
Parameters:
- id: Unique modal ID
- title: Modal title
- show_var: Alpine.js variable controlling visibility (default: 'isModalOpen')
- size: 'sm' | 'md' | 'lg' | 'xl' | 'full' (default: 'md')
- show_close: Whether to show close button (default: true)
- show_footer: Whether to show footer slot (default: true)
- close_on_backdrop: Close when clicking backdrop (default: true)
- close_on_escape: Close on Escape key (default: true)
#}
{% macro modal(id, title, show_var='isModalOpen', size='md', show_close=true, show_footer=true, close_on_backdrop=true, close_on_escape=true) %}
{% set sizes = {
'sm': 'max-w-sm',
'md': 'max-w-lg',
'lg': 'max-w-2xl',
'xl': 'max-w-4xl',
'full': 'max-w-full mx-4'
} %}
<div
x-show="{{ show_var }}"
x-cloak
{% if close_on_escape %}@keydown.escape.window="{{ show_var }} = false"{% endif %}
class="fixed inset-0 z-50 overflow-y-auto"
aria-labelledby="{{ id }}-title"
role="dialog"
aria-modal="true"
>
{# Backdrop #}
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-gray-500/50 dark:bg-gray-900/80 backdrop-blur-sm"
{% if close_on_backdrop %}@click="{{ show_var }} = false"{% endif %}
></div>
{# Modal Container #}
<div class="flex min-h-full items-center justify-center p-4">
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
@click.stop
class="relative w-full {{ sizes[size] }} bg-white dark:bg-gray-800 rounded-xl shadow-xl"
>
{# Header #}
<div class="flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700">
<h3 id="{{ id }}-title" class="text-lg font-semibold text-gray-900 dark:text-white">
{{ title }}
</h3>
{% if show_close %}
<button
@click="{{ show_var }} = false"
class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors"
aria-label="Close modal"
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
{% endif %}
</div>
{# Body #}
<div class="px-6 py-4 max-h-[calc(100vh-200px)] overflow-y-auto">
{{ caller() }}
</div>
{# Footer (optional) #}
{% if show_footer %}
<div class="flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 rounded-b-xl">
<button
@click="{{ show_var }} = false"
type="button"
class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors"
>
Cancel
</button>
{{ caller_footer() if caller_footer is defined else '' }}
</div>
{% endif %}
</div>
</div>
</div>
{% endmacro %}
{#
Modal Simple
============
A simpler modal without the caller pattern - just pass content.
Parameters:
- id: Unique modal ID
- title: Modal title
- show_var: Alpine.js variable controlling visibility
- size: Modal size
- content: HTML content for the modal body
#}
{% macro modal_simple(id, title, show_var='isModalOpen', size='md') %}
{% set sizes = {
'sm': 'max-w-sm',
'md': 'max-w-lg',
'lg': 'max-w-2xl',
'xl': 'max-w-4xl'
} %}
<div
x-show="{{ show_var }}"
x-cloak
@keydown.escape.window="{{ show_var }} = false"
class="fixed inset-0 z-50 overflow-y-auto"
role="dialog"
aria-modal="true"
>
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-gray-500/50 dark:bg-gray-900/80 backdrop-blur-sm"
@click="{{ show_var }} = false"
></div>
<div class="flex min-h-full items-center justify-center p-4">
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.stop
class="relative w-full {{ sizes[size] }} bg-white dark:bg-gray-800 rounded-xl shadow-xl"
>
<div class="flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">{{ title }}</h3>
<button
@click="{{ show_var }} = false"
class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors"
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div class="px-6 py-4">
{{ caller() }}
</div>
</div>
</div>
</div>
{% endmacro %}
{#
Confirm Modal
=============
A confirmation dialog for destructive actions.
Parameters:
- id: Unique modal ID
- title: Modal title
- message: Confirmation message
- confirm_action: Alpine.js action to execute on confirm
- show_var: Alpine.js variable controlling visibility
- confirm_text: Confirm button text (default: 'Confirm')
- cancel_text: Cancel button text (default: 'Cancel')
- variant: 'danger' | 'warning' | 'info' (default: 'danger')
- icon: Icon name (optional, auto-selected based on variant)
#}
{% macro confirm_modal(id, title, message, confirm_action, show_var='isConfirmModalOpen', confirm_text='Confirm', cancel_text='Cancel', variant='danger', icon=none) %}
{% set variants = {
'danger': {
'icon_bg': 'bg-red-100 dark:bg-red-900/30',
'icon_color': 'text-red-600 dark:text-red-400',
'btn_class': 'bg-red-600 hover:bg-red-700 focus:ring-red-500'
},
'warning': {
'icon_bg': 'bg-yellow-100 dark:bg-yellow-900/30',
'icon_color': 'text-yellow-600 dark:text-yellow-400',
'btn_class': 'bg-yellow-600 hover:bg-yellow-700 focus:ring-yellow-500'
},
'info': {
'icon_bg': 'bg-blue-100 dark:bg-blue-900/30',
'icon_color': 'text-blue-600 dark:text-blue-400',
'btn_class': 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500'
}
} %}
{% set icons = {
'danger': 'exclamation-triangle',
'warning': 'exclamation',
'info': 'information-circle'
} %}
{% set modal_icon = icon if icon else icons[variant] %}
{% set style = variants[variant] %}
<div
x-show="{{ show_var }}"
x-cloak
@keydown.escape.window="{{ show_var }} = false"
class="fixed inset-0 z-50 overflow-y-auto"
role="dialog"
aria-modal="true"
>
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-gray-500/50 dark:bg-gray-900/80 backdrop-blur-sm"
@click="{{ show_var }} = false"
></div>
<div class="flex min-h-full items-center justify-center p-4">
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.stop
class="relative w-full max-w-md bg-white dark:bg-gray-800 rounded-xl shadow-xl p-6"
>
<div class="flex items-start">
<div class="flex-shrink-0 flex items-center justify-center w-12 h-12 rounded-full {{ style.icon_bg }}">
<span x-html="$icon('{{ modal_icon }}', 'w-6 h-6 {{ style.icon_color }}')" class="{{ style.icon_color }}"></span>
</div>
<div class="ml-4 flex-1">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">
{{ title }}
</h3>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
{{ message }}
</p>
</div>
</div>
<div class="mt-6 flex justify-end gap-3">
<button
@click="{{ show_var }} = false"
type="button"
class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors"
>
{{ cancel_text }}
</button>
<button
@click="{{ confirm_action }}; {{ show_var }} = false"
type="button"
class="px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 {{ style.btn_class }}"
>
{{ confirm_text }}
</button>
</div>
</div>
</div>
</div>
{% endmacro %}
{#
Form Modal
==========
A modal optimized for forms with loading state support.
Parameters:
- id: Unique modal ID
- title: Modal title
- show_var: Alpine.js variable controlling visibility
- submit_action: Alpine.js action for form submission
- submit_text: Submit button text (default: 'Save')
- loading_var: Alpine.js variable for loading state (default: 'saving')
- loading_text: Text shown while loading (default: 'Saving...')
- size: Modal size (default: 'md')
#}
{% macro form_modal(id, title, show_var='isFormModalOpen', submit_action='submitForm()', submit_text='Save', loading_var='saving', loading_text='Saving...', size='md') %}
{% set sizes = {
'sm': 'max-w-sm',
'md': 'max-w-lg',
'lg': 'max-w-2xl',
'xl': 'max-w-4xl'
} %}
<div
x-show="{{ show_var }}"
x-cloak
@keydown.escape.window="!{{ loading_var }} && ({{ show_var }} = false)"
class="fixed inset-0 z-50 overflow-y-auto"
role="dialog"
aria-modal="true"
>
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-gray-500/50 dark:bg-gray-900/80 backdrop-blur-sm"
@click="!{{ loading_var }} && ({{ show_var }} = false)"
></div>
<div class="flex min-h-full items-center justify-center p-4">
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.stop
class="relative w-full {{ sizes[size] }} bg-white dark:bg-gray-800 rounded-xl shadow-xl"
>
<form @submit.prevent="{{ submit_action }}">
{# Header #}
<div class="flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">{{ title }}</h3>
<button
@click="{{ show_var }} = false"
type="button"
:disabled="{{ loading_var }}"
class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
{# Body #}
<div class="px-6 py-4 max-h-[calc(100vh-200px)] overflow-y-auto">
{{ caller() }}
</div>
{# Footer #}
<div class="flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 rounded-b-xl">
<button
@click="{{ show_var }} = false"
type="button"
:disabled="{{ loading_var }}"
class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
>
Cancel
</button>
<button
type="submit"
:disabled="{{ loading_var }}"
class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 disabled:opacity-50 disabled:cursor-not-allowed"
>
<span x-show="{{ loading_var }}" x-html="$icon('spinner', 'w-4 h-4 mr-2')"></span>
<span x-text="{{ loading_var }} ? '{{ loading_text }}' : '{{ submit_text }}'"></span>
</button>
</div>
</form>
</div>
</div>
</div>
{% endmacro %}
{#
Slide-over Panel
================
A side panel that slides in from the right.
Parameters:
- id: Unique panel ID
- title: Panel title
- show_var: Alpine.js variable controlling visibility
- width: 'sm' | 'md' | 'lg' | 'xl' (default: 'md')
#}
{% macro slide_over(id, title, show_var='isPanelOpen', width='md') %}
{% set widths = {
'sm': 'max-w-sm',
'md': 'max-w-md',
'lg': 'max-w-lg',
'xl': 'max-w-xl'
} %}
<div
x-show="{{ show_var }}"
x-cloak
@keydown.escape.window="{{ show_var }} = false"
class="fixed inset-0 z-50 overflow-hidden"
role="dialog"
aria-modal="true"
>
{# Backdrop #}
<div
x-show="{{ show_var }}"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-gray-500/50 dark:bg-gray-900/80 backdrop-blur-sm"
@click="{{ show_var }} = false"
></div>
{# Panel #}
<div class="fixed inset-y-0 right-0 flex max-w-full pl-10">
<div
x-show="{{ show_var }}"
x-transition:enter="transform transition ease-in-out duration-300"
x-transition:enter-start="translate-x-full"
x-transition:enter-end="translate-x-0"
x-transition:leave="transform transition ease-in-out duration-300"
x-transition:leave-start="translate-x-0"
x-transition:leave-end="translate-x-full"
class="w-screen {{ widths[width] }}"
>
<div class="flex h-full flex-col bg-white dark:bg-gray-800 shadow-xl">
{# Header #}
<div class="flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700">
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">{{ title }}</h2>
<button
@click="{{ show_var }} = false"
class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors"
>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
{# Body #}
<div class="flex-1 overflow-y-auto px-6 py-4">
{{ caller() }}
</div>
</div>
</div>
</div>
</div>
{% endmacro %}
{#
Job Details Modal
=================
A mobile-friendly modal for displaying import job details.
Used in marketplace and imports admin pages.
Parameters:
- show_var: Alpine.js variable controlling visibility (default: 'showJobModal')
- job_var: Alpine.js variable containing the job data (default: 'selectedJob')
- close_action: Alpine.js action to close modal (default: 'closeJobModal()')
- get_vendor_name: Function to get vendor name from ID (default: 'getVendorName')
- show_created_by: Whether to show Created By field (default: false)
Required Alpine.js state:
- showJobModal: boolean
- selectedJob: object with job data (fields: id, vendor_id, marketplace, status, source_url,
imported, updated, error_count, total_processed, started_at, completed_at, language)
- closeJobModal(): function to close and clear
- getVendorName(id): function to resolve vendor name
- formatDate(date): function to format dates
#}
{% macro job_details_modal(show_var='showJobModal', job_var='selectedJob', close_action='closeJobModal()', get_vendor_name='getVendorName', show_created_by=false) %}
<div x-show="{{ show_var }}"
x-cloak
@click.away="{{ close_action }}"
class="fixed inset-0 z-30 flex items-end bg-black bg-opacity-50 sm:items-center sm:justify-center"
x-transition:enter="transition ease-out duration-150"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0">
<div @click.away="{{ close_action }}"
class="w-full px-6 py-4 overflow-hidden bg-white rounded-t-lg dark:bg-gray-800 sm:rounded-lg sm:m-4 sm:max-w-2xl"
x-transition:enter="transition ease-out duration-150"
x-transition:enter-start="opacity-0 transform translate-y-1/2"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0 transform translate-y-1/2">
{# Modal Header #}
<div class="flex items-center justify-between pb-4 border-b border-gray-200 dark:border-gray-700">
<div class="flex items-center space-x-3">
<div class="p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg">
<span x-html="$icon('cube', 'w-5 h-5 text-purple-600 dark:text-purple-400')"></span>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100">
Import Job #<span x-text="{{ job_var }}?.id"></span>
</h3>
<p class="text-sm text-gray-500 dark:text-gray-400" x-text="{{ job_var }}?.marketplace + ' Import'"></p>
</div>
</div>
<button @click="{{ close_action }}" class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors">
<span x-html="$icon('close', 'w-5 h-5')"></span>
</button>
</div>
{# Modal Content #}
<div x-show="{{ job_var }}" class="py-4 space-y-6">
{# Status Badge #}
<div class="flex items-center justify-between">
<span class="text-sm font-medium text-gray-600 dark:text-gray-400">Status</span>
<span class="px-3 py-1 font-semibold leading-tight rounded-full text-sm"
:class="{
'text-green-700 bg-green-100 dark:bg-green-900/30 dark:text-green-400': {{ job_var }}?.status === 'completed',
'text-blue-700 bg-blue-100 dark:bg-blue-900/30 dark:text-blue-400': {{ job_var }}?.status === 'processing',
'text-yellow-700 bg-yellow-100 dark:bg-yellow-900/30 dark:text-yellow-400': {{ job_var }}?.status === 'pending',
'text-red-700 bg-red-100 dark:bg-red-900/30 dark:text-red-400': {{ job_var }}?.status === 'failed',
'text-orange-700 bg-orange-100 dark:bg-orange-900/30 dark:text-orange-400': {{ job_var }}?.status === 'completed_with_errors'
}"
x-text="{{ job_var }}?.status.replace('_', ' ').toUpperCase()">
</span>
</div>
{# Progress Stats Cards #}
<div class="grid grid-cols-4 gap-3">
<div class="p-3 bg-green-50 dark:bg-green-900/20 rounded-lg text-center">
<p class="text-2xl font-bold text-green-600 dark:text-green-400" x-text="{{ job_var }}?.imported ?? 0"></p>
<p class="text-xs text-green-700 dark:text-green-300 mt-1">Imported</p>
</div>
<div class="p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg text-center">
<p class="text-2xl font-bold text-blue-600 dark:text-blue-400" x-text="{{ job_var }}?.updated ?? 0"></p>
<p class="text-xs text-blue-700 dark:text-blue-300 mt-1">Updated</p>
</div>
<div class="p-3 bg-red-50 dark:bg-red-900/20 rounded-lg text-center">
<p class="text-2xl font-bold text-red-600 dark:text-red-400" x-text="{{ job_var }}?.error_count ?? 0"></p>
<p class="text-xs text-red-700 dark:text-red-300 mt-1">Errors</p>
</div>
<div class="p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg text-center">
<p class="text-2xl font-bold text-gray-600 dark:text-gray-300" x-text="{{ job_var }}?.total_processed ?? 0"></p>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Total</p>
</div>
</div>
{# Details Table #}
<div class="overflow-hidden border border-gray-200 dark:border-gray-700 rounded-lg">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50 w-1/3">Vendor</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100" x-text="{{ get_vendor_name }}({{ job_var }}?.vendor_id)"></td>
</tr>
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50">Marketplace</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100" x-text="{{ job_var }}?.marketplace"></td>
</tr>
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50">Language</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">
<span class="px-2 py-0.5 bg-gray-100 dark:bg-gray-600 rounded text-xs font-mono" x-text="{{ job_var }}?.language || 'en'"></span>
</td>
</tr>
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50">Source URL</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">
<span class="break-all text-xs font-mono" x-text="{{ job_var }}?.source_url"></span>
</td>
</tr>
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50">Started At</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100" x-text="{{ job_var }}?.started_at ? formatDate({{ job_var }}.started_at) : 'Not started'"></td>
</tr>
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50">Completed At</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100" x-text="{{ job_var }}?.completed_at ? formatDate({{ job_var }}.completed_at) : 'In progress'"></td>
</tr>
{% if show_created_by %}
<tr>
<td class="px-4 py-3 text-sm font-medium text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50">Created By</td>
<td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100" x-text="{{ job_var }}?.created_by_name || 'System'"></td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{# Error Message #}
<div x-show="{{ job_var }}?.error_message" class="p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">
<div class="flex items-start">
<span x-html="$icon('exclamation-circle', 'w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 mr-2 flex-shrink-0')"></span>
<div>
<p class="text-sm font-medium text-red-800 dark:text-red-300">Error Message</p>
<p class="text-sm text-red-700 dark:text-red-400 mt-1" x-text="{{ job_var }}?.error_message"></p>
</div>
</div>
</div>
{# 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>
{# Modal Footer #}
<div class="flex justify-end pt-4 border-t border-gray-200 dark:border-gray-700">
<button
@click="{{ close_action }}"
class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500"
>
Close
</button>
</div>
</div>
</div>
{% endmacro %}