forked from eatvio/eatvio-infra
update reviews comments
This commit is contained in:
@@ -6,6 +6,7 @@ use Livewire\Component;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlanComment;
|
||||
use App\Models\User;
|
||||
use Livewire\Attributes\Validate;
|
||||
|
||||
class Create extends Component
|
||||
{
|
||||
@@ -21,6 +22,11 @@ class Create extends Component
|
||||
|
||||
public function save()
|
||||
{
|
||||
$this->validate([
|
||||
'body' => 'required|min:10',
|
||||
'grade' => 'required',
|
||||
]);
|
||||
|
||||
$comment = new PlanComment();
|
||||
$comment->grade = $this->grade;
|
||||
$comment->body = $this->body;
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
<div class="container px-0 mb-4 --mw-1000 --bg_white --radius fs-4_5">
|
||||
<div class="d-sm-flex justify-content-between align-items-centerr ps-2 pe-3 pt-2">
|
||||
<textarea wire:model="body" id="plan-comment-textarea" class="form-control h-100 --no_border --no_resize" placeholder="Введите свой комментарий"></textarea>
|
||||
<div class="h-100 ps-2 pt-3 pb-4 pb-sm-0 --stars --no_wrap">
|
||||
<a href="#sg1" wire:click.prevent="$set('grade', 1)">
|
||||
<svg id="sg1" @class(['yellow-star-filter' => $grade >= 1]) width="24" height="24"><use xlink:href="#StarIcon"></use></svg>
|
||||
</a>
|
||||
<a href="#sg2" wire:click.prevent="$set('grade', 2)">
|
||||
<svg id="sg2" @class(['yellow-star-filter' => $grade >= 2]) width="24" height="24"><use xlink:href="#StarIcon"></use></svg>
|
||||
</a>
|
||||
<a href="#sg3" wire:click.prevent="$set('grade', 3)">
|
||||
<svg id="sg3" @class(['yellow-star-filter' => $grade >= 3]) width="24" height="24"><use xlink:href="#StarIcon"></use></svg>
|
||||
</a>
|
||||
<a href="#sg4" wire:click.prevent="$set('grade', 4)">
|
||||
<svg id="sg4" @class(['yellow-star-filter' => $grade >= 4]) width="24" height="24"><use xlink:href="#StarIcon"></use></svg>
|
||||
</a>
|
||||
<a href="#sg5" wire:click.prevent="$set('grade', 5)">
|
||||
<svg id="sg5" @class(['yellow-star-filter' => $grade >= 5]) width="24" height="24"><use xlink:href="#StarIcon"></use></svg>
|
||||
</a>
|
||||
|
||||
<a href="#sg1" wire:click.prevent="save" class="ms-3"><svg width="24" height="24"><use xlink:href="#SendPlainIcon"></use></svg></a>
|
||||
<form class="reviews__form">
|
||||
<textarea wire:model="body" class="textarea textarea-white" placeholder="Введите отзыв"></textarea>
|
||||
<div class="reviews__form-column">
|
||||
<div class="reviews__form-rate star-rating">
|
||||
<input wire:click="$set('grade', 5)" type="radio" name="rate" id="rate-5" value="5" class="star-rating__input hidden" hidden>
|
||||
<label class="star-rating__label" for="rate-5"></label>
|
||||
<input wire:click="$set('grade',4)" type="radio" name="rate" id="rate-4" value="4" class="star-rating__input hidden" hidden>
|
||||
<label class="star-rating__label" for="rate-4"></label>
|
||||
<input wire:click="$set('grade',3)" type="radio" name="rate" id="rate-3" value="3" class="star-rating__input hidden" hidden>
|
||||
<label class="star-rating__label" for="rate-3"></label>
|
||||
<input wire:click="$set('grade',2)" type="radio" name="rate" id="rate-2" value="2" class="star-rating__input hidden" hidden>
|
||||
<label class="star-rating__label" for="rate-2"></label>
|
||||
<input wire:click="$set('grade',1)" type="radio" name="rate" id="rate-1" value="1" class="star-rating__input hidden" hidden>
|
||||
<label class="star-rating__label" for="rate-1"></label>
|
||||
</div>
|
||||
<button wire:click.prevent="save" type="button" class="btn btn-primary">Оставь отзыв</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user