From f44f920b78f4bc84394e15503b2ae6891168747e Mon Sep 17 00:00:00 2001 From: Ashraf Monshi Date: Mon, 22 Aug 2022 11:05:15 +0300 Subject: [PATCH 1/2] sorting and icons --- src/Filament/Resources/CategoryResource.php | 10 +++++++++- .../CategoryResource/Pages/CreateCategory.php | 8 ++++++++ .../Resources/CategoryResource/Pages/EditCategory.php | 8 ++++++++ .../CategoryResource/Pages/ListCategories.php | 8 ++++++++ src/Filament/Resources/CollectionResource.php | 2 +- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Filament/Resources/CategoryResource.php b/src/Filament/Resources/CategoryResource.php index 7aa533c7..e3634664 100644 --- a/src/Filament/Resources/CategoryResource.php +++ b/src/Filament/Resources/CategoryResource.php @@ -15,13 +15,14 @@ use Filament\Tables\Columns\TextColumn; use Illuminate\Support\Str; use LaraZeus\Bolt\Filament\Resources\CategoryResource\Pages; +use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; use LaraZeus\Bolt\Models\Category; class CategoryResource extends Resource { protected static ?string $model = Category::class; protected static ?string $navigationIcon = 'heroicon-o-document-duplicate'; - protected static ?int $navigationSort = 1; + protected static ?int $navigationSort = 4; public static function form(Form $form): Form { @@ -90,4 +91,11 @@ protected static function getNavigationGroup(): ?string { return __('Bolt'); } + + public static function getWidgets(): array + { + return [ + BetaNote::class, + ]; + } } diff --git a/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php b/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php index 04b4654f..47474ed7 100644 --- a/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php +++ b/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php @@ -4,8 +4,16 @@ use Filament\Resources\Pages\CreateRecord; use LaraZeus\Bolt\Filament\Resources\CategoryResource; +use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; class CreateCategory extends CreateRecord { protected static string $resource = CategoryResource::class; + + protected function getHeaderWidgets(): array + { + return [ + BetaNote::class, + ]; + } } diff --git a/src/Filament/Resources/CategoryResource/Pages/EditCategory.php b/src/Filament/Resources/CategoryResource/Pages/EditCategory.php index d1530f17..942444f3 100644 --- a/src/Filament/Resources/CategoryResource/Pages/EditCategory.php +++ b/src/Filament/Resources/CategoryResource/Pages/EditCategory.php @@ -4,8 +4,16 @@ use Filament\Resources\Pages\EditRecord; use LaraZeus\Bolt\Filament\Resources\CategoryResource; +use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; class EditCategory extends EditRecord { protected static string $resource = CategoryResource::class; + + protected function getHeaderWidgets(): array + { + return [ + BetaNote::class, + ]; + } } diff --git a/src/Filament/Resources/CategoryResource/Pages/ListCategories.php b/src/Filament/Resources/CategoryResource/Pages/ListCategories.php index 6d93c684..a257e503 100644 --- a/src/Filament/Resources/CategoryResource/Pages/ListCategories.php +++ b/src/Filament/Resources/CategoryResource/Pages/ListCategories.php @@ -4,8 +4,16 @@ use Filament\Resources\Pages\ListRecords; use LaraZeus\Bolt\Filament\Resources\CategoryResource; +use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; class ListCategories extends ListRecords { protected static string $resource = CategoryResource::class; + + protected function getHeaderWidgets(): array + { + return [ + BetaNote::class, + ]; + } } diff --git a/src/Filament/Resources/CollectionResource.php b/src/Filament/Resources/CollectionResource.php index 40b05cce..de508dff 100644 --- a/src/Filament/Resources/CollectionResource.php +++ b/src/Filament/Resources/CollectionResource.php @@ -16,7 +16,7 @@ class CollectionResource extends Resource { protected static ?string $model = Collection::class; - protected static ?string $navigationIcon = 'clarity-list-line'; + protected static ?string $navigationIcon = 'clarity-tags-line'; protected static ?int $navigationSort = 3; protected static function getNavigationBadge(): ?string From 680aaa2c732a177132d7ab0796eeb1ac711b9f57 Mon Sep 17 00:00:00 2001 From: Ashraf Monshi Date: Mon, 22 Aug 2022 13:19:46 +0300 Subject: [PATCH 2/2] imporvments and add translation --- resources/lang/ar.json | 74 ++++++++++++++++++- .../components/fields-options.blade.php | 4 +- .../pages/browse-responses.blade.php | 4 +- .../views/forms/modals/options.blade.php | 39 +++++----- .../views/forms/modals/settings.blade.php | 18 ++--- resources/views/forms/modals/texts.blade.php | 19 +++-- src/Fields/Classes/DateTimePicker.php | 4 +- src/Fields/Classes/FileUpload.php | 2 +- src/Fields/Classes/Select.php | 4 +- src/Fields/Classes/TextInput.php | 2 +- src/Filament/Resources/CategoryResource.php | 58 +++++++++------ .../CategoryResource/Pages/CreateCategory.php | 19 ----- .../CategoryResource/Pages/EditCategory.php | 19 ----- .../CategoryResource/Pages/ListCategories.php | 12 ++- src/Filament/Resources/CollectionResource.php | 35 +++++---- src/Filament/Resources/FormResource.php | 56 +++++++------- src/Filament/Resources/ResponseResource.php | 8 +- 17 files changed, 213 insertions(+), 164 deletions(-) delete mode 100644 src/Filament/Resources/CategoryResource/Pages/CreateCategory.php delete mode 100644 src/Filament/Resources/CategoryResource/Pages/EditCategory.php diff --git a/resources/lang/ar.json b/resources/lang/ar.json index 122ced8e..859a51c1 100644 --- a/resources/lang/ar.json +++ b/resources/lang/ar.json @@ -50,5 +50,77 @@ "Question": "السؤال", "Answer": "الإجابة", "Clear": "مسح", - "Showing Search result of": "عرض نتائج البحث عن" + "Showing Search result of": "عرض نتائج البحث عن", + "Forms": "النماذج", + "Form": "نموذج", + "Form details": "تفاصيل النموذج", + "Name, slug, and other options": "الاسم، الرابط المختصر، والمزيد", + "Other Form Options": "خيارات متفرقة", + "Form Options": "خيارات النمودج", + "Category": "التصنيف", + "optional, organize your forms into categories": "اختياري، رتب النماذج الخاصة بك في تصنيفات", + "Select Category...": "اختر التصنيف", + "Form Dates": "تواريخ النموذج", + "optional, specify when the form will be active and receiving new entries": "اختياري، ادخل البريد الإلكتروني لارسال التنبيهات عند وجود ادخالات جديدة", + "Start Date": "تاريح البداية", + "End Date": "تاريخ النهاية", + "Emails Notifications": "تنبيهات البريد ال إلكتروني", + "separate emails with a comma": "افصل بين كل بريد واخر بفاصلة", + "optional, enter the emails you want to receive notification when ever you got a new entry": "اختياري، ادخل البريد الإلكتروني لارسال التنبيهات عند وجود ادخالات جديدة", + "emailOne , emailTwo": "emailOne , emailTwo", + "enter webHook URL": "رابط خارجي", + "Send the form data to a webHook.": "ارسال بيانات النموذج إلى رابط خارجي", + "Save": "حفظ", + "Is Active": "مفعل", + "Set Form Texts, like desc and details": "نصوص النموذج كالوصف والتفاصيل", + "Form Texts": "نصوص النموذج", + "Form Description": "وصف النموذج", + "Write a few details about the form.": "اكتب تفاصيل اضافية للنموذج", + "Confirmation Message": "رسالة التأكيد", + "optional, show a massage whenever any one submit a new entery": "اختياري، عرض رسالة بعد ارسال النموذج", + "form activation and access options": "خيارات عرض وتفعيل النموذج", + "Form Settings": "اعدادات النموذج", + "Activate the form": "تفعيل النموذج", + "require Login": "يتطلب تسجيل الدخول", + "User must be logged in or create an account before can submit a new entry": "اجبار المستخدمين على تسجيل الدخول قبل تعبئة النموذج", + "One Entry Per User": "ادخال واحد فقط لكل مستخدم", + "to check if the user already submitted an entry in this form": "يتم منع المستخدمين من اكمال النموذج عدة مرات", + "Sections To Pages": "عرض الاقسام كصفحات", + "instead of showing all section in one page, separate them in multiple pages with next and previous buttons": "عوضا عن عرض كافة الاقسام في صفحة واحدة هذا الخيار يعرض النموذج في صفحات منفضلة مع عرض التالي والسابق", + "Form Name": "عنوان النموذج", + "Form Slug": "الرابط المختصر", + "Form Order": "ترتيب النموذج", + "Ordering": "الترتيب", + "Section Name": "اسم القسم", + "Section Fields": "حقول القسم", + "Field Name": "اسم الحقل", + "Field Type": "نوع الحقل", + "Field Options": "خيارات الحقل", + "Add field": "اضف حقل", + "Add Section": "اضف قسم", + "Text Input": "حقل نصي", + "Select Menu": "قائمة منسدلة", + "File Upload": "رفع ملف", + "Date Time": "وقت وتاريخ", + "Date Type": "نوع التاريخ", + "Data Source": "مصدر الخيارات", + "Sections title": "الأقسام", + "Entries": "الإدخالات", + "view all entries": "عرض كافة الإدخالات", + "Open": "عرض النموذج", + "open form": "عرض النموذج", + "Collection": "قائمة", + "Collections": "قوائم البيانات", + "Response": "ادخال نموذج", + "Responses": "الإدخالات", + "Collections Name": "اسم القائمة", + "Collections Values": "القيم", + "Key": "المفتاح", + "what store in the form": "مايتم تخزينه في النموذج", + "Value": "القيمة", + "what the user will see": "مايتم عرضه للمستخدم", + "selected by default": "محدد بشكل افتراضي", + "Logo": "الصورة", + "Name": "الإسم", + "sections are here to group the fields, and you can display it as pages from the Form options. if you have one section, it wont show in the form": "الاقسام تساعدك على ترتيب الحقول وتجميعها ليسهل على المستخدم تعبئة النموذج، في حالة وجود قسم واحد فقط لن يتم اظهاره في النموذج" } diff --git a/resources/views/filament/resources/form-resource/components/fields-options.blade.php b/resources/views/filament/resources/form-resource/components/fields-options.blade.php index 117169f2..3ca7246d 100644 --- a/resources/views/filament/resources/form-resource/components/fields-options.blade.php +++ b/resources/views/filament/resources/form-resource/components/fields-options.blade.php @@ -11,11 +11,11 @@
- Form details + {{ __('Form details') }}

- Name, slug, and other options + {{ __('Name, slug, and other options') }}

diff --git a/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php b/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php index 356ca12a..2cfbc46f 100644 --- a/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php +++ b/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php @@ -30,8 +30,6 @@ @endif
@endforeach - - @foreach($row->fieldsResponses as $resp)
{{ $resp->field->name }}:{{ $resp->response ?? ''}} @@ -41,7 +39,7 @@
@empty
- + No responses found...
@endforelse diff --git a/resources/views/forms/modals/options.blade.php b/resources/views/forms/modals/options.blade.php index 6ea1a728..2fe3735d 100644 --- a/resources/views/forms/modals/options.blade.php +++ b/resources/views/forms/modals/options.blade.php @@ -1,6 +1,6 @@ - @@ -8,19 +8,18 @@

- Form Options + {{ __('Form Options') }}

- + - optional, - organize your forms into categories + {{ __('optional, organize your forms into categories') }} - + @foreach(\LaraZeus\Bolt\Models\Category::get() as $category) @endforeach @@ -28,44 +27,42 @@
-

Form Dates

+

{{ __('Form Dates') }}

- optional, - specify when the form will be active and receiving new entries + {{ __('optional, specify when the form will be active and receiving new entries') }}
- - + +
- - + +
- + - optional, - enter the emails you want to receive notification when ever you got a new entry + {{ __('optional, enter the emails you want to receive notification when ever you got a new entry') }} - + - + - Send the form data to a webHook, read more + {{ __('Send the form data to a webHook.') }} - +
- Save + {{ __('Save') }}
diff --git a/resources/views/forms/modals/settings.blade.php b/resources/views/forms/modals/settings.blade.php index ef2d9f28..6ea005e8 100644 --- a/resources/views/forms/modals/settings.blade.php +++ b/resources/views/forms/modals/settings.blade.php @@ -1,6 +1,6 @@ - @@ -8,25 +8,25 @@

- Form Settings + {{ __('Form Settings') }}

- + - + - User must be logged in or create an account before can submit a new entry + {{ __('User must be logged in or create an account before can submit a new entry') }}
- + to check if the user already submitted an entry in this form @@ -34,9 +34,9 @@
- + - instead of showing all section in one page, separate them in multiple pages with next and previous buttons + {{ __('instead of showing all section in one page, separate them in multiple pages with next and previous buttons') }} @@ -44,7 +44,7 @@ - Save + {{ __('Save') }} diff --git a/resources/views/forms/modals/texts.blade.php b/resources/views/forms/modals/texts.blade.php index b62980ea..6ebe9e99 100644 --- a/resources/views/forms/modals/texts.blade.php +++ b/resources/views/forms/modals/texts.blade.php @@ -1,6 +1,6 @@ - @@ -8,32 +8,31 @@

- Form Texts + {{ __('Form Texts') }}

- - + + - + - + - optional, - show a massage whenever any one submit a new entery + {{ __('optional, show a massage whenever any one submit a new entery') }} - +
- Save + {{ __('Save') }}
diff --git a/src/Fields/Classes/DateTimePicker.php b/src/Fields/Classes/DateTimePicker.php index 8ee6dcfd..5774f91c 100644 --- a/src/Fields/Classes/DateTimePicker.php +++ b/src/Fields/Classes/DateTimePicker.php @@ -13,7 +13,7 @@ public function __construct() { $this->definition = [ 'type' => 'DateTimePicker', - 'title' => 'Date Time', + 'title' => __('Date Time'), 'icon' => 'fa-calendar', 'settings_view' => 'date-time', 'order' => 6, @@ -23,7 +23,7 @@ public function __construct() public static function getOptions() { return [ - Select::make('options.dateType')->required()->options([ + Select::make('options.dateType')->label(__('Date Type'))->required()->options([ 'date'=>'date', 'datetime'=>'datetime', 'time'=>'time', diff --git a/src/Fields/Classes/FileUpload.php b/src/Fields/Classes/FileUpload.php index a0dfa060..2000b1c1 100644 --- a/src/Fields/Classes/FileUpload.php +++ b/src/Fields/Classes/FileUpload.php @@ -12,7 +12,7 @@ public function __construct() { $this->definition = [ 'type' => 'FileUpload', - 'title' => 'File Upload', + 'title' => __('File Upload'), 'icon' => 'fa-cloud-upload', 'settings_view' => 'file-upload', 'order' => 7, diff --git a/src/Fields/Classes/Select.php b/src/Fields/Classes/Select.php index b530648e..5fe0cf94 100644 --- a/src/Fields/Classes/Select.php +++ b/src/Fields/Classes/Select.php @@ -14,7 +14,7 @@ public function __construct() { $this->definition = [ 'type' => 'Select', - 'title' => 'Select Menu', + 'title' => __('Select Menu'), 'icon' => 'fa-check', 'settings_view' => 'list-values', 'order' => 3, @@ -24,7 +24,7 @@ public function __construct() public static function getOptions() { return [ - FilamentSelect::make('options.dataSource')->required()->options(Collection::pluck('name', 'id')), + FilamentSelect::make('options.dataSource')->required()->options(Collection::pluck('name', 'id'))->label(__('Data Source')), ]; } } diff --git a/src/Fields/Classes/TextInput.php b/src/Fields/Classes/TextInput.php index 2ac63957..01dd688b 100644 --- a/src/Fields/Classes/TextInput.php +++ b/src/Fields/Classes/TextInput.php @@ -12,7 +12,7 @@ public function __construct() { $this->definition = [ 'type' => 'TextInput', - 'title' => 'Text Input', + 'title' => __('Text Input'), 'icon' => 'fa-text-width', 'order' => 1, ]; diff --git a/src/Filament/Resources/CategoryResource.php b/src/Filament/Resources/CategoryResource.php index e3634664..d52b6eae 100644 --- a/src/Filament/Resources/CategoryResource.php +++ b/src/Filament/Resources/CategoryResource.php @@ -10,19 +10,32 @@ use Filament\Resources\Form; use Filament\Resources\Resource; use Filament\Resources\Table; +use Filament\Tables\Actions\DeleteAction; +use Filament\Tables\Actions\DeleteBulkAction; +use Filament\Tables\Actions\EditAction; use Filament\Tables\Columns\BooleanColumn; use Filament\Tables\Columns\ImageColumn; use Filament\Tables\Columns\TextColumn; use Illuminate\Support\Str; -use LaraZeus\Bolt\Filament\Resources\CategoryResource\Pages; -use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; +use LaraZeus\Bolt\Filament\Resources\CategoryResource\Pages\ListCategories; use LaraZeus\Bolt\Models\Category; class CategoryResource extends Resource { protected static ?string $model = Category::class; - protected static ?string $navigationIcon = 'heroicon-o-document-duplicate'; + protected static ?string $navigationIcon = 'clarity-tags-line'; protected static ?int $navigationSort = 4; + protected static ?string $recordTitleAttribute = 'name'; + + protected static function getNavigationBadge(): ?string + { + return (string) Category::query()->count(); + } + + public static function getGloballySearchableAttributes(): array + { + return ['name', 'slug']; + } public static function form(Form $form): Form { @@ -33,15 +46,16 @@ public static function form(Form $form): Form ->maxLength(255) ->reactive() ->label(__('name')) - ->afterStateUpdated(function (Closure $set, $state) { + ->afterStateUpdated(function (Closure $set, $state, $context) { + if ($context === 'edit') { + return; + } $set('slug', Str::slug($state)); }), - TextInput::make('slug')->required()->maxLength(255)->label(__('slug')), TextInput::make('ordering')->required()->numeric()->label(__('ordering')), Toggle::make('is_active')->label(__('is_active')), - Textarea::make('desc')->maxLength(65535)->columnSpan(['sm' => 2])->label(__('desc')), - + Textarea::make('desc')->maxLength(65535)->columnSpan(['sm' => 2])->label(__('Description')), FileUpload::make('logo') ->disk(config('zeus-bolt.uploads.disk', 'public')) ->directory(config('zeus-bolt.uploads.dir', 'logos')) @@ -54,21 +68,26 @@ public static function table(Table $table): Table { return $table ->columns([ - TextColumn::make('name')->label(__('name'))->sortable()->searchable(), - TextColumn::make('desc')->label(__('desc')), - TextColumn::make('ordering')->sortable()->label(__('ordering')), - BooleanColumn::make('is_active')->sortable()->label(__('is_active')), - ImageColumn::make('logo')->disk(config('zeus-bolt.uploads.disk', 'public'))->label(__('logo')), + TextColumn::make('name')->label(__('Name'))->sortable()->searchable(), + TextColumn::make('desc')->label(__('Description')), + TextColumn::make('ordering')->sortable()->label(__('Ordering')), + BooleanColumn::make('is_active')->sortable()->label(__('Is Active')), + ImageColumn::make('logo')->disk(config('zeus-bolt.uploads.disk', 'public'))->label(__('Logo')), ]) - ->defaultSort('id', 'desc'); + ->defaultSort('id', 'desc') + ->actions([ + EditAction::make(), + DeleteAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); } public static function getPages(): array { return [ - 'index' => Pages\ListCategories::route('/'), - 'create' => Pages\CreateCategory::route('/create'), - 'edit' => Pages\EditCategory::route('/{record}/edit'), + 'index' => ListCategories::route('/'), ]; } @@ -91,11 +110,4 @@ protected static function getNavigationGroup(): ?string { return __('Bolt'); } - - public static function getWidgets(): array - { - return [ - BetaNote::class, - ]; - } } diff --git a/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php b/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php deleted file mode 100644 index 47474ed7..00000000 --- a/src/Filament/Resources/CategoryResource/Pages/CreateCategory.php +++ /dev/null @@ -1,19 +0,0 @@ -schema([ TextInput::make('name')->label(__('Collections Name'))->required()->maxLength(255)->columnSpan(2), - Forms\Components\Repeater::make('values') + Repeater::make('values') + ->grid([ + 'default' => 1, + 'md' => 2, + 'lg' => 3, + ]) ->label(__('Collections Values')) ->schema([ - TextInput::make('itemKey')->required()->label(__('Key')), - TextInput::make('itemValue')->required()->label(__('Value')), + TextInput::make('itemKey')->required()->label(__('Key'))->hint(__('what store in the form')), + TextInput::make('itemValue')->required()->label(__('Value'))->hint(__('what the user will see')), Toggle::make('itemIsDefault')->label(__('selected by default')), - ])->columnSpan(2)->columns(3), + ])->columnSpan(2)->columns(1), ]); } @@ -63,8 +73,8 @@ public static function table(Table $table): Table { return $table ->columns([ - Tables\Columns\TextColumn::make('name')->label(__('Name')), - Tables\Columns\TextColumn::make('values-list')->html()->label(__('Values')), + Tables\Columns\TextColumn::make('name')->label(__('Collections Name'))->searchable(), + Tables\Columns\TextColumn::make('values-list')->html()->label(__('Collections Values'))->searchable(['values']), ]); } @@ -76,11 +86,4 @@ public static function getPages(): array 'edit' => Pages\EditCollection::route('/{record}/edit'), ]; } - - public static function getWidgets(): array - { - return [ - BetaNote::class, - ]; - } } diff --git a/src/Filament/Resources/FormResource.php b/src/Filament/Resources/FormResource.php index b717c9a8..ff02ba41 100644 --- a/src/Filament/Resources/FormResource.php +++ b/src/Filament/Resources/FormResource.php @@ -28,6 +28,12 @@ class FormResource extends Resource protected static ?string $model = ZeusForm::class; protected static ?string $navigationIcon = 'clarity-form-line'; protected static ?int $navigationSort = 1; + protected static ?string $recordTitleAttribute = 'name'; + + public static function getGloballySearchableAttributes(): array + { + return ['name','slug']; + } protected static function getNavigationBadge(): ?string { @@ -62,6 +68,7 @@ public static function form(Form $form): Form ->schema([ ViewField::make('')->view('zeus-bolt::filament.resources.form-resource.components.fields-options')->columnSpan(5), TextInput::make('name')->required()->maxLength(255)->columnSpan(2)->reactive() + ->label(__('Form Name')) ->afterStateUpdated(function (\Closure $set, $state, $context) { if ($context === 'edit') { return; @@ -69,29 +76,29 @@ public static function form(Form $form): Form $set('slug', Str::slug($state)); }), - TextInput::make('slug')->required()->maxLength(255)->columnSpan(2)->rules(['alpha_dash'])->unique(ignoreRecord: true), - TextInput::make('ordering')->required()->columnSpan(1), + TextInput::make('slug')->required()->maxLength(255)->columnSpan(2)->rules(['alpha_dash'])->unique(ignoreRecord: true)->label(__('Form Slug')), + TextInput::make('ordering')->required()->columnSpan(1)->label(__('Form Order')), ])->columns(5), - Hidden::make('user_id')->required()->default(auth()->user()->id), - Hidden::make('layout')->default(1), + Hidden::make('user_id')->required()->default(auth()->user()->id), //todo + Hidden::make('layout')->default(1), //todo Card::make() ->schema([ - Placeholder::make('Sections-title')->helperText('sections are here to group the fields, and you can display it as pages from the Form options. if you have one section, it wont show in the form'), + Placeholder::make('Sections-title')->label(__('Sections title'))->helperText(__('sections are here to group the fields, and you can display it as pages from the Form options. if you have one section, it wont show in the form')), ]), Repeater::make('sections') ->label('') ->schema([ - TextInput::make('name')->required()->lazy(), - Placeholder::make('Fields'), + TextInput::make('name')->required()->lazy()->label(__('Section Name')), + Placeholder::make('Fields')->label(__('Section Fields')), Repeater::make('fields') ->schema([ - TextInput::make('name')->required()->lazy(), - Select::make('type')->required()->options(Bolt::availableFields()->pluck('title', 'type'))->reactive()->default('Select'), + TextInput::make('name')->required()->lazy()->label(__('Field Name')), + Select::make('type')->required()->options(Bolt::availableFields()->pluck('title', 'type'))->reactive()->default('Select')->label(__('Field Type')), Fieldset::make('Options') - ->label('Options') + ->label(__('Field Options')) ->schema(function (\Closure $get) { $classNmae = '\LaraZeus\Bolt\Fields\Classes\\'.$get('type') ?? 'TextInput'; @@ -109,11 +116,11 @@ public static function form(Form $form): Form ]) ->label('') ->itemLabel(fn (array $state): ?string => $state['name'] ?? null) - ->createItemButtonLabel('Add field'), + ->createItemButtonLabel(__('Add field')), ]) ->relationship() ->orderable('ordering') - ->createItemButtonLabel('Add Section') + ->createItemButtonLabel(__('Add Section')) ->cloneable() ->collapsible() ->itemLabel(fn (array $state): ?string => $state['name'] ?? null) @@ -125,27 +132,24 @@ public static function table(Table $table): Table { return $table ->columns([ - TextColumn::make('name'), - TextColumn::make('category.name'), - TextColumn::make('ordering'), - BooleanColumn::make('is_active'), - TextColumn::make('start_date')->dateTime(), - TextColumn::make('end_date')->dateTime(), + TextColumn::make('name')->searchable()->sortable()->label(__('Form Name')), + TextColumn::make('category.name')->label(__('Category'))->sortable(), + TextColumn::make('ordering')->label(__('Ordering'))->sortable(), + BooleanColumn::make('is_active')->label(__('Is Active'))->sortable(), + TextColumn::make('start_date')->dateTime()->searchable()->sortable()->label(__('Start Date')), + TextColumn::make('end_date')->dateTime()->searchable()->sortable()->label(__('End Date')), ]) ->appendActions([ - /*Action::make('edit-zeus') - ->icon('heroicon-o-pencil') - ->tooltip('edit Form') - ->url(fn(ZeusForm $record) : string => route('admin.form.edit', $record->id)),*/ - Action::make('entries') - ->icon('heroicon-o-external-link') - ->tooltip('View All Entries') + ->label(__('Entries')) + ->icon('clarity-data-cluster-line') + ->tooltip(__('view all entries')) ->url(fn (ZeusForm $record): string => url('admin/responses?form_id='.$record->id)), Action::make('open') + ->label(__('Open')) ->icon('heroicon-o-external-link') - ->tooltip('Show the Form') + ->tooltip(__('open form')) ->url(fn (ZeusForm $record): string => route('bolt.user.form.show', $record)) ->openUrlInNewTab(), ]); diff --git a/src/Filament/Resources/ResponseResource.php b/src/Filament/Resources/ResponseResource.php index 282eb9a3..fa6b0ea2 100644 --- a/src/Filament/Resources/ResponseResource.php +++ b/src/Filament/Resources/ResponseResource.php @@ -16,7 +16,7 @@ class ResponseResource extends Resource { protected static ?string $model = Response::class; - protected static ?string $navigationIcon = 'heroicon-o-collection'; + protected static ?string $navigationIcon = 'clarity-data-cluster-line'; protected static ?int $navigationSort = 2; protected static function getNavigationBadge(): ?string @@ -85,10 +85,4 @@ public static function getPages(): array ]; } - public static function getWidgets(): array - { - return [ - BetaNote::class, - ]; - } }