forked from eatvio/eatvio-infra
plan styling fix
This commit is contained in:
@@ -26,7 +26,7 @@ class Create extends Component
|
||||
|
||||
public function toggle()
|
||||
{
|
||||
$this->isChecked = !$this->isChecked;
|
||||
$this->isChecked = ! $this->isChecked;
|
||||
}
|
||||
|
||||
public function save()
|
||||
|
||||
@@ -12,12 +12,17 @@ class Create extends Component
|
||||
{
|
||||
use WithFileUploads;
|
||||
|
||||
public $name = "";
|
||||
public $name = '';
|
||||
|
||||
public $image = null;
|
||||
public $duration = "7";
|
||||
public $state = "draft";
|
||||
|
||||
public $duration = '7';
|
||||
|
||||
public $state = 'draft';
|
||||
|
||||
public $type = ['fit' => false, 'slim' => false, 'behavior' => false, 'wellness' => false];
|
||||
public $details = "";
|
||||
|
||||
public $details = '';
|
||||
|
||||
public $packets_count = 1;
|
||||
|
||||
@@ -59,7 +64,7 @@ class Create extends Component
|
||||
'packet1_options.items' => 'required|array|min:1',
|
||||
];
|
||||
|
||||
if($this->packets_count === 3) {
|
||||
if ($this->packets_count === 3) {
|
||||
$rules['packet2_options.short'] = 'required|string|min:3';
|
||||
$rules['packet2_options.price'] = 'required|numeric|min:1';
|
||||
$rules['packet2_options.description'] = 'required|string|min:3';
|
||||
@@ -135,7 +140,6 @@ class Create extends Component
|
||||
|
||||
$plan->saveOrFail();
|
||||
|
||||
|
||||
$user = Auth::user();
|
||||
$user->author_of_plans()->attach($plan->id);
|
||||
|
||||
|
||||
@@ -11,23 +11,41 @@ class Edit extends Component
|
||||
use WithFileUploads;
|
||||
|
||||
public Plan $plan;
|
||||
|
||||
public $name = '';
|
||||
|
||||
public $image = null;
|
||||
|
||||
public $duration = '7';
|
||||
|
||||
public $state = 'draft';
|
||||
|
||||
public $type = ['fit' => false, 'slim' => false, 'behavior' => false, 'wellness' => false];
|
||||
|
||||
public $details = '';
|
||||
|
||||
public $packets_count = 1;
|
||||
|
||||
public $packet1_options = [];
|
||||
|
||||
public $packet2_options = [];
|
||||
|
||||
public $packet3_options = [];
|
||||
|
||||
public $packet1_options_input = [];
|
||||
|
||||
public $packet2_options_input = [];
|
||||
|
||||
public $packet3_options_input = [];
|
||||
|
||||
public $input_items_1 = '';
|
||||
|
||||
public $input_items_2 = '';
|
||||
|
||||
public $input_items_3 = '';
|
||||
|
||||
public $isVisibleDuration = false;
|
||||
|
||||
public $isVisibleState = false;
|
||||
|
||||
public function mount(Plan $plan)
|
||||
@@ -111,12 +129,12 @@ class Edit extends Component
|
||||
|
||||
public function showListDuration()
|
||||
{
|
||||
$this->isVisibleDuration = !$this->isVisibleDuration;
|
||||
$this->isVisibleDuration = ! $this->isVisibleDuration;
|
||||
}
|
||||
|
||||
public function showListState()
|
||||
{
|
||||
$this->isVisibleState = !$this->isVisibleState;
|
||||
$this->isVisibleState = ! $this->isVisibleState;
|
||||
}
|
||||
|
||||
public function toggleDuration($duration)
|
||||
@@ -142,7 +160,7 @@ class Edit extends Component
|
||||
$this->$options_type['items'][] = $this->input_items_3;
|
||||
|
||||
// delete empty value in items
|
||||
$this->$options_type['items'] = array_filter($this->$options_type['items'], fn($item) => !empty($item));
|
||||
$this->$options_type['items'] = array_filter($this->$options_type['items'], fn ($item) => ! empty($item));
|
||||
$this->reset('input_items_1');
|
||||
$this->reset('input_items_2');
|
||||
$this->reset('input_items_3');
|
||||
@@ -153,7 +171,7 @@ class Edit extends Component
|
||||
$this->validate();
|
||||
|
||||
$this->plan->name = $this->name;
|
||||
$this->plan->image = !is_string($this->image) ? $this->image->store('plans', 'public') : $this->image;
|
||||
$this->plan->image = ! is_string($this->image) ? $this->image->store('plans', 'public') : $this->image;
|
||||
$this->plan->duration = $this->duration;
|
||||
$this->plan->state = $this->state;
|
||||
$this->plan->details = $this->details;
|
||||
|
||||
@@ -24,12 +24,12 @@ class Plan extends Model implements Viewable
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
->generateSlugsFrom(['name'] )
|
||||
->generateSlugsFrom(['name'])
|
||||
->saveSlugsTo('slug')
|
||||
// ->slugsShouldBeNoLongerThan(20)
|
||||
->usingSeparator('_');
|
||||
// ->usingLanguage('ru')
|
||||
// ->doNotGenerateSlugsOnUpdate();
|
||||
// ->usingLanguage('ru')
|
||||
// ->doNotGenerateSlugsOnUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ class PlanFactory extends Factory
|
||||
'name' => $this->faker->foodName(),
|
||||
// 'image' => UploadedFile::fake()->image('plans/Photo_C.png'),
|
||||
'image' => $fileLocalPath,
|
||||
'duration' => $this->faker->randomElement([7, 14,21]),
|
||||
'duration' => $this->faker->randomElement([7, 14, 21]),
|
||||
'state' => $this->faker->randomElement(['active', 'draft', 'unactive']),
|
||||
//'type' => $this->faker->randomElement([$typeBody, $wrongTypeBody]),
|
||||
'type' => $typeBody,
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
<?php include '/opt/index.php';
|
||||
<?php
|
||||
|
||||
include '/opt/index.php';
|
||||
|
||||
@@ -88,7 +88,7 @@ Route::group(
|
||||
Route::resource('calendar', CalendarController::class);
|
||||
Route::resource('user_detailz', UserDetailzController::class);
|
||||
Route::resource('user', UserController::class)->only('show');
|
||||
Route::resource('finance', FinanceController::class)->only(['index','show']);
|
||||
Route::resource('finance', FinanceController::class)->only(['index', 'show']);
|
||||
Route::resource('plan', PlanController::class)->only(['create', 'show', 'index', 'edit']);
|
||||
Route::resource('diet', DietController::class)->only(['create', 'show', 'index', 'edit']);
|
||||
Route::resource('consultants', ConsultantController::class)->only(['index']);
|
||||
|
||||
@@ -42,7 +42,7 @@ class CreateTest extends TestCase
|
||||
->get(route('plan.create'));
|
||||
|
||||
$response->assertSuccessful();
|
||||
// ->assertRedirect(route('home'));
|
||||
// ->assertRedirect(route('home'));
|
||||
}
|
||||
|
||||
public function test_publish_new_plan_success(): void
|
||||
@@ -50,7 +50,7 @@ class CreateTest extends TestCase
|
||||
$this->actingAs($this->user);
|
||||
|
||||
// $this->assertEquals($this->plan->count(), $count = Plan::count());
|
||||
$planCountAtStart = Plan::count();
|
||||
$planCountAtStart = Plan::count();
|
||||
|
||||
Livewire::test(Create::class)
|
||||
->set('name', $this->plan->name)
|
||||
@@ -84,7 +84,6 @@ class CreateTest extends TestCase
|
||||
|
||||
$response->assertSuccessful();
|
||||
|
||||
|
||||
// $this->assertEquals($count + 1, Plan::count());
|
||||
}
|
||||
|
||||
@@ -92,7 +91,7 @@ class CreateTest extends TestCase
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$planCountAtStart = Plan::count();
|
||||
$planCountAtStart = Plan::count();
|
||||
|
||||
// $planLastId = $this->plan->latest()->first()->id;
|
||||
// $expectedRedirectRoute = route('plan.show', ['plan' => $planLastId + 1]);
|
||||
@@ -130,7 +129,7 @@ class CreateTest extends TestCase
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$planCountAtStart = Plan::count();
|
||||
$planCountAtStart = Plan::count();
|
||||
|
||||
Livewire::test(Create::class)
|
||||
->set('name', $this->plan->name)
|
||||
@@ -165,7 +164,7 @@ class CreateTest extends TestCase
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$planCountAtStart = Plan::count();
|
||||
$planCountAtStart = Plan::count();
|
||||
|
||||
Livewire::test(Create::class)
|
||||
->set('name', null)
|
||||
|
||||
Reference in New Issue
Block a user