Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
afsakar committed Oct 7, 2024
1 parent 2a8eb1e commit 76c4670
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 68 deletions.
167 changes: 167 additions & 0 deletions resources/lang/en/form-maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,183 @@

'resources' => [
'builder' => [
'section_title' => 'Form Information',
'model_label' => 'Form Builder',
'plural_model_label' => 'Form Builders',
'inputs' => [
'name' => 'Name',
],
'options' => [
'title' => 'Form Settings',
'description' => 'More Form Settings',
'notification_name' => 'Notification Name',
'background_color' => 'Background Color',
'mail_notifications' => 'Mail Notifications',
'user_emails' => 'Notification Emails',
'user_emails_hint' => 'Select the users you want to send the form to after it is submitted.',
'static_fields' => [
'full_span' => 'Full Width',
'placeholder' => 'Placeholder',
'notification_name' => 'Notification Name',
'is_required' => 'Required Field',
'hidden_label' => 'Hidden Label',
'field_id' => 'Field ID',
'html_id' => 'HTML ID',
'column_span' => 'Column Width',
'helper_text' => 'Helper Text',
],
'notifications' => [
'label' => 'Successful Notification Settings',
'title' => 'Title',
'body' => 'Body',
],
'select_field' => [
'title' => 'Select Box Settings',
'is_multiple' => 'Multiple Selection',
'is_searchable' => 'Searchable',
'data_source' => 'Data Source',
],
'checkbox_radio_field' => [
'title' => 'Checkbox / Radio Button Settings',
'data_source' => 'Data Source',
'one_column' => 'One Column',
'two_columns' => 'Two Columns',
'three_columns' => 'Three Columns',
'four_columns' => 'Four Columns',
],
'text_field' => [
'title' => 'Text Field Settings',
'field_type' => 'Field Type',
'types' => [
'text' => 'Text',
'email' => 'Email',
'url' => 'URL',
'number' => 'Number',
],
'max_value' => 'Maximum Value',
'min_value' => 'Minimum Value',
],
'file_field' => [
'title' => 'File Field Settings',
'max_size' => 'Maximum File Size',
'hint' => 'In KB',
'accepted_file_types' => 'Accepted Extensions',
'image' => 'Image',
],
'visibility' => [
'title' => 'Conditional Visibility',
'active' => 'Conditional Visibility Active',
'fieldId' => 'Field to Bind Condition',
'values' => 'Visibility Value',
'values_helper_text' => 'Leave this field empty if you want it to be visible when any value is selected.',
],
],
'sections' => [
'title' => 'Sections',
'count' => 'Section Count',
'add_action_label' => 'Add Section',
'new_section_label' => 'New Section',
'inputs' => [
'title' => 'Title',
'columns' => 'Column Count',
'columns_hint' => 'Number of columns in the section',
],
],
'fields' => [
'title' => 'Fields',
'add_action_label' => 'Add Field',
'new_field_label' => 'New Field',
'options' => [
'title' => 'Field Settings',
'description' => 'More Field Settings',
],
'inputs' => [
'name' => 'Field Name',
'type' => 'Field Type',
],
],
],
'collections' => [
'model_label' => 'Form Collection',
'plural_model_label' => 'Form Collections',
'inputs' => [
'name' => 'Name',
'type' => 'Type',
'type_options' => [
'list' => 'List',
'model' => 'Model',
],
'values' => [
'title' => 'Values',
'label' => 'Label',
'value' => 'Value',
'add_value' => 'Add Value',
],
],
],
'form_data' => [
'model_label' => 'Form Data',
'plural_model_label' => 'Form Data',
'inputs' => [
'name' => 'Form Name',
'status' => 'Status',
'ip_address' => 'IP Address',
'user_agent' => 'Browser Info',
'file' => [
'label' => 'File',
'download' => 'Download File',
],
'created_at' => 'Created At',
'updated_at' => 'Updated At',
],
'section_title' => 'Form Information',
'actions' => [
'open' => [
'label' => 'Reopen',
'modal' => [
'title' => 'Reopen Form',
'body' => 'Are you sure you want to reopen the form?',
'success' => 'Form successfully reopened.',
],
],
'close' => [
'label' => 'Close',
'modal' => [
'title' => 'Close Form',
'body' => 'Are you sure you want to close the form?',
'success' => 'Form successfully closed.',
],
],
],
],
],

'notification' => [
'toast' => [
'title' => 'Operation Successful',
'body' => 'Your message has been sent. We will contact you as soon as possible.',
],
'mail' => [
'title' => 'New Notification - :form_name',
'greeting' => 'Hello!',
'view' => 'View',
],
],

'enums' => [
'field_types' => [
'text' => 'Text',
'phone' => 'Phone',
'textarea' => 'Text Area',
'select' => 'Select Box',
'file' => 'File',
'date' => 'Date',
'checkbox' => 'Checkbox',
'radio' => 'Radio Button',
],
'form_status' => [
'closed' => 'Closed',
'open' => 'Open',
],
],
];
83 changes: 81 additions & 2 deletions resources/lang/tr/form-maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
'notification_name' => 'Bildirim Adı',
'background_color' => 'Arka Plan Rengi',
'mail_notifications' => 'Mail Bildirimleri',
'user_emails' => 'Kullanıcı E-postaları',
'user_emails_hint' => 'Forum\'un doldurulduktan sonra iletilmesini istediğiniz kullanıcıları seçiniz.',
'user_emails' => 'Bildirim E-postaları',
'user_emails_hint' => 'Formun doldurulduktan sonra iletilmesini istediğiniz kullanıcıları seçiniz.',
'static_fields' => [
'full_span' => 'Tam Genişlik',
'placeholder' => 'Placeholder',
Expand All @@ -31,6 +31,11 @@
'column_span' => 'Sütun Genişliği',
'helper_text' => 'Yardımcı Metin',
],
'notifications' => [
'label' => 'Başarılı Bildirim Ayarları',
'title' => 'Başlık',
'body' => 'Metin',
],
'select_field' => [
'title' => 'Seçim Kutusu Ayarları',
'is_multiple' => 'Çoklu Seçim',
Expand Down Expand Up @@ -100,10 +105,84 @@
'collections' => [
'model_label' => 'Form Koleksiyonu',
'plural_model_label' => 'Form Koleksiyonları',
'inputs' => [
'name' => 'Adı',
'type' => 'Tipi',
'type_options' => [
'list' => 'Liste',
'model' => 'Model',
],
'values' => [
'title' => 'Değerler',
'label' => 'Etiket',
'value' => 'Değer',
'add_value' => 'Değer Ekle',
],
],
],
'form_data' => [
'model_label' => 'Form Verileri',
'plural_model_label' => 'Form Verileri',
'inputs' => [
'name' => 'Form Adı',
'status' => 'Durum',
'ip_address' => 'IP Adresi',
'user_agent' => 'Tarayıcı Bilgisi',
'file' => [
'label' => 'Dosya',
'download' => 'Dosyayı İndir',
],
'created_at' => 'Oluşturulma Tarihi',
'updated_at' => 'Güncellenme Tarihi',
],
'section_title' => 'Form Bilgileri',
'actions' => [
'open' => [
'label' => 'Yeniden Aç',
'modal' => [
'title' => 'Formu Yeniden Aç',
'body' => 'Formu yeniden açmak istediğinize emin misiniz?',
'success' => 'Form başarıyla yeniden açıldı.',
],
],
'close' => [
'label' => 'Kapat',
'modal' => [
'title' => 'Formu Kapat',
'body' => 'Formu kapatmak istediğinize emin misiniz?',
'success' => 'Form başarıyla kapatıldı.',
],
],
],
],
],

'notification' => [
'toast' => [
'title' => 'İşlem Başarılı',
'body' => 'Mesajınız gönderildi. En kısa sürede sizinle iletişime geçeceğiz.',
],
'mail' => [
'title' => 'Yeni Bildirim - :form_name',
'greeting' => 'Merhaba!',
'view' => 'Görüntüle',
],
],

'enums' => [
'field_types' => [
'text' => 'Metin',
'phone' => 'Telefon',
'textarea' => 'Metin Alanı',
'select' => 'Seçim Kutusu',
'file' => 'Dosya',
'date' => 'Tarih',
'checkbox' => 'Onay Kutusu',
'radio' => 'Seçim Düğmesi',
],
'form_status' => [
'closed' => 'Kapatıldı',
'open' => 'Açık',
],
],
];
16 changes: 8 additions & 8 deletions src/Enums/FieldTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ enum FieldTypes: string
public function label(): string
{
return match ($this) {
self::TEXT => 'Metin',
self::PHONE => 'Telefon',
self::TEXTAREA => 'Uzun Metin',
self::SELECT => 'Seçim Kutusu',
self::FILE => 'Dosya',
self::DATE => 'Tarih',
self::CHECKBOX => 'Onay Kutusu',
self::RADIO => 'Seçim Düğmesi',
self::TEXT => trans('filament-form-maker::form-maker.enums.field_types.text'),
self::PHONE => trans('filament-form-maker::form-maker.enums.field_types.phone'),
self::TEXTAREA => trans('filament-form-maker::form-maker.enums.field_types.textarea'),
self::SELECT => trans('filament-form-maker::form-maker.enums.field_types.select'),
self::FILE => trans('filament-form-maker::form-maker.enums.field_types.file'),
self::DATE => trans('filament-form-maker::form-maker.enums.field_types.date'),
self::CHECKBOX => trans('filament-form-maker::form-maker.enums.field_types.checkbox'),
self::RADIO => trans('filament-form-maker::form-maker.enums.field_types.radio'),
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/Enums/FormStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ enum FormStatus: string
public function label(): string
{
return match ($this) {
self::CLOSED => 'Kapatıldı',
self::OPEN => 'Açık',
self::CLOSED => trans('filament-form-maker::form-maker.enums.form_status.closed'),
self::OPEN => trans('filament-form-maker::form-maker.enums.form_status.open'),
};
}

Expand Down
1 change: 0 additions & 1 deletion src/Filament/Forms/FormPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ protected function setUp(): void
{
parent::setUp();

$this->native(false);
$this->searchable();
$this->preload();
$this->options(fn () => FormBuilder::pluck('name', 'id')->toArray());
Expand Down
24 changes: 12 additions & 12 deletions src/Filament/Resources/FormBuilderCollectionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ public static function form(Form $form): Form
Forms\Components\Section::make()
->schema([
Forms\Components\TextInput::make('name')
->label('Adı')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.name'))
->required(),
Forms\Components\ToggleButtons::make('type')
->label('Tipi')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.type'))
->live()
->inline()
->options([
'list' => 'Liste',
'model' => 'Model',
'list' => trans('filament-form-maker::form-maker.resources.collections.inputs.type_options.list'),
'model' => trans('filament-form-maker::form-maker.resources.collections.inputs.type_options.model'),
])
->default('list')
->required(),
Forms\Components\Select::make('model')
->label('Model')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.type_options.model'))
->visible(fn ($get) => $get('type') === 'model')
->native(false)
->preload()
Expand All @@ -76,16 +76,16 @@ public static function form(Form $form): Form
})
->required(),
Forms\Components\Repeater::make('values')
->label('Değerler')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.values.title'))
->visible(fn ($get) => $get('type') === 'list')
->addActionLabel('Değer Ekle')
->addActionLabel(trans('filament-form-maker::form-maker.resources.collections.inputs.values.add_value'))
->grid(3)
->schema([
Forms\Components\TextInput::make('label')
->label('Etiket')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.values.label'))
->required(),
Forms\Components\TextInput::make('value')
->label('Değer')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.values.value'))
->required(),
]),
]),
Expand All @@ -98,14 +98,14 @@ public static function table(Table $table): Table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->label('Adı'),
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.name')),
Tables\Columns\TextColumn::make('type')
->label('Tipi')
->label(trans('filament-form-maker::form-maker.resources.collections.inputs.type'))
->badge()
->color('info')
->formatStateUsing(function ($state, $record) {
return match ($state) {
default => 'Liste',
default => trans('filament-form-maker::form-maker.resources.collections.inputs.type'),
'model' => (new $record->model)->getClassName(),
};
}),
Expand Down
Loading

0 comments on commit 76c4670

Please sign in to comment.