🎨 Widget FILE Sistemi Analiz & Planlama

📅 Tarih: 2025-12-04 | 🎯 Tenant: ixtif.com | 👨‍💻 Analiz: Widget Sistem Mimarisi

📋 Analiz Özeti

Widget Management sisteminde FILE type widget'lar için şema sisteminin eksik olduğu tespit edildi. Mevcut widget'lar statik HTML içeriyor, ayarlanabilir değil. Hero ve Form Builder widget'ları için dinamik şema sistemi kurulacak.

🏗️ Mevcut Sistem Mimarisi

1. Widget Tipleri

Tip Açıklama Veri Kaynağı Örnek
MODULE Backend modüllerden veri çeker Database (Blog, Product vb.) Blog Listesi, Ürün Kartları
FILE Blade view dosyasından render Static view dosyası Hero, Contact Form, Layout'lar
CUSTOM Kullanıcı tanımlı HTML/CSS/JS Widget içinde saklanan kod Özel banner, embed kod

2. FILE Widget Sistemi Nasıl Çalışıyor?

Adım 1: Widget Tanımı (Database)

id: 69
name: "Hero - Ana Banner"
type: "file"
file_path: "hero.ixtif-hero.view"
has_items: 1
settings_schema: NULL ← SORUN!
item_schema: NULL ← SORUN!

Adım 2: View Dosyası

📁 Modules/WidgetManagement/resources/views/blocks/
    hero/
        ixtif-hero/
            view.blade.php ← Render edilen dosya
            settings.json ← YOK! (Olmalı)
            items.json ← YOK! (Olmalı)

Adım 3: Render İşlemi (WidgetService.php)

  1. file_path parse edilir → "hero.ixtif-hero.view"
  2. Blade view bulunur → blocks/hero/ixtif-hero/view.blade.php
  3. Settings ve Items verileri ile render edilir
  4. HTML output döner

🚨 Tespit Edilen Problemler

Problem 1: Statik Widget'lar

Durum: Mevcut FILE widget'ları sadece hardcoded HTML içeriyor.

<!-- Mevcut: contact-form/view.blade.php -->
<form>
    <input type="text" placeholder="Adınız"> ← Sabit değer!
    <input type="email" placeholder="Email"> ← Değiştirilemez!
</form>

Sonuç: Tenant'lar widget'ı özelleştiremez. Form alanlarını değiştiremez.

Problem 2: Schema Sisteminin Eksikliği

Durum: settings.json ve items.json dosyaları YOK.

Sonuç:

Problem 3: Hero Widget Yarım Kaldı

Durum: ixtif-hero widget'ı has_items=1 ama item_schema tanımlı değil.

Sonuç: Items eklenemiyor, sadece settings kullanılabiliyor.

✅ Çözüm Planı

Hedef

FILE type widget'ları için tam dinamik schema sistemi kurmak:

  1. settings.json → Widget ayarları (renkler, başlıklar, buttonlar)
  2. items.json → Dinamik içerik elemanları (slider items, form fields)
  3. Form Builder entegrasyonu → Admin panelden drag&drop ile düzenleme

📐 İmplementasyon Planı

Faz 1: Hero Widget Tamamlama (Öncelik: YÜKSEK)

1.1. Hero Settings Schema (settings.json)

Dosya: blocks/hero/ixtif-hero/settings.json

İçerik: Başlık, alt başlık, buton metni, renkler, arka plan

{
  "title_line1": { "type": "text", "label": "Ana Başlık (1. Satır)" },
  "title_line2": { "type": "text", "label": "Ana Başlık (2. Satır)" },
  "description": { "type": "textarea", "label": "Açıklama" },
  "cta_text": { "type": "text", "label": "Buton Metni" },
  "cta_url": { "type": "text", "label": "Buton URL" },
  "cta_icon": { "type": "text", "label": "Buton İkon (FontAwesome)" },
  "hero_image": { "type": "media", "label": "Hero Görseli" }
}

1.2. Hero Items Schema (items.json)

Dosya: blocks/hero/ixtif-hero/items.json

İçerik: Feature listesi (ikonlu özellik kartları)

{
  "title": { "type": "text", "label": "Özellik Başlığı", "required": true },
  "content": {
    "subtitle": { "type": "text", "label": "Alt Başlık" },
    "icon": { "type": "text", "label": "İkon (FontAwesome)" }
  }
}

1.3. View Template Güncellemesi

Dosya: blocks/hero/ixtif-hero/view.blade.php

Değişiklik: Hardcoded değerler → $settings ve $items kullanımı

Durum: Zaten yapıldı! (View dosyası hazır)

1.4. Database Güncelleme

İşlem: Widget #69'un settings_schema ve item_schema'sını doldur

UPDATE widgets SET
  settings_schema = /* settings.json içeriği */,
  item_schema = /* items.json içeriği */
WHERE id = 69;

Faz 2: Contact Form Widget (Öncelik: ORTA)

2.1. Contact Form Settings Schema

Amaç: Form başlığı, açıklama, başarı mesajı ayarlanabilir olacak

{
  "form_title": { "type": "text", "label": "Form Başlığı" },
  "form_description": { "type": "textarea", "label": "Açıklama" },
  "submit_text": { "type": "text", "label": "Gönder Butonu Metni" },
  "success_message": { "type": "text", "label": "Başarı Mesajı" },
  "notification_email": { "type": "email", "label": "Bildirim Email" }
}

2.2. Contact Form Items Schema (Form Builder!)

Amaç: Form alanları dinamik olarak eklenebilecek

{
  "field_type": { "type": "select", "options": ["text", "email", "tel", "textarea"] },
  "field_label": { "type": "text", "label": "Alan Etiketi" },
  "field_name": { "type": "text", "label": "Alan Adı (name)" },
  "field_placeholder": { "type": "text", "label": "Placeholder" },
  "field_required": { "type": "checkbox", "label": "Zorunlu Alan?" }
}

2.3. Backend Form Handling

Gerekli: Form submit işlemi için Livewire component

Özellikler:

Faz 3: Form Builder UI Tamamlama (Öncelik: DÜŞÜK)

3.1. Drag & Drop Form Builder

Durum: Mevcut Form Builder component var ama eksik

Yapılacaklar:

3.2. Schema Preview

Özellik: Oluşturulan form'un canlı önizlemesi

Teknoloji: Alpine.js + Livewire

🎯 Öncelik Sıralaması

Sıra İşlem Widget Süre Etki
1 Hero settings.json + items.json ixtif-hero 2-3 saat Ana banner özelleştirilebilir
2 Hero DB güncelleme + test ixtif-hero 1 saat Hero widget tamamlanır
3 Contact Form schema'ları contact-form 3-4 saat Form özelleştirilebilir
4 Form submit backend contact-form 4-5 saat Form çalışır hale gelir
5 Form Builder UI Genel 1-2 gün Admin panelden form oluşturma

💡 Öneriler

Başlangıç için

İleri Adımlar

📝 Sonuç

Widget FILE sistemi büyük potansiyele sahip ama şu anda yarım kalmış durumda. Schema sistemi tamamlandığında:

İlk adım: Hero widget için settings.json ve items.json oluştur!

🤖 Claude AI - Widget Sistem Analizi - 2025-12-04