diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..d5feb2158 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +/resources/js/app.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..a63d290df --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,96 @@ +module.exports = { + 'env': { + 'browser': true, + 'es6': true + }, + 'extends': [ + 'plugin:vue/recommended' + ], + 'parserOptions': { + 'ecmaVersion': 12, + 'sourceType': 'module' + }, + 'plugins': [ + 'vue', + ], + 'rules': { + 'array-bracket-spacing': [ + 'error', + 'never' + ], + 'indent': [ + 'error', + 2 + ], + 'linebreak-style': [ + 'error', + 'unix' + ], + 'no-trailing-spaces': [ + 'error', + { + 'ignoreComments': true, + 'skipBlankLines': true + } + ], + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'always' + ], + 'semi-spacing': [ + 'error', + { + 'after': true, + 'before': false + } + ], + 'semi-style': [ + 'error', + 'last' + ], + + // strongly recommended + 'vue/component-name-in-template-casing': [ + 'error', + 'kebab-case' + ], + 'vue/component-tags-order': [ + 'warn', + { + 'order': [['style', 'template'], 'script'] + } + ], + 'vue/html-end-tags': 'error', + 'vue/html-self-closing': [ + 'error', + { + 'html': { + 'normal': 'always', + 'void': 'never' + } + } + ], + 'vue/no-v-model-argument': 0, + 'vue/no-v-html': 0, + 'vue/max-attributes-per-line': [ + // https://vuejs.org/v2/style-guide/#Multi-attribute-elements-strongly-recommended + 'error', + { + 'singleline': 5, + 'multiline': { + 'max': 5, + 'allowFirstLine': true + } + } + ], + 'vue/singleline-html-element-content-newline': ['error', { + 'ignoreWhenNoAttributes': true, + 'ignoreWhenEmpty': true, + 'ignores': ['pre', 'textarea', 'inertia-link', 'a', 'p', 'li'] + }] + } +}; diff --git a/app/Http/Controllers/Settings/Personalize/Genders/PersonalizeGenderController.php b/app/Http/Controllers/Settings/Personalize/Genders/PersonalizeGenderController.php new file mode 100644 index 000000000..e008f85a1 --- /dev/null +++ b/app/Http/Controllers/Settings/Personalize/Genders/PersonalizeGenderController.php @@ -0,0 +1,70 @@ + VaultIndexViewHelper::layoutData(), + 'data' => PersonalizeGenderIndexViewHelper::data(Auth::user()->account), + ]); + } + + public function store(Request $request) + { + $data = [ + 'account_id' => Auth::user()->account_id, + 'author_id' => Auth::user()->id, + 'name' => $request->input('name'), + ]; + + $gender = (new CreateGender)->execute($data); + + return response()->json([ + 'data' => PersonalizeGenderIndexViewHelper::dtoGender($gender), + ], 201); + } + + public function update(Request $request, int $genderId) + { + $data = [ + 'account_id' => Auth::user()->account_id, + 'author_id' => Auth::user()->id, + 'gender_id' => $genderId, + 'name' => $request->input('name'), + ]; + + $gender = (new UpdateGender)->execute($data); + + return response()->json([ + 'data' => PersonalizeGenderIndexViewHelper::dtoGender($gender), + ], 200); + } + + public function destroy(Request $request, int $genderId) + { + $data = [ + 'account_id' => Auth::user()->account_id, + 'author_id' => Auth::user()->id, + 'gender_id' => $genderId, + ]; + + (new DestroyGender)->execute($data); + + return response()->json([ + 'data' => true, + ], 200); + } +} diff --git a/app/Http/Controllers/Settings/Personalize/Genders/ViewHelpers/PersonalizeGenderIndexViewHelper.php b/app/Http/Controllers/Settings/Personalize/Genders/ViewHelpers/PersonalizeGenderIndexViewHelper.php new file mode 100644 index 000000000..27dd52a1a --- /dev/null +++ b/app/Http/Controllers/Settings/Personalize/Genders/ViewHelpers/PersonalizeGenderIndexViewHelper.php @@ -0,0 +1,46 @@ +genders() + ->orderBy('name', 'asc') + ->get(); + + $collection = collect(); + foreach ($genders as $gender) { + $collection->push(self::dtoGender($gender)); + } + + return [ + 'genders' => $collection, + 'url' => [ + 'settings' => route('settings.index'), + 'personalize' => route('settings.personalize.index'), + 'gender_store' => route('settings.personalize.gender.store'), + ], + ]; + } + + public static function dtoGender(Gender $gender): array + { + return [ + 'id' => $gender->id, + 'name' => $gender->name, + 'url' => [ + 'update' => route('settings.personalize.gender.update', [ + 'gender' => $gender->id, + ]), + 'destroy' => route('settings.personalize.gender.destroy', [ + 'gender' => $gender->id, + ]), + ], + ]; + } +} diff --git a/app/Http/Controllers/Settings/Personalize/ViewHelpers/PersonalizeIndexViewHelper.php b/app/Http/Controllers/Settings/Personalize/ViewHelpers/PersonalizeIndexViewHelper.php index 1c7a54605..06edef0c9 100644 --- a/app/Http/Controllers/Settings/Personalize/ViewHelpers/PersonalizeIndexViewHelper.php +++ b/app/Http/Controllers/Settings/Personalize/ViewHelpers/PersonalizeIndexViewHelper.php @@ -12,6 +12,7 @@ class PersonalizeIndexViewHelper 'back' => route('settings.index'), 'manage_relationships' => route('settings.personalize.relationship.index'), 'manage_labels' => route('settings.personalize.label.index'), + 'manage_genders' => route('settings.personalize.gender.index'), ], ]; } diff --git a/app/Services/Account/ManageGenders/DestroyGender.php b/app/Services/Account/ManageGenders/DestroyGender.php index ebca14746..925a53981 100644 --- a/app/Services/Account/ManageGenders/DestroyGender.php +++ b/app/Services/Account/ManageGenders/DestroyGender.php @@ -19,8 +19,8 @@ class DestroyGender extends BaseService implements ServiceInterface { return [ 'account_id' => 'required|integer|exists:accounts,id', - 'gender_id' => 'required|integer|exists:genders,id', 'author_id' => 'required|integer|exists:users,id', + 'gender_id' => 'required|integer|exists:genders,id', ]; } diff --git a/resources/js/Components/ApplicationLogo.vue b/resources/js/Components/ApplicationLogo.vue index d503f69b8..6e0f4204e 100644 --- a/resources/js/Components/ApplicationLogo.vue +++ b/resources/js/Components/ApplicationLogo.vue @@ -1,5 +1,5 @@ diff --git a/resources/js/Components/Button.vue b/resources/js/Components/Button.vue index c5c15f86d..324388520 100644 --- a/resources/js/Components/Button.vue +++ b/resources/js/Components/Button.vue @@ -1,16 +1,16 @@ diff --git a/resources/js/Components/Checkbox.vue b/resources/js/Components/Checkbox.vue index 7bd5a4d30..06d432a51 100644 --- a/resources/js/Components/Checkbox.vue +++ b/resources/js/Components/Checkbox.vue @@ -1,32 +1,34 @@ diff --git a/resources/js/Components/Dropdown.vue b/resources/js/Components/Dropdown.vue index a00e6405c..a1ce3d263 100644 --- a/resources/js/Components/Dropdown.vue +++ b/resources/js/Components/Dropdown.vue @@ -1,81 +1,86 @@ diff --git a/resources/js/Components/DropdownLink.vue b/resources/js/Components/DropdownLink.vue index bf453fc12..6d0717cd8 100644 --- a/resources/js/Components/DropdownLink.vue +++ b/resources/js/Components/DropdownLink.vue @@ -1,15 +1,14 @@ diff --git a/resources/js/Components/Input.vue b/resources/js/Components/Input.vue index 393e7e6d5..409677d87 100644 --- a/resources/js/Components/Input.vue +++ b/resources/js/Components/Input.vue @@ -1,17 +1,22 @@ diff --git a/resources/js/Components/InputError.vue b/resources/js/Components/InputError.vue index 91bf90f6d..9aff22c0e 100644 --- a/resources/js/Components/InputError.vue +++ b/resources/js/Components/InputError.vue @@ -1,13 +1,18 @@ diff --git a/resources/js/Components/Label.vue b/resources/js/Components/Label.vue index 87e8c71a1..340024cd7 100644 --- a/resources/js/Components/Label.vue +++ b/resources/js/Components/Label.vue @@ -1,12 +1,21 @@ diff --git a/resources/js/Components/NavLink.vue b/resources/js/Components/NavLink.vue index 8b910c946..e67c62859 100644 --- a/resources/js/Components/NavLink.vue +++ b/resources/js/Components/NavLink.vue @@ -1,25 +1,30 @@ diff --git a/resources/js/Components/ResponsiveNavLink.vue b/resources/js/Components/ResponsiveNavLink.vue index 18ecf31f3..6c2c8426d 100644 --- a/resources/js/Components/ResponsiveNavLink.vue +++ b/resources/js/Components/ResponsiveNavLink.vue @@ -1,25 +1,30 @@ diff --git a/resources/js/Components/ValidationErrors.vue b/resources/js/Components/ValidationErrors.vue index 42dca4bda..b92df2d08 100644 --- a/resources/js/Components/ValidationErrors.vue +++ b/resources/js/Components/ValidationErrors.vue @@ -1,23 +1,25 @@ diff --git a/resources/js/Pages/Auth/AcceptInvitation.vue b/resources/js/Pages/Auth/AcceptInvitation.vue index f32ed10a9..1562f8f2a 100644 --- a/resources/js/Pages/Auth/AcceptInvitation.vue +++ b/resources/js/Pages/Auth/AcceptInvitation.vue @@ -1,59 +1,68 @@ diff --git a/resources/js/Pages/Auth/ConfirmPassword.vue b/resources/js/Pages/Auth/ConfirmPassword.vue index 41eedfada..48ed528dc 100644 --- a/resources/js/Pages/Auth/ConfirmPassword.vue +++ b/resources/js/Pages/Auth/ConfirmPassword.vue @@ -1,59 +1,59 @@ diff --git a/resources/js/Pages/Auth/ForgotPassword.vue b/resources/js/Pages/Auth/ForgotPassword.vue index 249bb717a..9439e7bad 100644 --- a/resources/js/Pages/Auth/ForgotPassword.vue +++ b/resources/js/Pages/Auth/ForgotPassword.vue @@ -1,65 +1,68 @@ diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index 7927ab9ff..d78480d89 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -1,85 +1,94 @@ diff --git a/resources/js/Pages/Auth/Register.vue b/resources/js/Pages/Auth/Register.vue index b194135fd..1f4b19c26 100644 --- a/resources/js/Pages/Auth/Register.vue +++ b/resources/js/Pages/Auth/Register.vue @@ -1,85 +1,92 @@ diff --git a/resources/js/Pages/Auth/ResetPassword.vue b/resources/js/Pages/Auth/ResetPassword.vue index ce0999e69..6b2882def 100644 --- a/resources/js/Pages/Auth/ResetPassword.vue +++ b/resources/js/Pages/Auth/ResetPassword.vue @@ -1,73 +1,83 @@ diff --git a/resources/js/Pages/Auth/VerifyEmail.vue b/resources/js/Pages/Auth/VerifyEmail.vue index f09aca2ec..be3c5fb99 100644 --- a/resources/js/Pages/Auth/VerifyEmail.vue +++ b/resources/js/Pages/Auth/VerifyEmail.vue @@ -1,59 +1,61 @@ diff --git a/resources/js/Pages/Settings/CancelAccount/Index.vue b/resources/js/Pages/Settings/CancelAccount/Index.vue index 104ad5d44..cdc8c2b8b 100644 --- a/resources/js/Pages/Settings/CancelAccount/Index.vue +++ b/resources/js/Pages/Settings/CancelAccount/Index.vue @@ -6,7 +6,7 @@ diff --git a/resources/js/Pages/Settings/Personalize/Index.vue b/resources/js/Pages/Settings/Personalize/Index.vue index e9dd81ade..b1a44b7da 100644 --- a/resources/js/Pages/Settings/Personalize/Index.vue +++ b/resources/js/Pages/Settings/Personalize/Index.vue @@ -6,7 +6,7 @@ diff --git a/resources/js/Shared/Errors.vue b/resources/js/Shared/Errors.vue index a99e3ec6b..cab7a6db1 100644 --- a/resources/js/Shared/Errors.vue +++ b/resources/js/Shared/Errors.vue @@ -33,9 +33,9 @@ Exception {{ errors.exception }} -
+
- {{ trace.class }}{{ trace.type }}{{ trace.function }}
+ {{ trace.class }}{{ trace.type }}{{ trace.function }}

diff --git a/resources/js/Shared/Guest.vue b/resources/js/Shared/Guest.vue index 3bee78d32..19dfc4609 100644 --- a/resources/js/Shared/Guest.vue +++ b/resources/js/Shared/Guest.vue @@ -1,25 +1,24 @@ diff --git a/resources/js/Shared/Layout.vue b/resources/js/Shared/Layout.vue index beae048b1..58b72dbed 100644 --- a/resources/js/Shared/Layout.vue +++ b/resources/js/Shared/Layout.vue @@ -8,13 +8,12 @@ main {
-
- +
@@ -99,12 +100,11 @@ main { diff --git a/resources/js/Shared/Toaster.vue b/resources/js/Shared/Toaster.vue index eddbe643e..5d72a7915 100644 --- a/resources/js/Shared/Toaster.vue +++ b/resources/js/Shared/Toaster.vue @@ -24,7 +24,9 @@ levelClass, isOpen ? isVisibleClass : '' ]" > - ๐Ÿ‘‹ {{ messageText }} + + ๐Ÿ‘‹ + {{ messageText }} diff --git a/resources/js/app.js b/resources/js/app.js index 6e3395e75..8edfe969f 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,7 +1,7 @@ require('./bootstrap'); import { createApp, h } from 'vue'; -import { createInertiaApp } from '@inertiajs/inertia-vue3'; +import { createInertiaApp, Link } from '@inertiajs/inertia-vue3'; import { InertiaProgress } from '@inertiajs/progress'; const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel'; @@ -13,6 +13,7 @@ createInertiaApp({ return createApp({ render: () => h(app, props) }) .use(plugin) .mixin({ methods: _.assign({ route }, require('./methods').default) }) + .component('inertia-link', Link) .mount(el); }, }); diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index f01cdf214..7e02962fb 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -9,7 +9,7 @@ {{ config('app.name', 'Laravel') }} - + @routes diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index dd6a45db7..ae21ea6f5 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -7,7 +7,7 @@ Laravel - +