2026.03.29 20:00 Gitea_manager javítás előtt

This commit is contained in:
Roo
2026-03-29 17:59:06 +00:00
parent 03258db091
commit ba8b6579ef
148 changed files with 7951 additions and 591 deletions

View File

@@ -35,7 +35,7 @@
<script setup>
import { ref } from 'vue'
import axios from 'axios'
import api from '@/services/api'
const form = ref({
category: 'REFUELING',
@@ -47,7 +47,25 @@ const form = ref({
const handleSubmit = async () => {
try {
await axios.post(`${import.meta.env.VITE_API_BASE_URL || 'https://dev.servicefinder.hu'}/api/v1/expenses/add`, form.value)
// Map frontend fields to backend schema
const categoryMap = {
'REFUELING': 'fuel',
'SERVICE': 'service',
'INSURANCE': 'insurance',
'TOLL': 'toll',
'FINE': 'fine'
}
const payload = {
cost_type: categoryMap[form.value.category] || form.value.category.toLowerCase(),
amount_local: form.value.amount,
currency_local: 'HUF',
mileage_at_cost: form.value.odometer_value,
date: new Date(form.value.date).toISOString(),
asset_id: form.value.vehicle_id,
description: null,
data: {}
}
await api.post('/expenses/', payload)
alert("Sikeresen mentve!")
} catch (err) {
alert("Hiba történt a mentéskor.")

View File

@@ -33,10 +33,12 @@
<script setup>
import { ref } from 'vue'
import axios from 'axios'
import api from '@/services/api'
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/authStore'
const router = useRouter()
const authStore = useAuthStore()
const searchQuery = ref('')
const brands = ref([])
const selectedBrand = ref(null)
@@ -44,7 +46,7 @@ const form = ref({ model_name: '', plate: '', vin: '', current_odo: 0 })
const searchBrands = async () => {
if (searchQuery.value.length < 2) { brands.value = []; return; }
const res = await axios.get(`http://192.168.100.43:8000/api/v1/vehicles/search/brands?q=${searchQuery.value}`)
const res = await api.get(`/vehicles/search/brands?q=${searchQuery.value}`)
brands.value = res.data.data
}
@@ -54,15 +56,16 @@ const selectBrand = (brand) => {
}
const saveVehicle = async () => {
const token = localStorage.getItem('token')
try {
await axios.post('http://192.168.100.43:8000/api/v1/vehicles/register', {
brand_id: selectedBrand.value.id,
...form.value
}, { headers: { Authorization: `Bearer ${token}` }})
await api.post('/assets/vehicles', {
vin: form.value.vin || null,
license_plate: form.value.plate || 'N/A',
catalog_id: null, // draft mode, no catalog mapping yet
organization_id: authStore.activeOrgId // Use active organization ID, must be present
})
router.push('/')
} catch (err) {
alert("Hiba a mentés során.")
}
}
</script>
</script>

View File

@@ -5,17 +5,23 @@ import VehicleShowcase from '@/components/garage/VehicleShowcase.vue'
import AchievementShowcase from '@/components/gamification/AchievementShowcase.vue'
import AnalyticsDashboard from '@/components/analytics/AnalyticsDashboard.vue'
import { useThemeStore } from '@/stores/themeStore'
import { useAuthStore } from '@/stores/authStore'
const report = ref(null)
const loading = ref(true)
const themeStore = useThemeStore()
const authStore = useAuthStore()
const themeClasses = computed(() => themeStore.themeClasses)
onMounted(async () => {
const token = localStorage.getItem('token')
try {
const res = await axios.get(`${import.meta.env.VITE_API_BASE_URL || 'https://dev.servicefinder.hu'}/api/v1/reports/summary/latest`, {
// Fetch user profile
await authStore.fetchUserProfile()
// Fetch report summary
const res = await axios.get(`${import.meta.env.VITE_API_BASE_URL || 'https://dev.servicefinder.hu'}/reports/summary/latest`, {
headers: { Authorization: `Bearer ${token}` }
})
report.value = res.data

View File

@@ -0,0 +1,369 @@
<template>
<div class="debug-page">
<h1>🚨 DEBUG VIEW - RAW STATE INSPECTOR</h1>
<div class="credentials">
<h2>Test Credentials</h2>
<p><strong>Email:</strong> tester_pro@profibot.hu</p>
<p><strong>Password:</strong> Password123!</p>
<p class="note">Use these credentials to test the login flow</p>
</div>
<div class="actions">
<h2>Auth Store Actions</h2>
<div class="button-group">
<button @click="triggerLogin" :disabled="false">
🔐 Trigger Login (tester_pro@profibot.hu)
</button>
<button @click="fetchUserProfile" :disabled="!authStore.isLoggedIn">
👤 Fetch User Profile
</button>
<button @click="fetchVehicles" :disabled="!authStore.isLoggedIn">
🚗 Fetch Vehicles (Garage)
</button>
<button @click="clearState">
🗑 Clear All State
</button>
</div>
<div class="status">
<p><strong>Status:</strong> {{ statusMessage }}</p>
</div>
</div>
<div class="grid">
<!-- Auth Store State -->
<div class="panel">
<h2>🔐 Auth Store State</h2>
<div class="state-info">
<p><span class="label">isLoggedIn:</span> <span :class="authStore.isLoggedIn ? 'yes' : 'no'">{{ authStore.isLoggedIn ? 'YES' : 'NO' }}</span></p>
<p><span class="label">isAdmin:</span> <span :class="authStore.isAdmin ? 'yes' : 'no'">{{ authStore.isAdmin ? 'YES' : 'NO' }}</span></p>
<p><span class="label">isTester:</span> <span :class="authStore.isTester ? 'yes' : 'no'">{{ authStore.isTester ? 'YES' : 'NO' }}</span></p>
</div>
<h3>Raw JSON State:</h3>
<pre>{{ authStoreJSON }}</pre>
</div>
<!-- Garage Store State -->
<div class="panel">
<h2>🚗 Garage Store State</h2>
<div class="state-info">
<p><span class="label">Vehicles Count:</span> {{ garageStore.vehicles ? garageStore.vehicles.length : 0 }}</p>
<p><span class="label">Loading:</span> {{ garageStore.loading ? 'YES' : 'NO' }}</p>
</div>
<h3>Raw JSON State:</h3>
<pre>{{ garageStoreJSON }}</pre>
</div>
</div>
<!-- LocalStorage Inspection -->
<div class="panel">
<h2>💾 LocalStorage Inspection</h2>
<div class="storage-grid">
<div class="storage-item">
<div class="storage-label">token</div>
<div class="storage-value">{{ localStorage.token ? `${localStorage.token.substring(0, 30)}...` : '(empty)' }}</div>
</div>
<div class="storage-item">
<div class="storage-label">user_email</div>
<div class="storage-value">{{ localStorage.user_email || '(empty)' }}</div>
</div>
<div class="storage-item">
<div class="storage-label">is_admin</div>
<div class="storage-value">{{ localStorage.is_admin || '(empty)' }}</div>
</div>
<div class="storage-item">
<div class="storage-label">user_role</div>
<div class="storage-value">{{ localStorage.user_role || '(empty)' }}</div>
</div>
</div>
<button @click="refreshLocalStorage">
🔄 Refresh LocalStorage
</button>
</div>
</div>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { useAuthStore } from '@/stores/authStore'
import { useGarageStore } from '@/stores/garageStore'
const authStore = useAuthStore()
const garageStore = useGarageStore()
const statusMessage = ref('Ready')
const localStorage = ref({})
// Computed properties for JSON display
const authStoreJSON = computed(() => {
return JSON.stringify({
token: authStore.token,
isLoggedIn: authStore.isLoggedIn,
isAdmin: authStore.isAdmin,
isTester: authStore.isTester,
userEmail: authStore.userEmail,
userRole: authStore.userRole,
userProfile: authStore.userProfile,
displayName: authStore.displayName,
activeOrgId: authStore.activeOrgId
}, null, 2)
})
const garageStoreJSON = computed(() => {
return JSON.stringify({
vehicles: garageStore.vehicles,
loading: garageStore.loading,
error: garageStore.error,
selectedVehicle: garageStore.selectedVehicle
}, null, 2)
})
// Functions
const triggerLogin = async () => {
statusMessage.value = 'Logging in with tester_pro@profibot.hu...'
try {
await authStore.login('tester_pro@profibot.hu', 'Password123!')
statusMessage.value = 'Login successful! Check auth store state.'
refreshLocalStorage()
} catch (error) {
statusMessage.value = `Login failed: ${error.message}`
console.error('Login error:', error)
}
}
const fetchUserProfile = async () => {
statusMessage.value = 'Fetching user profile...'
try {
await authStore.fetchUserProfile()
statusMessage.value = 'User profile fetched successfully!'
} catch (error) {
statusMessage.value = `Failed to fetch user profile: ${error.message}`
console.error('Fetch user profile error:', error)
}
}
const fetchVehicles = async () => {
statusMessage.value = 'Fetching vehicles...'
try {
await garageStore.fetchVehicles()
statusMessage.value = `Vehicles fetched successfully! Found ${garageStore.vehicles?.length || 0} vehicles.`
} catch (error) {
statusMessage.value = `Failed to fetch vehicles: ${error.message}`
console.error('Fetch vehicles error:', error)
}
}
const clearState = () => {
authStore.logout()
garageStore.$reset()
refreshLocalStorage()
statusMessage.value = 'All state cleared!'
}
const refreshLocalStorage = () => {
localStorage.value = {
token: window.localStorage.getItem('token') || '',
user_email: window.localStorage.getItem('user_email') || '',
is_admin: window.localStorage.getItem('is_admin') || '',
user_role: window.localStorage.getItem('user_role') || '',
refresh_token: window.localStorage.getItem('refresh_token') ? '***' : '',
ui_mode: window.localStorage.getItem('ui_mode') || '',
active_org_id: window.localStorage.getItem('active_org_id') || ''
}
}
// Lifecycle
onMounted(() => {
refreshLocalStorage()
statusMessage.value = 'Debug view loaded. Use buttons to test auth flow.'
})
</script>
<style scoped>
.debug-page {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
font-family: monospace;
background: white;
color: black;
}
h1 {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
color: #1e3a8a; /* sötétkék */
border-bottom: 2px solid #1e3a8a;
padding-bottom: 10px;
}
h2 {
font-size: 18px;
font-weight: bold;
margin: 15px 0 10px 0;
color: #1e3a8a; /* sötétkék */
}
h3 {
font-size: 16px;
font-weight: bold;
margin: 10px 0 5px 0;
color: #1e3a8a; /* sötétkék */
}
.credentials {
background: #f5f5f5;
border: 1px solid #ddd;
padding: 15px;
margin-bottom: 20px;
border-radius: 4px;
}
.credentials h2 {
margin-top: 0;
}
.note {
font-size: 14px;
color: #666;
margin-top: 10px;
}
.actions {
margin-bottom: 30px;
}
.button-group {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin: 15px 0;
}
button {
padding: 10px 15px;
background: #1e3a8a; /* sötétkék */
color: white;
border: 1px solid #1e3a8a;
border-radius: 4px;
cursor: pointer;
font-family: monospace;
font-size: 14px;
}
button:hover {
background: #1e40af; /* sötétkék - sötétebb */
}
button:disabled {
background: #ccc;
color: #666;
border-color: #ccc;
cursor: not-allowed;
}
.status {
background: #f0f0f0;
border: 1px solid #ddd;
padding: 10px;
margin-top: 15px;
border-radius: 4px;
}
.status p {
margin: 0;
color: #1e3a8a; /* sötétkék */
}
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 30px;
}
@media (max-width: 768px) {
.grid {
grid-template-columns: 1fr;
}
}
.panel {
border: 1px solid #ddd;
padding: 15px;
border-radius: 4px;
background: white;
}
.state-info {
margin-bottom: 15px;
}
.state-info p {
margin: 5px 0;
}
.label {
font-weight: bold;
color: #1e3a8a; /* sötétkék */
margin-right: 10px;
}
.yes {
color: #065f46; /* zöld */
font-weight: bold;
}
.no {
color: #991b1b; /* piros */
font-weight: bold;
}
pre {
background: #1e1e1e;
color: #f5f5f5;
padding: 15px;
border-radius: 4px;
overflow: auto;
max-height: 300px;
font-size: 12px;
line-height: 1.4;
border: 1px solid #333;
}
.storage-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 10px;
margin: 15px 0;
}
.storage-item {
border: 1px solid #ddd;
padding: 10px;
border-radius: 4px;
background: #f9f9f9;
}
.storage-label {
font-weight: bold;
font-size: 12px;
color: #1e3a8a; /* sötétkék */
margin-bottom: 5px;
}
.storage-value {
font-family: monospace;
font-size: 12px;
word-break: break-all;
color: black;
}
</style>

View File

@@ -1,36 +1,141 @@
<template>
<div class="max-w-md mx-auto mt-10 p-8 bg-white rounded-2xl shadow-xl">
<h2 class="text-2xl font-bold mb-6 text-center">Új Széf létrehozása</h2>
<form @submit.prevent="handleRegister" class="space-y-4">
<input v-model="form.first_name" type="text" placeholder="Keresztnév" required class="w-full p-3 border rounded-lg" />
<input v-model="form.last_name" type="text" placeholder="Vezetéknév" required class="w-full p-3 border rounded-lg" />
<input v-model="form.email" type="email" placeholder="E-mail" required class="w-full p-3 border rounded-lg" />
<input v-model="form.password" type="password" placeholder="Jelszó" required class="w-full p-3 border rounded-lg" />
<button class="w-full bg-green-600 text-white py-3 rounded-lg font-bold hover:bg-green-700 transition">Fiók létrehozása</button>
</form>
<p v-if="msg" class="mt-4 text-center font-medium text-green-600">{{ msg }}</p>
<!-- Registration Form (shown when not successful) -->
<div v-if="!success">
<form @submit.prevent="handleRegister" class="space-y-4">
<input v-model="form.first_name" type="text" placeholder="Keresztnév" required class="w-full p-3 border rounded-lg" />
<input v-model="form.last_name" type="text" placeholder="Vezetéknév" required class="w-full p-3 border rounded-lg" />
<input v-model="form.email" type="email" placeholder="E-mail" required class="w-full p-3 border rounded-lg" />
<input v-model="form.password" type="password" placeholder="Jelszó" required class="w-full p-3 border rounded-lg" />
<button
:disabled="loading"
class="w-full bg-green-600 text-white py-3 rounded-lg font-bold hover:bg-green-700 transition disabled:opacity-50 disabled:cursor-not-allowed"
>
<span v-if="loading">Feldolgozás...</span>
<span v-else>Fiók létrehozása</span>
</button>
</form>
<p v-if="msg && !success" :class="['mt-4 text-center font-medium', isError ? 'text-red-600' : 'text-green-600']">{{ msg }}</p>
</div>
<!-- Success Card (shown after successful registration) -->
<div v-else class="text-center">
<div class="mb-6">
<!-- Animated checkmark -->
<div class="relative inline-flex items-center justify-center w-24 h-24">
<div class="absolute inset-0 bg-green-100 rounded-full"></div>
<svg class="relative w-16 h-16 text-green-600 animate-checkmark" viewBox="0 0 52 52">
<circle class="stroke-current" cx="26" cy="26" r="25" fill="none" stroke-width="2"/>
<path class="stroke-current" fill="none" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
</svg>
</div>
</div>
<h3 class="text-xl font-bold text-gray-800 mb-3">Sikeres regisztráció!</h3>
<p class="text-gray-600 mb-6">
Elküldtünk egy megerősítő e-mailt a(z) <span class="font-semibold">{{ form.email }}</span> címre.
Kérjük, ellenőrizd a postaládádat és kattints a linkre a fiók aktiválásához.
</p>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6 text-left">
<div class="flex items-start">
<svg class="w-5 h-5 text-blue-500 mt-0.5 mr-3 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
</svg>
<div>
<p class="text-sm text-blue-800">
<strong>Fontos:</strong> A megerősítő e-mail néhány perc múlva érkezhet meg.
Ha nem találod, ellenőrizd a spam mappát is.
</p>
</div>
</div>
</div>
<button
@click="resetForm"
class="w-full bg-gray-200 text-gray-800 py-3 rounded-lg font-bold hover:bg-gray-300 transition"
>
Új regisztráció
</button>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import axios from 'axios'
import api from '@/services/api'
const form = ref({ email: '', password: '', first_name: '', last_name: '' })
const msg = ref('')
const isError = ref(false)
const loading = ref(false)
const success = ref(false)
const handleRegister = async () => {
msg.value = ""; // Üzenet alaphelyzetbe
isError.value = false
loading.value = true
try {
const res = await axios.post(`http://192.168.100.43:8000/api/v2/auth/register`, null, { params: form.value });
msg.value = "Sikeres regisztráció! Kérlek aktiváld az e-mailedet.";
const res = await api.post('/auth/register', form.value);
// Sikeres válasz: 201 Created
success.value = true
msg.value = `Verification email sent to ${form.value.email}!`;
isError.value = false
} catch (err) {
isError.value = true
success.value = false
// ITT A JAVÍTÁS: kiolvassuk a backend hibaüzenetét
if (err.response && err.response.data && err.response.data.detail) {
msg.value = "Hiba: " + err.response.data.detail;
} else {
msg.value = "Hiba történt a regisztráció során.";
}
} finally {
loading.value = false
}
}
</script>
const resetForm = () => {
success.value = false
form.value = { email: '', password: '', first_name: '', last_name: '' }
msg.value = ''
}
</script>
<style scoped>
@keyframes checkmark {
0% {
stroke-dashoffset: 100;
opacity: 0;
transform: scale(0.8);
}
50% {
opacity: 1;
transform: scale(1.1);
}
100% {
stroke-dashoffset: 0;
transform: scale(1);
}
}
.animate-checkmark circle {
stroke-dasharray: 166;
stroke-dashoffset: 166;
animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.animate-checkmark path {
stroke-dasharray: 48;
stroke-dashoffset: 48;
animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}
@keyframes stroke {
100% {
stroke-dashoffset: 0;
}
}
</style>