diff --git a/composer.json b/composer.json index 9b5524c9..ddae8dcb 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "php": "^8.0", "codeat3/blade-clarity-icons": "^1.7", "filament/notifications": "^2.0", + "filament/spatie-laravel-translatable-plugin": "^2.0", "lara-zeus/core": "^2.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index aef66499..b493240b 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": "846d6b634127d9e8e6274e18c7c418dc", + "content-hash": "c2bd52e9c307f7890160a0b91029b5ee", "packages": [ { "name": "akaunting/laravel-money", @@ -203,16 +203,16 @@ }, { "name": "blade-ui-kit/blade-icons", - "version": "1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/blade-ui-kit/blade-icons.git", - "reference": "57a7c41e1e79e38aed029d3e6ae690b04344c99e" + "reference": "efa53eb8bfc674306a02304eb6186adb078c8815" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/blade-ui-kit/blade-icons/zipball/57a7c41e1e79e38aed029d3e6ae690b04344c99e", - "reference": "57a7c41e1e79e38aed029d3e6ae690b04344c99e", + "url": "https://api.github.com/repos/blade-ui-kit/blade-icons/zipball/efa53eb8bfc674306a02304eb6186adb078c8815", + "reference": "efa53eb8bfc674306a02304eb6186adb078c8815", "shasum": "" }, "require": { @@ -280,7 +280,7 @@ "type": "github" } ], - "time": "2022-05-11T12:38:11+00:00" + "time": "2022-08-24T13:35:42+00:00" }, { "name": "brick/math", @@ -1011,16 +1011,16 @@ }, { "name": "filament/filament", - "version": "v2.15.25", + "version": "v2.15.40", "source": { "type": "git", "url": "https://github.com/filamentphp/admin.git", - "reference": "8ccbc06f765a4f95922f526e61fe24d251f0dbc3" + "reference": "f406377d853c68a2d2f2e65ef76bf76d1a42fee8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/admin/zipball/8ccbc06f765a4f95922f526e61fe24d251f0dbc3", - "reference": "8ccbc06f765a4f95922f526e61fe24d251f0dbc3", + "url": "https://api.github.com/repos/filamentphp/admin/zipball/f406377d853c68a2d2f2e65ef76bf76d1a42fee8", + "reference": "f406377d853c68a2d2f2e65ef76bf76d1a42fee8", "shasum": "" }, "require": { @@ -1039,7 +1039,7 @@ "illuminate/session": "^8.6|^9.0", "illuminate/support": "^8.6|^9.0", "illuminate/view": "^8.6|^9.0", - "livewire/livewire": "^2.6", + "livewire/livewire": "^2.10.7", "php": "^8.0", "spatie/laravel-package-tools": "^1.9" }, @@ -1069,20 +1069,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2022-08-24T12:43:54+00:00" + "time": "2022-09-01T22:09:57+00:00" }, { "name": "filament/forms", - "version": "v2.15.25", + "version": "v2.15.40", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "455083c766406606d5d18f04d9bcf270f7d5144c" + "reference": "d2d3b5ea69a60802559477ac3befa583898f2b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/455083c766406606d5d18f04d9bcf270f7d5144c", - "reference": "455083c766406606d5d18f04d9bcf270f7d5144c", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/d2d3b5ea69a60802559477ac3befa583898f2b5b", + "reference": "d2d3b5ea69a60802559477ac3befa583898f2b5b", "shasum": "" }, "require": { @@ -1097,7 +1097,7 @@ "illuminate/support": "^8.6|^9.0", "illuminate/validation": "^8.6|^9.0", "illuminate/view": "^8.6|^9.0", - "livewire/livewire": "^2.6", + "livewire/livewire": "^2.10.7", "php": "^8.0", "spatie/laravel-package-tools": "^1.9" }, @@ -1127,20 +1127,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2022-08-24T12:43:52+00:00" + "time": "2022-09-01T22:09:48+00:00" }, { "name": "filament/notifications", - "version": "v2.15.25", + "version": "v2.15.40", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", - "reference": "a72331e19eec77e3068ce348db51470edccf4155" + "reference": "5f148469ec5466688b5fc01a23d48e64a6b88b1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/notifications/zipball/a72331e19eec77e3068ce348db51470edccf4155", - "reference": "a72331e19eec77e3068ce348db51470edccf4155", + "url": "https://api.github.com/repos/filamentphp/notifications/zipball/5f148469ec5466688b5fc01a23d48e64a6b88b1e", + "reference": "5f148469ec5466688b5fc01a23d48e64a6b88b1e", "shasum": "" }, "require": { @@ -1149,7 +1149,7 @@ "illuminate/contracts": "^8.6|^9.0", "illuminate/filesystem": "^8.6|^9.0", "illuminate/support": "^8.6|^9.0", - "livewire/livewire": "^2.6", + "livewire/livewire": "^2.10.7", "php": "^8.0", "spatie/laravel-package-tools": "^1.9" }, @@ -1176,20 +1176,66 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2022-08-22T22:07:12+00:00" + "time": "2022-09-01T22:09:39+00:00" + }, + { + "name": "filament/spatie-laravel-translatable-plugin", + "version": "v2.15.40", + "source": { + "type": "git", + "url": "https://github.com/filamentphp/spatie-laravel-translatable-plugin.git", + "reference": "f3510757908545315077e713047b3f6f18b53a7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filamentphp/spatie-laravel-translatable-plugin/zipball/f3510757908545315077e713047b3f6f18b53a7b", + "reference": "f3510757908545315077e713047b3f6f18b53a7b", + "shasum": "" + }, + "require": { + "ext-intl": "*", + "filament/filament": "self.version", + "illuminate/support": "^8.6|^9.0", + "php": "^8.0", + "spatie/laravel-translatable": "^5.0|^6.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Filament\\SpatieLaravelTranslatablePluginServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Filament\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Filament support for `spatie/laravel-translatable`.", + "homepage": "https://github.com/filamentphp/filament", + "support": { + "issues": "https://github.com/filamentphp/filament/issues", + "source": "https://github.com/filamentphp/filament" + }, + "time": "2022-08-31T10:18:23+00:00" }, { "name": "filament/support", - "version": "v2.15.25", + "version": "v2.15.40", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", - "reference": "e58fcffd982914fd203c0123bcc2439a7295e3c0" + "reference": "b6ea4ceea8e8fb965227f8f7a9e5ebb3ee879537" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/support/zipball/e58fcffd982914fd203c0123bcc2439a7295e3c0", - "reference": "e58fcffd982914fd203c0123bcc2439a7295e3c0", + "url": "https://api.github.com/repos/filamentphp/support/zipball/b6ea4ceea8e8fb965227f8f7a9e5ebb3ee879537", + "reference": "b6ea4ceea8e8fb965227f8f7a9e5ebb3ee879537", "shasum": "" }, "require": { @@ -1226,20 +1272,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2022-08-24T12:43:47+00:00" + "time": "2022-09-01T22:09:40+00:00" }, { "name": "filament/tables", - "version": "v2.15.25", + "version": "v2.15.40", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", - "reference": "081d70dab460ed2e3b4eff8c309bc2be20ad6344" + "reference": "a105a7153c6c7c5e28b115b16a2354a9d9fb0460" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/tables/zipball/081d70dab460ed2e3b4eff8c309bc2be20ad6344", - "reference": "081d70dab460ed2e3b4eff8c309bc2be20ad6344", + "url": "https://api.github.com/repos/filamentphp/tables/zipball/a105a7153c6c7c5e28b115b16a2354a9d9fb0460", + "reference": "a105a7153c6c7c5e28b115b16a2354a9d9fb0460", "shasum": "" }, "require": { @@ -1254,7 +1300,7 @@ "illuminate/filesystem": "^8.6|^9.0", "illuminate/support": "^8.6|^9.0", "illuminate/view": "^8.6|^9.0", - "livewire/livewire": "^2.6", + "livewire/livewire": "^2.10.7", "php": "^8.0", "spatie/invade": "^1.0", "spatie/laravel-package-tools": "^1.9" @@ -1282,7 +1328,7 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2022-08-24T12:43:46+00:00" + "time": "2022-09-01T22:09:55+00:00" }, { "name": "fruitcake/php-cors", @@ -1565,16 +1611,16 @@ }, { "name": "laravel/framework", - "version": "v9.26.1", + "version": "v9.27.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "1ccfb91afee7a351b09ba1f1b97739096a3ad1cf" + "reference": "27572f45120fd3977d92651a71d8c711a9aaa790" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/1ccfb91afee7a351b09ba1f1b97739096a3ad1cf", - "reference": "1ccfb91afee7a351b09ba1f1b97739096a3ad1cf", + "url": "https://api.github.com/repos/laravel/framework/zipball/27572f45120fd3977d92651a71d8c711a9aaa790", + "reference": "27572f45120fd3977d92651a71d8c711a9aaa790", "shasum": "" }, "require": { @@ -1741,29 +1787,30 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-08-23T19:00:07+00:00" + "time": "2022-08-30T13:34:43+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.2.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "09f0e9fb61829f628205b7c94906c28740ff9540" + "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/09f0e9fb61829f628205b7c94906c28740ff9540", - "reference": "09f0e9fb61829f628205b7c94906c28740ff9540", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/d78fd36ba031a1a695ea5a406f29996948d7011b", + "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b", "shasum": "" }, "require": { "php": "^7.3|^8.0" }, "require-dev": { - "pestphp/pest": "^1.18", - "phpstan/phpstan": "^0.12.98", - "symfony/var-dumper": "^5.3" + "nesbot/carbon": "^2.61", + "pestphp/pest": "^1.21.3", + "phpstan/phpstan": "^1.8.2", + "symfony/var-dumper": "^5.4.11" }, "type": "library", "extra": { @@ -1800,7 +1847,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-05-16T17:09:47+00:00" + "time": "2022-08-26T15:25:27+00:00" }, { "name": "league/commonmark", @@ -2451,16 +2498,16 @@ }, { "name": "nesbot/carbon", - "version": "2.61.0", + "version": "2.62.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6" + "reference": "7507aec3d626797ce2123cf6c6556683be22b5f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bdf4f4fe3a3eac4de84dbec0738082a862c68ba6", - "reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7507aec3d626797ce2123cf6c6556683be22b5f8", + "reference": "7507aec3d626797ce2123cf6c6556683be22b5f8", "shasum": "" }, "require": { @@ -2549,7 +2596,7 @@ "type": "tidelift" } ], - "time": "2022-08-06T12:41:24+00:00" + "time": "2022-08-28T19:48:05+00:00" }, { "name": "nette/schema", @@ -3360,18 +3407,99 @@ ], "time": "2022-06-28T14:29:26+00:00" }, + { + "name": "spatie/laravel-translatable", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-translatable.git", + "reference": "c4c2bef702738f26562b6dc37b66bdac545610e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/c4c2bef702738f26562b6dc37b66bdac545610e1", + "reference": "c4c2bef702738f26562b6dc37b66bdac545610e1", + "shasum": "" + }, + "require": { + "illuminate/database": "^9.0", + "illuminate/support": "^9.0", + "php": "^8.0", + "spatie/laravel-package-tools": "^1.11" + }, + "require-dev": { + "mockery/mockery": "^1.4", + "orchestra/testbench": "^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Translatable\\TranslatableServiceProvider" + ] + }, + "aliases": { + "Translatable": "Spatie\\Translatable\\Facades\\Translatable" + } + }, + "autoload": { + "psr-4": { + "Spatie\\Translatable\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Sebastian De Deyne", + "email": "sebastian@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A trait to make an Eloquent model hold translations", + "homepage": "https://github.com/spatie/laravel-translatable", + "keywords": [ + "eloquent", + "i8n", + "laravel-translatable", + "model", + "multilingual", + "spatie", + "translate" + ], + "support": { + "issues": "https://github.com/spatie/laravel-translatable/issues", + "source": "https://github.com/spatie/laravel-translatable/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-03-07T13:50:51+00:00" + }, { "name": "symfony/console", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "43fcb5c5966b43c56bcfa481368d90d748936ab8" + "reference": "7fccea8728aa2d431a6725b02b3ce759049fc84d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/43fcb5c5966b43c56bcfa481368d90d748936ab8", - "reference": "43fcb5c5966b43c56bcfa481368d90d748936ab8", + "url": "https://api.github.com/repos/symfony/console/zipball/7fccea8728aa2d431a6725b02b3ce759049fc84d", + "reference": "7fccea8728aa2d431a6725b02b3ce759049fc84d", "shasum": "" }, "require": { @@ -3438,7 +3566,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.1.3" + "source": "https://github.com/symfony/console/tree/v6.1.4" }, "funding": [ { @@ -3454,7 +3582,7 @@ "type": "tidelift" } ], - "time": "2022-07-22T14:17:57+00:00" + "time": "2022-08-26T10:32:31+00:00" }, { "name": "symfony/css-selector", @@ -3887,16 +4015,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "b03712c93759a81fc243ecc18ec4637958afebdb" + "reference": "18e0f106a32887bcebef757e5b39c88e39a08f20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b03712c93759a81fc243ecc18ec4637958afebdb", - "reference": "b03712c93759a81fc243ecc18ec4637958afebdb", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/18e0f106a32887bcebef757e5b39c88e39a08f20", + "reference": "18e0f106a32887bcebef757e5b39c88e39a08f20", "shasum": "" }, "require": { @@ -3907,8 +4035,11 @@ "require-dev": { "predis/predis": "~1.0", "symfony/cache": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", - "symfony/mime": "^5.4|^6.0" + "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4", + "symfony/mime": "^5.4|^6.0", + "symfony/rate-limiter": "^5.2|^6.0" }, "suggest": { "symfony/mime": "To use the file extension guesser" @@ -3939,7 +4070,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.1.3" + "source": "https://github.com/symfony/http-foundation/tree/v6.1.4" }, "funding": [ { @@ -3955,20 +4086,20 @@ "type": "tidelift" } ], - "time": "2022-07-27T15:50:51+00:00" + "time": "2022-08-19T14:27:04+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "0692bc185a1dbb54864686a1fc6785667279da70" + "reference": "2144c53a278254af57fa1e6f71427be656fab6f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/0692bc185a1dbb54864686a1fc6785667279da70", - "reference": "0692bc185a1dbb54864686a1fc6785667279da70", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/2144c53a278254af57fa1e6f71427be656fab6f4", + "reference": "2144c53a278254af57fa1e6f71427be656fab6f4", "shasum": "" }, "require": { @@ -4049,7 +4180,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.1.3" + "source": "https://github.com/symfony/http-kernel/tree/v6.1.4" }, "funding": [ { @@ -4065,20 +4196,20 @@ "type": "tidelift" } ], - "time": "2022-07-29T12:59:10+00:00" + "time": "2022-08-26T14:50:30+00:00" }, { "name": "symfony/mailer", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "b2db228a93278863d1567f90d7caf26922dbfede" + "reference": "55a7cb8f8518d35e2a039daaec6e1ee20509510e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/b2db228a93278863d1567f90d7caf26922dbfede", - "reference": "b2db228a93278863d1567f90d7caf26922dbfede", + "url": "https://api.github.com/repos/symfony/mailer/zipball/55a7cb8f8518d35e2a039daaec6e1ee20509510e", + "reference": "55a7cb8f8518d35e2a039daaec6e1ee20509510e", "shasum": "" }, "require": { @@ -4123,7 +4254,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.1.3" + "source": "https://github.com/symfony/mailer/tree/v6.1.4" }, "funding": [ { @@ -4139,20 +4270,20 @@ "type": "tidelift" } ], - "time": "2022-07-27T15:50:51+00:00" + "time": "2022-08-03T05:16:05+00:00" }, { "name": "symfony/mime", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "9c0247994fc6584da8591ba64b2bffaace9df87d" + "reference": "5d1de2d3c52f8ca469c488f4b9e007e9e9cee0b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/9c0247994fc6584da8591ba64b2bffaace9df87d", - "reference": "9c0247994fc6584da8591ba64b2bffaace9df87d", + "url": "https://api.github.com/repos/symfony/mime/zipball/5d1de2d3c52f8ca469c488f4b9e007e9e9cee0b3", + "reference": "5d1de2d3c52f8ca469c488f4b9e007e9e9cee0b3", "shasum": "" }, "require": { @@ -4204,7 +4335,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.1.3" + "source": "https://github.com/symfony/mime/tree/v6.1.4" }, "funding": [ { @@ -4220,7 +4351,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T13:46:29+00:00" + "time": "2022-08-19T14:27:04+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5113,16 +5244,16 @@ }, { "name": "symfony/string", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f35241f45c30bcd9046af2bb200a7086f70e1d6b" + "reference": "290972cad7b364e3befaa74ba0ec729800fb161c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f35241f45c30bcd9046af2bb200a7086f70e1d6b", - "reference": "f35241f45c30bcd9046af2bb200a7086f70e1d6b", + "url": "https://api.github.com/repos/symfony/string/zipball/290972cad7b364e3befaa74ba0ec729800fb161c", + "reference": "290972cad7b364e3befaa74ba0ec729800fb161c", "shasum": "" }, "require": { @@ -5178,7 +5309,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.1.3" + "source": "https://github.com/symfony/string/tree/v6.1.4" }, "funding": [ { @@ -5194,20 +5325,20 @@ "type": "tidelift" } ], - "time": "2022-07-27T15:50:51+00:00" + "time": "2022-08-12T18:05:43+00:00" }, { "name": "symfony/translation", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "b042e16087d298d08c1f013ff505d16c12a3b1be" + "reference": "45d0f5bb8df7255651ca91c122fab604e776af03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/b042e16087d298d08c1f013ff505d16c12a3b1be", - "reference": "b042e16087d298d08c1f013ff505d16c12a3b1be", + "url": "https://api.github.com/repos/symfony/translation/zipball/45d0f5bb8df7255651ca91c122fab604e776af03", + "reference": "45d0f5bb8df7255651ca91c122fab604e776af03", "shasum": "" }, "require": { @@ -5274,7 +5405,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.1.3" + "source": "https://github.com/symfony/translation/tree/v6.1.4" }, "funding": [ { @@ -5290,7 +5421,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T13:46:29+00:00" + "time": "2022-08-02T16:17:38+00:00" }, { "name": "symfony/translation-contracts", @@ -5916,16 +6047,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "13388f00956b1503577598873fffb5ae994b5737" + "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/13388f00956b1503577598873fffb5ae994b5737", - "reference": "13388f00956b1503577598873fffb5ae994b5737", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", + "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", "shasum": "" }, "require": { @@ -5939,15 +6070,19 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", + "bamarni/composer-bin-plugin": "^1.8.1", "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.8 || ^9.3.10" + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { "dev-master": "2.4-dev" } @@ -6011,7 +6146,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.0" + "source": "https://github.com/guzzle/psr7/tree/2.4.1" }, "funding": [ { @@ -6027,7 +6162,7 @@ "type": "tidelift" } ], - "time": "2022-06-20T21:43:11+00:00" + "time": "2022-08-28T14:45:39+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -6082,16 +6217,16 @@ }, { "name": "laravel/pint", - "version": "v1.1.1", + "version": "v1.1.2", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "118a55fc3a870f20ae111b7439f18bd20298d388" + "reference": "ebfe95b446e4395eba1eefb8615214fb55163165" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/118a55fc3a870f20ae111b7439f18bd20298d388", - "reference": "118a55fc3a870f20ae111b7439f18bd20298d388", + "url": "https://api.github.com/repos/laravel/pint/zipball/ebfe95b446e4395eba1eefb8615214fb55163165", + "reference": "ebfe95b446e4395eba1eefb8615214fb55163165", "shasum": "" }, "require": { @@ -6102,13 +6237,13 @@ "php": "^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.9.5", - "illuminate/view": "^9.22.1", - "laravel-zero/framework": "^9.1.2", + "friendsofphp/php-cs-fixer": "^3.10.0", + "illuminate/view": "^9.26.0", + "laravel-zero/framework": "^9.1.3", "mockery/mockery": "^1.5.0", "nunomaduro/larastan": "^2.1.12", - "nunomaduro/termwind": "^1.13.0", - "pestphp/pest": "^1.21.3" + "nunomaduro/termwind": "^1.14.0", + "pestphp/pest": "^1.22.0" }, "bin": [ "builds/pint" @@ -6144,7 +6279,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2022-08-02T15:02:55+00:00" + "time": "2022-08-30T15:28:20+00:00" }, { "name": "mockery/mockery", @@ -6610,16 +6745,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.16", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2593003befdcc10db5e213f9f28814f5aa8ac073" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2593003befdcc10db5e213f9f28814f5aa8ac073", - "reference": "2593003befdcc10db5e213f9f28814f5aa8ac073", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { @@ -6675,7 +6810,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.16" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -6683,7 +6818,7 @@ "type": "github" } ], - "time": "2022-08-20T05:26:47+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -6928,16 +7063,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.23", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "888556852e7e9bbeeedb9656afe46118765ade34" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/888556852e7e9bbeeedb9656afe46118765ade34", - "reference": "888556852e7e9bbeeedb9656afe46118765ade34", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -6966,7 +7101,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -7010,7 +7145,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { @@ -7022,7 +7157,7 @@ "type": "github" } ], - "time": "2022-08-22T14:01:36+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "pimple/pimple", @@ -8086,16 +8221,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb44e1cc6e557418387ad815780360057e40753e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", + "reference": "fb44e1cc6e557418387ad815780360057e40753e", "shasum": "" }, "require": { @@ -8107,7 +8242,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -8130,7 +8265,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" }, "funding": [ { @@ -8138,7 +8273,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-08-29T06:55:37+00:00" }, { "name": "sebastian/version", @@ -8611,16 +8746,16 @@ }, { "name": "symfony/yaml", - "version": "v6.1.3", + "version": "v6.1.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "cc48dd42ae1201abced04ae38284e23ce2d2d8f3" + "reference": "86ee4d8fa594ed45e40d86eedfda1bcb66c8d919" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/cc48dd42ae1201abced04ae38284e23ce2d2d8f3", - "reference": "cc48dd42ae1201abced04ae38284e23ce2d2d8f3", + "url": "https://api.github.com/repos/symfony/yaml/zipball/86ee4d8fa594ed45e40d86eedfda1bcb66c8d919", + "reference": "86ee4d8fa594ed45e40d86eedfda1bcb66c8d919", "shasum": "" }, "require": { @@ -8665,7 +8800,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.1.3" + "source": "https://github.com/symfony/yaml/tree/v6.1.4" }, "funding": [ { @@ -8681,7 +8816,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T14:45:06+00:00" + "time": "2022-08-02T16:17:38+00:00" }, { "name": "theseer/tokenizer", @@ -8735,16 +8870,16 @@ }, { "name": "zbateson/mail-mime-parser", - "version": "2.2.1", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/zbateson/mail-mime-parser.git", - "reference": "24955de7ec352b3258c1d4551efd21202cb8710c" + "reference": "318cd809afebe48e8fb41625b05b25470fb3fa86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/24955de7ec352b3258c1d4551efd21202cb8710c", - "reference": "24955de7ec352b3258c1d4551efd21202cb8710c", + "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/318cd809afebe48e8fb41625b05b25470fb3fa86", + "reference": "318cd809afebe48e8fb41625b05b25470fb3fa86", "shasum": "" }, "require": { @@ -8804,7 +8939,7 @@ "type": "github" } ], - "time": "2022-02-22T21:35:59+00:00" + "time": "2022-09-01T15:59:13+00:00" }, { "name": "zbateson/mb-wrapper", diff --git a/config/zeus-bolt.php b/config/zeus-bolt.php index bd0280e6..89e7de2a 100644 --- a/config/zeus-bolt.php +++ b/config/zeus-bolt.php @@ -38,4 +38,9 @@ 'disk' => 'public', 'directory' => 'logos', ], + + /** + * available locales, this currently used only in tags manager. + */ + 'translatable_Locales' => ['en', 'ar'], ]; diff --git a/database/migrations/create_forms_table.php.stub b/database/migrations/create_forms_table.php.stub index 316b07b0..5897700f 100644 --- a/database/migrations/create_forms_table.php.stub +++ b/database/migrations/create_forms_table.php.stub @@ -16,11 +16,11 @@ class CreateFormsTable extends Migration Schema::create('forms', function (Blueprint $table) { $table->id(); $table->foreignId('user_id')->constrained('users'); - $table->foreignId('category_id')->constrained('categories'); + $table->foreignId('category_id')->nullable()->constrained('categories'); $table->text('name'); $table->string('slug'); $table->string('layout'); - $table->integer('ordering'); + $table->integer('ordering')->default(1); $table->boolean('is_active'); $table->text('desc')->nullable(); $table->longText('details')->nullable(); diff --git a/resources/lang/ar.json b/resources/lang/ar.json index db88226e..a1736641 100644 --- a/resources/lang/ar.json +++ b/resources/lang/ar.json @@ -85,7 +85,7 @@ "User must be logged in or create an account before can submit a new entry": "اجبار المستخدمين على تسجيل الدخول قبل تعبئة النموذج", "One Entry Per User": "ادخال واحد فقط لكل مستخدم", "to check if the user already submitted an entry in this form": "يتم منع المستخدمين من اكمال النموذج عدة مرات", - "Sections To Pages": "عرض الاقسام كصفحات", + "Show As Wizard": "عرض كخظوات", "instead of showing all section in one page, separate them in multiple pages with next and previous buttons": "عوضا عن عرض كافة الاقسام في صفحة واحدة هذا الخيار يعرض النموذج في صفحات منفضلة مع عرض التالي والسابق", "Form Name": "عنوان النموذج", "Form Slug": "الرابط المختصر", diff --git a/resources/views/filament/resources/response-resource/components/view-responses.blade.php b/resources/views/filament/resources/response-resource/components/view-responses.blade.php new file mode 100644 index 00000000..d7900a15 --- /dev/null +++ b/resources/views/filament/resources/response-resource/components/view-responses.blade.php @@ -0,0 +1,43 @@ + +
+ +
+ + User Details +

+ {{ __('By') }}: + {{ ($getRecord()->user->name) ?? '' }} +

+

+ {{ __('created at') }}: + {{ $getRecord()->created_at->format('Y.m/d') }}-{{ $getRecord()->created_at->format('h:i a') }} +

+
+ + Form Details +

{{ ($getRecord()->form->name) ?? '' }}

+

{{ ($getRecord()->form->desc) ?? '' }}

+
+
+ + + Respons Details + @foreach($getRecord()->fieldsResponses as $resp) +
+

{{ $resp->field->name }}

+

{{ $resp->response ?? ''}}

+ +
+ @endforeach +
+
+
diff --git a/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php b/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php index 2cfbc46f..1d0596f0 100644 --- a/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php +++ b/resources/views/filament/resources/response-resource/pages/browse-responses.blade.php @@ -1,53 +1,40 @@ - - @forelse ($rows as $row) - -
-

- {{ __('From') }}: - {{ ($row->user->name) ?? '' }} -

-

- {{ __('created at') }}: - {{ $row->created_at->format('Y.m/d') }}-{{ $row->created_at->format('h:i a') }} -

-
-
+ @forelse ($rows as $row) +
+ + User Details +

+ {{ __('By') }}: + {{ ($row->user->name) ?? '' }} +

+

+ {{ __('created at') }}: + {{ $row->created_at->format('Y.m/d') }}-{{ $row->created_at->format('h:i a') }} +

+
+ + Form Details +

{{ ($row->form->name) ?? '' }}

+

{{ ($row->form->desc) ?? '' }}

+
+
+ Respons Details +
+ @foreach($row->fieldsResponses as $resp) + +

{{ $resp->field->name }}

+

{{ $resp->response ?? ''}}

+
+ @endforeach +
+ @empty +
+ + No responses found... +
+ @endforelse -
-
- @foreach($fields->where('inShow',true) as $field) -
- {{ $field['label'] }}: - @if(\Illuminate\Support\Str::contains($field['id'],'.')) - {{ ($flattenedRows[$loop->parent->index.'.'.$field['id']]) ?? '' }} - @elseif(isset($field['listAtt'])) - {!! $row->{$field['listAtt']} !!} - @elseif(isset($row->{$field['id']})) - {{ $row->{$field['id']} }} - @else - {{ $field['id'] ?? '' }} - @endif -
- @endforeach - @foreach($row->fieldsResponses as $resp) -
- {{ $resp->field->name }}:{{ $resp->response ?? ''}} -
- @endforeach -
-
- @empty -
- - No responses found... -
- @endforelse - - @if ($rows->hasPages()) - - {{ $rows->links() }} - - @endif -
+ @if ($rows->hasPages()) + {{ $rows->links() }} + @endif
diff --git a/src/Filament/Resources/BoltResource.php b/src/Filament/Resources/BoltResource.php new file mode 100644 index 00000000..0025a3f5 --- /dev/null +++ b/src/Filament/Resources/BoltResource.php @@ -0,0 +1,16 @@ +schema([ - Tabs::make('Name') - ->tabs([ - Tabs\Tab::make('form-options')->label(__('Form Options')) - ->schema([ - TextInput::make('name')->required()->maxLength(255)->columnSpan(2)->reactive() - ->label(__('Form Name')) - ->afterStateUpdated(function (\Closure $set, $state, $context) { - if ($context === 'edit') { - return; - } - $set('slug', Str::slug($state)); - }), - TextInput::make('slug')->required()->maxLength(255)->columnSpan(2)->rules([ 'alpha_dash' ])->unique(ignoreRecord: true)->label(__('Form Slug')), - TextInput::make('ordering')->required()->columnSpan(1)->label(__('Form Order')), - ])->columns(5), - Tabs\Tab::make('Options') - ->schema([ - Select::make('category_id') - ->label(__('Category')) - ->helperText(__('optional, organize your forms into categories')) - ->options(\LaraZeus\Bolt\Models\Category::pluck('name', 'id')), - Grid::make()->schema([ - Placeholder::make('form-dates')->label('Form Dates')->content(__('optional, specify when the form will be active and receiving new entries'))->columnSpan(2), - DateTimePicker::make('start_date')->label(__('Start Date')), - DateTimePicker::make('end_date')->label(__('End Date')), - ])->columns(2), - Grid::make()->schema([ - TextInput::make('options.emails-notification') - ->label(__('Emails Notifications')) - ->helperText(__('optional, enter the emails you want to receive notification when ever you got a new entry')), - TextInput::make('options.web-hook') - ->label(__('enter webHook URL')) - ->helperText(__('Send the form data to a webHook')), - ])->columns(2), - ]), - Tabs\Tab::make('Text') - ->schema([ - Textarea::make('desc')->label(__('Form Description'))->helperText(__('shown under the title of the form and used in SEO')), - RichEditor::make('details')->label(__('Form Details'))->helperText(__('a highlighted section above the form, to show some instructions or more details')), - RichEditor::make('options.confirmation-message')->label(__('Confirmation Message'))->helperText(__('optional, show a massage whenever any one submit a new entery')), - ]), - Tabs\Tab::make('Settings') - ->schema([ - Toggle::make('is_active')->label(__('is_active'))->helperText(__('Activate the form and let users start submissions')), - Toggle::make('options.require-login')->label(__('require Login'))->helperText(__('User must be logged in or create an account before can submit a new entry')), - 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')), - Toggle::make('options.sections-to-pages')->label(__('Sections To Pages'))->helperText(__('instead of showing all section in one page, separate them in multiple pages with next and previous buttons')), - ])->columns(2), - ])->columnSpan(2), - - Hidden::make('user_id')->default(auth()->user()->id ?? null), - Hidden::make('layout')->default(1), - - Card::make() - ->schema([ - Placeholder::make('Sections-title')->label(__('Sections'))->helperText(__('sections are here to group the fields, and you can display it as pages from the Form options. if you have one section, it wont show in the form')), - ]), - - Repeater::make('sections') - ->label('') - ->schema([ - TextInput::make('name')->required()->lazy()->label(__('Section Name')), - Placeholder::make('Fields')->label(__('Section Fields')), - Repeater::make('fields') - ->schema([ - TextInput::make('name')->required()->lazy()->label(__('Field Name')), - Select::make('type') - ->required() - ->options(Bolt::availableFields()->pluck('title', 'class')) - ->reactive() - ->default('\LaraZeus\Bolt\Fields\Classes\TextInput') - ->label(__('Field Type')), - Fieldset::make('Options') - ->label(__('Field Options')) - ->visible(function (\Closure $get) { - $class = $get('type'); - return ( new $class )->hasOptions(); - }) - ->schema(function (\Closure $get) { - return $get('type')::getOptions(); - }), - ]) - ->relationship() - ->label('') - ->orderable('ordering') - ->cloneable() - ->collapsible() - ->grid([ - 'default' => 1, - 'md' => 2, - ]) - ->label('') - ->itemLabel(fn(array $state) : ?string => $state['name'] ?? null) - ->createItemButtonLabel(__('Add field')), - ]) - ->relationship() - ->orderable('ordering') - ->createItemButtonLabel(__('Add Section')) - ->cloneable() - ->collapsible() - ->itemLabel(fn(array $state) : ?string => $state['name'] ?? null) - ->columnSpan(2), - ]); + return $form->schema(static::getMainFormSchema()); } public static function table(Table $table) : Table @@ -180,10 +64,11 @@ public static function table(Table $table) : Table ->columns([ TextColumn::make('name')->searchable()->sortable()->label(__('Form Name')), TextColumn::make('category.name')->label(__('Category'))->sortable(), - TextColumn::make('ordering')->label(__('Ordering'))->sortable(), BooleanColumn::make('is_active')->label(__('Is Active'))->sortable(), TextColumn::make('start_date')->dateTime()->searchable()->sortable()->label(__('Start Date')), TextColumn::make('end_date')->dateTime()->searchable()->sortable()->label(__('End Date')), + BooleanColumn::make('responses_exists')->exists('responses')->label(__('Responses Exists'))->sortable(), + TextColumn::make('responses_count')->counts('responses')->label(__('Responses Count'))->sortable(), ]) ->appendActions([ Action::make('entries') @@ -198,16 +83,14 @@ public static function table(Table $table) : Table ->tooltip(__('open form')) ->url(fn(ZeusForm $record) : string => route('bolt.user.form.show', $record)) ->openUrlInNewTab(), + ])->filters([ + Filter::make('is_active') + ->toggle() + ->query(fn (Builder $query): Builder => $query->where('is_active', true)) + ->label(__('Is Active')), ]); } - public static function getRelations() : array - { - return [ - ResponsesRelationManager::class, - ]; - } - public static function getPages() : array { return [ diff --git a/src/Filament/Resources/FormResource/Pages/CreateForm.php b/src/Filament/Resources/FormResource/Pages/CreateForm.php index 02bc6fd8..4e91bb82 100644 --- a/src/Filament/Resources/FormResource/Pages/CreateForm.php +++ b/src/Filament/Resources/FormResource/Pages/CreateForm.php @@ -8,6 +8,8 @@ class CreateForm extends CreateRecord { + use CreateRecord\Concerns\Translatable; + protected static string $resource = FormResource::class; protected function getHeaderWidgets(): array diff --git a/src/Filament/Resources/FormResource/Pages/EditForm.php b/src/Filament/Resources/FormResource/Pages/EditForm.php index dc634228..1352c270 100644 --- a/src/Filament/Resources/FormResource/Pages/EditForm.php +++ b/src/Filament/Resources/FormResource/Pages/EditForm.php @@ -2,19 +2,22 @@ namespace LaraZeus\Bolt\Filament\Resources\FormResource\Pages; +use Filament\Pages\Actions\LocaleSwitcher; use Filament\Resources\Pages\EditRecord; use Filament\Pages\Actions\Action; use LaraZeus\Bolt\Filament\Resources\FormResource; use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; -use LaraZeus\Bolt\Models\Form as ZeusForm; class EditForm extends EditRecord { + use EditRecord\Concerns\Translatable; + protected static string $resource = FormResource::class; protected function getActions(): array { return [ + LocaleSwitcher::make(), Action::make('entries') ->label(__('Entries')) ->icon('clarity-data-cluster-line') diff --git a/src/Filament/Resources/FormResource/Pages/ListForms.php b/src/Filament/Resources/FormResource/Pages/ListForms.php index 1c2be947..0c1a16f0 100644 --- a/src/Filament/Resources/FormResource/Pages/ListForms.php +++ b/src/Filament/Resources/FormResource/Pages/ListForms.php @@ -2,14 +2,15 @@ namespace LaraZeus\Bolt\Filament\Resources\FormResource\Pages; -use Filament\Pages\Actions\Action; -use Filament\Pages\Actions\CreateAction; +use Filament\Pages\Actions; use Filament\Resources\Pages\ListRecords; use LaraZeus\Bolt\Filament\Resources\FormResource; use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; class ListForms extends ListRecords { + use ListRecords\Concerns\Translatable; + protected static string $resource = FormResource::class; protected function getHeaderWidgets(): array @@ -22,7 +23,13 @@ protected function getHeaderWidgets(): array protected function getActions(): array { return [ - CreateAction::make('create'), + Actions\LocaleSwitcher::make(), + Actions\CreateAction::make('create'), ]; } + + protected function getTableReorderColumn(): ?string + { + return 'ordering'; + } } diff --git a/src/Filament/Resources/FormResource/RelationManagers/ResponsesRelationManager.php b/src/Filament/Resources/FormResource/RelationManagers/ResponsesRelationManager.php deleted file mode 100644 index 4c738d85..00000000 --- a/src/Filament/Resources/FormResource/RelationManagers/ResponsesRelationManager.php +++ /dev/null @@ -1,34 +0,0 @@ -schema([ - TextColumn::make('user_id'), - TextColumn::make('status'), - TextColumn::make('notes'), - ]); - } - - public static function table(Table $table): Table - { - return $table - ->columns([ - TextColumn::make('user_id'), - TextColumn::make('status'), - ]); - } -} diff --git a/src/Filament/Resources/FormResource/Schemata.php b/src/Filament/Resources/FormResource/Schemata.php new file mode 100644 index 00000000..f8bf639d --- /dev/null +++ b/src/Filament/Resources/FormResource/Schemata.php @@ -0,0 +1,139 @@ +default(auth()->user()->id ?? null), + Hidden::make('layout')->default(1), + + Tabs::make('Name')->tabs(static::getTabsSchema())->columnSpan(2), + Card::make()->schema([ + Placeholder::make('Sections-title')->label(__('Sections'))->helperText(__('sections are here to group the fields, and you can display it as pages from the Form options. if you have one section, it wont show in the form')), + ]), + + Repeater::make('sections') + ->label('') + ->schema(static::getSectionsSchema()) + ->relationship() + ->orderable('ordering') + ->createItemButtonLabel(__('Add Section')) + ->cloneable() + ->collapsible() + ->itemLabel(fn(array $state) : ?string => $state['name'] ?? null) + ->columnSpan(2), + ]; + } + public static function getTabsSchema() : array + { + return [ + Tabs\Tab::make('title-slug')->label(__('Title & Slug'))->schema([ + TextInput::make('name')->required()->maxLength(255)->reactive() + ->label(__('Form Name')) + ->afterStateUpdated(function (\Closure $set, $state, $context) { + if ($context === 'edit') { + return; + } + $set('slug', Str::slug($state)); + }), + TextInput::make('slug')->required()->maxLength(255)->rules([ 'alpha_dash' ])->unique(ignoreRecord: true)->label(__('Form Slug')), + ])->columns(2), + Tabs\Tab::make('text-details')->label(__('Text & Details'))->schema([ + Textarea::make('desc')->label(__('Form Description'))->helperText(__('shown under the title of the form and used in SEO')), + RichEditor::make('details')->label(__('Form Details'))->helperText(__('a highlighted section above the form, to show some instructions or more details')), + RichEditor::make('options.confirmation-message')->label(__('Confirmation Message'))->helperText(__('optional, show a massage whenever any one submit a new entery')), + ]), + Tabs\Tab::make('display-access')->label(__('Display & Access'))->schema([ + Toggle::make('is_active')->label(__('is_active'))->helperText(__('Activate the form and let users start submissions')), + Toggle::make('options.show-as-wizard')->label(__('Show As Wizard'))->helperText(__('instead of showing all section in one page, separate them in multiple steps')), + Toggle::make('options.require-login')->label(__('require Login'))->helperText(__('User must be logged in or create an account before can submit a new entry'))->reactive(), + 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')) + ->visible(function (\Closure $get) { + return $get('options.require-login'); + }), + ])->columns(2), + Tabs\Tab::make('advanced')->label(__('Advanced'))->schema([ + Select::make('category_id') + ->label(__('Category')) + ->helperText(__('optional, organize your forms into categories')) + ->options(\LaraZeus\Bolt\Models\Category::pluck('name', 'id')), + Grid::make()->schema([ + Placeholder::make('form-dates')->label('Form Dates')->content(__('optional, specify when the form will be active and receiving new entries'))->columnSpan(2), + DateTimePicker::make('start_date')->label(__('Start Date')), + DateTimePicker::make('end_date')->label(__('End Date')), + ])->columns(2), + Grid::make()->schema([ + TextInput::make('options.emails-notification') + ->label(__('Emails Notifications')) + ->helperText(__('optional, enter the emails you want to receive notification when ever you got a new entry')), + TextInput::make('options.web-hook') + ->label(__('enter webHook URL')) + ->helperText(__('Send the form data to a webHook')), + ])->columns(2), + ]), + ]; + } + + public static function getSectionsSchema() : array + { + return [ + TextInput::make('name')->required()->lazy()->label(__('Section Name')), + Placeholder::make('Fields')->label(__('Section Fields')), + Repeater::make('fields') + ->schema(static::getFieldsSchema()) + ->relationship() + ->label('') + ->orderable('ordering') + ->cloneable() + ->collapsible() + ->grid([ + 'default' => 1, + 'md' => 2, + ]) + ->label('') + ->itemLabel(fn(array $state) : ?string => $state['name'] ?? null) + ->createItemButtonLabel(__('Add field')), + ]; + } + + public static function getFieldsSchema() : array + { + return [ + TextInput::make('name')->required()->lazy()->label(__('Field Name')), + Select::make('type') + ->required() + ->options(Bolt::availableFields()->pluck('title', 'class')) + ->reactive() + ->default('\LaraZeus\Bolt\Fields\Classes\TextInput') + ->label(__('Field Type')), + Fieldset::make('Options') + ->label(__('Field Options')) + ->visible(function (\Closure $get) { + $class = $get('type'); + + return ( new $class )->hasOptions(); + }) + ->schema(function (\Closure $get) { + return $get('type')::getOptions(); + }), + ]; + } +} diff --git a/src/Filament/Resources/ResponseResource.php b/src/Filament/Resources/ResponseResource.php index 417f5c57..de7ff13f 100644 --- a/src/Filament/Resources/ResponseResource.php +++ b/src/Filament/Resources/ResponseResource.php @@ -2,17 +2,15 @@ namespace LaraZeus\Bolt\Filament\Resources; -use Filament\Forms; +use Filament\Forms\Components\ViewField; use Filament\Resources\Form; -use Filament\Resources\Resource; use Filament\Resources\Table; -use Filament\Tables; +use Filament\Tables\Columns\TextColumn; use Filament\Tables\Filters\SelectFilter; use LaraZeus\Bolt\Filament\Resources\ResponseResource\Pages; -use LaraZeus\Bolt\Filament\Resources\ResponseResource\RelationManagers\FieldsResponsesRelationManager; use LaraZeus\Bolt\Models\Response; -class ResponseResource extends Resource +class ResponseResource extends BoltResource { protected static ?string $model = Response::class; @@ -20,9 +18,11 @@ class ResponseResource extends Resource protected static ?int $navigationSort = 2; + protected static ?string $slug = 'responses'; + protected static function getNavigationBadge(): ?string { - return (string) Response::query()->count(); + return (string)Response::query()->count(); } protected static function getNavigationGroup(): ?string @@ -32,57 +32,55 @@ protected static function getNavigationGroup(): ?string public static function getLabel(): string { - return __('Response'); + return __('Entries'); } public static function getPluralLabel(): string { - return __('Responses'); + return __('Entries'); } protected static function getNavigationLabel(): string { - return __('Responses'); + return __('Entries'); } public static function form(Form $form): Form { return $form ->schema([ - Forms\Components\TextInput::make('form_id')->required(), - Forms\Components\TextInput::make('user_id')->required(), - Forms\Components\TextInput::make('status')->required()->maxLength(255), - Forms\Components\Textarea::make('notes')->maxLength(65535), + ViewField::make('response')->view('zeus-bolt::filament.resources.response-resource.components.view-responses') + ->label('') + ->columnSpan(2) ]); } public static function table(Table $table): Table { + $mainColumns = [ + TextColumn::make('user.name')->label(__('User')), + TextColumn::make('status')->label(__('Status')), + TextColumn::make('notes')->label(__('Notes')), + TextColumn::make('created_at')->label(__('Created Date')), + ]; + + if (!request()->filled('form_id')) { + TextColumn::make('form.name')->label(__('form')); + } + return $table - ->columns([ - Tables\Columns\TextColumn::make('form_id'), - Tables\Columns\TextColumn::make('user_id'), - Tables\Columns\TextColumn::make('status'), - Tables\Columns\TextColumn::make('notes'), - ]) + ->columns($mainColumns) ->filters([ - SelectFilter::make('form')->relationship('form', 'name') - ->default(request('form_id', null)), + SelectFilter::make('form')->relationship('form', 'name')->default(request('form_id', null)), ]); } - public static function getRelations(): array - { - return [ - FieldsResponsesRelationManager::class, - ]; - } - public static function getPages(): array { return [ - 'index' => Pages\BrowseResponses::route('/'), - //'brows' => Pages\BrowseResponses::route('/brows'), + 'brows' => Pages\BrowseResponses::route('/brows'), + 'index' => Pages\ListResponses::route('/'), + 'view' => Pages\ViewResponse::route('/{record}'), ]; } } diff --git a/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php b/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php index e21c78cc..6365c86a 100644 --- a/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php +++ b/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php @@ -19,7 +19,7 @@ class BrowseResponses extends Page implements Tables\Contracts\HasTable protected static ?string $navigationIcon = 'heroicon-o-eye'; - protected static ?string $title = 'Responses'; + protected static ?string $title = 'Entries'; protected function getHeaderWidgets(): array { @@ -36,43 +36,22 @@ protected function getTableQuery(): Builder protected function getTableColumns(): array { return [ - Tables\Columns\TextColumn::make('title'), + Tables\Columns\ViewColumn::make('response') + ->view('zeus-bolt::filament.resources.response-resource.components.view-responses') + ->label('') ]; } protected function getViewData(): array { + $form = $this->getModel()::query(); + if (request()->filled('form_id')) { + $form = $form->where('form_id', request('form_id')); + } + $form = $form->paginate(1); + return [ - 'rows' => $this->getModel()::where('user_id', auth()->user()->id)->simplePaginate(1), - 'fields' => $this->fields(), + 'rows' => $form, ]; } - - public function fields() - { - return collect([ - [ - 'id' => 'form.name', - 'label' => 'Form Name', - 'sortable' => true, - 'inShow' => false, - ], - [ - 'id' => 'user.name', - 'label' => 'user', - 'inShow' => false, - ], - [ - 'id' => 'status', - 'label' => 'status', - 'sortable' => true, - 'inShow' => true, - ], - [ - 'id' => 'notes', - 'label' => 'notes', - 'inShow' => true, - ], - ]); - } } diff --git a/src/Filament/Resources/ResponseResource/Pages/ListResponses.php b/src/Filament/Resources/ResponseResource/Pages/ListResponses.php index e993ab99..906f676e 100644 --- a/src/Filament/Resources/ResponseResource/Pages/ListResponses.php +++ b/src/Filament/Resources/ResponseResource/Pages/ListResponses.php @@ -3,6 +3,7 @@ namespace LaraZeus\Bolt\Filament\Resources\ResponseResource\Pages; use Filament\Resources\Pages\ListRecords; +use Filament\Pages\Actions\Action; use LaraZeus\Bolt\Filament\Resources\FormResource\Widgets\BetaNote; use LaraZeus\Bolt\Filament\Resources\ResponseResource; @@ -16,4 +17,13 @@ protected function getHeaderWidgets(): array BetaNote::class, ]; } + + protected function getActions(): array + { + return [ + Action::make('brows') + ->label(__('Brows Entries')) + ->url(fn (): string => 'responses/brows?form_id='.request('form_id')) + ]; + } } diff --git a/src/Filament/Resources/ResponseResource/Pages/ViewResponse.php b/src/Filament/Resources/ResponseResource/Pages/ViewResponse.php new file mode 100644 index 00000000..94a84cd4 --- /dev/null +++ b/src/Filament/Resources/ResponseResource/Pages/ViewResponse.php @@ -0,0 +1,11 @@ +schema([ - // - ]); - } - - public static function table(Table $table): Table - { - return $table - ->columns([ - // - ]) - ->filters([ - // - ]); - } -} diff --git a/src/Http/Livewire/FillForms.php b/src/Http/Livewire/FillForms.php index 8f0a105f..0c3e29f2 100644 --- a/src/Http/Livewire/FillForms.php +++ b/src/Http/Livewire/FillForms.php @@ -3,6 +3,7 @@ namespace LaraZeus\Bolt\Http\Livewire; use Filament\Forms; +use Filament\Forms\Components\Wizard; use LaraZeus\Bolt\Models\Collection; use LaraZeus\Bolt\Models\FieldResponse; use LaraZeus\Bolt\Models\Form; @@ -14,23 +15,21 @@ class FillForms extends Component implements Forms\Contracts\HasForms use Forms\Concerns\InteractsWithForms; public Form $zeusForm; - public $zeusData = []; - protected function getFormSchema(): array + protected function getFormSchema() : array { $sections = []; - foreach ($this->zeusForm->sections as $section) { + foreach ($this->zeusForm->sections()->orderBy('ordering')->get() as $section) { $fields = []; - foreach ($section->fields as $field) { - $setField = (new $field->type)->renderClass::make('zeusData.'.$field->id) + foreach ($section->fields()->orderBy('ordering')->get() as $field) { + $setField = ( new $field->type )->renderClass::make('zeusData.' . $field->id) ->label($field->name) ->helperText($field->description) ->id($field->html_id) - // ->rules(collect($field->rules)->pluck('rule')) -; - - if ($field->type === 'Select') { // todo change + //->rules(collect($field->rules)->pluck('rule')) + ; + if ($field->type === '\LaraZeus\Bolt\Fields\Classes\Select') { // todo change $setField = $setField->options(collect(Collection::find($field->options['dataSource'])->values)->pluck('itemValue', 'itemKey')); } @@ -44,28 +43,39 @@ protected function getFormSchema(): array } }*/ - $fields[] = Forms\Components\Card::make()->schema([$setField]); + $fields[] = Forms\Components\Card::make()->schema([ $setField ]); + } + + if ($this->zeusForm->options['show-as-wizard']) { + $sections[] = Wizard\Step::make($section->name)->schema($fields); + } else { + $sections[] = Forms\Components\Section::make($section->name)->schema($fields); } - $sections[] = Forms\Components\Section::make($section->name)->schema($fields); + } + + if ($this->zeusForm->options['show-as-wizard']) { + return [ Wizard::make($sections) ]; } return $sections; } - protected function getFormModel(): Form + protected function getFormModel() : Form { return $this->zeusForm; } public function mount($slug) { - $this->zeusForm = Form::with(['sections', 'fields'])->whereSlug($slug)->firstOrFail(); + $this->zeusForm = Form::with([ 'sections', 'sections.fields' ])->whereSlug($slug)->whereIsActive(1)->firstOrFail(); + + abort_if($this->zeusForm->options['require-login'] && !auth()->check(), 401); foreach ($this->zeusForm->fields as $field) { $this->zeusData[$field->id] = ''; } - $rules = $validationAttributes = []; + //$rules = $validationAttributes = []; } public function resetAll() @@ -78,21 +88,21 @@ public function store() $this->validate(); $response = Response::make([ 'form_id' => $this->zeusForm->id, - 'user_id' => (auth()->check()) ? auth()->user()->id : null, - 'status' => 'NEW', - 'notes' => '', + 'user_id' => ( auth()->check() ) ? auth()->user()->id : null, + 'status' => 'NEW', + 'notes' => '', ]); $response->save(); foreach ($this->form->getState()['zeusData'] as $field => $value) { - $fieldResponse['response'] = $value ?? ''; + $fieldResponse['response'] = $value ?? ''; $fieldResponse['response_id'] = $response->id; - $fieldResponse['form_id'] = $this->zeusForm->id; - $fieldResponse['field_id'] = $field; + $fieldResponse['form_id'] = $this->zeusForm->id; + $fieldResponse['field_id'] = $field; FieldResponse::create($fieldResponse); } - return redirect()->route('bolt.user.submitted', ['slug' => $this->zeusForm->slug]); + return redirect()->route('bolt.user.submitted', [ 'slug' => $this->zeusForm->slug ]); } public function render() diff --git a/src/Models/Category.php b/src/Models/Category.php index 101a12dc..53f7e8ce 100644 --- a/src/Models/Category.php +++ b/src/Models/Category.php @@ -5,11 +5,15 @@ use Database\Factories\CategoryFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Spatie\Translatable\HasTranslations; class Category extends Model { use HasFactory; use HasUpdates; + use HasTranslations; + + public $translatable = ['name']; protected $guarded = []; diff --git a/src/Models/Field.php b/src/Models/Field.php index ea7fe26a..16d98483 100644 --- a/src/Models/Field.php +++ b/src/Models/Field.php @@ -6,11 +6,15 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Translatable\HasTranslations; class Field extends Model { use SoftDeletes; use HasFactory; + use HasTranslations; + + public $translatable = ['name']; protected $guarded = []; @@ -31,10 +35,10 @@ protected static function newFactory() return FieldFactory::new(); } - /*public function form() + public function form() { return $this->belongsTo(Form::class); - }*/ + } public function section() { @@ -43,6 +47,6 @@ public function section() public function fieldResponses() { - return $this->hasMany(FieldResponse::class); + return $this->hasOne(FieldResponse::class); } } diff --git a/src/Models/FieldResponse.php b/src/Models/FieldResponse.php index 3516d30a..be021156 100644 --- a/src/Models/FieldResponse.php +++ b/src/Models/FieldResponse.php @@ -26,8 +26,13 @@ public function field() return $this->belongsTo(Field::class); } - public function response() + public function parentResponse() { - return $this->hasOne(Response::class); + return $this->belongsTo(Response::class,'response_id','id'); + } + + public function form() + { + return $this->belongsTo(Form::class); } } diff --git a/src/Models/Form.php b/src/Models/Form.php index ef2517af..f57915d4 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Translatable\HasTranslations; class Form extends Model { @@ -13,6 +14,9 @@ class Form extends Model use HasFactory; use HasUpdates; use HasActive; + use HasTranslations; + + public $translatable = ['name']; public function getRouteKeyName() { diff --git a/src/Models/Section.php b/src/Models/Section.php index 7f06713f..3f4125e5 100644 --- a/src/Models/Section.php +++ b/src/Models/Section.php @@ -6,11 +6,15 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Translatable\HasTranslations; class Section extends Model { use SoftDeletes; use HasFactory; + use HasTranslations; + + public $translatable = ['name']; protected $guarded = [];