From 0418bec22636c708cef40a4577262b3bcef34c5d Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 23 Jul 2026 22:28:30 +0700 Subject: [PATCH] feat: create onboarding page with multi-step form and validation --- app/assets/css/tailwind.css | 29 +- app/components/OnboardingForm.vue | 364 +++++++++++++++++++++ app/pages/onboarding/index.vue | 10 + docs/history/2026-07-23-onboarding-page.md | 69 ++++ 4 files changed, 471 insertions(+), 1 deletion(-) create mode 100644 app/components/OnboardingForm.vue create mode 100644 app/pages/onboarding/index.vue create mode 100644 docs/history/2026-07-23-onboarding-page.md diff --git a/app/assets/css/tailwind.css b/app/assets/css/tailwind.css index 9da903c..f72234e 100644 --- a/app/assets/css/tailwind.css +++ b/app/assets/css/tailwind.css @@ -1,4 +1,3 @@ - @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); @import "tailwindcss"; @@ -118,7 +117,35 @@ * { @apply border-border outline-ring/50; } + body { @apply bg-background text-foreground; } } + +* { + scrollbar-width: thin; + scrollbar-color: #c4c4c4 transparent; +} + +.dark * { + scrollbar-color: #444 transparent; +} + +*::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +*::-webkit-scrollbar-track { + background: transparent; +} + +*::-webkit-scrollbar-thumb { + background-color: #c4c4c4; + border-radius: 9999px; +} + +.dark *::-webkit-scrollbar-thumb { + background-color: #444; +} \ No newline at end of file diff --git a/app/components/OnboardingForm.vue b/app/components/OnboardingForm.vue new file mode 100644 index 0000000..dc91808 --- /dev/null +++ b/app/components/OnboardingForm.vue @@ -0,0 +1,364 @@ + + + diff --git a/app/pages/onboarding/index.vue b/app/pages/onboarding/index.vue new file mode 100644 index 0000000..7ebd016 --- /dev/null +++ b/app/pages/onboarding/index.vue @@ -0,0 +1,10 @@ + + + + + diff --git a/docs/history/2026-07-23-onboarding-page.md b/docs/history/2026-07-23-onboarding-page.md new file mode 100644 index 0000000..b491de0 --- /dev/null +++ b/docs/history/2026-07-23-onboarding-page.md @@ -0,0 +1,69 @@ +# Onboarding Page - Session 3 + +**Tanggal:** 2026-07-23 +**Status:** Selesai + +## Tujuan + +Membuat halaman onboarding pada `web2/app/components/OnboardingForm.vue` dengan referensi dari `web/app/pages/onboarding.vue`, mengadaptasi komponen Nuxt UI ke shadcn-vue. + +## Yang Dikerjakan + +### 1. Buat `app/pages/onboarding/index.vue` +- Page wrapper yang merender ``. + +### 2. Buat `app/components/OnboardingForm.vue` +- Multi-step form (3 langkah) dengan stepper UI. +- **Step 0 - Bisnis:** Pilih jenis bisnis (grid kartu dengan gambar). +- **Step 1 - Info:** Form nama bisnis, telepon, email, alamat. +- **Step 2 - Paket:** Pilih paket langganan (card pricing). +- Validasi per step menggunakan Zod. +- Submit handler: `POST /tenants` via `$fetch`. +- Toast notification (success/error/warning) via `vue-sonner`. +- Loading state pada tombol submit. +- Layout split-screen (55% form + 45% gambar dekoratif). +- Navigasi: tombol Kembali, Lanjut, Selesai. + +## File yang Dibuat + +| File | Aksi | +|------|------| +| `app/pages/onboarding/index.vue` | Dibuat | +| `app/components/OnboardingForm.vue` | Dibuat | + +## API yang Digunakan + +- `GET /v1/business-types?is_active=true` - Daftar jenis bisnis +- `GET /v1/plans` - Daftar paket langganan +- `POST /v1/tenants` - Buat bisnis baru + +## Adaptasi Nuxt UI → shadcn-vue + +| Nuxt UI (web) | shadcn-vue (web2) | +|---|---| +| `UButton` | `Button` | +| `UInput` | `Input` | +| `UFormField` | `Field` + `FieldLabel` | +| `UBadge` | `` styled | +| `UIcon` | `i-lucide-*` class | +| `useToast()` | `toast` dari `vue-sonner` | + +## Fields Form (Step 1) + +| Field | Type | Validasi | +|-------|------|----------| +| `name` | text | wajib, max 100 karakter | +| `phone` | text | optional, max 20 karakter | +| `email` | email | optional, format email, max 100 karakter | +| `address` | text | optional, max 255 karakter | + +## Error Handling + +- Field-level errors dari Zod validation +- Toast warning untuk validasi step +- Toast error untuk API errors +- Toast success untuk submit berhasil + +## Catatan + +- Route `/onboarding` memerlukan hard refresh atau restart dev server setelah pembuatan file baru.