diff --git a/app/Livewire/BlogPost/ListView.php b/app/Livewire/BlogPost/ListView.php index e17ca3f..0194498 100644 --- a/app/Livewire/BlogPost/ListView.php +++ b/app/Livewire/BlogPost/ListView.php @@ -2,7 +2,6 @@ namespace App\Livewire\BlogPost; -use App\Models\User; use App\Services\BlogPost\ListViewService; use Illuminate\View\View; use Livewire\Component; @@ -18,7 +17,7 @@ class ListView extends Component public string $tag = ''; - public User|null $author = null; + public ?int $author = null; protected array $queryString = [ 'search' => ['except' => ''], diff --git a/app/Livewire/Registration/Step1.php b/app/Livewire/Registration/Step1.php index f30851e..c41c8ee 100644 --- a/app/Livewire/Registration/Step1.php +++ b/app/Livewire/Registration/Step1.php @@ -38,41 +38,41 @@ class Step1 extends Component public string $lang = 'ru'; - public int|string $weight = ''; + public int|string|null $weight = ''; - public int|string $height = ''; + public int|string|null $height = ''; - public int|string $chest_circumference = ''; + public int|string|null $chest_circumference = ''; - public int|string $waist_circumference = ''; + public int|string|null $waist_circumference = ''; - public int|string $hip_circumference = ''; + public int|string|null $hip_circumference = ''; - public int|string $blood_pressure_up = ''; + public int|string|null $blood_pressure_up = ''; - public int|string $blood_pressure_down = ''; + public int|string|null $blood_pressure_down = ''; public int|string $has_hypo = 0; public int|string $has_hyper = 0; - public string $about_alergy = ''; + public ?string $about_alergy = ''; - public string $about_taking_pils = ''; + public ?string $about_taking_pils = ''; - public string $about_sport_hobbies = ''; + public ?string $about_sport_hobbies = ''; - public string $favorite_foods = ''; + public ?string $favorite_foods = ''; - public string $unfavorite_foods = ''; + public ?string $unfavorite_foods = ''; - public string $additional_info = ''; + public ?string $additional_info = ''; public function mount(string $step): void { $this->step = $step; collect(session()->get('registrationdata', [])) - ->each(fn ($item, $key) => $this->{$key} = $item); + ->each(fn ($item, $key): mixed => $this->{$key} = $item); } public function render(): View|ViewFactory diff --git a/app/Models/Plan.php b/app/Models/Plan.php index ecea57c..d807a6e 100644 --- a/app/Models/Plan.php +++ b/app/Models/Plan.php @@ -32,7 +32,6 @@ use Spatie\Sluggable\SlugOptions; * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property string $slug - * * @property-read \Illuminate\Database\Eloquent\Collection $author * @property-read int|null $author_count * @property-read \Illuminate\Database\Eloquent\Collection $comments @@ -102,7 +101,7 @@ class Plan extends Model implements Viewable return 'slug'; } - public function author(): BelongsToMany + public function author(): ?BelongsToMany { return $this->belongsToMany(User::class, 'plan_author', 'plan_id', 'user_id'); } diff --git a/app/Presenters/PlanPresenter.php b/app/Presenters/PlanPresenter.php index b414553..ffc5730 100644 --- a/app/Presenters/PlanPresenter.php +++ b/app/Presenters/PlanPresenter.php @@ -18,7 +18,7 @@ class PlanPresenter extends Presenter return Storage::url($author->profile_photo_path); } - public function getAuthor(): User + public function getAuthor(): ?User { return $this->author->first(); } diff --git a/app/Rules/MinWords.php b/app/Rules/MinWords.php index c04582d..3a08281 100644 --- a/app/Rules/MinWords.php +++ b/app/Rules/MinWords.php @@ -2,9 +2,11 @@ namespace App\Rules; +use Closure; use Illuminate\Contracts\Validation\Rule; +use Illuminate\Contracts\Validation\ValidationRule; -class MinWords implements Rule +class MinWords implements ValidationRule { protected int $minWords; @@ -13,15 +15,15 @@ class MinWords implements Rule $this->minWords = $minWords; } - public function passes(mixed $attribute, mixed $value): bool|int + /** + * Run the validation rule. + */ + public function validate(string $attribute, mixed $value, Closure $fail): void { $wordCount = count(preg_split('/\W+/u', $value, -1, PREG_SPLIT_NO_EMPTY)); - return $wordCount >= $this->minWords; - } - - public function message(): string - { - return "The :attribute must have at least {$this->minWords} words."; + if ($wordCount <= $this->minWords) { + $fail('validation.min_words_count')->translate(['min' => $this->minWords]); + } } } diff --git a/app/Services/RegistrationRuleSet.php b/app/Services/RegistrationRuleSet.php index df33072..a5c8e7a 100644 --- a/app/Services/RegistrationRuleSet.php +++ b/app/Services/RegistrationRuleSet.php @@ -70,13 +70,13 @@ class RegistrationRuleSet 'height' => static::transform($obj->height), ], 'step3' => [ - 'chest_circumference' => $obj->chest_circumference, - 'waist_circumference' => $obj->waist_circumference, - 'hip_circumference' => $obj->hip_circumference, + 'chest_circumference' => static::transform($obj->chest_circumference), + 'waist_circumference' => static::transform($obj->waist_circumference), + 'hip_circumference' => static::transform($obj->hip_circumference), ], 'step4' => [ - 'blood_pressure_up' => $obj->blood_pressure_up, - 'blood_pressure_down' => $obj->blood_pressure_down, + 'blood_pressure_up' => static::transform($obj->blood_pressure_up), + 'blood_pressure_down' => static::transform($obj->blood_pressure_down), 'has_hypo' => $obj->has_hypo, 'has_hyper' => $obj->has_hyper, ], diff --git a/lang/en/validation.php b/lang/en/validation.php index 60fba71..2fdfae6 100644 --- a/lang/en/validation.php +++ b/lang/en/validation.php @@ -49,6 +49,7 @@ return [ 'exists' => 'The selected :attribute is invalid.', 'file' => 'The :attribute must be a file.', 'filled' => 'The :attribute field must have a value.', + 'min_words_count' => 'The :attribute must have at least :min words.', 'gt' => [ 'array' => 'The :attribute must have more than :value items.', 'file' => 'The :attribute must be greater than :value kilobytes.', diff --git a/lang/ru/reg_form.php b/lang/ru/reg_form.php index 38b7085..3f97a47 100644 --- a/lang/ru/reg_form.php +++ b/lang/ru/reg_form.php @@ -40,12 +40,12 @@ return [ 'save_changes' => 'Сохранить изменения', 'skip' => 'Пропустить', 'go_back' => 'Вернуться', - 'step3_head' => 'Так держать :)', + 'step3_head' => 'Так держать :) Шаг №3', 'primary_measurements' => 'Первичные замеры', 'chest_circumference' => 'Обхват груди', 'waist_circumference' => 'Обхват талии', 'hip_circumference' => 'Обхват бедр', - 'step4_head' => 'Давай в том же духе :)', + 'step4_head' => 'Давай в том же духе :) Шаг №4', 'your_blood_pressure' => 'Ваше артериальное давление?', 'average_pressure_readings' => 'Показатели артериального давления', 'pressure_up' => 'Верхннее', @@ -54,10 +54,10 @@ return [ 'prone_to_hypertension' => 'Есть ли у вас склонность к гипертонии?', 'yes' => 'Да', 'no' => 'Нет', - 'step5_head' => 'Расскажите о себе :)', - 'step6_head' => 'Расскажите о себе :)', - 'step7_head' => 'Расскажите о себе :)', - 'step8_head' => 'Ещё немного :)', + 'step5_head' => 'Расскажите о себе :) Шаг №5', + 'step6_head' => 'Расскажите о себе :) Шаг №6', + 'step7_head' => 'Расскажите о себе :) Шаг №7', + 'step8_head' => 'Ещё немного :) Шаг №8', 'has_alergy' => 'Наличие аллергии', 'enter_info' => 'Введите информацию...', 'take_pils' => 'Принимаете ли вы лекарства на постоянной основе? Если да, то укажите какие', diff --git a/lang/ru/validation.php b/lang/ru/validation.php index 726457c..5dd3ed7 100644 --- a/lang/ru/validation.php +++ b/lang/ru/validation.php @@ -49,6 +49,7 @@ return [ 'exists' => 'The selected :attribute is invalid.', 'file' => 'The :attribute must be a file.', 'filled' => 'The :attribute field must have a value.', + 'min_words_count' => 'Поле ":attribute" должно состоять минимум из :min слов.', 'gt' => [ 'array' => 'The :attribute must have more than :value items.', 'file' => 'The :attribute must be greater than :value kilobytes.', @@ -162,6 +163,31 @@ return [ 'attributes' => [ 'image' => 'Изображение', + 'unfavorite_foods' => 'не любимые продукты', + 'favorite_foods' => 'любимые продукты', + 'first_name' => 'Имя', + 'last_name' => 'Фамилия', + 'email' => 'Мэйл', + 'password' => 'Пароль', + 'password_confirmation' => 'Подтверждение пароля', + 'birthdate' => 'Дата рождения', + 'gender' => 'Пол', + 'country' => 'Страна', + 'city' => 'Город', + 'lang' => 'Язык', + 'weight' => 'Вес', + 'height' => 'Рост', + 'chest_circumference' => 'Замер груди', + 'waist_circumference' => 'Замер пояса', + 'hip_circumference' => 'Замер бёдер', + 'blood_pressure_up' => 'Верхнее давление', + 'blood_pressure_down' => 'Нижнее давление', + 'has_hypo' => 'Наличие гипотонии', + 'has_hyper' => 'Наличи гипертонии', + 'about_alergy' => 'Наличие аллерги на продукты', + 'about_taking_pils' => 'Наличи регулярного приёма лекарств', + 'about_sport_hobbies' => 'Спортивные предпочтения', + 'additional_info' => 'Дополнительная информация', ], ]; diff --git a/public/css/app.css b/public/css/app.css index 7c358cf..2d3dd24 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -13182,16 +13182,12 @@ video { align-items: flex-end; }.items-center { align-items: center; -}.items-stretch { - align-items: stretch; }.justify-end { justify-content: flex-end; }.justify-center { justify-content: center; }.justify-between { justify-content: space-between; -}.justify-around { - justify-content: space-around; }.justify-items-center { justify-items: center; }.gap-1 { @@ -13202,14 +13198,14 @@ video { gap: 1.25rem; }.gap-6 { gap: 1.5rem; +}.gap-x-12 { + -moz-column-gap: 3rem; + column-gap: 3rem; }.gap-x-6 { -moz-column-gap: 1.5rem; column-gap: 1.5rem; }.gap-y-8 { row-gap: 2rem; -}.gap-x-12 { - -moz-column-gap: 3rem; - column-gap: 3rem; }.space-x-2 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(0.5rem * var(--tw-space-x-reverse)); @@ -13254,14 +13250,14 @@ video { word-break: break-all; }.rounded { border-radius: 0.25rem; +}.rounded-3xl { + border-radius: 1.5rem; }.rounded-full { border-radius: 9999px; }.rounded-lg { border-radius: 0.5rem; }.rounded-md { border-radius: 0.375rem; -}.rounded-3xl { - border-radius: 1.5rem; }.rounded-b-none { border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; @@ -13319,9 +13315,6 @@ video { }.bg-blue-500 { --tw-bg-opacity: 1; background-color: rgb(59 130 246 / var(--tw-bg-opacity)); -}.bg-blue-600 { - --tw-bg-opacity: 1; - background-color: rgb(37 99 235 / var(--tw-bg-opacity)); }.bg-gray-100 { --tw-bg-opacity: 1; background-color: rgb(243 244 246 / var(--tw-bg-opacity)); @@ -13370,12 +13363,15 @@ video { }.bg-red-700 { --tw-bg-opacity: 1; background-color: rgb(185 28 28 / var(--tw-bg-opacity)); -}.bg-white { - --tw-bg-opacity: 1; - background-color: rgb(255 255 255 / var(--tw-bg-opacity)); }.bg-slate-400 { --tw-bg-opacity: 1; background-color: rgb(148 163 184 / var(--tw-bg-opacity)); +}.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +}.bg-\[\#019a3e\] { + --tw-bg-opacity: 1; + background-color: rgb(1 154 62 / var(--tw-bg-opacity)); }.bg-opacity-25 { --tw-bg-opacity: 0.25; }.bg-cover { @@ -13531,10 +13527,10 @@ video { vertical-align: bottom; }.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; -}.font-sans { - font-family: Figtree, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; }.font-mulish { font-family: Mulish, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; +}.font-sans { + font-family: Figtree, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; }.text-2xl { font-size: 1.5rem; line-height: 2rem; @@ -13707,11 +13703,11 @@ video { }.ring-gray-300 { --tw-ring-opacity: 1; --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)); +}.ring-gray-900\/5 { + --tw-ring-color: rgb(17 24 39 / 0.05); }.ring-red-500 { --tw-ring-opacity: 1; --tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)); -}.ring-gray-900\/5 { - --tw-ring-color: rgb(17 24 39 / 0.05); }.ring-opacity-5 { --tw-ring-opacity: 0.05; }.blur { @@ -13788,9 +13784,6 @@ video { }.hover\:border-gray-300:hover { --tw-border-opacity: 1; border-color: rgb(209 213 219 / var(--tw-border-opacity)); -}.hover\:bg-blue-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(59 130 246 / var(--tw-bg-opacity)); }.hover\:bg-blue-600:hover { --tw-bg-opacity: 1; background-color: rgb(37 99 235 / var(--tw-bg-opacity)); @@ -13924,6 +13917,9 @@ video { }.focus\:ring-blue-200:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity)); +}.focus\:ring-blue-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); }.focus\:ring-blue-600:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(37 99 235 / var(--tw-ring-opacity)); @@ -13936,18 +13932,12 @@ video { }.focus\:ring-indigo-500:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)); -}.focus\:ring-indigo-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(79 70 229 / var(--tw-ring-opacity)); }.focus\:ring-red-200:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(254 202 202 / var(--tw-ring-opacity)); }.focus\:ring-red-500:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)); -}.focus\:ring-blue-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); }.focus\:ring-opacity-50:focus { --tw-ring-opacity: 0.5; }.focus\:ring-offset-2:focus { @@ -13997,6 +13987,8 @@ video { grid-column: span 3 / span 3; }.sm\:col-span-4 { grid-column: span 4 / span 4; + }.sm\:col-span-6 { + grid-column: span 6 / span 6; }.sm\:-my-px { margin-top: -1px; margin-bottom: -1px; diff --git a/public/css/registration.css b/public/css/registration.css index 9edf0cf..7f295ba 100644 --- a/public/css/registration.css +++ b/public/css/registration.css @@ -1883,10 +1883,6 @@ select { --tw-bg-opacity: 1; background-color: rgb(59 130 246 / var(--tw-bg-opacity)); } -.bg-blue-600 { - --tw-bg-opacity: 1; - background-color: rgb(37 99 235 / var(--tw-bg-opacity)); -} .bg-gray-100 { --tw-bg-opacity: 1; background-color: rgb(243 244 246 / var(--tw-bg-opacity)); @@ -1959,6 +1955,10 @@ select { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); } +.bg-\[\#019a3e\] { + --tw-bg-opacity: 1; + background-color: rgb(1 154 62 / var(--tw-bg-opacity)); +} .bg-opacity-25 { --tw-bg-opacity: 0.25; } @@ -2558,11 +2558,6 @@ select { border-color: rgb(209 213 219 / var(--tw-border-opacity)); } -.hover\:bg-blue-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(59 130 246 / var(--tw-bg-opacity)); -} - .hover\:bg-blue-600:hover { --tw-bg-opacity: 1; background-color: rgb(37 99 235 / var(--tw-bg-opacity)); @@ -2784,6 +2779,11 @@ select { --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity)); } +.focus\:ring-blue-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); +} + .focus\:ring-blue-600:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(37 99 235 / var(--tw-ring-opacity)); @@ -2804,11 +2804,6 @@ select { --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)); } -.focus\:ring-indigo-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(79 70 229 / var(--tw-ring-opacity)); -} - .focus\:ring-red-200:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(254 202 202 / var(--tw-ring-opacity)); @@ -2819,11 +2814,6 @@ select { --tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity)); } -.focus\:ring-blue-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); -} - .focus\:ring-opacity-50:focus { --tw-ring-opacity: 0.5; } @@ -2915,6 +2905,10 @@ select { grid-column: span 4 / span 4; } + .sm\:col-span-6 { + grid-column: span 6 / span 6; + } + .sm\:-my-px { margin-top: -1px; margin-bottom: -1px; diff --git a/resources/views/livewire/registration/step2.blade.php b/resources/views/livewire/registration/step2.blade.php index ba8a984..c70c1e8 100644 --- a/resources/views/livewire/registration/step2.blade.php +++ b/resources/views/livewire/registration/step2.blade.php @@ -100,22 +100,25 @@ -
+
-
diff --git a/resources/views/livewire/registration/step3.blade.php b/resources/views/livewire/registration/step3.blade.php index c5aab0d..2b94740 100644 --- a/resources/views/livewire/registration/step3.blade.php +++ b/resources/views/livewire/registration/step3.blade.php @@ -1,56 +1,69 @@ @section('title', __('reg_form.title_' . $step)) -
-