AW: theCure

This commit is contained in:
2025-08-27 19:15:08 +02:00
commit 5eab37082c
32 changed files with 1188 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Admin / Apps</h2></template>
<p>Scaffold placeholder. Add CRUD UI for applications.</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Admin / Entity Fields</h2></template>
<p>Scaffold placeholder. Add fields to the selected entity.</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Admin / Entities</h2></template>
<p>Scaffold placeholder. List and manage entities here.</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Admin / Forms</h2></template>
<p>Scaffold placeholder. Manage form layouts (layout_json) here.</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Admin / Workflows</h2></template>
<p>Scaffold placeholder. Manage workflows (trigger_event, condition_json, action_json).</p>
</UCard>
</div>
</template>

16
frontend/pages/index.vue Normal file
View File

@@ -0,0 +1,16 @@
<template>
<div class="p-6">
<UCard>
<h1 class="text-2xl font-semibold">Codeless Platform</h1>
<p class="mt-2">Nuxt 4 + Nuxt UI starter running.</p>
<div class="mt-4 flex gap-3">
<UButton to="/admin/apps" color="primary" variant="solid">Admin Studio</UButton>
<UButton to="/runtime/tickets/list" variant="soft">Tickets (Demo)</UButton>
</div>
<p class="mt-4 text-xs text-gray-500">
Tip: set your backend base URL in localStorage:
<code>localStorage.setItem('API_BASE','http://localhost:8000')</code>
</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Edit Record</h2></template>
<p>Placeholder. Implement edit form honoring field update permissions.</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,8 @@
<template>
<div class="p-6">
<UCard>
<template #header><h2 class="text-xl font-semibold">Record View</h2></template>
<p>Placeholder. Implement detail view honoring field read permissions.</p>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,53 @@
<script setup lang="ts">
const entity = 'tickets'
const baseURL = process.client ? (localStorage.getItem('API_BASE') || 'http://localhost:8000') : ''
const items = ref<any[]>([])
const error = ref<string | null>(null)
const loading = ref(true)
onMounted(async () => {
try {
const res = await fetch(`${baseURL}/api/${entity}/records`)
if (!res.ok) throw new Error(await res.text())
items.value = await res.json()
} catch (e: any) {
error.value = e.message
} finally {
loading.value = false
}
})
</script>
<template>
<div class="p-6 space-y-4">
<UCard>
<template #header>
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold">Tickets</h2>
<div class="flex gap-2">
<UButton to="/runtime/tickets/new">New</UButton>
<UButton to="/">Home</UButton>
</div>
</div>
</template>
<div v-if="loading" class="py-8"><ULoading /></div>
<ul v-else class="space-y-2">
<li v-for="it in items" :key="it.id" class="p-3 border rounded">
<div class="flex justify-between items-center">
<div>
<strong>{{ it.title }}</strong>
<div class="text-sm text-gray-600">{{ it.status }}</div>
</div>
<div class="text-xs text-gray-500">{{ new Date(it.created_at).toLocaleString() }}</div>
</div>
</li>
</ul>
<template #footer>
<p v-if="error" class="text-red-600 text-sm">{{ error }}</p>
</template>
</UCard>
</div>
</template>

View File

@@ -0,0 +1,55 @@
<script setup lang="ts">
const entity = 'tickets'
const baseURL = process.client ? (localStorage.getItem('API_BASE') || 'http://localhost:8000') : ''
const loading = ref(false)
const error = ref<string | null>(null)
const formLayout = ref<{ sections: Array<{ title?: string; fields: string[] }> }>({
sections: [{ title: 'Ticket Info', fields: ['title', 'description', 'status'] }]
})
const fieldsMeta = ref<Record<string, any>>({
title: { label: 'Title', type: 'string', required: true },
description: { label: 'Description', type: 'textarea' },
status: { label: 'Status', type: 'select', options: [{ label: 'Open', value: 'open' }, { label: 'Closed', value: 'closed' }] }
})
async function handleSubmit(payload: Record<string, any>) {
try {
loading.value = true
const res = await fetch(`${baseURL}/api/${entity}/records`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
})
if (!res.ok) throw new Error(await res.text())
navigateTo(`/runtime/${entity}/list`)
} catch (e: any) {
error.value = e.message
} finally {
loading.value = false
}
}
</script>
<template>
<div class="p-6 space-y-4">
<UCard>
<template #header>
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold">New Ticket</h2>
<UButton variant="ghost" to="/runtime/tickets/list">Back to list</UButton>
</div>
</template>
<div v-if="loading" class="py-8"><ULoading /></div>
<div v-else>
<DynamicForm :layout="formLayout" :fields-meta="fieldsMeta" @submit="handleSubmit" />
</div>
<template #footer>
<p v-if="error" class="text-red-600 text-sm">{{ error }}</p>
<p class="text-xs text-gray-500">Set localStorage API_BASE to your backend URL if not localhost:8000</p>
</template>
</UCard>
</div>
</template>