diff --git a/composer.json b/composer.json index 46f8037d..5b8e49ee 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "flowframe/laravel-trend": "^0.2", "guava/filament-icon-picker": "^2.0", "lara-zeus/accordion": "^1.1", - "lara-zeus/core": "^3.1", + "lara-zeus/core": "^4.0", "lara-zeus/list-group": "^1.0", "ryangjchandler/blade-tabler-icons": "^2.3" }, diff --git a/composer.lock b/composer.lock index 42463f0e..783ef566 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fb4441a09246d5eefbbe0d5c715e9640", + "content-hash": "d5fee087e8d6d86199990b4cb701128b", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -8078,30 +8078,38 @@ }, { "name": "composer/pcre", - "version": "3.1.4", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "04229f163664973f68f38f6f73d917799168ef24" + "reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", - "reference": "04229f163664973f68f38f6f73d917799168ef24", + "url": "https://api.github.com/repos/composer/pcre/zipball/ea4ab6f9580a4fd221e0418f2c357cdd39102a90", + "reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.8" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.8", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -8129,7 +8137,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.4" + "source": "https://github.com/composer/pcre/tree/3.2.0" }, "funding": [ { @@ -8145,7 +8153,7 @@ "type": "tidelift" } ], - "time": "2024-05-27T13:40:54+00:00" + "time": "2024-07-25T09:36:02+00:00" }, { "name": "composer/semver", @@ -8616,16 +8624,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.3", + "version": "v3.60.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" + "reference": "e595e4e070d17c5d42ed8c4206f630fcc5f401a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e595e4e070d17c5d42ed8c4206f630fcc5f401a4", + "reference": "e595e4e070d17c5d42ed8c4206f630fcc5f401a4", "shasum": "" }, "require": { @@ -8707,7 +8715,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.60.0" }, "funding": [ { @@ -8715,7 +8723,7 @@ "type": "github" } ], - "time": "2024-06-16T14:17:03+00:00" + "time": "2024-07-25T09:26:51+00:00" }, { "name": "guzzlehttp/psr7", @@ -12278,16 +12286,16 @@ }, { "name": "rector/rector", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "b38a3eed3ce2046f40c001255e2fec9d2746bacf" + "reference": "044e6364017882d1e346da8690eeabc154da5495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/b38a3eed3ce2046f40c001255e2fec9d2746bacf", - "reference": "b38a3eed3ce2046f40c001255e2fec9d2746bacf", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/044e6364017882d1e346da8690eeabc154da5495", + "reference": "044e6364017882d1e346da8690eeabc154da5495", "shasum": "" }, "require": { @@ -12325,7 +12333,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.1" + "source": "https://github.com/rectorphp/rector/tree/1.2.2" }, "funding": [ { @@ -12333,7 +12341,7 @@ "type": "github" } ], - "time": "2024-07-16T00:22:54+00:00" + "time": "2024-07-25T07:44:34+00:00" }, { "name": "sebastian/cli-parser", diff --git a/resources/lang/en/category.php b/resources/lang/en/category.php new file mode 100644 index 00000000..d0b9e630 --- /dev/null +++ b/resources/lang/en/category.php @@ -0,0 +1,14 @@ + 'Category', + 'plural_label' => 'Categories', + 'navigation_label' => 'Categories', + 'name' => 'Name', + 'slug' => 'Slug', + 'ordering' => 'Ordering', + 'is_active' => 'Is Active', + 'not_active' => 'Not Active', + 'description' => 'Description', + 'logo' => 'Logo', + 'Forms' => 'forms', +]; \ No newline at end of file diff --git a/resources/lang/en/collection.php b/resources/lang/en/collection.php new file mode 100644 index 00000000..1bc2f47a --- /dev/null +++ b/resources/lang/en/collection.php @@ -0,0 +1,12 @@ + 'Collection', + 'plural_label' => 'Collections', + 'navigation_label' => 'Collections', + 'name' => 'Collections Name', + 'values' => 'Collections Values', + 'value' => 'Value', + 'key' => 'what the user will see', + 'key_help' => 'what store in the form', + 'default' => 'selected by default', +]; \ No newline at end of file diff --git a/resources/lang/en/fields_types.php b/resources/lang/en/fields_types.php new file mode 100644 index 00000000..b67b5447 --- /dev/null +++ b/resources/lang/en/fields_types.php @@ -0,0 +1,55 @@ + [ + 'title' => 'Checkbox List', + 'description' => 'checkbox items from data source', + ], + 'color_picker' => [ + 'title' => 'Color Picker', + 'description' => 'pick a color with rgb, rgba or hsl', + ], + 'date_picker' => [ + 'title' => 'Date Picker', + 'description' => 'full date picker', + ], + 'date_time_picker' => [ + 'title' => 'Date Time Picker', + 'description' => 'full date and time picker', + ], + 'file_upload' => [ + 'title' => 'File Upload', + 'description' => 'single or multiple file uploader', + ], + 'paragraph' => [ + 'title' => 'Paragraph', + 'description' => 'display a paragraph in your form', + ], + 'radio' => [ + 'title' => 'Radio', + 'description' => 'single choice from a datasource', + ], + 'rich_editor' => [ + 'title' => 'Rich Editor', + 'description' => 'Text editor with styling', + ], + 'select' => [ + 'title' => 'Select Menu', + 'description' => 'select single or multiple items from a dropdown list', + ], + 'textarea' => [ + 'title' => 'Textarea', + 'description' => 'multi line textarea', + ], + 'text_input' => [ + 'title' => 'Text Input', + 'description' => 'text input', + ], + 'time_picker' => [ + 'title' => 'Time Picker', + 'description' => 'time picker', + ], + 'toggle' => [ + 'title' => 'Toggle', + 'description' => 'toggle', + ], +]; \ No newline at end of file diff --git a/resources/lang/en/forms.php b/resources/lang/en/forms.php new file mode 100644 index 00000000..39a8f7d2 --- /dev/null +++ b/resources/lang/en/forms.php @@ -0,0 +1,219 @@ + 'Extension', + 'plural_label' => 'Extension', + 'navigation_label' => 'Extension', + + 'form_id' => 'Form ID', + 'extension' => 'Extension', + 'forms' => 'Forms', + 'inactive' => 'Inactive', + 'active' => 'Active', + 'status' => 'Status', + 'notes' => 'Notes', + 'updated_at' => 'Updated At', + 'cant_delete' => 'Can\'t delete a form linked to an Extensions', + 'status_labels'=>[ + 'new'=>'New', + 'open'=>'Open', + 'closed'=>'Closed', + ], + 'options' => [ + 'tabs' => [ + 'title' => [ + 'label' => 'Title & Slug', + 'name' => 'Form Name', + 'slug' => 'Form Slug', + 'links' => 'Form Links', + 'category' => [ + 'label' => 'Category', + 'hint' => 'optional, organize your forms into categories', + 'name' => 'Name', + 'slug' => 'Slug', + ], + ], + 'details' => [ + 'label' => 'Text & Details', + 'description' => 'Form Description', + 'description_help' => 'shown under the title of the form and used in SEO', + 'details' => 'Form Details', + 'details_help' => 'a highlighted section above the form, to show some instructions or more details', + 'confirmation_message' => 'Confirmation Message', + 'confirmation_message_help' => 'optional, show a massage whenever any one submit a new entry', + ], + 'display' => [ + 'label' => 'Display & Access', + 'is_active' => 'Is Active', + 'is_active_help' => 'Activate the form and let users start submissions', + 'require_login' => 'require Login', + 'require_login_help' => 'User must be logged in or create an account before can submit a new entry', + 'one_entry_per_user' => 'One Entry Per User', + 'one_entry_per_user_help' => 'to check if the user already submitted an entry in this form', + 'show_as' => [ + 'label' => 'Show the form as', + 'type' => [ + 'page' => 'Show on one page', + 'wizard' => 'Show As Wizard', + 'tabs' => 'Show As Tabs', + ], + 'type_desc' => [ + 'page' => 'show all sections on one page', + 'wizard' => 'separate each section in steps', + 'tabs' => 'Show the Form as Tabs', + ], + ], + 'ordering' => 'ordering', + ], + 'advanced' => [ + 'label' => 'Advanced', + 'dates' => 'Form Dates', + 'dates_help' => 'optional, specify when the form will be active and receiving new entries', + 'start_date' => 'Start Date', + 'end_date' => 'End Date', + 'emails_notifications' => 'Emails Notifications', + 'emails_notifications_help' => 'optional, enter the emails (comma separated) you want to receive notification when ever you got a new entry', + ], + 'extensions' => [ + 'label' => 'Extensions', + ], + 'design' => [ + 'label' => 'Design', + 'logo' => 'Logo', + 'cover' => 'Cover', + ] + ], + 'conditional_visibility' => [ + 'title' => 'Conditional Visibility', + 'label' => 'Enable Conditional Visibility', + 'field' => 'show when the field:', + 'values' => 'has the value:', + ], + 'checked' => 'checked', + 'not_checked' => 'not checked', + 'is_required' => 'Is Required', + 'is_active' => 'Is Active', + 'hint' => [ + 'text' => 'Hint Text', + 'icon_tooltip' => 'Hint Icon tooltip', + 'color' => 'Hint Color', + 'label' => 'Hint Icon', + ], + 'column_span_full' => [ + 'help_text' => 'show this field in full width row', + 'label' => 'Full Width', + ], + 'collections' => [ + 'label' => 'Collections Name', + 'values' => 'Collections Values', + 'value' => 'Value', + 'value_hint' => 'what the user will see', + 'key' => 'Key', + 'key_hint' => 'what store in the form', + 'is_default' => 'selected by default', + ], + 'data_source' => [ + 'label' => 'Data Source', + ], + 'html_id' => 'HTML ID', + ], + + 'section' => [ + 'name' => 'Section Name', + 'description' => 'Section Description', + 'fields' => 'Section Fields', + 'options' => [ + 'title' => 'Section Options', + 'more' => 'more section options', + 'visual_options' => 'Visual Options', + 'columns_hint' => 'fields per row', + 'columns_label' => 'Section Columns', + 'icon' => 'Section icon', + 'compact' => 'compact section', + 'add' => 'Add Section', + ], + ], + 'widgets'=>[ + 'fields_label' => 'Fields', + 'responses_label' => 'Responses', + 'fields_responses' => 'Fields Responses', + 'responses_entries' => 'Responses Entries', + 'entries_per_month' => 'Responses Entries', + 'responses_status' => 'Responses Status', + 'per_day' => 'Per Day', + 'per_month' => 'Per month', + 'per_year' => 'Per year', + 'responses_count' => 'Responses Count', + 'entries_per_month_desc' => 'entries per month', + ], + 'fields' => [ + 'add' => 'Add field', + 'settings' => 'advanced fields settings', + 'description' => 'Field Description', + 'options' => [ + 'label' => 'Field Options', + 'general' => 'General Options', + 'color_type' => 'Color Type', + 'allow_multiple' => 'Allow Multiple', + 'is_inline' => 'Is inline', + 'rows' => 'Rows', + 'cols' => 'Cols', + 'min_length' => 'Min Length', + 'max_length' => 'Max Length', + 'min_value' => 'Min value', + 'max_value' => 'Max value', + 'validation_options' => 'Validation Options', + 'data_type' => 'Data Type', + 'data_type_types' => [ + 'string' => 'text', + 'email' => 'email', + 'numeric' => 'numeric', + 'password' => 'password', + 'tel' => 'tel', + 'url' => 'url', + 'activeUrl' => 'active url', + 'alpha' => 'alpha', + 'alphaDash' => 'alpha dash', + 'alphaNum' => 'alpha num', + 'ip' => 'ip', + 'ipv4' => 'ip v4', + 'ipv6' => 'ip v6', + 'macAddress' => 'mac address', + ], + 'visual_options'=>'Visual Options', + 'prefix'=>'prefix', + 'suffix'=>'suffix', + 'prefix_icon'=>'Prefix Icon', + 'suffix_icon'=>'Suffix Icon', + 'prefix_icon_color'=>'Prefix Icon', + 'suffix_icon_color'=>'Suffix Icon', + 'on_icon'=>'On Icon', + 'off_icon'=>'Off Icon', + 'on_color'=>'On Color', + 'off_color'=>'Off Color', + 'yes'=>'Yes', + 'no'=>'No', + ], + 'name' => 'Field Name', + 'type' => 'Field Type', + 'marks' => [ + 'suffix' => 'marks', + ], + ], + 'actions'=>[ + 'replicate'=>'Replicate', + 'set_status'=>'Set Status', + 'prefilled_link'=>'Prefilled Link', + 'prefilled_link_tooltip'=>'Get Prefilled Link', + 'short_link'=>'Short Link', + 'open'=>'Open', + 'open_tooltip'=>'open form', + 'open_tooltip_all'=>'open all forms', + ], + 'responses_exists'=>'Responses Exists', + 'responses_count'=>'Responses Count', + 'entries'=>'Entries', + 'browse_entries'=>'Browse Entries', + 'view_all_entries'=>'view all entries', + 'edit_form'=>'Edit Form', + 'view_form'=>'View Form', +]; \ No newline at end of file diff --git a/resources/lang/en/response.php b/resources/lang/en/response.php new file mode 100644 index 00000000..fa98bb8b --- /dev/null +++ b/resources/lang/en/response.php @@ -0,0 +1,16 @@ + 'name', + 'status' => 'status', + 'notes' => 'notes', + 'created_at' => 'created at', + 'guest' => 'guest', + 'export_responses' => 'Export Responses', + 'entries_report' => 'Entries Report', + 'set_status' => 'Set Status', + 'view_response_number' => 'view response #', + 'view_the_entry' => 'view the entry', + 'my_responses' => 'My Responses', + 'show_entry' => 'Show entry', + 'new_submission_in' => 'New Submission in', +]; \ No newline at end of file diff --git a/src/BoltPlugin.php b/src/BoltPlugin.php index 6a465ae5..304c7d5f 100644 --- a/src/BoltPlugin.php +++ b/src/BoltPlugin.php @@ -4,23 +4,13 @@ use Filament\Contracts\Plugin; use Filament\Panel; -use Filament\Support\Concerns\EvaluatesClosures; use LaraZeus\Bolt\Filament\Resources\CategoryResource; use LaraZeus\Bolt\Filament\Resources\CollectionResource; use LaraZeus\Bolt\Filament\Resources\FormResource; -use LaraZeus\Core\Concerns\CanGloballySearch; final class BoltPlugin implements Plugin { - use CanGloballySearch; use Configuration; - use EvaluatesClosures; - - public array $defaultGloballySearchableAttributes = [ - CategoryResource::class => ['name', 'slug'], - CollectionResource::class => ['name', 'values'], - FormResource::class => ['name', 'slug'], - ]; public function getId(): string { diff --git a/src/Concerns/Designer.php b/src/Concerns/Designer.php index 71884072..b1cd620a 100644 --- a/src/Concerns/Designer.php +++ b/src/Concerns/Designer.php @@ -59,7 +59,7 @@ private static function drawExt(Form $zeusForm): array return (new $class)->label(); } - return __('Extension'); + return __('zeus-bolt::forms.extension'); }) ->schema($getExtComponent), ]; diff --git a/src/Concerns/HasActive.php b/src/Concerns/HasActive.php index a30b0f92..4758f49a 100644 --- a/src/Concerns/HasActive.php +++ b/src/Concerns/HasActive.php @@ -7,7 +7,7 @@ trait HasActive public function getIsActiveDescAttribute(): string { return ($this->is_active === 0) - ? '' . __('Inactive') . '' - : '' . __('Active') . ''; + ? '' . __('zeus-bolt::forms.inactive') . '' + : '' . __('zeus-bolt::forms.active') . ''; } } diff --git a/src/Concerns/HasHiddenOptions.php b/src/Concerns/HasHiddenOptions.php index c61279a0..94e1cb24 100644 --- a/src/Concerns/HasHiddenOptions.php +++ b/src/Concerns/HasHiddenOptions.php @@ -25,7 +25,9 @@ public static function hiddenRequired(): array public static function hiddenIsActive(): array { return [ - Hidden::make('options.is_active')->default(true), + Hidden::make('options.is_active') + ->formatStateUsing(fn($record)=> $record->options['is_active'] ?? true) + ->default(true), ]; } diff --git a/src/Concerns/HasOptions.php b/src/Concerns/HasOptions.php index 11466a0d..5af26725 100644 --- a/src/Concerns/HasOptions.php +++ b/src/Concerns/HasOptions.php @@ -2,83 +2,26 @@ namespace LaraZeus\Bolt\Concerns; -use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\ColorPicker; use Filament\Forms\Components\Grid; -use Filament\Forms\Components\Repeater; -use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Toggle; -use Filament\Forms\Get; -use Filament\Forms\Set; use Guava\FilamentIconPicker\Forms\IconPicker; use LaraZeus\Accordion\Forms\Accordion; -use LaraZeus\Bolt\BoltPlugin; -use LaraZeus\Bolt\Facades\Bolt; -use LaraZeus\Bolt\Fields\FieldsContract; +use LaraZeus\Bolt\Concerns\Options\DataSource; +use LaraZeus\Bolt\Concerns\Options\Visibility; trait HasOptions { - public static function visibility(?array $getFields = []): Accordion - { - if (filled($getFields)) { - $getFields = collect($getFields) - ->pluck('fields') - ->mapWithKeys(function (array $item) { - return $item; - }); - } - - return Accordion::make('visibility-options') - ->label(__('Conditional Visibility')) - ->icon('iconpark-eyes') - ->schema([ - Toggle::make('options.visibility.active') - ->live() - ->label(__('Enable Conditional Visibility')), - - Select::make('options.visibility.fieldID') - ->label(__('show when the field:')) - ->live() - ->searchable(false) - ->visible(fn (Get $get): bool => ! empty($get('options.visibility.active'))) - ->required(fn (Get $get): bool => ! empty($get('options.visibility.active'))) - ->options(optional($getFields)->pluck('name', 'id')), - - Select::make('options.visibility.values') - ->label(__('has the value:')) - ->live() - ->searchable(false) - ->required(fn (Get $get): bool => ! empty($get('options.visibility.fieldID'))) - ->visible(fn (Get $get): bool => ! empty($get('options.visibility.fieldID'))) - ->options(function (Get $get) use ($getFields) { - $getRelated = $getFields->where('id', $get('options.visibility.fieldID'))->first(); - - if ($get('options.visibility.fieldID') === null) { - return []; - } - - if ($getRelated['type'] === '\LaraZeus\Bolt\Fields\Classes\Toggle') { - return [ - 'true' => __('checked'), - 'false' => __('not checked'), - ]; - } - - if (! isset($getRelated['options']['dataSource'])) { - return []; - } - - return FieldsContract::getFieldCollectionItemsList($getRelated); - }), - ]); - } + use DataSource; + use Visibility; public static function required(): Grid { return Grid::make() ->schema([ - Toggle::make('options.is_required')->label(__('Is Required')), + Toggle::make('options.is_required') + ->label(__('zeus-bolt::forms.options.is_required')), ]) ->columns(1); } @@ -89,7 +32,7 @@ public static function isActive(): Grid ->schema([ Toggle::make('options.is_active') ->default(1) - ->label(__('Is Active')), + ->label(__('zeus-bolt::forms.options.is_active')), ]) ->columns(1); } @@ -102,17 +45,18 @@ public static function hintOptions(): Accordion ->icon('heroicon-o-light-bulb') ->schema([ TextInput::make('options.hint.text') - ->label(__('Hint Text')), + ->label(__('zeus-bolt::forms.options.hint.text')), TextInput::make('options.hint.icon-tooltip') - ->label(__('Hint Icon tooltip')), - ColorPicker::make('options.hint.color')->label(__('Hint Color')), + ->label(__('zeus-bolt::forms.options.hint.icon_tooltip')), + ColorPicker::make('options.hint.color') + ->label(__('zeus-bolt::forms.options.hint.color')), IconPicker::make('options.hint.icon') ->columns([ 'default' => 1, 'lg' => 3, '2xl' => 5, ]) - ->label(__('Hint Icon')), + ->label(__('zeus-bolt::forms.options.hint.label')), ]); } @@ -121,78 +65,8 @@ public static function columnSpanFull(): Grid return Grid::make() ->schema([ Toggle::make('options.column_span_full') - ->helperText(__('show this field in full width row')) - ->label(__('Full Width')), - ]) - ->columns(1); - } - - public static function dataSource(): Grid - { - $dataSources = BoltPlugin::getModel('Collection')::get() - ->mapWithKeys(function ($item, $key) { - return [ - $key => [ - 'title' => $item['name'], - 'class' => $item['id'], - ], - ]; - }) - ->toBase() - ->merge( - Bolt::availableDataSource() - ->mapWithKeys(function ($item, $key) { - return [ - $key => [ - 'title' => $item['title'], - 'class' => $item['class'], - ], - ]; - }) - ) - ->pluck('title', 'class'); - - return Grid::make() - ->schema([ - Select::make('options.dataSource') - ->createOptionAction(fn (Action $action) => $action->hidden(auth()->user()->cannot('create', BoltPlugin::getModel('Collection')))) - ->required() - ->createOptionForm([ - TextInput::make('name') - ->live(onBlur: true) - ->label(__('Collections Name'))->required()->maxLength(255)->columnSpan(2), - Repeater::make('values') - ->grid([ - 'default' => 1, - 'md' => 2, - 'lg' => 3, - ]) - ->label(__('Collections Values')) - ->columnSpan(2) - ->columns(1) - ->schema([ - TextInput::make('itemValue') - ->live(onBlur: true) - ->afterStateUpdated(function (Set $set, Get $get, string $operation) { - $set('itemKey', $get('itemValue')); - }) - ->required()->label(__('Value'))->hint(__('what the user will see')), - TextInput::make('itemKey') - ->live(onBlur: true) - ->required()->label(__('Key'))->hint(__('what store in the form')), - Toggle::make('itemIsDefault')->label(__('selected by default')), - ]), - ]) - ->createOptionUsing(function (array $data) { - $collectionModel = BoltPlugin::getModel('Collection'); - $collection = new $collectionModel; - $collection->fill($data); - $collection->save(); - - return $collection->id; - }) - ->options($dataSources) - ->label(__('Data Source')), + ->helperText(__('zeus-bolt::forms.options.column_span_full.help_text')) + ->label(__('zeus-bolt::forms.options.column_span_full.label')), ]) ->columns(1); } @@ -204,7 +78,7 @@ public static function htmlID(): Grid TextInput::make('options.htmlId') ->required() ->default(str()->random(6)) - ->label(__('HTML ID')), + ->label(__('zeus-bolt::forms.options.html_id')), ]) ->columns(1); } diff --git a/src/Concerns/Options/DataSource.php b/src/Concerns/Options/DataSource.php new file mode 100644 index 00000000..d78c5c16 --- /dev/null +++ b/src/Concerns/Options/DataSource.php @@ -0,0 +1,96 @@ +mapWithKeys(function ($item, $key) { + return [ + $key => [ + 'title' => $item['name'], + 'class' => $item['id'], + ], + ]; + }) + ->toBase() + ->merge( + Bolt::availableDataSource() + ->mapWithKeys(function ($item, $key) { + return [ + $key => [ + 'title' => $item['title'], + 'class' => $item['class'], + ], + ]; + }) + ) + ->pluck('title', 'class'); + + return Grid::make() + ->schema([ + Select::make('options.dataSource') + ->createOptionAction(fn (Action $action) => $action->hidden(auth()->user()->cannot('create', BoltPlugin::getModel('Collection')))) + ->required() + ->createOptionForm([ + TextInput::make('name') + ->live(onBlur: true) + ->label(__('zeus-bolt::forms.options.collections.label')) + ->required() + ->maxLength(255) + ->columnSpan(2), + Repeater::make('values') + ->grid([ + 'default' => 1, + 'md' => 2, + 'lg' => 3, + ]) + ->label(__('zeus-bolt::forms.options.collections.values')) + ->columnSpan(2) + ->columns(1) + ->schema([ + TextInput::make('itemValue') + ->live(onBlur: true) + ->afterStateUpdated(function (Set $set, Get $get, string $operation) { + $set('itemKey', $get('itemValue')); + }) + ->required() + ->label(__('zeus-bolt::forms.options.collections.value')) + ->hint(__('zeus-bolt::forms.options.collections.value_hint')), + + TextInput::make('itemKey') + ->live(onBlur: true) + ->required() + ->label(__('zeus-bolt::forms.options.collections.key')) + ->hint(__('zeus-bolt::forms.options.collections.key_hint')), + Toggle::make('itemIsDefault') + ->label(__('zeus-bolt::forms.options.collections.is_default')), + ]), + ]) + ->createOptionUsing(function (array $data) { + $collectionModel = BoltPlugin::getModel('Collection'); + $collection = new $collectionModel; + $collection->fill($data); + $collection->save(); + + return $collection->id; + }) + ->options($dataSources) + ->label(__('zeus-bolt::forms.options.data_source.label')), + ]) + ->columns(1); + } +} \ No newline at end of file diff --git a/src/Concerns/Options/Visibility.php b/src/Concerns/Options/Visibility.php new file mode 100644 index 00000000..e5356985 --- /dev/null +++ b/src/Concerns/Options/Visibility.php @@ -0,0 +1,67 @@ +pluck('fields') + ->mapWithKeys(function (array $item) { + return $item; + }); + } + + return Accordion::make('visibility-options') + ->label(__('zeus-bolt::forms.options.conditional_visibility.title')) + ->icon('iconpark-eyes') + ->schema([ + Toggle::make('options.visibility.active') + ->live() + ->label(__('zeus-bolt::forms.options.conditional_visibility.label')), + + Select::make('options.visibility.fieldID') + ->label(__('zeus-bolt::forms.options.conditional_visibility.field')) + ->live() + ->searchable(false) + ->visible(fn (Get $get): bool => ! empty($get('options.visibility.active'))) + ->required(fn (Get $get): bool => ! empty($get('options.visibility.active'))) + ->options(optional($getFields)->pluck('name', 'id')), + + Select::make('options.visibility.values') + ->label(__('zeus-bolt::forms.options.conditional_visibility.values')) + ->live() + ->searchable(false) + ->required(fn (Get $get): bool => ! empty($get('options.visibility.fieldID'))) + ->visible(fn (Get $get): bool => ! empty($get('options.visibility.fieldID'))) + ->options(function (Get $get) use ($getFields) { + $getRelated = $getFields->where('id', $get('options.visibility.fieldID'))->first(); + + if ($get('options.visibility.fieldID') === null) { + return []; + } + + if ($getRelated['type'] === '\LaraZeus\Bolt\Fields\Classes\Toggle') { + return [ + 'true' => __('zeus-bolt::forms.options.checked'), + 'false' => __('zeus-bolt::forms.options.not_checked'), + ]; + } + + if (! isset($getRelated['options']['dataSource'])) { + return []; + } + + return FieldsContract::getFieldCollectionItemsList($getRelated); + }), + ]); + } +} \ No newline at end of file diff --git a/src/Concerns/Schemata.php b/src/Concerns/Schemata.php index 57d44479..9a207f71 100644 --- a/src/Concerns/Schemata.php +++ b/src/Concerns/Schemata.php @@ -58,12 +58,12 @@ protected static function sectionOptionsFormSchema(array $formOptions, array $al TextInput::make('description') ->nullable() ->visible($formOptions['show-as'] !== 'tabs') - ->label(__('Section Description')), + ->label(__('zeus-bolt::forms.section.description')), Accordions::make('section-options') ->accordions(fn () => array_filter([ Accordion::make('visual-options') - ->label(__('Visual Options')) + ->label(__('zeus-bolt::forms.section.options.visual_options')) ->columns() ->icon('iconpark-viewgriddetail-o') ->schema([ @@ -71,23 +71,23 @@ protected static function sectionOptionsFormSchema(array $formOptions, array $al ->options(fn (): array => array_combine(range(1, 12), range(1, 12))) ->required() ->default(1) - ->hint(__('fields per row')) - ->label(__('Section Columns')), + ->hint(__('zeus-bolt::forms.section.options.columns_hint')) + ->label(__('zeus-bolt::forms.section.options.columns_label')), IconPicker::make('icon') ->columns([ 'default' => 1, 'lg' => 3, '2xl' => 5, ]) - ->label(__('Section icon')), + ->label(__('zeus-bolt::forms.section.options.icon')), Toggle::make('aside') ->default(false) ->visible($formOptions['show-as'] === 'page') - ->label(__('show as aside')), + ->label(__('zeus-bolt::forms.section.options.aside')), Toggle::make('compact') ->default(false) ->visible($formOptions['show-as'] === 'page') - ->label(__('compact section')), + ->label(__('zeus-bolt::forms.section.options.compact')), ]), self::visibility($allSections), Bolt::getCustomSchema('section') ?? [], @@ -109,7 +109,7 @@ public static function getMainFormSchema(): array ->schema(static::getSectionsSchema()) ->relationship() ->orderColumn('ordering') - ->addActionLabel(__('Add Section')) + ->addActionLabel(__('zeus-bolt::forms.section.options.add')) ->cloneable() ->collapsible() ->collapsed(fn (string $operation) => $operation === 'edit') @@ -119,10 +119,10 @@ public static function getMainFormSchema(): array Bolt::hasPro() ? \LaraZeus\BoltPro\Actions\SectionMarkAction::make('marks') : null, Action::make('options') - ->label(__('section options')) + ->label(__('zeus-bolt::forms.section.options.title')) ->slideOver() ->color('warning') - ->tooltip(__('more section options')) + ->tooltip(__('zeus-bolt::forms.section.options.more')) ->icon('heroicon-m-cog') ->fillForm(fn ( array $arguments, @@ -152,14 +152,14 @@ public static function getTabsSchema(): array { $tabs = [ Tabs\Tab::make('title-slug-tab') - ->label(__('Title & Slug')) + ->label(__('zeus-bolt::forms.options.tabs.title.label')) ->columns() ->schema([ TextInput::make('name') ->required() ->maxLength(255) ->live(onBlur: true) - ->label(__('Form Name')) + ->label(__('zeus-bolt::forms.options.tabs.title.name')) ->afterStateUpdated(function (Set $set, $state, $context) { if ($context === 'edit') { return; @@ -171,10 +171,10 @@ public static function getTabsSchema(): array ->maxLength(255) ->rules(['alpha_dash']) ->unique(ignoreRecord: true) - ->label(__('Form Slug')), + ->label(__('zeus-bolt::forms.options.tabs.title.slug')), Select::make('category_id') - ->label(__('Category')) + ->label(__('zeus-bolt::forms.options.tabs.title.category.label')) ->searchable() ->preload() ->relationship( @@ -188,41 +188,44 @@ public static function getTabsSchema(): array return BoltPlugin::getModel('Category')::query()->whereBelongsTo(Filament::getTenant()); }, ) - ->helperText(__('optional, organize your forms into categories')) + ->helperText(__('zeus-bolt::forms.options.tabs.title.category.hint')) ->createOptionForm([ TextInput::make('name') ->required() ->maxLength(255) ->live(onBlur: true) - ->label(__('Name')) + ->label(__('zeus-bolt::forms.options.tabs.title.category.name')) ->afterStateUpdated(function (Set $set, $state, $context) { if ($context === 'edit') { return; } $set('slug', Str::slug($state)); }), - TextInput::make('slug')->required()->maxLength(255)->label(__('slug')), + TextInput::make('slug') + ->required() + ->maxLength(255) + ->label(__('zeus-bolt::forms.options.tabs.title.category.slug')), ]) ->createOptionAction(fn (Action $action) => $action->hidden(auth()->user()->cannot('create', BoltPlugin::getModel('Category')))) ->getOptionLabelFromRecordUsing(fn (Category $record) => $record->name), ]), Tabs\Tab::make('text-details-tab') - ->label(__('Text & Details')) + ->label(__('zeus-bolt::forms.options.tabs.details.label')) ->schema([ Textarea::make('description') - ->label(__('Form Description')) - ->helperText(__('shown under the title of the form and used in SEO')), + ->label(__('zeus-bolt::forms.options.tabs.details.description')) + ->helperText(__('zeus-bolt::forms.options.tabs.details.description_help')), RichEditor::make('details') - ->label(__('Form Details')) - ->helperText(__('a highlighted section above the form, to show some instructions or more details')), + ->label(__('zeus-bolt::forms.options.tabs.details.details')) + ->helperText(__('zeus-bolt::forms.options.tabs.details.details_help')), RichEditor::make('options.confirmation-message') - ->label(__('Confirmation Message')) - ->helperText(__('optional, show a massage whenever any one submit a new entry')), + ->label(__('zeus-bolt::forms.options.tabs.details.confirmation_message')) + ->helperText(__('zeus-bolt::forms.options.tabs.details.confirmation_message_help')), ]), Tabs\Tab::make('display-access-tab') - ->label(__('Display & Access')) + ->label(__('zeus-bolt::forms.options.tabs.display.label')) ->columns() ->schema([ Grid::make() @@ -230,16 +233,16 @@ public static function getTabsSchema(): array ->columns(1) ->schema([ Toggle::make('is_active') - ->label(__('Is Active')) + ->label(__('zeus-bolt::forms.options.tabs.display.is_active')) ->default(1) - ->helperText(__('Activate the form and let users start submissions')), + ->helperText(__('zeus-bolt::forms.options.tabs.display.is_active_help')), Toggle::make('options.require-login') - ->label(__('require Login')) - ->helperText(__('User must be logged in or create an account before can submit a new entry')) + ->label(__('zeus-bolt::forms.options.tabs.display.require_login')) + ->helperText(__('zeus-bolt::forms.options.tabs.display.require_login_help')) ->live(), Toggle::make('options.one-entry-per-user') - ->label(__('One Entry Per User')) - ->helperText(__('to check if the user already submitted an entry in this form')) + ->label(__('zeus-bolt::forms.options.tabs.display.one_entry_per_user')) + ->helperText(__('zeus-bolt::forms.options.tabs.display.one_entry_per_user_help')) ->visible(function (Get $get) { return $get('options.require-login'); }), @@ -249,59 +252,59 @@ public static function getTabsSchema(): array ->columns(1) ->schema([ Radio::make('options.show-as') - ->label(__('Show the form as')) + ->label(__('zeus-bolt::forms.options.tabs.display.show_as.label')) ->live() ->default('page') ->descriptions([ - 'page' => __('show all sections on one page'), - 'wizard' => __('separate each section in steps'), - 'tabs' => __('Show the Form as Tabs'), + 'page' => __('zeus-bolt::forms.options.tabs.display.show_as.type_desc.page'), + 'wizard' => __('zeus-bolt::forms.options.tabs.display.show_as.type_desc.wizard'), + 'tabs' => __('zeus-bolt::forms.options.tabs.display.show_as.type_desc.tabs'), ]) ->options([ - 'page' => __('Show on one page'), - 'wizard' => __('Show As Wizard'), - 'tabs' => __('Show As Tabs'), + 'page' => __('zeus-bolt::forms.options.tabs.display.show_as.type.page'), + 'wizard' => __('zeus-bolt::forms.options.tabs.display.show_as.type.wizard'), + 'tabs' => __('zeus-bolt::forms.options.tabs.display.show_as.type.tabs'), ]), ]), TextInput::make('ordering') ->numeric() - ->label(__('ordering')) + ->label(__('zeus-bolt::forms.options.tabs.display.ordering')) ->default(1), ]), Tabs\Tab::make('advanced-tab') - ->label(__('Advanced')) + ->label(__('zeus-bolt::forms.options.tabs.advanced.label')) ->schema([ Grid::make() ->columns() ->schema([ Placeholder::make('form-dates') - ->label(__('Form Dates')) - ->content(__('optional, specify when the form will be active and receiving new entries')) + ->label(__('zeus-bolt::forms.options.tabs.advanced.dates')) + ->content(__('zeus-bolt::forms.options.tabs.advanced.dates_help')) ->columnSpanFull(), DateTimePicker::make('start_date') ->requiredWith('end_date') - ->label(__('Start Date')), + ->label(__('zeus-bolt::forms.options.tabs.advanced.start_date')), DateTimePicker::make('end_date') ->requiredWith('start_date') - ->label(__('End Date')), + ->label(__('zeus-bolt::forms.options.tabs.advanced.end_date')), ]), Grid::make() ->columns() ->schema([ TextInput::make('options.emails-notification') - ->label(__('Emails Notifications')) - ->helperText(__('optional, enter the emails (comma separated) you want to receive notification when ever you got a new entry')), + ->label(__('zeus-bolt::forms.options.tabs.advanced.emails_notifications')) + ->helperText(__('zeus-bolt::forms.options.tabs.advanced.emails_notifications_help')), ]), ]), Tabs\Tab::make('extensions-tab') - ->label(__('Extensions')) + ->label(__('zeus-bolt::forms.options.tabs.extensions.label')) ->visible(BoltPlugin::get()->getExtensions() !== null) ->schema([ Select::make('extensions') - ->label(__('Extensions')) + ->label(__('zeus-bolt::forms.options.tabs.extensions.label')) ->preload() ->live() ->options(function () { @@ -318,7 +321,7 @@ public static function getTabsSchema(): array ]), Tabs\Tab::make('design') - ->label(__('Design')) + ->label(__('zeus-bolt::forms.options.tabs.design.label')) ->visible(Bolt::hasPro() && config('zeus-bolt.allow_design')) ->schema([ ViewField::make('options.primary_color') @@ -330,14 +333,14 @@ public static function getTabsSchema(): array ->visibility(config('zeus-bolt.uploadVisibility')) ->image() ->imageEditor() - ->label(__('Logo')), + ->label(__('zeus-bolt::forms.options.tabs.design.logo')), FileUpload::make('options.cover') ->disk(config('zeus-bolt.uploadDisk')) ->directory(config('zeus-bolt.uploadDirectory')) ->visibility(config('zeus-bolt.uploadVisibility')) ->image() ->imageEditor() - ->label(__('Cover')), + ->label(__('zeus-bolt::forms.options.tabs.design.cover')), ]), ]; @@ -357,10 +360,10 @@ public static function getSectionsSchema(): array ->columnSpanFull() ->required() ->lazy() - ->label(__('Section Name')), + ->label(__('zeus-bolt::forms.section.name')), Placeholder::make('section-fields-placeholder') - ->label(__('Section Fields')), + ->label(__('zeus-bolt::forms.section.name')), Repeater::make('fields') ->relationship() @@ -391,9 +394,9 @@ public static function getSectionsSchema(): array 'xl' => 3, '2xl' => 3, ]) - ->label('') + ->hiddenLabel() ->itemLabel(fn (array $state): ?string => $state['name'] ?? null) - ->addActionLabel(__('Add field')) + ->addActionLabel(__('zeus-bolt::forms.fields.add')) ->extraItemActions([ // @phpstan-ignore-next-line Bolt::hasPro() ? \LaraZeus\BoltPro\Actions\FieldMarkAction::make('marks') : null, @@ -404,7 +407,7 @@ public static function getSectionsSchema(): array ->tooltip('more field options') ->icon('heroicon-m-cog') ->modalIcon('heroicon-m-cog') - ->modalDescription(__('advanced fields settings')) + ->modalDescription(__('zeus-bolt::forms.fields.settings')) ->fillForm(fn ( $state, array $arguments, @@ -415,9 +418,9 @@ public static function getSectionsSchema(): array return [ Textarea::make('description') - ->label(__('Field Description')), + ->label(__('zeus-bolt::forms.fields.description')), Group::make() - ->label(__('Field Options')) + ->label(__('zeus-bolt::forms.fields.options')) ->schema(function (Get $get) use ($allSections, $component, $arguments) { $class = $get('type'); if (class_exists($class)) { @@ -466,7 +469,7 @@ public static function getFieldsSchema(): array TextInput::make('name') ->required() ->lazy() - ->label(__('Field Name')), + ->label(__('zeus-bolt::forms.fields.name')), Select::make('type') ->required() ->searchable() @@ -488,7 +491,7 @@ public static function getFieldsSchema(): array }) ->live() ->default('\LaraZeus\Bolt\Fields\Classes\TextInput') - ->label(__('Field Type')), + ->label(__('zeus-bolt::forms.fields.type')), Group::make() ->schema(function (Get $get) { $class = $get('type'); diff --git a/src/Fields/Classes/CheckboxList.php b/src/Fields/Classes/CheckboxList.php index a4871c5f..a26c6eb1 100644 --- a/src/Fields/Classes/CheckboxList.php +++ b/src/Fields/Classes/CheckboxList.php @@ -15,21 +15,11 @@ class CheckboxList extends FieldsContract public int $sort = 3; - public function title(): string - { - return __('Checkbox List'); - } - public function icon(): string { return 'tabler-list-check'; } - public function description(): string - { - return __('checkbox items from data source'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ @@ -38,7 +28,7 @@ public static function getOptions(?array $sections = null, ?array $field = null) Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), diff --git a/src/Fields/Classes/ColorPicker.php b/src/Fields/Classes/ColorPicker.php index f8c5d8dc..e77b8d83 100644 --- a/src/Fields/Classes/ColorPicker.php +++ b/src/Fields/Classes/ColorPicker.php @@ -15,32 +15,22 @@ class ColorPicker extends FieldsContract public int $sort = 9; - public function title(): string - { - return __('Color Picker'); - } - public function icon(): string { return 'tabler-color-picker'; } - public function description(): string - { - return __('pick a color with rgb, rgba or hsl'); - } - public static function getOptions(?array $sections = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ \Filament\Forms\Components\Select::make('options.colorType') - ->label(__('Color Type')) + ->label(__('zeus-bolt::forms.fields.options.color_type')) ->options([ 'hsl' => 'hsl', 'rgb' => 'rgb', diff --git a/src/Fields/Classes/DatePicker.php b/src/Fields/Classes/DatePicker.php index 04397bb0..50d5f7ac 100644 --- a/src/Fields/Classes/DatePicker.php +++ b/src/Fields/Classes/DatePicker.php @@ -13,28 +13,18 @@ class DatePicker extends FieldsContract public int $sort = 6; - public function title(): string - { - return __('Date Picker'); - } - public function icon(): string { return 'tabler-calendar'; } - public function description(): string - { - return __('full date picker'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), diff --git a/src/Fields/Classes/DateTimePicker.php b/src/Fields/Classes/DateTimePicker.php index c5e8638b..a54eb21f 100644 --- a/src/Fields/Classes/DateTimePicker.php +++ b/src/Fields/Classes/DateTimePicker.php @@ -13,28 +13,18 @@ class DateTimePicker extends FieldsContract public int $sort = 5; - public function title(): string - { - return __('Date Time Picker'); - } - public function icon(): string { return 'tabler-calendar-time'; } - public function description(): string - { - return __('full date and time picker'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), diff --git a/src/Fields/Classes/FileUpload.php b/src/Fields/Classes/FileUpload.php index 5b14cb92..1a2df6fc 100644 --- a/src/Fields/Classes/FileUpload.php +++ b/src/Fields/Classes/FileUpload.php @@ -16,31 +16,22 @@ class FileUpload extends FieldsContract public int $sort = 11; - public function title(): string - { - return __('File Upload'); - } - public function icon(): string { return 'tabler-cloud-upload'; } - public function description(): string - { - return __('single or multiple file uploader'); - } - public static function getOptions(?array $sections = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ - \Filament\Forms\Components\Toggle::make('options.allow_multiple')->label(__('Allow Multiple')), + \Filament\Forms\Components\Toggle::make('options.allow_multiple') + ->label(__('zeus-bolt::forms.fields.options.allow_multiple')), self::isActive(), self::required(), self::columnSpanFull(), diff --git a/src/Fields/Classes/Paragraph.php b/src/Fields/Classes/Paragraph.php index 1350f9fd..2a9f1877 100644 --- a/src/Fields/Classes/Paragraph.php +++ b/src/Fields/Classes/Paragraph.php @@ -14,28 +14,18 @@ class Paragraph extends FieldsContract public int $sort = 10; - public function title(): string - { - return __('Paragraph'); - } - public function icon(): string { return 'tabler-text-recognition'; } - public function description(): string - { - return __('display a paragraph in your form'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), diff --git a/src/Fields/Classes/Radio.php b/src/Fields/Classes/Radio.php index 2ad077b0..4d0080f2 100644 --- a/src/Fields/Classes/Radio.php +++ b/src/Fields/Classes/Radio.php @@ -17,21 +17,11 @@ class Radio extends FieldsContract public int $sort = 4; - public function title(): string - { - return __('Radio'); - } - public function icon(): string { return 'tabler-circle-check'; } - public function description(): string - { - return __('single choice from a datasource'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ @@ -39,12 +29,13 @@ public static function getOptions(?array $sections = null, ?array $field = null) Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), self::required(), - Toggle::make('options.is_inline')->label(__('Is inline')), + Toggle::make('options.is_inline') + ->label(__('zeus-bolt::forms.fields.options.is_inline')), self::columnSpanFull(), self::htmlID(), ]), diff --git a/src/Fields/Classes/RichEditor.php b/src/Fields/Classes/RichEditor.php index 14d2aca0..9979a79f 100644 --- a/src/Fields/Classes/RichEditor.php +++ b/src/Fields/Classes/RichEditor.php @@ -13,28 +13,18 @@ class RichEditor extends FieldsContract public int $sort = 7; - public function title(): string - { - return __('Rich Editor'); - } - public function icon(): string { return 'tabler-cursor-text'; } - public function description(): string - { - return __('Text editor with styling'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), diff --git a/src/Fields/Classes/Select.php b/src/Fields/Classes/Select.php index 15b0e2cf..c16e80c9 100644 --- a/src/Fields/Classes/Select.php +++ b/src/Fields/Classes/Select.php @@ -17,31 +17,22 @@ class Select extends FieldsContract public int $sort = 2; - public function title(): string - { - return __('Select Menu'); - } - public function icon(): string { return 'tabler-selector'; } - public function description(): string - { - return __('select single or multiple items from a dropdown list'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ self::dataSource(), - Toggle::make('options.allow_multiple')->label(__('Allow Multiple')), + Toggle::make('options.allow_multiple') + ->label(__('zeus-bolt::forms.fields.options.allow_multiple')), Accordions::make('options') ->activeAccordion(1) ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->columns() ->schema([ diff --git a/src/Fields/Classes/TextInput.php b/src/Fields/Classes/TextInput.php index 50c54608..6bf33646 100644 --- a/src/Fields/Classes/TextInput.php +++ b/src/Fields/Classes/TextInput.php @@ -20,49 +20,39 @@ class TextInput extends FieldsContract public int $sort = 1; - public function title(): string - { - return __('Text Input'); - } - public function icon(): string { return 'tabler-input-search'; } - public function description(): string - { - return __('text input'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('options') ->accordions([ Accordion::make('validation-options') - ->label(__('Validation Options')) + ->label(__('zeus-bolt::forms.fields.options.validation_options')) ->icon('iconpark-checkcorrect-o') ->columns() ->schema([ Select::make('options.dateType') - ->label(__('Data type')) + ->label(__('zeus-bolt::forms.fields.options.data_type')) ->required() ->options([ - 'string' => __('text'), - 'email' => __('email'), - 'numeric' => __('numeric'), - 'password' => __('password'), - 'tel' => __('tel'), - 'url' => __('url'), - 'activeUrl' => __('active url'), - 'alpha' => __('alpha'), - 'alphaDash' => __('alpha dash'), - 'alphaNum' => __('alpha num'), - 'ip' => __('ip'), - 'ipv4' => __('ip v4'), - 'ipv6' => __('ip v6'), - 'macAddress' => __('mac address'), + 'string' => __('zeus-bolt::forms.fields.options.data_type_types.string'), + 'email' => __('zeus-bolt::forms.fields.options.data_type_types.email'), + 'numeric' => __('zeus-bolt::forms.fields.options.data_type_types.numeric'), + 'password' => __('zeus-bolt::forms.fields.options.data_type_types.password'), + 'tel' => __('zeus-bolt::forms.fields.options.data_type_types.tel'), + 'url' => __('zeus-bolt::forms.fields.options.data_type_types.url'), + 'activeUrl' => __('zeus-bolt::forms.fields.options.data_type_types.activeUrl'), + 'alpha' => __('zeus-bolt::forms.fields.options.data_type_types.alpha'), + 'alphaDash' => __('zeus-bolt::forms.fields.options.data_type_types.alphaDash'), + 'alphaNum' => __('zeus-bolt::forms.fields.options.data_type_types.alphaNum'), + 'ip' => __('zeus-bolt::forms.fields.options.data_type_types.ip'), + 'ipv4' => __('zeus-bolt::forms.fields.options.data_type_types.ipv4'), + 'ipv6' => __('zeus-bolt::forms.fields.options.data_type_types.ipv6'), + 'macAddress' => __('zeus-bolt::forms.fields.options.data_type_types.macAddress'), ]) ->default('string') ->columnSpanFull() @@ -70,25 +60,25 @@ public static function getOptions(?array $sections = null, ?array $field = null) TextInputAlias::make('options.minValue') ->visible(fn (Get $get): bool => $get('options.dateType') === 'numeric') - ->label(__('min value')), + ->label(__('zeus-bolt::forms.fields.options.min_value')), TextInputAlias::make('options.maxValue') ->visible(fn (Get $get): bool => $get('options.dateType') === 'numeric') - ->label(__('max value')), + ->label(__('zeus-bolt::forms.fields.options.max_value')), self::isActive(), self::required(), ]), Accordion::make('visual-options') - ->label(__('Visual Options')) + ->label(__('zeus-bolt::forms.fields.options.visual_options')) ->columns() ->icon('iconpark-viewgriddetail-o') ->schema([ TextInputAlias::make('options.prefix') - ->label(__('prefix')), + ->label(__('zeus-bolt::forms.fields.options.prefix')), TextInputAlias::make('options.suffix') - ->label(__('suffix')), + ->label(__('zeus-bolt::forms.fields.options.suffix')), IconPicker::make('options.prefix-icon') ->columns([ @@ -96,19 +86,19 @@ public static function getOptions(?array $sections = null, ?array $field = null) 'lg' => 3, '2xl' => 5, ]) - ->label(__('Prefix Icon')), + ->label(__('zeus-bolt::forms.fields.options.prefix_icon')), IconPicker::make('options.suffix-icon') ->columns([ 'default' => 1, 'lg' => 3, '2xl' => 5, ]) - ->label(__('Suffix Icon')), + ->label(__('zeus-bolt::forms.fields.options.suffix_icon')), ColorPicker::make('options.prefix-icon-color') - ->label(__('Prefix Icon Color')), + ->label(__('zeus-bolt::forms.fields.options.prefix_icon_color')), ColorPicker::make('options.suffix-icon-color') - ->label(__('Suffix Icon Color')), + ->label(__('zeus-bolt::forms.fields.options.suffix_icon_color')), self::columnSpanFull(), self::htmlID(), diff --git a/src/Fields/Classes/Textarea.php b/src/Fields/Classes/Textarea.php index 6d988867..c307d9a4 100644 --- a/src/Fields/Classes/Textarea.php +++ b/src/Fields/Classes/Textarea.php @@ -22,21 +22,11 @@ class Textarea extends FieldsContract public int $sort = 8; - public function title(): string - { - return __('Textarea'); - } - public function icon(): string { return 'tabler-text-size'; } - public function description(): string - { - return __('multi line textarea'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ @@ -44,20 +34,20 @@ public static function getOptions(?array $sections = null, ?array $field = null) ->columns() ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ TextInput::make('options.rows') - ->label(__('rows')), + ->label(__('zeus-bolt::forms.fields.options.rows')), TextInput::make('options.cols') - ->label(__('cols')), + ->label(__('zeus-bolt::forms.fields.options.cols')), TextInput::make('options.minLength') - ->label(__('min length')), + ->label(__('zeus-bolt::forms.fields.options.min_length')), TextInput::make('options.maxLength') - ->label(__('max length')), + ->label(__('zeus-bolt::forms.fields.options.max_length')), self::isActive(), self::required(), diff --git a/src/Fields/Classes/TimePicker.php b/src/Fields/Classes/TimePicker.php index b71da14f..1630df23 100644 --- a/src/Fields/Classes/TimePicker.php +++ b/src/Fields/Classes/TimePicker.php @@ -13,28 +13,18 @@ class TimePicker extends FieldsContract public int $sort = 8; - public function title(): string - { - return __('Time Picker'); - } - public function icon(): string { return 'tabler-clock-hour-8'; } - public function description(): string - { - return __('time picker'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ self::isActive(), diff --git a/src/Fields/Classes/Toggle.php b/src/Fields/Classes/Toggle.php index a71f491c..b4a2f55d 100644 --- a/src/Fields/Classes/Toggle.php +++ b/src/Fields/Classes/Toggle.php @@ -25,28 +25,18 @@ class Toggle extends FieldsContract public int $sort = 5; - public function title(): string - { - return __('Toggle'); - } - public function icon(): string { return 'tabler-toggle-left'; } - public function description(): string - { - return __('toggle'); - } - public static function getOptions(?array $sections = null, ?array $field = null): array { return [ Accordions::make('check-list-options') ->accordions([ Accordion::make('general-options') - ->label(__('General Options')) + ->label(__('zeus-bolt::forms.fields.options.general')) ->icon('iconpark-checklist-o') ->schema([ Grid::make() @@ -58,7 +48,7 @@ public static function getOptions(?array $sections = null, ?array $field = null) 'lg' => 3, '2xl' => 5, ]) - ->label(__('On Icon')), + ->label(__('zeus-bolt::forms.fields.options.on_icon')), IconPicker::make('options.off-icon') ->columns([ @@ -66,10 +56,14 @@ public static function getOptions(?array $sections = null, ?array $field = null) 'lg' => 3, '2xl' => 5, ]) - ->label(__('Off Icon')), + ->label(__('zeus-bolt::forms.fields.options.off_icon')), - ColorPicker::make('options.on-color')->hex(), - ColorPicker::make('options.off-color')->hex(), + ColorPicker::make('options.on-color') + ->label(__('zeus-bolt::forms.fields.options.off_color')) + ->hex(), + ColorPicker::make('options.off-color') + ->label(__('zeus-bolt::forms.fields.options.off_color')) + ->hex(), \Filament\Forms\Components\Toggle::make('options.is-inline'), ]), @@ -155,7 +149,7 @@ public function entry(Field $field, FieldResponse $resp): string { $response = (int) $resp->response; - return ($response === 1) ? __('yes') : __('no'); + return ($response === 1) ? __('zeus-bolt::forms.fields.options.yes') : __('zeus-bolt::forms.fields.options.no'); } public function ExportColumn(Field $field): ?ExportColumn @@ -167,7 +161,7 @@ public function ExportColumn(Field $field): ?ExportColumn $response = $record->fieldsResponses()->where('field_id', $field->id)->first(); $response = (int) $response->response; - return ($response === 1) ? __('yes') : __('no'); + return ($response === 1) ? __('zeus-bolt::forms.fields.options.yes') : __('zeus-bolt::forms.fields.options.no'); }); } } diff --git a/src/Fields/FieldsContract.php b/src/Fields/FieldsContract.php index 799faa80..6bd03518 100644 --- a/src/Fields/FieldsContract.php +++ b/src/Fields/FieldsContract.php @@ -50,12 +50,14 @@ public function toArray(): array public function title(): string { - return __(class_basename($this)); + $fieldType = str(class_basename($this))->snake(); + return __('zeus-bolt::fields_types.'.$fieldType.'.title'); } public function description(): string { - return __('field text for all the text you need'); + $fieldType = str(class_basename($this))->snake(); + return __('zeus-bolt::fields_types.'.$fieldType.'.description'); } public function icon(): string @@ -94,7 +96,7 @@ public function appendFilamentComponentsOptions($component, $zeusField, bool $ha return null; } - return optional($zeusField->options)['grades']['points'] ?? 0 . ' ' . __('marks'); + return optional($zeusField->options)['grades']['points'] ?? 0 . ' ' . __('zeus-bolt::forms.fields.marks.suffix'); }) ->helperText($zeusField->description); diff --git a/src/Filament/Actions/ReplicateFormAction.php b/src/Filament/Actions/ReplicateFormAction.php index 25dbec37..5092bc82 100644 --- a/src/Filament/Actions/ReplicateFormAction.php +++ b/src/Filament/Actions/ReplicateFormAction.php @@ -22,14 +22,14 @@ protected function setUp(): void $this->baseSetUp(); $this->icon(FilamentIcon::resolve('actions::replicate-action') ?? 'heroicon-m-square-2-stack') - ->label(__('Replicate')) + ->label(__('zeus-bolt::forms.actions.replicate')) ->excludeAttributes(['name', 'slug', 'responses_exists', 'responses_count']) ->form([ TextInput::make('name.' . app()->getLocale()) ->required() ->maxLength(255) ->live(onBlur: true) - ->label(__('Form Name')) + ->label(__('zeus-bolt::forms.options.tabs.title.name')) ->afterStateUpdated(function (Set $set, $state) { $set('slug', Str::slug($state)); }), @@ -39,7 +39,7 @@ protected function setUp(): void ->maxLength(255) ->rules(['alpha_dash']) ->unique(ignoreRecord: true) - ->label(__('Form Slug')), + ->label(__('zeus-bolt::forms.options.tabs.title.slug')), ]) ->beforeReplicaSaved(function (ZeusForm $replica, ZeusForm $record, array $data): void { $repForm = $replica->fill($data); diff --git a/src/Filament/Actions/SetResponseStatus.php b/src/Filament/Actions/SetResponseStatus.php index 03ce6c62..74406d7e 100644 --- a/src/Filament/Actions/SetResponseStatus.php +++ b/src/Filament/Actions/SetResponseStatus.php @@ -29,7 +29,7 @@ protected function setUp(): void return $record->form->extensions === null; }); - $this->label(__('Set Status')); + $this->label(__('zeus-bolt::forms.actions.set_status')); $this->icon('heroicon-o-tag'); @@ -41,13 +41,13 @@ protected function setUp(): void $this->form([ Select::make('status') - ->label(__('status')) + ->label(__('zeus-bolt::forms.status')) ->default(fn (Response $record) => $record->status) ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) ->required(), Textarea::make('notes') ->default(fn (Response $record) => $record->notes) - ->label(__('Notes')), + ->label(__('zeus-bolt::forms.notes')), ]); } diff --git a/src/Filament/Exports/ResponseExporter.php b/src/Filament/Exports/ResponseExporter.php index 9f86c681..bff97853 100644 --- a/src/Filament/Exports/ResponseExporter.php +++ b/src/Filament/Exports/ResponseExporter.php @@ -21,14 +21,14 @@ public static function getColumns(): array $getUserModel = config('auth.providers.users.model')::getBoltUserFullNameAttribute(); $mainColumns = [ ExportColumn::make('user.' . $getUserModel) - ->label(__('Name')) - ->default(__('guest')), + ->label(__('zeus-bolt::response.name')) + ->default(__('zeus-bolt::response.guest')), ExportColumn::make('status') - ->label(__('status')), + ->label(__('zeus-bolt::response.status')), ExportColumn::make('notes') - ->label(__('notes')), + ->label(__('zeus-bolt::response.notes')), ]; /** @@ -43,7 +43,7 @@ public static function getColumns(): array } $mainColumns[] = ExportColumn::make('created_at') - ->label(__('created at')); + ->label(__('zeus-bolt::response.created_at')); return $mainColumns; } diff --git a/src/Filament/Resources/CategoryResource.php b/src/Filament/Resources/CategoryResource.php index bc283ec5..3d7f5fd5 100644 --- a/src/Filament/Resources/CategoryResource.php +++ b/src/Filament/Resources/CategoryResource.php @@ -27,7 +27,6 @@ use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Support\Str; use LaraZeus\Bolt\BoltPlugin; -use LaraZeus\Bolt\Enums\Resources; use LaraZeus\Bolt\Filament\Resources\CategoryResource\Pages\CreateCategory; use LaraZeus\Bolt\Filament\Resources\CategoryResource\Pages\EditCategory; use LaraZeus\Bolt\Filament\Resources\CategoryResource\Pages\ListCategories; @@ -48,7 +47,7 @@ public static function getModel(): string public static function getNavigationBadge(): ?string { - if (! BoltPlugin::getNavigationBadgesVisibility(Resources::CategoryResource)) { + if (! BoltPlugin::getNavigationBadgesVisibility(static::class)) { return null; } @@ -66,23 +65,38 @@ public static function form(Form $form): Form ->required() ->maxLength(255) ->live(onBlur: true) - ->label(__('Name')) + ->label(__('zeus-bolt::category.name')) ->afterStateUpdated(function (Set $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'))->default(1), - Textarea::make('description')->maxLength(65535)->columnSpan(['sm' => 2])->label(__('Description')), + TextInput::make('slug') + ->required() + ->maxLength(255) + ->label(__('zeus-bolt::category.slug')), + + TextInput::make('ordering') + ->required() + ->numeric() + ->label(__('zeus-bolt::category.ordering')), + + Toggle::make('is_active') + ->label(__('zeus-bolt::category.is_active')) + ->default(1), + + Textarea::make('description') + ->maxLength(65535) + ->columnSpan(['sm' => 2]) + ->label(__('zeus-bolt::category.description')), + FileUpload::make('logo') ->disk(config('zeus-bolt.uploadDisk')) ->directory(config('zeus-bolt.uploadDirectory')) ->visibility(config('zeus-bolt.uploadVisibility')) ->columnSpan(['sm' => 2]) - ->label(__('logo')), + ->label(__('zeus-bolt::category.logo')), ]), ]); } @@ -95,22 +109,22 @@ public static function table(Table $table): Table ->disk(config('zeus-bolt.uploadDisk')) ->visibility(config('zeus-bolt.uploadVisibility')) ->toggleable() - ->label(__('Logo')), + ->label(__('zeus-bolt::category.logo')), TextColumn::make('name') - ->label(__('Name')) + ->label(__('zeus-bolt::category.name')) ->sortable() ->toggleable() ->searchable(), TextColumn::make('forms_count') ->counts('forms') - ->label(__('Forms')) + ->label(__('zeus-bolt::category.forms')) ->toggleable() ->searchable(), IconColumn::make('is_active') ->boolean() ->sortable() ->toggleable() - ->label(__('Is Active')), + ->label(__('zeus-bolt::category.is_active')), ]) ->reorderable('ordering') ->defaultSort('id', 'description') @@ -125,11 +139,11 @@ public static function table(Table $table): Table ->filters([ TrashedFilter::make(), Filter::make('is_active') - ->label(__('is active')) + ->label(__('zeus-bolt::category.is_active')) ->toggle() ->query(fn (Builder $query): Builder => $query->where('is_active', true)), Filter::make('not_active') - ->label(__('not active')) + ->label(__('zeus-bolt::category.not_active')) ->toggle() ->query(fn (Builder $query): Builder => $query->where('is_active', false)), ]) @@ -160,16 +174,16 @@ public static function getPages(): array public static function getModelLabel(): string { - return __('Category'); + return __('zeus-bolt::category.label'); } public static function getPluralModelLabel(): string { - return __('Categories'); + return __('zeus-bolt::category.plural_label'); } public static function getNavigationLabel(): string { - return __('Categories'); + return __('zeus-bolt::category.navigation_label'); } } diff --git a/src/Filament/Resources/CollectionResource.php b/src/Filament/Resources/CollectionResource.php index 4928352b..7ecade2a 100644 --- a/src/Filament/Resources/CollectionResource.php +++ b/src/Filament/Resources/CollectionResource.php @@ -14,7 +14,6 @@ use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; use LaraZeus\Bolt\BoltPlugin; -use LaraZeus\Bolt\Enums\Resources; use LaraZeus\Bolt\Filament\Resources\CollectionResource\Pages; use LaraZeus\Bolt\Filament\Resources\CollectionResource\Widgets\EditCollectionWarning; @@ -33,7 +32,7 @@ public static function getModel(): string public static function getNavigationBadge(): ?string { - if (! BoltPlugin::getNavigationBadgesVisibility(Resources::CollectionResource)) { + if (! BoltPlugin::getNavigationBadgesVisibility(static::class)) { return null; } @@ -42,17 +41,17 @@ public static function getNavigationBadge(): ?string public static function getModelLabel(): string { - return __('Collection'); + return __('zeus-bolt::collection.label'); } public static function getPluralModelLabel(): string { - return __('Collections'); + return __('zeus-bolt::collection.navigation_label'); } public static function getNavigationLabel(): string { - return __('Collections'); + return __('zeus-bolt::collection.navigation_label'); } public static function form(Form $form): Form @@ -61,14 +60,18 @@ public static function form(Form $form): Form ->schema([ TextInput::make('name') ->live(onBlur: true) - ->label(__('Collections Name'))->required()->maxLength(255)->columnSpan(2), + ->label(__('zeus-bolt::collection.name')) + ->required() + ->maxLength(255) + ->columnSpan(2), + Repeater::make('values') ->grid([ 'default' => 1, 'md' => 2, 'lg' => 3, ]) - ->label(__('Collections Values')) + ->label(__('zeus-bolt::collection.values')) ->columnSpan(2) ->columns(1) ->schema([ @@ -79,11 +82,18 @@ public static function form(Form $form): Form $set('itemKey', $get('itemValue')); } }) - ->required()->label(__('Value'))->hint(__('what the user will see')), + ->required() + ->label(__('zeus-bolt::collection.value')) + ->hint(__('zeus-bolt::collection.value_help')), + TextInput::make('itemKey') ->live(onBlur: true) - ->required()->label(__('Key'))->hint(__('what store in the form')), - Toggle::make('itemIsDefault')->label(__('selected by default')), + ->required() + ->label(__('zeus-bolt::collection.key')) + ->hint(__('zeus-bolt::collection.key_help')), + + Toggle::make('itemIsDefault') + ->label(__('zeus-bolt::collection.default')), ]), ]); } @@ -93,14 +103,14 @@ public static function table(Table $table): Table return $table ->columns([ TextColumn::make('name') - ->label(__('Collections Name')) + ->label(__('zeus-bolt::collection.name')) ->searchable() ->sortable() ->toggleable(), TextColumn::make('values-list') ->badge() ->separator(',') - ->label(__('Collections Values')) + ->label(__('zeus-bolt::collection.values')) ->searchable(['values']) ->toggleable(), ]) diff --git a/src/Filament/Resources/FormResource.php b/src/Filament/Resources/FormResource.php index ac697685..36e05164 100644 --- a/src/Filament/Resources/FormResource.php +++ b/src/Filament/Resources/FormResource.php @@ -31,7 +31,6 @@ use LaraZeus\Bolt\BoltPlugin; use LaraZeus\Bolt\Concerns\HasOptions; use LaraZeus\Bolt\Concerns\Schemata; -use LaraZeus\Bolt\Enums\Resources; use LaraZeus\Bolt\Facades\Bolt; use LaraZeus\Bolt\Filament\Actions\ReplicateFormAction; use LaraZeus\Bolt\Filament\Resources\FormResource\Pages; @@ -60,7 +59,7 @@ public static function getModel(): string public static function getNavigationBadge(): ?string { - if (! BoltPlugin::getNavigationBadgesVisibility(Resources::FormResource)) { + if (! BoltPlugin::getNavigationBadgesVisibility(static::class)) { return null; } @@ -69,17 +68,17 @@ public static function getNavigationBadge(): ?string public static function getModelLabel(): string { - return __('Form'); + return __('zeus-bolt::forms.label'); } public static function getPluralModelLabel(): string { - return __('Forms'); + return __('zeus-bolt::forms.plural_label'); } public static function getNavigationLabel(): string { - return __('Forms'); + return __('zeus-bolt::forms.navigation_label'); } public static function infolist(Infolist $infolist): Infolist @@ -88,25 +87,25 @@ public static function infolist(Infolist $infolist): Infolist ->schema([ Section::make()->schema([ TextEntry::make('name') - ->label(__('name')), + ->label(__('zeus-bolt::forms.options.tabs.title.name')), ListEntry::make('items') ->visible(fn (ZeusForm $record) => $record->extensions !== null) - ->heading(__('Form Links')) + ->heading(__('zeus-bolt::forms.options.tabs.title.links')) ->list() ->state(fn ($record) => $record->slug_url), TextEntry::make('slug') - ->label(__('slug')) + ->label(__('zeus-bolt::forms.options.tabs.title.slug')) ->url(fn (ZeusForm $record) => route('bolt.form.show', ['slug' => $record->slug])) ->visible(fn (ZeusForm $record) => $record->extensions === null) ->icon('heroicon-o-arrow-top-right-on-square') ->openUrlInNewTab(), TextEntry::make('description') - ->label(__('description')), + ->label(__('zeus-bolt::forms.options.tabs.details.description')), IconEntry::make('is_active') - ->label(__('is active')) + ->label(__('zeus-bolt::forms.options.tabs.display.is_active')) ->icon(fn (string $state): string => match ($state) { '0' => 'clarity-times-circle-solid', default => 'clarity-check-circle-line', @@ -118,10 +117,10 @@ public static function infolist(Infolist $infolist): Infolist }), TextEntry::make('start_date') - ->label(__('start date')) + ->label(__('zeus-bolt::forms.options.tabs.advanced.start_date')) ->dateTime(), TextEntry::make('end_date') - ->label(__('end date')) + ->label(__('zeus-bolt::forms.options.tabs.advanced.end_date')) ->dateTime(), ]) ->columns(), @@ -151,14 +150,50 @@ public static function table(Table $table): Table return $table ->reorderable('ordering') ->columns([ - TextColumn::make('id')->sortable()->label(__('Form ID'))->toggleable(isToggledHiddenByDefault: true), - TextColumn::make('name')->searchable()->sortable()->label(__('Form Name'))->toggleable(), - TextColumn::make('category.name')->searchable()->label(__('Category'))->sortable()->toggleable(), - IconColumn::make('is_active')->boolean()->label(__('Is Active'))->sortable()->toggleable(), - TextColumn::make('start_date')->dateTime()->searchable()->sortable()->label(__('Start Date'))->toggleable(isToggledHiddenByDefault: true), - TextColumn::make('end_date')->dateTime()->searchable()->sortable()->label(__('End Date'))->toggleable(isToggledHiddenByDefault: true), - IconColumn::make('responses_exists')->boolean()->exists('responses')->label(__('Responses Exists'))->sortable()->toggleable()->searchable(false), - TextColumn::make('responses_count')->counts('responses')->label(__('Responses Count'))->sortable()->toggleable()->searchable(false), + TextColumn::make('id') + ->sortable() + ->label(__('zeus-bolt::forms.form_id')) + ->toggleable(isToggledHiddenByDefault: true), + TextColumn::make('name') + ->searchable() + ->sortable() + ->label(__('zeus-bolt::forms.options.tabs.title.name')) + ->toggleable(), + TextColumn::make('category.name') + ->searchable() + ->label(__('zeus-bolt::forms.options.tabs.title.category.label')) + ->sortable() + ->toggleable(), + IconColumn::make('is_active') + ->boolean() + ->label(__('zeus-bolt::forms.options.tabs.display.is_active')) + ->sortable() + ->toggleable(), + TextColumn::make('start_date') + ->dateTime() + ->searchable() + ->sortable() + ->label(__('zeus-bolt::forms.options.tabs.advanced.start_date')) + ->toggleable(isToggledHiddenByDefault: true), + TextColumn::make('end_date') + ->dateTime() + ->searchable() + ->sortable() + ->label(__('zeus-bolt::forms.options.tabs.advanced.end_date')) + ->toggleable(isToggledHiddenByDefault: true), + IconColumn::make('responses_exists') + ->boolean() + ->exists('responses') + ->label(__('zeus-bolt::forms.responses_exists')) + ->sortable() + ->toggleable() + ->searchable(false), + TextColumn::make('responses_count') + ->counts('responses') + ->label(__('zeus-bolt::forms.responses_count')) + ->sortable() + ->toggleable() + ->searchable(false), ]) ->actions(static::getActions()) ->filters([ @@ -166,16 +201,16 @@ public static function table(Table $table): Table Filter::make('is_active') ->toggle() ->query(fn (Builder $query): Builder => $query->where('is_active', true)) - ->label(__('Is Active')), + ->label(__('zeus-bolt::forms.options.tabs.display.is_active')), Filter::make('not_active') ->toggle() ->query(fn (Builder $query): Builder => $query->where('is_active', false)) - ->label(__('Inactive')), + ->label(__('zeus-bolt::forms.options.tabs.display.inactive')), SelectFilter::make('category_id') ->options(BoltPlugin::getModel('Category')::pluck('name', 'id')) - ->label(__('Category')), + ->label(__('zeus-bolt::forms.options.tabs.title.category.label')), ]) ->bulkActions([ DeleteBulkAction::make(), @@ -245,9 +280,9 @@ public static function getActions(): array ActionGroup::make([ Action::make('entries') ->color('warning') - ->label(__('Entries')) + ->label(__('zeus-bolt::forms.entries')) ->icon('clarity-data-cluster-line') - ->tooltip(__('view all entries')) + ->tooltip(__('zeus-bolt::forms.view_all_entries')) ->url(fn (ZeusForm $record): string => FormResource::getUrl('report', ['record' => $record])), ]) ->dropdown(false), @@ -257,9 +292,9 @@ public static function getActions(): array if (Bolt::hasPro()) { $advancedActions[] = Action::make('prefilledLink') - ->label(__('Prefilled Link')) + ->label(__('zeus-bolt::forms.actions.prefilled_link')) ->icon('iconpark-formone-o') - ->tooltip(__('Get Prefilled Link')) + ->tooltip(__('zeus-bolt::forms.actions.prefilled_link_tooltip')) ->visible(Bolt::hasPro()) ->url(fn (ZeusForm $record): string => FormResource::getUrl('prefilled', ['record' => $record])); } @@ -267,7 +302,7 @@ public static function getActions(): array if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) { //@phpstan-ignore-next-line $advancedActions[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link') - ->label(__('Short Link')) + ->label(__('zeus-bolt::forms.actions.short_link')) ->distUrl(fn (ZeusForm $record) => route('bolt.form.show', $record)); } diff --git a/src/Filament/Resources/FormResource/Pages/BrowseResponses.php b/src/Filament/Resources/FormResource/Pages/BrowseResponses.php index 26e03e9b..392e5fdc 100644 --- a/src/Filament/Resources/FormResource/Pages/BrowseResponses.php +++ b/src/Filament/Resources/FormResource/Pages/BrowseResponses.php @@ -32,7 +32,7 @@ public function table(Table $table): Table ->query(BoltPlugin::getModel('Response')::query()->where('form_id', $this->record->id)) ->columns([ ViewColumn::make('response') - ->label(__('Browse Entries')) + ->label(__('zeus-bolt::forms.browse_entries')) ->view('zeus::filament.resources.response-resource.pages.browse-entry'), ]) ->actions([ @@ -41,17 +41,17 @@ public function table(Table $table): Table ->filters([ SelectFilter::make('status') ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) - ->label(__('Status')), + ->label(__('zeus-bolt::forms.status')), ]); } public static function getNavigationLabel(): string { - return __('Browse Entries'); + return __('zeus-bolt::forms.browse_entries'); } public function getTitle(): string { - return __('Browse Entries'); + return __('zeus-bolt::forms.browse_entries'); } } diff --git a/src/Filament/Resources/FormResource/Pages/EditForm.php b/src/Filament/Resources/FormResource/Pages/EditForm.php index 7318d186..d42b18f5 100644 --- a/src/Filament/Resources/FormResource/Pages/EditForm.php +++ b/src/Filament/Resources/FormResource/Pages/EditForm.php @@ -26,12 +26,12 @@ public function areFormActionsSticky(): bool public function getTitle(): string | Htmlable { - return __('Edit Form'); + return __('zeus-bolt::forms.edit_form'); } public static function getNavigationLabel(): string { - return __('Edit Form'); + return __('zeus-bolt::forms.edit_form'); } protected function getHeaderActions(): array @@ -39,9 +39,9 @@ protected function getHeaderActions(): array return [ LocaleSwitcher::make(), Action::make('open') - ->label(__('Open')) + ->label(__('zeus-bolt::forms.actions.open')) ->icon('heroicon-o-arrow-top-right-on-square') - ->tooltip(__('open form')) + ->tooltip(__('zeus-bolt::forms.actions.open_tooltip')) ->color('warning') ->url(fn () => route('bolt.form.show', $this->record)) ->openUrlInNewTab(), diff --git a/src/Filament/Resources/FormResource/Pages/ListForms.php b/src/Filament/Resources/FormResource/Pages/ListForms.php index 99cb8471..9a2fdc84 100644 --- a/src/Filament/Resources/FormResource/Pages/ListForms.php +++ b/src/Filament/Resources/FormResource/Pages/ListForms.php @@ -20,9 +20,9 @@ protected function getHeaderActions(): array Actions\LocaleSwitcher::make(), Actions\CreateAction::make('create'), Action::make('open') - ->label(__('Open')) + ->label(__('zeus-bolt::forms.actions.open')) ->icon('heroicon-o-arrow-top-right-on-square') - ->tooltip(__('open all forms')) + ->tooltip(__('zeus-bolt::forms.actions.open_tooltip_all')) ->color('warning') ->url(fn () => route('bolt.forms.list')) ->openUrlInNewTab(), diff --git a/src/Filament/Resources/FormResource/Pages/ManageResponses.php b/src/Filament/Resources/FormResource/Pages/ManageResponses.php index c96c895d..fa3e8ac8 100644 --- a/src/Filament/Resources/FormResource/Pages/ManageResponses.php +++ b/src/Filament/Resources/FormResource/Pages/ManageResponses.php @@ -38,22 +38,22 @@ public function table(Table $table): Table ImageColumn::make('user.avatar') ->sortable(false) ->searchable(false) - ->label(__('Avatar')) + ->label(__('zeus-bolt::response.avatar')) ->circular() ->toggleable(), TextColumn::make('user.' . $getUserModel) - ->label(__('Name')) + ->label(__('zeus-bolt::response.name')) ->toggleable() ->sortable() - ->default(__('guest')) + ->default(__('zeus-bolt::response.guest')) ->searchable(), TextColumn::make('status') ->toggleable() ->sortable() ->badge() - ->label(__('status')) + ->label(__('zeus-bolt::response.status')) ->formatStateUsing(fn ($state) => __(str($state)->title()->toString())) ->colors(BoltPlugin::getModel('FormsStatus')::pluck('key', 'color')->toArray()) ->icons(BoltPlugin::getModel('FormsStatus')::pluck('key', 'icon')->toArray()) @@ -61,7 +61,7 @@ public function table(Table $table): Table ->searchable('status'), TextColumn::make('notes') - ->label(__('notes')) + ->label(__('zeus-bolt::response.notes')) ->sortable() ->searchable() ->toggleable(), @@ -82,7 +82,7 @@ public function table(Table $table): Table ->sortable() ->searchable() ->dateTime() - ->label(__('created at')) + ->label(__('zeus-bolt::response.notes')) ->toggleable(); return $table @@ -121,7 +121,7 @@ public function table(Table $table): Table Tables\Filters\TrashedFilter::make(), SelectFilter::make('status') ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) - ->label(__('Status')), + ->label(__('zeus-bolt::response.status')), ]) ->bulkActions([ Tables\Actions\DeleteBulkAction::make(), @@ -129,7 +129,7 @@ public function table(Table $table): Table Tables\Actions\ForceDeleteBulkAction::make(), Tables\Actions\ExportBulkAction::make() - ->label(__('Export Responses')) + ->label(__('zeus-bolt::response.export_responses')) ->exporter(ResponseExporter::class), ]) ->recordUrl( @@ -142,11 +142,11 @@ public function table(Table $table): Table public static function getNavigationLabel(): string { - return __('Entries Report'); + return __('zeus-bolt::response.entries_report'); } public function getTitle(): string { - return __('Entries Report'); + return __('zeus-bolt::response.entries_report'); } } diff --git a/src/Filament/Resources/FormResource/Pages/ViewForm.php b/src/Filament/Resources/FormResource/Pages/ViewForm.php index 3798a7f5..a82ffa27 100644 --- a/src/Filament/Resources/FormResource/Pages/ViewForm.php +++ b/src/Filament/Resources/FormResource/Pages/ViewForm.php @@ -21,12 +21,12 @@ class ViewForm extends ViewRecord public function getTitle(): string | Htmlable { - return __('View Form'); + return __('zeus-bolt::forms.view_form'); } public static function getNavigationLabel(): string { - return __('View Form'); + return __('zeus-bolt::forms.view_form'); } protected function getHeaderActions(): array @@ -34,9 +34,9 @@ protected function getHeaderActions(): array return [ LocaleSwitcher::make(), Action::make('open') - ->label(__('Open')) + ->label(__('zeus-bolt::forms.actions.open')) ->icon('heroicon-o-arrow-top-right-on-square') - ->tooltip(__('open form')) + ->tooltip(__('zeus-bolt::forms.actions.open_tooltip')) ->color('warning') ->url(fn () => route('bolt.form.show', $this->record)) ->visible(fn (Form $record) => $record->extensions === null) diff --git a/src/Filament/Resources/FormResource/Pages/ViewResponse.php b/src/Filament/Resources/FormResource/Pages/ViewResponse.php index bc0d6c1f..8a8a6089 100644 --- a/src/Filament/Resources/FormResource/Pages/ViewResponse.php +++ b/src/Filament/Resources/FormResource/Pages/ViewResponse.php @@ -40,17 +40,17 @@ protected function getHeaderActions(): array ->visible(function (): bool { return $this->response->form->extensions === null; }) - ->label(__('Set Status')) + ->label(__('zeus-bolt::response.set_status')) ->icon('heroicon-o-tag') ->form([ Select::make('status') - ->label(__('status')) + ->label(__('zeus-bolt::response.status')) ->default(fn () => $this->response->status) ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) ->required(), Textarea::make('notes') ->default(fn () => $this->response->notes) - ->label(__('Notes')), + ->label(__('zeus-bolt::response.notes')), ]) ->action(function (array $data): void { $this->response->status = $data['status']; @@ -62,7 +62,7 @@ protected function getHeaderActions(): array public function getTitle(): string | Htmlable { - return __('view response #') . $this->response->id; + return __('zeus-bolt::response.view_response_number') . $this->response->id; } public function getBreadcrumbs(): array @@ -70,8 +70,8 @@ public function getBreadcrumbs(): array return [ FormResource::getUrl() => FormResource::getBreadcrumb(), FormResource::getUrl('view', ['record' => $this->record->slug]) => $this->record->name, - FormResource::getUrl('report', ['record' => $this->record->slug]) => __('Entries Report'), - __('view the entry'), + FormResource::getUrl('report', ['record' => $this->record->slug]) => __('zeus-bolt::response.entries_report'), + __('zeus-bolt::response.view_the_entry'), ]; } } diff --git a/src/Filament/Resources/FormResource/Widgets/FormOverview.php b/src/Filament/Resources/FormResource/Widgets/FormOverview.php index 5f8d6629..e2bd1fe7 100644 --- a/src/Filament/Resources/FormResource/Widgets/FormOverview.php +++ b/src/Filament/Resources/FormResource/Widgets/FormOverview.php @@ -13,9 +13,9 @@ class FormOverview extends BaseWidget protected function getStats(): array { return [ - Stat::make('fields', $this->record->fields()->count())->label(__('Fields')), - Stat::make('responses', $this->record->responses()->count())->label(__('Responses')), - Stat::make('fields_responses', $this->record->fieldsResponses()->count())->label(__('Fields Responses')), + Stat::make('fields', $this->record->fields()->count())->label(__('zeus-bolt::forms.widgets.fields_label')), + Stat::make('responses', $this->record->responses()->count())->label(__('zeus-bolt::forms.widgets.responses_label')), + Stat::make('fields_responses', $this->record->fieldsResponses()->count())->label(__('zeus-bolt::forms.widgets.fields_responses')), ]; } } diff --git a/src/Filament/Resources/FormResource/Widgets/ResponsesPerFields.php b/src/Filament/Resources/FormResource/Widgets/ResponsesPerFields.php index 3a152a23..c7c64912 100644 --- a/src/Filament/Resources/FormResource/Widgets/ResponsesPerFields.php +++ b/src/Filament/Resources/FormResource/Widgets/ResponsesPerFields.php @@ -45,7 +45,7 @@ protected function getType(): string public function getHeading(): string { - return __('Responses Entries'); + return __('zeus-bolt::forms.widgets.responses_entries'); } protected function getData(): array @@ -67,7 +67,7 @@ protected function getData(): array return [ 'datasets' => [ [ - 'label' => __('entries per month'), + 'label' => __('zeus-bolt::forms.widgets.entries_per_month'), 'data' => $dataset, 'backgroundColor' => '#8A8AFF', 'borderColor' => '#ffffff', diff --git a/src/Filament/Resources/FormResource/Widgets/ResponsesPerMonth.php b/src/Filament/Resources/FormResource/Widgets/ResponsesPerMonth.php index 2caf01bd..15615d40 100644 --- a/src/Filament/Resources/FormResource/Widgets/ResponsesPerMonth.php +++ b/src/Filament/Resources/FormResource/Widgets/ResponsesPerMonth.php @@ -12,7 +12,7 @@ class ResponsesPerMonth extends ChartWidget { public Form $record; - protected int | string | array $columnSpan = 'full'; + protected int|string|array $columnSpan = 'full'; protected static ?string $maxHeight = '300px'; @@ -26,37 +26,32 @@ protected function getType(): string protected function getFilters(): ?array { return [ - 'per_day' => __('Per Day'), - 'per_month' => __('Per month'), - 'per_year' => __('Per year'), + 'per_day' => __('zeus-bolt::forms.widgets.per_day'), + 'per_month' => __('zeus-bolt::forms.widgets.per_month'), + 'per_year' => __('zeus-bolt::forms.widgets.per_year'), ]; } public function getHeading(): string { - return __('Responses Count'); + return __('zeus-bolt::forms.widgets.responses_count'); } protected function getData(): array { - $label = null; - $data = Trend::model(BoltPlugin::getModel('Response')) ->between( start: now()->startOfYear(), end: now()->endOfYear(), ); - if ($this->filter == 'per_day') { - $label = __('Per day'); - $data = $data->perDay(); - } elseif ($this->filter == 'per_month') { - $label = __('Per month'); - $data = $data->perMonth(); - } elseif ($this->filter == 'per_year') { - $label = __('Per year'); - $data = $data->perYear(); - } + $data = match ($this->filter) { + 'per_day' => $data->perDay(), + 'per_month' => $data->perMonth(), + default => $data->perYear() + }; + + $label = __('zeus-bolt::forms.widgets.'.$this->filter); $data = $data->count(); @@ -64,10 +59,10 @@ protected function getData(): array 'datasets' => [ [ 'label' => $label, - 'data' => $data->map(fn (TrendValue $value) => $value->aggregate), + 'data' => $data->map(fn(TrendValue $value) => $value->aggregate), ], ], - 'labels' => $data->map(fn (TrendValue $value) => $value->date), + 'labels' => $data->map(fn(TrendValue $value) => $value->date), ]; } } diff --git a/src/Filament/Resources/FormResource/Widgets/ResponsesPerStatus.php b/src/Filament/Resources/FormResource/Widgets/ResponsesPerStatus.php index 8a93dbc9..fb5c1c79 100644 --- a/src/Filament/Resources/FormResource/Widgets/ResponsesPerStatus.php +++ b/src/Filament/Resources/FormResource/Widgets/ResponsesPerStatus.php @@ -40,7 +40,7 @@ class ResponsesPerStatus extends ChartWidget public function getHeading(): string { - return __('Responses Status'); + return __('zeus-bolt::forms.widgets.responses_status'); } protected function getData(): array @@ -62,7 +62,7 @@ protected function getData(): array return [ 'datasets' => [ [ - 'label' => __('entries per month'), + 'label' => __('zeus-bolt::forms.widgets.entries_per_month_desc'), 'data' => $dataset, 'backgroundColor' => $statuses->pluck('chartColor'), 'borderColor' => '#ffffff', diff --git a/src/Livewire/FillForms.php b/src/Livewire/FillForms.php index 5ba37154..4e9852e0 100644 --- a/src/Livewire/FillForms.php +++ b/src/Livewire/FillForms.php @@ -139,7 +139,7 @@ public function render(): View { if (! $this->inline) { seo() - ->title($this->zeusForm->name . ' - ' . __('Forms') . ' - ' . config('zeus.site_title', 'Laravel')) + ->title($this->zeusForm->name . ' - ' . __('zeus-bolt::forms.forms') . ' - ' . config('zeus.site_title', 'Laravel')) ->description($this->zeusForm->description . ' - ' . config('zeus.site_description') . ' ' . config('zeus.site_title')) ->site(config('zeus.site_title', 'Laravel')) ->rawTag('favicon', '') diff --git a/src/Livewire/ListEntries.php b/src/Livewire/ListEntries.php index 66a16b76..98944e60 100644 --- a/src/Livewire/ListEntries.php +++ b/src/Livewire/ListEntries.php @@ -34,17 +34,19 @@ public function table(Table $table): Table Split::make([ TextColumn::make('status') ->badge() - ->label(__('status')) + ->label(__('zeus-bolt::forms.status')) ->colors(config('zeus-bolt.models.FormsStatus')::pluck('key', 'color')->toArray()) ->icons(config('zeus-bolt.models.FormsStatus')::pluck('key', 'icon')->toArray()) ->grow(false), TextColumn::make('form.name') ->searchable('name') - ->label(__('Form Name')) + ->label(__('zeus-bolt::forms.options.tabs.title.name')) ->url(fn (Response $record): string => route('bolt.entry.show', $record)), ]), Stack::make([ - TextColumn::make('updated_at')->label(__('Updated At'))->dateTime(), + TextColumn::make('updated_at') + ->label(__('zeus-bolt::forms.updated_at')) + ->dateTime(), ]), ]); } @@ -52,8 +54,8 @@ public function table(Table $table): Table public function render(): View { seo() - ->title(__('My Responses') . ' ' . config('zeus.site_title', 'Laravel')) - ->description(__('My Responses') . ' ' . config('zeus.site_description', 'Laravel')) + ->title(__('zeus-bolt::response.my_responses') . ' ' . config('zeus.site_title', 'Laravel')) + ->description(__('zeus-bolt::response.my_responses') . ' ' . config('zeus.site_description', 'Laravel')) ->site(config('zeus.site_title', 'Laravel')) ->rawTag('favicon', '') ->rawTag('') diff --git a/src/Livewire/ListForms.php b/src/Livewire/ListForms.php index 9e23812b..e425836f 100644 --- a/src/Livewire/ListForms.php +++ b/src/Livewire/ListForms.php @@ -11,8 +11,8 @@ public function render(): View { seo() ->site(config('zeus.site_title', 'Laravel')) - ->title(__('Forms') . ' - ' . config('zeus.site_title')) - ->description(__('Forms') . ' - ' . config('zeus.site_description') . ' ' . config('zeus.site_title')) + ->title(__('zeus-bolt::forms.forms') . ' - ' . config('zeus.site_title')) + ->description(__('zeus-bolt::forms.forms') . ' - ' . config('zeus.site_description') . ' ' . config('zeus.site_title')) ->rawTag('favicon', '') ->rawTag('') ->withUrl() diff --git a/src/Livewire/ShowEntry.php b/src/Livewire/ShowEntry.php index b9a013df..2e095319 100644 --- a/src/Livewire/ShowEntry.php +++ b/src/Livewire/ShowEntry.php @@ -24,8 +24,8 @@ public function mount(int $responseID): void public function render(): View { seo() - ->title(__('Show entry') . ' #' . $this->response->id . ' - ' . config('zeus.site_title', 'Laravel')) - ->description(__('Show entry') . ' - ' . config('zeus.site_description', 'Laravel')) + ->title(__('zeus-bolt::response.show_entry') . ' #' . $this->response->id . ' - ' . config('zeus.site_title', 'Laravel')) + ->description(__('zeus-bolt::response.show_entry') . ' - ' . config('zeus.site_description', 'Laravel')) ->site(config('zeus.site_title', 'Laravel')) ->rawTag('favicon', '') ->rawTag('') diff --git a/src/Mail/FormSubmission.php b/src/Mail/FormSubmission.php index 38bec176..d1d11b4f 100644 --- a/src/Mail/FormSubmission.php +++ b/src/Mail/FormSubmission.php @@ -36,7 +36,7 @@ public function __construct(Form $form, Response $response) public function envelope(): Envelope { return new Envelope( - subject: __('New Submission in') . ' ' . $this->form->name, + subject: __('zeus-bolt::response.new_submission_in') . ' ' . $this->form->name, ); } diff --git a/src/Models/Form.php b/src/Models/Form.php index 0cec8329..3b107bf6 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -75,7 +75,7 @@ protected static function booted(): void if (! $canDelete) { Notification::make() - ->title(__('Can\'t delete a form linked to an Extensions')) + ->title(__('zeus-bolt::forms.cant_delete')) ->danger() ->send(); diff --git a/src/Models/FormsStatus.php b/src/Models/FormsStatus.php index 96767ab9..1db2a5cf 100644 --- a/src/Models/FormsStatus.php +++ b/src/Models/FormsStatus.php @@ -22,7 +22,7 @@ public function getRows(): array return [ [ 'key' => 'NEW', - 'label' => __('New'), + 'label' => __('zeus-bolt::forms.status_labels.new'), 'description' => 'used when a new form created by the user or an employee', 'color' => 'success', 'chartColor' => '#21C55D', @@ -31,7 +31,7 @@ public function getRows(): array ], [ 'key' => 'OPEN', - 'label' => __('Open'), + 'label' => __('zeus-bolt::forms.status_labels.open'), 'description' => 'used when a new form created by the user or an employee', 'color' => 'success', 'chartColor' => '#21C55D', @@ -40,7 +40,7 @@ public function getRows(): array ], [ 'key' => 'CLOSE', - 'label' => __('closed'), + 'label' => __('zeus-bolt::forms.status_labels.closed'), 'description' => 'used when a new form created by the user or an employee', 'color' => 'danger', 'chartColor' => '#EF4444', diff --git a/src/Models/Response.php b/src/Models/Response.php index 7c6e1e0f..0a9c8ad3 100644 --- a/src/Models/Response.php +++ b/src/Models/Response.php @@ -49,7 +49,7 @@ protected static function booted(): void if (! $canDelete) { Notification::make() - ->title(__('Can\'t delete a form linked to an Extensions')) + ->title(__('zeus-bolt::forms.cant_delete')) ->danger() ->send();