diff --git a/proyek-frontend/app/components/template-page/CategorySelection.vue b/proyek-frontend/app/components/template-page/CategorySelection.vue index b142f4a..9d7dcbd 100644 --- a/proyek-frontend/app/components/template-page/CategorySelection.vue +++ b/proyek-frontend/app/components/template-page/CategorySelection.vue @@ -29,38 +29,28 @@ Gagal memuat kategori. - -
-
- -
-
-

- {{ category.nama }} -

-

- {{ category.deskripsi }} -

+ +
+
+ +
+
+

+ {{ category.nama }} +

+

+ {{ category.deskripsi }} +

+
+
-
-
-
- Belum ada kategori. -
+
+ Belum ada kategori. +
@@ -127,12 +117,11 @@
- - Order @@ -263,7 +252,7 @@ const templatesWithFeatures = computed(() => kategori: t.kategori, paket: paketData[index % paketData.length].paket, fiturs: paketData[index % paketData.length].fiturs.map((f, i) => ({ id: i + 1, deskripsi: f })), - formPath: formMapping[t.nama_template] || `/form/lainny` // 🔥 ambil path form sesuai mapping + formPath: t.slug })) ) diff --git a/proyek-frontend/app/components/template-page/TemplateGrid.vue b/proyek-frontend/app/components/template-page/TemplateGrid.vue index 6a95b0c..b300adc 100644 --- a/proyek-frontend/app/components/template-page/TemplateGrid.vue +++ b/proyek-frontend/app/components/template-page/TemplateGrid.vue @@ -75,14 +75,16 @@
- - Preview - - Order +

Path: {{ `/form/${tpl.kategori?.nama}/${tpl.slug}` }}

+ +
+ +
@@ -169,24 +171,26 @@ const fetchTemplates = async (categoryId) => { }) templates.value = res.map(tpl => { - // Pastikan nama paket konsisten: 'Starter', 'Basic', 'Premium' - const paketKey = tpl.paket ? tpl.paket.charAt(0).toUpperCase() + tpl.paket.slice(1).toLowerCase() : 'Starter' + const paketKey = tpl.paket + ? tpl.paket.charAt(0).toUpperCase() + tpl.paket.slice(1).toLowerCase() + : 'Starter' + + return { + id: tpl.id, + nama_template: tpl.nama_template, + slug: tpl.slug, + harga: tpl.harga, + kategori: tpl.kategori, // pastikan kategori berisi object { nama_kategori } + foto: tpl.foto ?? '/logo2.png', + paket: paketKey, + fiturs: (fiturPerPaket[paketKey] || []).map((f, i) => ({ + id: i + 1, + deskripsi: f + })), + preview_link: tpl.preview_link ?? null + } +}) - return { - id: tpl.id, - nama_template: tpl.nama_template, - harga: tpl.harga, - kategori: tpl.kategori, - foto: tpl.foto ?? '/logo2.png', - paket: paketKey, - fiturs: (fiturPerPaket[paketKey] || []).map((f, i) => ({ - id: i + 1, - deskripsi: f - })), - preview_link: tpl.preview_link ?? null, - formPath: formMapping[tpl.nama_template] || '/form/lainny' - } - }) } catch (err) { console.error(err) error.value = 'Gagal memuat template.' @@ -202,6 +206,8 @@ onMounted(() => fetchTemplates(props.id_category)) watch(() => props.id_category, (newId) => { if (newId) fetchTemplates(newId) }) + +