Merge branch 'eatvio-main'

This commit is contained in:
2023-12-25 16:08:34 +03:00
18 changed files with 16346 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -0,0 +1,89 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use FakerRestaurant\Provider\en_US\Restaurant;
use App\Models\Diet;
use App\Models\User;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\File;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Diet>
*/
class DietFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$faker = \Faker\Factory::create();
$this->faker->addProvider(new Restaurant($faker));
$dietDuration = $this->faker->randomElement([7, 14, 21]);
$dietState = $this->faker->randomElement(['active','draft','archived']);
$numberOfDefinedDietTypes = $this->faker->numberBetween(1, 4);
$expectedDietTypes = ['meat', 'veg', 'corb', 'alko'];
$selectedDietTypes = $this->faker->randomElements($expectedDietTypes, $numberOfDefinedDietTypes);
$dietTypes = array_reduce(
$selectedDietTypes,
function($acc, $el) {
$acc[$el] = true;
return $acc;
},
[]
);
$dietEatingTypes = ['breakfast', 'dinner', 'supper', 'lunch', 'snacks'];
$dailySchedule = [];
$images = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.png', '8.png', '9.jpg', '10.png'];
Storage::fake('diets');
$imageFileKey = $this->faker->numberBetween(0, 9);
$imageFilePath = 'database/assets/images/diets/' . $images[$imageFileKey];
$file = new File($imageFilePath);
$fileLocalPath = Storage::putFile('diets', $file, 'public');
for($day = 1; $day <= $dietDuration ; $day++) {
foreach($dietEatingTypes as $eatingType) {
$numberOfProductsInCurrentMeel = $this->faker->numberBetween(1, 4);
for(;$numberOfProductsInCurrentMeel > 0; $numberOfProductsInCurrentMeel--) {
$meelName = $this->faker->foodName();
$dailySchedule[$day][$eatingType][] = [
'name' => $meelName,
'quantity' => $this->faker->numberBetween(1, 1000),
'portion' => $this->faker->randomElement(['grams', 'pcs', 'milliliters']),
'uniq' => $meelName . '-' . time(),
];
}
}
}
$dietName = $this->faker->randomElement([
$this->faker->foodName(),
$this->faker->beverageName(),
$this->faker->dairyName(),
$this->faker->vegetableName(),
$this->faker->fruitName(),
$this->faker->meatName(),
$this->faker->sauceName(),
]);
$dietNamePrefix = $this->faker->randomElement(['Super', 'Keto', 'Fast', 'Detox', 'Power Of', 'Green', 'Healthy', 'Turbo']);
return [
'name' => $dietNamePrefix . " " . $dietName . " Diet",
'duration' => $dietDuration,
'state' => $dietState,
'image' => $fileLocalPath,
'type' => $dietTypes,
'details' => $this->faker->paragraph(3, true),
'daily_schedule' => $dailySchedule
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Diet;
use App\Models\User;
class DietsSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$diets = Diet::factory()->count(10)->create();
$diets->each(
fn ($diet) => $diet->author()->attach(User::inRandomOrder()->first())
);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -44,12 +44,12 @@ $isDiary = Str::of($curUrl)->test('/\/diary/');
<div class="header__menu-content">
<ul class="header__menu-list">
<li class="header__menu-item">
<a href="{{ route('recipe.index') }}" @class(["header__menu-link", "icon-book-open", 'active' => route('recipe.index') == $curUrl] )>
<a href="{{ route('recipe.index') }}" @class(["header__menu-link", "text-black", "icon-book-open", 'active' => route('recipe.index') == $curUrl] )>
{{__('routes.recipe_index') }}
</a>
</li>
<li class="header__menu-item">
<a href="{{ route('blog_post.index') }}" @class(["header__menu-link", "icon-message-circle", "active" => route('blog_post.index') == $curUrl])>
<a href="{{ route('blog_post.index') }}" @class(["header__menu-link", "text-black", "icon-message-circle", "active" => route('blog_post.index') == $curUrl])>
{{ __('routes.blog_post_index') }}
</a>
</li>
@@ -57,17 +57,17 @@ $isDiary = Str::of($curUrl)->test('/\/diary/');
<span class="header__menu-separator"></span>
<ul class="header__menu-list">
<li class="header__menu-item">
<a href="{{ route('plan.index') }}" @class(["header__menu-link", "icon-file-text", "active" => route('plan.index') == $curUrl])>
<a href="{{ route('plan.index') }}" @class([ "header__menu-link", "text-black", "icon-file-text", "active" => route('plan.index') == $curUrl])>
{{ __('routes.plan_index') }}
</a>
</li>
<li class="header__menu-item">
<a href="{{ route('consultants.index')}}" @class(["header__menu-link", "icon-users", "active" => route('consultants.index') == $curUrl])>
<a href="{{ route('consultants.index')}}" @class(["header__menu-link", "text-black", "icon-users", "active" => route('consultants.index') == $curUrl])>
{{ __('routes.consultants_index')}}
</a>
</li>
<li class="header__menu-item">
<a href="{{ route('diet.index') }}" @class(["header__menu-link", "icon-diet", "active" => route('diet.index') == $curUrl])>
<a href="{{ route('diet.index') }}" @class(["header__menu-link", "text-black", "icon-diet", "active" => route('diet.index') == $curUrl])>
{{ __('routes.diet_index')}}
</a>
</li>
@@ -77,18 +77,18 @@ $isDiary = Str::of($curUrl)->test('/\/diary/');
@if(auth()->user()->is_consultant)
<li class="header__menu-item">
<a href="{{ route('consultant_diary_comment.index')}}"
@class(["header__menu-link", "icon-check-square", "active" => route('consultant_diary_comment.index') == $curUrl])>
@class(["header__menu-link", "text-black", "icon-check-square", "active" => route('consultant_diary_comment.index') == $curUrl])>
{{__('routes.consultant_diary_comment_index') }}
</a>
</li>
@endif
<li class="header__menu-item">
<a href="{{ route('chat.index') }}" @class(["header__menu-link", "icon-message-square", 'active' => route('chat.index') == $curUrl])>
<a href="{{ route('chat.index') }}" @class(["header__menu-link", "text-black", "icon-message-square", 'active' => route('chat.index') == $curUrl])>
{{ __('routes.chat_index')}}
</a>
</li>
<li class="header__menu-item">
<a href="{{ route('finance.index')}}" class="header__menu-link icon-rubble">
<a href="{{ route('finance.index')}}" class="header__menu-link text-black icon-rubble">
{{ __('routes.finances_index')}}
</a>
</li>

View File

@@ -1,8 +1,4 @@
<div class="d-flex align-items-center ms-3 ms-sm-0 mt-sm-4" data-comment-id={{ $comment->id }}>
<button wire:click.stop.prevent="downvote" @class(["pt-1", 'text-red-400' => $isDownVoted])>
<svg width="20" height="18" @class(["me-1", "down-vote-filter" => $isDownVoted])><use xlink:href="#DislikeIcon"></use></svg>
</button>
<span class="--f_bold">{{ $sum }}</span>
<button
wire:click.stop.prevent="upvote"
@class(
@@ -15,5 +11,9 @@
>
<svg width="20" height="24" @class(["ms-1", "up-vote-filter" => $isUpVoted])><use xlink:href="#LikeIcon"></use></svg>
</button>
<span class="--f_bold">{{ $sum }}</span>
<button wire:click.stop.prevent="downvote" @class(["pt-1", 'text-red-400' => $isDownVoted])>
<svg width="20" height="18" @class(["me-1", "down-vote-filter" => $isDownVoted])><use xlink:href="#DislikeIcon"></use></svg>
</button>
</div>

View File

@@ -1,8 +1,4 @@
<div style="margin-left:20px;">
<button wire:click.stop.prevent="downvote" @class(["pt-1", 'text-red-400' => $isDownVoted])>
<svg width="20" height="18" @class(["me-1", "down-vote-filter" => $isDownVoted])><use xlink:href="#DislikeIcon"></use></svg>
</button>
<span class="--f_bold">{{ $sum }}</span>
<button
wire:click.stop.prevent="upvote"
@class(
@@ -15,5 +11,9 @@
>
<svg width="20" height="24" @class(["ms-1", "up-vote-filter" => $isUpVoted])><use xlink:href="#LikeIcon"></use></svg>
</button>
<span class="--f_bold">{{ $sum }}</span>
<button wire:click.stop.prevent="downvote" @class(["pt-1", 'text-red-400' => $isDownVoted])>
<svg width="20" height="18" @class(["me-1", "down-vote-filter" => $isDownVoted])><use xlink:href="#DislikeIcon"></use></svg>
</button>
</div>

View File

@@ -9,6 +9,8 @@
$planViewsCount = views($plan)
->unique()
->count();
$isPlanUrlActive= true;
@endphp
@section('main_section')
<section class="page" id="main">
@@ -16,14 +18,14 @@
<div class="settings__container container-sm">
<div class="settings__header">
<a href="{{ route('plan.index', ['author' => $author->id]) }}" class="settings__back icon-arrow-short-left">
<a href="{{ route('plan.index', ['author' => $author->id]) }}" class="settings__back icon-arrow-short-left text-black">
<span>Планы питания консультанта</span>
</a>
<div class="settings__actions">
<div class="settings__action setting__person">
<div class="settings__person-content">
<a href="{{ route('profile.show', ['user' => $author]) }}" class="setting__person-name">
<a href="{{ route('profile.show', ['user' => $author]) }}" class="setting__person-name text-black">
{{ $author->name }}
</a>
</div>
@@ -31,7 +33,7 @@
<img src="{{ $author->profile_photo_url }}" alt="thumb">
</a>
</div>
<a href="" class="settings__action btn btn-md btn-primary icon-message-square">
<a href="" class="settings__action l-btn l-btn-md l-btn-primary icon-message-square">
<span>Написать</span>
</a>
</div>