feat: implement proposal management system including database schema, Filament resources, and client-facing preview views

This commit is contained in:
Ümit Tunç
2026-05-25 07:05:57 +03:00
parent 15ba98e14d
commit c5a33f4d18
14 changed files with 2226 additions and 0 deletions
@@ -0,0 +1,140 @@
<?php
namespace App\Filament\Admin\Resources\Proposals\Schemas;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class ProposalForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(3)
->schema([
// Sol kolon - Ana içerik (2 sütun genişliğinde)
Section::make(__('proposal.content_section'))
->schema([
TextInput::make('title')
->label(__('proposal.title_field'))
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(function (string $operation, $state, callable $set) {
if ($operation !== 'create') {
return;
}
$set('slug', \Str::slug($state));
}),
TextInput::make('slug')
->label(__('proposal.slug_field'))
->required()
->maxLength(255)
->unique(ignoreRecord: true)
->rules(['alpha_dash'])
->helperText(__('proposal.slug_helper')),
Textarea::make('content')
->label(__('proposal.content_field'))
->required()
->rows(18)
->extraInputAttributes(['style' => 'font-family: monospace; font-size: 0.9rem; line-height: 1.5;'])
->columnSpanFull(),
Textarea::make('client_feedback')
->label('Müşteri Geri Bildirimi / Revizyon Notu')
->rows(3)
->disabled()
->dehydrated(false)
->placeholder('Henüz geri bildirim bırakılmadı.')
->visible(fn ($record) => $record !== null && !empty($record->client_feedback))
->columnSpanFull(),
])
->columnSpan(2)
->collapsible(false),
// Sağ kolon - Durum, Fiyat, Müşteri ve Tasarım (1 sütun genişliğinde)
Section::make(__('proposal.settings_section'))
->schema([
Select::make('status')
->label(__('proposal.status_field'))
->options([
'draft' => __('proposal.status_draft'),
'sent' => __('proposal.status_sent'),
'accepted' => __('proposal.status_accepted'),
'rejected' => __('proposal.status_rejected'),
'revised' => __('proposal.status_revised'),
])
->default('draft')
->required()
->columnSpanFull(),
TextInput::make('client_name')
->label(__('proposal.client_name_field'))
->required()
->maxLength(255)
->columnSpanFull(),
TextInput::make('client_email')
->label(__('proposal.client_email_field'))
->email()
->maxLength(255)
->columnSpanFull(),
TextInput::make('total_price')
->label(__('proposal.total_price_field'))
->numeric()
->prefix(fn ($get) => match ($get('currency')) {
'USD' => '$',
'EUR' => '€',
default => '₺',
})
->columnSpan(2),
Select::make('currency')
->label(__('proposal.currency_field'))
->options([
'TRY' => 'TL (₺)',
'USD' => 'USD ($)',
'EUR' => 'EUR (€)',
])
->default('TRY')
->required()
->live()
->columnSpan(1),
DatePicker::make('valid_until')
->label(__('proposal.valid_until_field'))
->native(false)
->displayFormat('d.m.Y')
->columnSpanFull(),
Select::make('meta.accent_color')
->label(__('proposal.accent_color_field'))
->options([
'indigo' => 'Premium Indigo (Mor/Mavi)',
'emerald' => 'Emerald Medical (Zümrüt Yeşil)',
'cyberpunk' => 'Cyberpunk Neon (Pembe/Mavi)',
'coral' => 'Coral Corporate (Mercan Kırmızı)',
'amber' => 'Amber Executive (Kehribar/Altın)',
])
->default('indigo')
->columnSpanFull(),
Checkbox::make('meta.show_calculator')
->label(__('proposal.show_calculator_field'))
->default(true)
->columnSpanFull(),
])
->columns(3)
->columnSpan(1)
->collapsible(false),
]);
}
}