frontend admin refakctorálás
This commit is contained in:
274
frontend_admin/pages/gamification/validation-rules.vue
Normal file
274
frontend_admin/pages/gamification/validation-rules.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- Page Header -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-2xl font-bold text-white">{{ t('gamification.validation_rules.title') }}</h1>
|
||||
<p class="text-slate-400 mt-1">{{ t('gamification.validation_rules.subtitle') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Loading State -->
|
||||
<div v-if="loading" class="flex items-center justify-center py-20">
|
||||
<div class="text-slate-400 flex items-center gap-3">
|
||||
<svg class="w-5 h-5 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
<span>{{ t('gamification.validation_rules.loading') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div v-else-if="error" class="bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8">
|
||||
<p class="text-rose-400">{{ t('gamification.validation_rules.load_error') }}</p>
|
||||
<button @click="fetchRules" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">{{ t('gamification.validation_rules.retry') }}</button>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<!-- Save Button Bar -->
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="text-sm text-slate-500">{{ t('gamification.validation_rules.last_saved') }} {{ lastSaved ? lastSaved : '—' }}</span>
|
||||
</div>
|
||||
<button
|
||||
@click="saveRules"
|
||||
:disabled="saving || !hasChanges"
|
||||
class="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 disabled:bg-emerald-600/50 text-white rounded-lg text-sm font-medium transition flex items-center gap-2"
|
||||
>
|
||||
<svg v-if="saving" class="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
{{ saving ? t('gamification.validation_rules.saving') : t('gamification.validation_rules.save_rules') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Rules Grid -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
|
||||
<div
|
||||
v-for="rule in rules"
|
||||
:key="rule.rule_key"
|
||||
class="bg-slate-800 rounded-xl border border-slate-700 p-6"
|
||||
>
|
||||
<div class="flex items-start justify-between mb-4">
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold text-white font-mono">{{ rule.rule_key }}</h2>
|
||||
<p class="text-sm text-slate-400 mt-1">{{ rule.description }}</p>
|
||||
</div>
|
||||
<span
|
||||
class="text-xs font-medium px-2 py-1 rounded-full"
|
||||
:class="getValueBadgeClass(rule.rule_value)"
|
||||
>
|
||||
{{ rule.rule_value }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<!-- Number Input -->
|
||||
<div class="flex items-center gap-3">
|
||||
<input
|
||||
:value="editedValues[rule.rule_key] ?? rule.rule_value"
|
||||
@input="onValueChange(rule.rule_key, ($event.target as HTMLInputElement).value)"
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm text-center focus:outline-none focus:ring-2 focus:ring-indigo-500/50"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Visual progress bar -->
|
||||
<div class="w-full bg-slate-700 rounded-full h-2 overflow-hidden">
|
||||
<div
|
||||
class="h-full rounded-full transition-all duration-300"
|
||||
:class="getProgressBarClass(rule.rule_value)"
|
||||
:style="{ width: getProgressWidth(rule.rule_key) + '%' }"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Change indicator -->
|
||||
<div v-if="hasRuleChanged(rule.rule_key)" class="flex items-center gap-1 text-xs">
|
||||
<span class="text-amber-400">{{ t('gamification.validation_rules.changed_from') }} {{ getOriginalValue(rule.rule_key) }}</span>
|
||||
<svg class="w-3 h-3 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6" />
|
||||
</svg>
|
||||
<span class="text-emerald-400">{{ editedValues[rule.rule_key] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Card -->
|
||||
<div class="bg-slate-800/50 border border-slate-700/50 rounded-xl p-6">
|
||||
<div class="flex items-start gap-3">
|
||||
<svg class="w-5 h-5 text-indigo-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<div>
|
||||
<h3 class="text-sm font-medium text-white mb-1">{{ t('gamification.validation_rules.info_title') }}</h3>
|
||||
<p class="text-sm text-slate-400">{{ t('gamification.validation_rules.info_text') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Form Error Toast -->
|
||||
<div v-if="formError" class="fixed bottom-6 right-6 z-50 bg-rose-600 text-white px-4 py-3 rounded-lg shadow-lg text-sm flex items-center gap-2">
|
||||
<svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
{{ formError }}
|
||||
</div>
|
||||
|
||||
<!-- Success Toast -->
|
||||
<div v-if="toast" class="fixed bottom-6 right-6 z-50 bg-emerald-600 text-white px-4 py-3 rounded-lg shadow-lg text-sm flex items-center gap-2 animate-slide-up">
|
||||
<svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
{{ toast }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface ValidationRule {
|
||||
id: number
|
||||
rule_key: string
|
||||
rule_value: number
|
||||
description: string | null
|
||||
updated_at: string | null
|
||||
}
|
||||
|
||||
const loading = ref(true)
|
||||
const error = ref(false)
|
||||
const saving = ref(false)
|
||||
const formError = ref('')
|
||||
const toast = ref('')
|
||||
const lastSaved = ref('')
|
||||
|
||||
const rules = ref<ValidationRule[]>([])
|
||||
const originalValues = ref<Record<string, number>>({})
|
||||
const editedValues = ref<Record<string, number>>({})
|
||||
|
||||
const hasChanges = computed(() => {
|
||||
return Object.keys(editedValues.value).length > 0
|
||||
})
|
||||
|
||||
function getHeaders(): Record<string, string> {
|
||||
const tokenCookie = useCookie('access_token')
|
||||
const token = tokenCookie.value
|
||||
return token ? { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } : { 'Content-Type': 'application/json' }
|
||||
}
|
||||
|
||||
function showToast(msg: string) {
|
||||
toast.value = msg
|
||||
setTimeout(() => { toast.value = '' }, 3000)
|
||||
}
|
||||
|
||||
function onValueChange(ruleKey: string, rawValue: string) {
|
||||
const num = parseInt(rawValue, 10)
|
||||
if (isNaN(num)) return
|
||||
const clamped = Math.max(0, Math.min(100, num))
|
||||
editedValues.value[ruleKey] = clamped
|
||||
}
|
||||
|
||||
function hasRuleChanged(ruleKey: string): boolean {
|
||||
return ruleKey in editedValues.value
|
||||
}
|
||||
|
||||
function getOriginalValue(ruleKey: string): number {
|
||||
return originalValues.value[ruleKey] ?? 0
|
||||
}
|
||||
|
||||
function getProgressWidth(ruleKey: string): string {
|
||||
const val = editedValues.value[ruleKey] ?? originalValues.value[ruleKey] ?? 0
|
||||
return val + '%'
|
||||
}
|
||||
|
||||
function getValueBadgeClass(val: number): string {
|
||||
if (val >= 80) return 'bg-emerald-500/20 text-emerald-400'
|
||||
if (val >= 50) return 'bg-amber-500/20 text-amber-400'
|
||||
return 'bg-slate-500/20 text-slate-400'
|
||||
}
|
||||
|
||||
function getProgressBarClass(val: number): string {
|
||||
if (val >= 80) return 'bg-emerald-500'
|
||||
if (val >= 50) return 'bg-amber-500'
|
||||
return 'bg-slate-500'
|
||||
}
|
||||
|
||||
async function fetchRules() {
|
||||
loading.value = true
|
||||
error.value = false
|
||||
try {
|
||||
const data = await $fetch<ValidationRule[]>('/api/v1/admin/gamification/validation-rules', {
|
||||
headers: getHeaders(),
|
||||
})
|
||||
rules.value = data
|
||||
// Store original values for change tracking
|
||||
originalValues.value = {}
|
||||
editedValues.value = {}
|
||||
for (const rule of data) {
|
||||
originalValues.value[rule.rule_key] = rule.rule_value
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to fetch validation rules:', e)
|
||||
error.value = true
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function saveRules() {
|
||||
saving.value = true
|
||||
formError.value = ''
|
||||
try {
|
||||
const payload: Record<string, number> = {}
|
||||
for (const [key, val] of Object.entries(editedValues.value)) {
|
||||
payload[key] = val
|
||||
}
|
||||
|
||||
await $fetch('/api/v1/admin/gamification/validation-rules', {
|
||||
method: 'PUT',
|
||||
headers: getHeaders(),
|
||||
body: { rules: payload },
|
||||
})
|
||||
|
||||
// Update original values after save
|
||||
for (const [key, val] of Object.entries(editedValues.value)) {
|
||||
originalValues.value[key] = val
|
||||
}
|
||||
editedValues.value = {}
|
||||
lastSaved.value = new Date().toLocaleString('hu-HU')
|
||||
showToast(t('gamification.validation_rules.rules_updated'))
|
||||
} catch (e: any) {
|
||||
formError.value = t('gamification.validation_rules.save_error')
|
||||
console.error('Failed to save validation rules:', e)
|
||||
setTimeout(() => { formError.value = '' }, 4000)
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchRules()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.animate-slide-up {
|
||||
animation: slideUp 0.3s ease-out;
|
||||
}
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(1rem);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -528,51 +528,10 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1.5">{{ $t('garages.details.zip') }}</label>
|
||||
<input
|
||||
v-model="editForm.address_zip"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1.5">{{ $t('garages.details.city') }}</label>
|
||||
<input
|
||||
v-model="editForm.address_city"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1.5">{{ $t('garages.details.street_name') }}</label>
|
||||
<input
|
||||
v-model="editForm.address_street_name"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1.5">{{ $t('garages.details.street_type') }}</label>
|
||||
<input
|
||||
v-model="editForm.address_street_type"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1.5">{{ $t('garages.details.house_number') }}</label>
|
||||
<input
|
||||
v-model="editForm.address_house_number"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<!-- P0 BUGFIX: Use SharedAddressForm for structured address editing -->
|
||||
<div class="border-t border-slate-700/50 pt-4 mt-4">
|
||||
<h4 class="text-sm font-semibold text-white mb-3">{{ $t('garages.details.address') }}</h4>
|
||||
<SharedAddressForm v-if="editForm.address_detail" v-model="editForm.address_detail" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -871,11 +830,21 @@ const editForm = ref({
|
||||
tax_number: '',
|
||||
reg_number: '',
|
||||
org_type: '',
|
||||
address_zip: '',
|
||||
address_city: '',
|
||||
address_street_name: '',
|
||||
address_street_type: '',
|
||||
address_house_number: '',
|
||||
/** P0 BUGFIX: Use address_detail object instead of flat address fields */
|
||||
address_detail: {
|
||||
zip: null as string | null,
|
||||
city: null as string | null,
|
||||
street_name: null as string | null,
|
||||
street_type: null as string | null,
|
||||
house_number: null as string | null,
|
||||
stairwell: null as string | null,
|
||||
floor: null as string | null,
|
||||
door: null as string | null,
|
||||
parcel_id: null as string | null,
|
||||
full_address_text: null as string | null,
|
||||
latitude: null as number | null,
|
||||
longitude: null as number | null,
|
||||
},
|
||||
contact_person_name: '',
|
||||
contact_email: '',
|
||||
contact_phone: '',
|
||||
@@ -1031,6 +1000,8 @@ async function fetchFleetVehicles() {
|
||||
// Edit Modal
|
||||
function openEditModal() {
|
||||
if (!garage.value) return
|
||||
/** P0 BUGFIX: Map address_detail from API response to form.address_detail */
|
||||
const addr = garage.value.address_detail || {}
|
||||
editForm.value = {
|
||||
full_name: garage.value.full_name || '',
|
||||
name: garage.value.name || '',
|
||||
@@ -1040,11 +1011,20 @@ function openEditModal() {
|
||||
tax_number: garage.value.tax_number || '',
|
||||
reg_number: garage.value.reg_number || '',
|
||||
org_type: garage.value.org_type || '',
|
||||
address_zip: garage.value.address_zip || '',
|
||||
address_city: garage.value.address_city || '',
|
||||
address_street_name: garage.value.address_street_name || '',
|
||||
address_street_type: garage.value.address_street_type || '',
|
||||
address_house_number: garage.value.address_house_number || '',
|
||||
address_detail: {
|
||||
zip: addr.zip || addr.address_zip || null,
|
||||
city: addr.city || null,
|
||||
street_name: addr.street_name || addr.address_street_name || null,
|
||||
street_type: addr.street_type || addr.address_street_type || null,
|
||||
house_number: addr.house_number || addr.address_house_number || null,
|
||||
stairwell: addr.stairwell || null,
|
||||
floor: addr.floor || null,
|
||||
door: addr.door || null,
|
||||
parcel_id: addr.parcel_id || null,
|
||||
full_address_text: addr.full_address_text || null,
|
||||
latitude: addr.latitude ?? null,
|
||||
longitude: addr.longitude ?? null,
|
||||
},
|
||||
contact_person_name: garage.value.contact_person_name || '',
|
||||
contact_email: garage.value.contact_email || '',
|
||||
contact_phone: garage.value.contact_phone || '',
|
||||
@@ -1073,12 +1053,57 @@ async function saveEdit() {
|
||||
const tokenCookie = useCookie('access_token')
|
||||
const token = (tokenCookie.value || auth.token || '').trim()
|
||||
|
||||
const payload: Record<string, any> = {}
|
||||
for (const [key, value] of Object.entries(editForm.value)) {
|
||||
if (value !== '' && value !== null && value !== undefined) {
|
||||
payload[key] = value
|
||||
/** P0 BUGFIX: Build payload with address_detail nested object instead of flat address fields */
|
||||
const f = editForm.value
|
||||
const payload: Record<string, any> = {
|
||||
full_name: f.full_name || undefined,
|
||||
name: f.name || undefined,
|
||||
display_name: f.display_name || undefined,
|
||||
email: f.email || undefined,
|
||||
phone: f.phone || undefined,
|
||||
tax_number: f.tax_number || undefined,
|
||||
reg_number: f.reg_number || undefined,
|
||||
org_type: f.org_type || undefined,
|
||||
contact_person_name: f.contact_person_name || undefined,
|
||||
contact_email: f.contact_email || undefined,
|
||||
contact_phone: f.contact_phone || undefined,
|
||||
billing_zip: f.billing_zip || undefined,
|
||||
billing_city: f.billing_city || undefined,
|
||||
billing_street_name: f.billing_street_name || undefined,
|
||||
billing_street_type: f.billing_street_type || undefined,
|
||||
billing_house_number: f.billing_house_number || undefined,
|
||||
notification_zip: f.notification_zip || undefined,
|
||||
notification_city: f.notification_city || undefined,
|
||||
notification_street_name: f.notification_street_name || undefined,
|
||||
notification_street_type: f.notification_street_type || undefined,
|
||||
notification_house_number: f.notification_house_number || undefined,
|
||||
/** Send address_detail as a nested object matching the API contract */
|
||||
address_detail: {
|
||||
zip: f.address_detail.zip,
|
||||
city: f.address_detail.city,
|
||||
street_name: f.address_detail.street_name,
|
||||
street_type: f.address_detail.street_type,
|
||||
house_number: f.address_detail.house_number,
|
||||
stairwell: f.address_detail.stairwell,
|
||||
floor: f.address_detail.floor,
|
||||
door: f.address_detail.door,
|
||||
parcel_id: f.address_detail.parcel_id,
|
||||
full_address_text: f.address_detail.full_address_text,
|
||||
latitude: f.address_detail.latitude,
|
||||
longitude: f.address_detail.longitude,
|
||||
},
|
||||
}
|
||||
|
||||
// Remove undefined values
|
||||
for (const key of Object.keys(payload)) {
|
||||
if (payload[key] === undefined) {
|
||||
delete payload[key]
|
||||
}
|
||||
}
|
||||
// Remove address_detail if all fields are null
|
||||
if (payload.address_detail && Object.values(payload.address_detail).every(v => v === null || v === undefined)) {
|
||||
delete payload.address_detail
|
||||
}
|
||||
|
||||
if (garage.value?.org_type === 'individual') {
|
||||
if (payload.contact_email && !payload.email) payload.email = payload.contact_email
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
>
|
||||
{{ garageDisplayName(garage) }}
|
||||
</NuxtLink>
|
||||
<p class="text-xs text-slate-500">{{ garage.city || '—' }} · {{ garage.member_count }} {{ $t('garages.members') }}</p>
|
||||
<p class="text-xs text-slate-500">{{ garage.address_detail?.city || '—' }} · {{ garage.member_count }} {{ $t('garages.members') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -388,6 +388,14 @@ interface Garage {
|
||||
city: string | null
|
||||
region: string | null
|
||||
segment: string | null
|
||||
address_detail?: {
|
||||
zip: string | null
|
||||
city: string | null
|
||||
street_name: string | null
|
||||
street_type: string | null
|
||||
house_number: string | null
|
||||
full_address_text: string | null
|
||||
} | null
|
||||
member_count: number
|
||||
created_at: string | null
|
||||
subscription: SubscriptionInfo | null
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,30 +2,30 @@
|
||||
<div>
|
||||
<!-- Page Header -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-2xl font-bold text-white">Szolgáltatók</h1>
|
||||
<p class="text-slate-400 mt-1">Szolgáltatók listázása, keresése és moderálása</p>
|
||||
<h1 class="text-2xl font-bold text-white">{{ $t('providers.title') }}</h1>
|
||||
<p class="text-slate-400 mt-1">{{ $t('providers.subtitle') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Stats Cards -->
|
||||
<div class="grid grid-cols-2 md:grid-cols-5 gap-4 mb-8">
|
||||
<div class="bg-slate-800 rounded-xl border border-slate-700 p-4">
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">Összes</p>
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">{{ $t('providers.stats_total') }}</p>
|
||||
<p class="text-2xl font-bold text-white mt-1">{{ stats.total }}</p>
|
||||
</div>
|
||||
<div class="bg-slate-800 rounded-xl border border-amber-500/30 p-4">
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">Függőben</p>
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">{{ $t('providers.stats_pending') }}</p>
|
||||
<p class="text-2xl font-bold text-amber-400 mt-1">{{ stats.pending }}</p>
|
||||
</div>
|
||||
<div class="bg-slate-800 rounded-xl border border-emerald-500/30 p-4">
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">Jóváhagyott</p>
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">{{ $t('providers.stats_approved') }}</p>
|
||||
<p class="text-2xl font-bold text-emerald-400 mt-1">{{ stats.approved }}</p>
|
||||
</div>
|
||||
<div class="bg-slate-800 rounded-xl border border-rose-500/30 p-4">
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">Elutasított</p>
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">{{ $t('providers.stats_rejected') }}</p>
|
||||
<p class="text-2xl font-bold text-rose-400 mt-1">{{ stats.rejected }}</p>
|
||||
</div>
|
||||
<div class="bg-slate-800 rounded-xl border border-purple-500/30 p-4">
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">Megjelölt</p>
|
||||
<p class="text-xs text-slate-400 uppercase tracking-wider">{{ $t('providers.stats_flagged') }}</p>
|
||||
<p class="text-2xl font-bold text-purple-400 mt-1">{{ stats.flagged }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,14 +36,14 @@
|
||||
<svg class="w-5 h-5 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
<span>Szolgáltatók betöltése...</span>
|
||||
<span>{{ $t('providers.loading') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div v-else-if="error" class="bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8">
|
||||
<p class="text-rose-400">Hiba történt a szolgáltatók betöltése közben.</p>
|
||||
<button @click="fetchProviders" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">Újrapróbálkozás</button>
|
||||
<p class="text-rose-400">{{ $t('providers.error') }}</p>
|
||||
<button @click="fetchProviders" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">{{ $t('providers.retry') }}</button>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
@@ -55,7 +55,7 @@
|
||||
<input
|
||||
v-model="filters.search"
|
||||
type="text"
|
||||
placeholder="Keresés név alapján..."
|
||||
:placeholder="$t('providers.search_placeholder')"
|
||||
class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"
|
||||
@input="onSearchInput"
|
||||
/>
|
||||
@@ -67,11 +67,11 @@
|
||||
class="px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"
|
||||
@change="fetchProviders"
|
||||
>
|
||||
<option value="">Minden státusz</option>
|
||||
<option value="pending">Függőben</option>
|
||||
<option value="approved">Jóváhagyott</option>
|
||||
<option value="rejected">Elutasított</option>
|
||||
<option value="flagged">Megjelölt</option>
|
||||
<option value="">{{ $t('providers.filter_all_status') }}</option>
|
||||
<option value="pending">{{ $t('providers.filter_pending') }}</option>
|
||||
<option value="approved">{{ $t('providers.filter_approved') }}</option>
|
||||
<option value="rejected">{{ $t('providers.filter_rejected') }}</option>
|
||||
<option value="flagged">{{ $t('providers.filter_flagged') }}</option>
|
||||
</select>
|
||||
|
||||
<!-- Source Filter -->
|
||||
@@ -80,12 +80,12 @@
|
||||
class="px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"
|
||||
@change="fetchProviders"
|
||||
>
|
||||
<option value="">Minden forrás</option>
|
||||
<option value="manual">Kézi</option>
|
||||
<option value="ocr">OCR</option>
|
||||
<option value="import">Import</option>
|
||||
<option value="bot">Bot (Staging)</option>
|
||||
<option value="verified_org">Szervezet</option>
|
||||
<option value="">{{ $t('providers.filter_all_sources') }}</option>
|
||||
<option value="manual">{{ $t('providers.source_manual') }}</option>
|
||||
<option value="ocr">{{ $t('providers.source_ocr') }}</option>
|
||||
<option value="import">{{ $t('providers.source_import') }}</option>
|
||||
<option value="bot">{{ $t('providers.source_bot') }}</option>
|
||||
<option value="verified_org">{{ $t('providers.source_verified_org') }}</option>
|
||||
</select>
|
||||
|
||||
<!-- Sort -->
|
||||
@@ -94,9 +94,9 @@
|
||||
class="px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"
|
||||
@change="fetchProviders"
|
||||
>
|
||||
<option value="created_at">Létrehozás dátuma</option>
|
||||
<option value="name">Név</option>
|
||||
<option value="validation_score">Validációs pontszám</option>
|
||||
<option value="created_at">{{ $t('providers.sort_created_at') }}</option>
|
||||
<option value="name">{{ $t('providers.sort_name') }}</option>
|
||||
<option value="validation_score">{{ $t('providers.sort_validation_score') }}</option>
|
||||
</select>
|
||||
|
||||
<button
|
||||
@@ -106,7 +106,7 @@
|
||||
<svg class="w-4 h-4" :class="filters.sort_order === 'asc' ? 'rotate-180' : ''" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
{{ filters.sort_order === 'asc' ? 'Növekvő' : 'Csökkenő' }}
|
||||
{{ filters.sort_order === 'asc' ? $t('common.ascending') : $t('common.descending') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -116,14 +116,14 @@
|
||||
<table class="w-full">
|
||||
<thead>
|
||||
<tr class="border-b border-slate-700">
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">ID</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Név</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Cím</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Státusz</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Forrás</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Validáció</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Létrehozva</th>
|
||||
<th class="text-right px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">Műveletek</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_id') }}</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_name') }}</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_address') }}</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_status') }}</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_source') }}</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_validation') }}</th>
|
||||
<th class="text-left px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_created') }}</th>
|
||||
<th class="text-right px-6 py-4 text-xs font-medium text-slate-400 uppercase tracking-wider">{{ $t('providers.col_actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-700/50">
|
||||
@@ -134,7 +134,7 @@
|
||||
{{ provider.name }}
|
||||
</NuxtLink>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm text-slate-300 max-w-[200px] truncate">{{ provider.address || '—' }}</td>
|
||||
<td class="px-6 py-4 text-sm text-slate-300 max-w-[200px] truncate">{{ provider.address_detail?.full_address_text || [provider.address_detail?.zip, provider.address_detail?.city, provider.address_detail?.street_name].filter(Boolean).join(' ') || '—' }}</td>
|
||||
<td class="px-6 py-4">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium" :class="statusClass(provider.status)">
|
||||
{{ statusLabel(provider.status) }}
|
||||
@@ -164,7 +164,7 @@
|
||||
<NuxtLink
|
||||
:to="`/providers/${provider.id}`"
|
||||
class="p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition"
|
||||
title="Részletek"
|
||||
:title="$t('providers.view_details')"
|
||||
>
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
@@ -176,7 +176,7 @@
|
||||
</tr>
|
||||
<tr v-if="providers.length === 0">
|
||||
<td colspan="8" class="px-6 py-12 text-center text-sm text-slate-500">
|
||||
Nincs megjeleníthető szolgáltató.
|
||||
{{ $t('providers.no_providers') }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -186,7 +186,7 @@
|
||||
<!-- Pagination -->
|
||||
<div class="flex items-center justify-between mt-6">
|
||||
<p class="text-sm text-slate-400">
|
||||
{{ providers.length }} találat (összesen: {{ stats.total }})
|
||||
{{ $t('providers.results_count', { count: providers.length, total: stats.total }) }}
|
||||
</p>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
@@ -194,17 +194,17 @@
|
||||
@click="filters.skip = Math.max(0, filters.skip - filters.limit); fetchProviders()"
|
||||
class="px-3 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:bg-slate-600 transition text-sm"
|
||||
>
|
||||
Előző
|
||||
{{ $t('common.prev') }}
|
||||
</button>
|
||||
<span class="text-sm text-slate-400">
|
||||
{{ Math.floor(filters.skip / filters.limit) + 1 }}. oldal
|
||||
{{ $t('providers.page', { page: Math.floor(filters.skip / filters.limit) + 1 }) }}
|
||||
</span>
|
||||
<button
|
||||
:disabled="providers.length < filters.limit"
|
||||
@click="filters.skip += filters.limit; fetchProviders()"
|
||||
class="px-3 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:bg-slate-600 transition text-sm"
|
||||
>
|
||||
Következő
|
||||
{{ $t('common.next') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -225,6 +225,7 @@ definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const { formatDate } = useFormatter()
|
||||
|
||||
interface ProviderListItem {
|
||||
@@ -232,6 +233,14 @@ interface ProviderListItem {
|
||||
name: string
|
||||
address: string | null
|
||||
city: string | null
|
||||
address_detail?: {
|
||||
zip: string | null
|
||||
city: string | null
|
||||
street_name: string | null
|
||||
street_type: string | null
|
||||
house_number: string | null
|
||||
full_address_text: string | null
|
||||
} | null
|
||||
category: string | null
|
||||
status: string
|
||||
source: string
|
||||
@@ -299,10 +308,10 @@ function statusClass(status: string): string {
|
||||
|
||||
function statusLabel(status: string): string {
|
||||
const map: Record<string, string> = {
|
||||
pending: 'Függőben',
|
||||
approved: 'Jóváhagyott',
|
||||
rejected: 'Elutasított',
|
||||
flagged: 'Megjelölt',
|
||||
pending: t('providers.status_pending'),
|
||||
approved: t('providers.status_approved'),
|
||||
rejected: t('providers.status_rejected'),
|
||||
flagged: t('providers.status_flagged'),
|
||||
}
|
||||
return map[status] || status
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div>
|
||||
<!-- Page Header -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-2xl font-bold text-white">Jóváhagyásra váró szolgáltatók</h1>
|
||||
<p class="text-slate-400 mt-1">A közösség által beküldött szolgáltatók moderációs sora</p>
|
||||
<h1 class="text-2xl font-bold text-white">{{ $t('providers.pending_title') }}</h1>
|
||||
<p class="text-slate-400 mt-1">{{ $t('providers.pending_subtitle') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Loading State -->
|
||||
@@ -12,14 +12,14 @@
|
||||
<svg class="w-5 h-5 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
<span>Függőben lévő szolgáltatók betöltése...</span>
|
||||
<span>{{ $t('providers.pending_loading') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div v-else-if="error" class="bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8">
|
||||
<p class="text-rose-400">Hiba történt a szolgáltatók betöltése közben.</p>
|
||||
<button @click="fetchPendingProviders" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">Újrapróbálkozás</button>
|
||||
<p class="text-rose-400">{{ $t('providers.error') }}</p>
|
||||
<button @click="fetchPendingProviders" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">{{ $t('providers.retry') }}</button>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
@@ -34,29 +34,31 @@
|
||||
<!-- Left: Provider Info -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<h3 class="text-lg font-semibold text-white truncate">{{ provider.name }}</h3>
|
||||
<NuxtLink :to="`/providers/${provider.id}`" class="text-lg font-semibold text-blue-400 hover:text-blue-300 hover:underline cursor-pointer transition-colors truncate">
|
||||
{{ provider.name }}
|
||||
</NuxtLink>
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400">
|
||||
Függőben
|
||||
{{ $t('providers.status_pending') }}
|
||||
</span>
|
||||
<code class="text-xs font-mono text-slate-400 bg-slate-700/50 px-2 py-0.5 rounded">{{ provider.source }}</code>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-x-8 gap-y-2 text-sm">
|
||||
<div v-if="provider.address" class="text-slate-300">
|
||||
<span class="text-slate-500">Cím:</span> {{ provider.address }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_address') }}</span> {{ provider.address }}
|
||||
</div>
|
||||
<div v-if="provider.city" class="text-slate-300">
|
||||
<span class="text-slate-500">Város:</span> {{ provider.city }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_city') }}</span> {{ provider.city }}
|
||||
</div>
|
||||
<div v-if="provider.category" class="text-slate-300">
|
||||
<span class="text-slate-500">Kategória:</span> {{ provider.category }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_category') }}</span> {{ provider.category }}
|
||||
</div>
|
||||
<div class="text-slate-300">
|
||||
<span class="text-slate-500">Validációs pontszám:</span>
|
||||
<span class="text-slate-500">{{ $t('providers.label_validation_score') }}</span>
|
||||
<span class="text-amber-400 font-medium ml-1">{{ provider.validation_score }}</span>
|
||||
</div>
|
||||
<div v-if="provider.created_at" class="text-slate-300">
|
||||
<span class="text-slate-500">Beküldve:</span> {{ formatDate(provider.created_at) }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_submitted') }}</span> {{ formatDate(provider.created_at) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,7 +76,7 @@
|
||||
<svg v-else class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
|
||||
</svg>
|
||||
Jóváhagyás
|
||||
{{ $t('providers.approve') }}
|
||||
</button>
|
||||
<button
|
||||
@click="openRejectModal(provider)"
|
||||
@@ -84,7 +86,7 @@
|
||||
<svg class="w-4 h-4" 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" />
|
||||
</svg>
|
||||
Elutasítás
|
||||
{{ $t('providers.reject') }}
|
||||
</button>
|
||||
<NuxtLink
|
||||
:to="`/providers/${provider.id}`"
|
||||
@@ -94,7 +96,7 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
Részletek
|
||||
{{ $t('providers.details') }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,8 +107,8 @@
|
||||
<svg class="w-12 h-12 mx-auto text-slate-600 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<h3 class="text-lg font-medium text-slate-400 mb-1">Nincs függőben lévő szolgáltató</h3>
|
||||
<p class="text-sm text-slate-500">Minden beküldött szolgáltató fel lett dolgozva.</p>
|
||||
<h3 class="text-lg font-medium text-slate-400 mb-1">{{ $t('providers.no_pending') }}</h3>
|
||||
<p class="text-sm text-slate-500">{{ $t('providers.no_pending_subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -114,29 +116,29 @@
|
||||
<!-- Reject Modal -->
|
||||
<div v-if="showRejectModal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm" @click.self="showRejectModal = false">
|
||||
<div class="bg-slate-800 rounded-xl border border-slate-700 p-6 w-full max-w-lg mx-4 shadow-2xl">
|
||||
<h2 class="text-lg font-semibold text-white mb-2">Szolgáltató elutasítása</h2>
|
||||
<h2 class="text-lg font-semibold text-white mb-2">{{ $t('providers.reject_modal_title') }}</h2>
|
||||
<p class="text-sm text-slate-400 mb-6">
|
||||
Biztosan elutasítod a(z) <strong class="text-white">{{ rejectingProvider?.name }}</strong> szolgáltatót?
|
||||
{{ $t('providers.reject_modal_body', { name: rejectingProvider?.name }) }}
|
||||
</p>
|
||||
|
||||
<form @submit.prevent="rejectProvider">
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-slate-300 mb-1">Indoklás (opcionális)</label>
|
||||
<label class="block text-sm font-medium text-slate-300 mb-1">{{ $t('providers.reject_reason_label') }}</label>
|
||||
<textarea
|
||||
v-model="rejectReason"
|
||||
rows="3"
|
||||
placeholder="Add meg az elutasítás okát..."
|
||||
:placeholder="$t('providers.reject_reason_placeholder')"
|
||||
class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-rose-500/50 focus:border-rose-500 text-sm resize-none"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-3">
|
||||
<button type="button" @click="showRejectModal = false" class="px-4 py-2 text-sm text-slate-400 hover:text-white transition">Mégse</button>
|
||||
<button type="button" @click="showRejectModal = false" class="px-4 py-2 text-sm text-slate-400 hover:text-white transition">{{ $t('common.cancel') }}</button>
|
||||
<button type="submit" :disabled="rejectLoading" class="px-4 py-2 bg-rose-600 hover:bg-rose-500 disabled:bg-rose-600/50 text-white rounded-lg text-sm font-medium transition flex items-center gap-2">
|
||||
<svg v-if="rejectLoading" class="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
Elutasítás
|
||||
{{ $t('providers.reject') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -158,6 +160,7 @@ definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const { formatDate } = useFormatter()
|
||||
|
||||
interface ProviderListItem {
|
||||
@@ -217,11 +220,11 @@ async function approveProvider(provider: ProviderListItem) {
|
||||
headers: getHeaders(),
|
||||
body: { reason: 'Admin approved via pending queue' },
|
||||
})
|
||||
showToast(`"${provider.name}" sikeresen jóváhagyva`)
|
||||
showToast(t('providers.approved_toast', { name: provider.name }))
|
||||
providers.value = providers.value.filter(p => p.id !== provider.id)
|
||||
} catch (e: any) {
|
||||
const detail = e?.response?._data?.detail || e?.data?.detail || 'Ismeretlen hiba'
|
||||
showToast(`Hiba: ${detail}`)
|
||||
const detail = e?.response?._data?.detail || e?.data?.detail || t('providers.unknown_error')
|
||||
showToast(t('providers.error_prefix', { detail }))
|
||||
console.error('Failed to approve provider:', e)
|
||||
} finally {
|
||||
actionLoading.value = null
|
||||
@@ -243,13 +246,13 @@ async function rejectProvider() {
|
||||
headers: getHeaders(),
|
||||
body: { reason: rejectReason.value || 'Admin rejected via pending queue' },
|
||||
})
|
||||
showToast(`"${rejectingProvider.value.name}" elutasítva`)
|
||||
showToast(t('providers.rejected_toast', { name: rejectingProvider.value.name }))
|
||||
providers.value = providers.value.filter(p => p.id !== rejectingProvider.value!.id)
|
||||
showRejectModal.value = false
|
||||
rejectingProvider.value = null
|
||||
} catch (e: any) {
|
||||
const detail = e?.response?._data?.detail || e?.data?.detail || 'Ismeretlen hiba'
|
||||
showToast(`Hiba: ${detail}`)
|
||||
const detail = e?.response?._data?.detail || e?.data?.detail || t('providers.unknown_error')
|
||||
showToast(t('providers.error_prefix', { detail }))
|
||||
console.error('Failed to reject provider:', e)
|
||||
} finally {
|
||||
rejectLoading.value = false
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div>
|
||||
<!-- Page Header -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-2xl font-bold text-white">Elutasított szolgáltatók</h1>
|
||||
<p class="text-slate-400 mt-1">Elutasított szolgáltatók visszaállítása az aktív kereshető szolgáltatók közé</p>
|
||||
<h1 class="text-2xl font-bold text-white">{{ $t('providers.rejected_title') }}</h1>
|
||||
<p class="text-slate-400 mt-1">{{ $t('providers.rejected_subtitle') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Loading State -->
|
||||
@@ -12,14 +12,14 @@
|
||||
<svg class="w-5 h-5 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
<span>Elutasított szolgáltatók betöltése...</span>
|
||||
<span>{{ $t('providers.rejected_loading') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div v-else-if="error" class="bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8">
|
||||
<p class="text-rose-400">Hiba történt a szolgáltatók betöltése közben.</p>
|
||||
<button @click="fetchRejectedProviders" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">Újrapróbálkozás</button>
|
||||
<p class="text-rose-400">{{ $t('providers.error') }}</p>
|
||||
<button @click="fetchRejectedProviders" class="mt-3 text-sm text-rose-300 hover:text-rose-200 underline">{{ $t('providers.retry') }}</button>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<h3 class="text-lg font-semibold text-white truncate">{{ provider.name }}</h3>
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400">
|
||||
Elutasított
|
||||
{{ $t('providers.status_rejected') }}
|
||||
</span>
|
||||
<code class="text-xs font-mono text-slate-400 bg-slate-700/50 px-2 py-0.5 rounded">{{ provider.source }}</code>
|
||||
<span v-if="provider.source_table" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-mono bg-slate-700/50 text-slate-400">
|
||||
@@ -46,20 +46,20 @@
|
||||
|
||||
<div class="grid grid-cols-2 gap-x-8 gap-y-2 text-sm">
|
||||
<div v-if="provider.address" class="text-slate-300">
|
||||
<span class="text-slate-500">Cím:</span> {{ provider.address }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_address') }}</span> {{ provider.address }}
|
||||
</div>
|
||||
<div v-if="provider.city" class="text-slate-300">
|
||||
<span class="text-slate-500">Város:</span> {{ provider.city }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_city') }}</span> {{ provider.city }}
|
||||
</div>
|
||||
<div v-if="provider.category" class="text-slate-300">
|
||||
<span class="text-slate-500">Kategória:</span> {{ provider.category }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_category') }}</span> {{ provider.category }}
|
||||
</div>
|
||||
<div class="text-slate-300">
|
||||
<span class="text-slate-500">Validációs pontszám:</span>
|
||||
<span class="text-slate-500">{{ $t('providers.label_validation_score') }}</span>
|
||||
<span class="text-rose-400 font-medium ml-1">{{ provider.validation_score }}</span>
|
||||
</div>
|
||||
<div v-if="provider.created_at" class="text-slate-300">
|
||||
<span class="text-slate-500">Létrehozva:</span> {{ formatDate(provider.created_at) }}
|
||||
<span class="text-slate-500">{{ $t('providers.label_created') }}</span> {{ formatDate(provider.created_at) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,7 +77,7 @@
|
||||
<svg v-else class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
Visszaállítás
|
||||
{{ $t('providers.restore') }}
|
||||
</button>
|
||||
<NuxtLink
|
||||
:to="`/providers/${provider.id}`"
|
||||
@@ -87,7 +87,7 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
Részletek
|
||||
{{ $t('providers.details') }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,8 +98,8 @@
|
||||
<svg class="w-12 h-12 mx-auto text-slate-600 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<h3 class="text-lg font-medium text-slate-400 mb-1">Nincs elutasított szolgáltató</h3>
|
||||
<p class="text-sm text-slate-500">Minden szolgáltató jóváhagyott státuszban van.</p>
|
||||
<h3 class="text-lg font-medium text-slate-400 mb-1">{{ $t('providers.no_rejected') }}</h3>
|
||||
<p class="text-sm text-slate-500">{{ $t('providers.no_rejected_subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -107,30 +107,29 @@
|
||||
<!-- Restore Modal -->
|
||||
<div v-if="showRestoreModal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm" @click.self="showRestoreModal = false">
|
||||
<div class="bg-slate-800 rounded-xl border border-slate-700 p-6 w-full max-w-lg mx-4 shadow-2xl">
|
||||
<h2 class="text-lg font-semibold text-white mb-2">Szolgáltató visszaállítása</h2>
|
||||
<h2 class="text-lg font-semibold text-white mb-2">{{ $t('providers.restore_modal_title') }}</h2>
|
||||
<p class="text-sm text-slate-400 mb-6">
|
||||
Biztosan visszaállítod a(z) <strong class="text-white">{{ restoringProvider?.name }}</strong> szolgáltatót?
|
||||
A visszaállítás után a szolgáltató újra elérhető lesz a keresőben és a listákban.
|
||||
{{ $t('providers.restore_modal_body', { name: restoringProvider?.name }) }}
|
||||
</p>
|
||||
|
||||
<form @submit.prevent="restoreProvider">
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-slate-300 mb-1">Indoklás (opcionális)</label>
|
||||
<label class="block text-sm font-medium text-slate-300 mb-1">{{ $t('providers.restore_reason_label') }}</label>
|
||||
<textarea
|
||||
v-model="restoreReason"
|
||||
rows="3"
|
||||
placeholder="Add meg a visszaállítás okát..."
|
||||
:placeholder="$t('providers.restore_reason_placeholder')"
|
||||
class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-emerald-500/50 focus:border-emerald-500 text-sm resize-none"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-3">
|
||||
<button type="button" @click="showRestoreModal = false" class="px-4 py-2 text-sm text-slate-400 hover:text-white transition">Mégse</button>
|
||||
<button type="button" @click="showRestoreModal = false" class="px-4 py-2 text-sm text-slate-400 hover:text-white transition">{{ $t('common.cancel') }}</button>
|
||||
<button type="submit" :disabled="restoreLoading" class="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 disabled:bg-emerald-600/50 text-white rounded-lg text-sm font-medium transition flex items-center gap-2">
|
||||
<svg v-if="restoreLoading" class="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
Visszaállítás
|
||||
{{ $t('providers.restore') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -152,6 +151,7 @@ definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const { formatDate } = useFormatter()
|
||||
|
||||
interface ProviderListItem {
|
||||
@@ -218,13 +218,13 @@ async function restoreProvider() {
|
||||
headers: getHeaders(),
|
||||
body: { reason: restoreReason.value || 'Admin restored via rejected queue' },
|
||||
})
|
||||
showToast(`"${restoringProvider.value.name}" sikeresen visszaállítva`)
|
||||
showToast(t('providers.restored_toast', { name: restoringProvider.value.name }))
|
||||
providers.value = providers.value.filter(p => p.id !== restoringProvider.value!.id)
|
||||
showRestoreModal.value = false
|
||||
restoringProvider.value = null
|
||||
} catch (e: any) {
|
||||
const detail = e?.response?._data?.detail || e?.data?.detail || 'Ismeretlen hiba'
|
||||
showToast(`Hiba: ${detail}`)
|
||||
const detail = e?.response?._data?.detail || e?.data?.detail || t('providers.unknown_error')
|
||||
showToast(t('providers.error_prefix', { detail }))
|
||||
console.error('Failed to restore provider:', e)
|
||||
} finally {
|
||||
restoreLoading.value = false
|
||||
|
||||
Reference in New Issue
Block a user