Files
eatvio-infra/resources/views/livewire/diet/day-edit.blade.php
2023-10-04 17:57:09 +03:00

83 lines
6.7 KiB
PHP

<div>
<div class="px-4 py-3 --bg_white --shadow --radius">
<div class="d-flex justify-content-between mb-3 align-items-center fs-4_5">
<div>{{ __('diet.day_no') }} {{ $day }}</div>
<button type="button" class="justify-self-end" wire:click.prevent="$dispatch('makeCopy', '{{ $day }}')">
<span class="me-2">{{ __('diet.copy') }}</span>
<svg width="18" height="22"><use xlink:href="#copyIcon"></use></svg>
</button>
<button class="justify-self-end" wire:click.prevent="$dispath('makePaste', '{{ $day }}')">
<span class="me-2">{{ __('diet.paste') }}</span>
<img src="/img/paste.svg" alt="paste icon" width="24" height="24" />
</button>
</div>
<div class="mb-3 d-flex align-items-center flex-wrap flex-lg-nowrap flex-column-reverse flex-lg-row">
<ul class="nav nav-pills flex-nowrap w-100 --bordered --radius --tabs_blue overflow-x-xs-scroll" id="pills-tab-{{ $day }}" role="tablist">
@foreach($eatingTypes as $k => $type)
<li wire:key="button-{{ $k . "-" . $type }}" class="nav-item" role="presentation">
<button
@class(["btn-lg", "nav-link", "active" => $type === $activeType])
id="pills-home-{{ $day }}-tab"
data-bs-toggle="pill"
data-bs-target="#pills-{{ $k }}-{{ $day }}"
type="button"
role="tab"
wire:click="$set('activeType', '{{ $type }}')"
data-eating-type="{{ $type }}"
aria-controls="pills-{{ $k }}-{{ $day }}"
aria-selected="true">
<small>{{ __('diary.' . $type) }}</small>
</button>
</li>
@endforeach
</ul>
</div>
<div class="tab-content" id="pills-tabContent-{{ $day }}">
<div class="tab-pane fade active show" id="pills-{{ $activeType }}-{{ $day }}" role="tabpanel" aria-labelledby="pills-{{ $activeType }}-tab">
@if(isset($portions[$activeType]))
<div class="py-3">
<table class="w-100">
@foreach($portions[$activeType] as $pk => $curPortion)
<tr wire:key="{{ $curPortion['uniq'] }}" class="w-100">
<td class="w-45">{{ $curPortion['name'] }}</td>
<td>{{ $curPortion['quantity'] }}</td>
<td>{{ __('diet.' . $curPortion['portion']) }}</td>
<td>
<a href="#" wire:click.prevent="edit('{{ $curPortion['uniq'] }}', '{{ $activeType }}')">
<svg width="30" height="30">
<use xlink:href="#Settings"></use>
</svg>
</a>
</td>
<td>
<button wire:click.prevent="delete('{{ $curPortion['uniq'] }}', '{{ $activeType }}')" class="btn btn-outline-danger" type="button">x</button>
</td>
</tr>
@endforeach
</table>
</div>
@endif
<div class="d-flex align-items-center flex-wrap flex-sm-nowrap" data-row="0">
<input wire:model="name" type="text" class="form-control fs-4_5 py-3 w-50" placeholder="Введите название продукта...." required="">
<div class="d-flex w-md-50 align-items-center">
<div class="d-flex align-items-center ms-sm-2 mt-3 mt-sm-0">
<input wire:model="quantity" type="number" min="1" class="form-control fs-4_5 py-3 w-45 ms-sm-1" placeholder="Количество" required="">
<select wire:model="portion" class="form-control fs-4_5 py-3 w-45 ms-sm-1">
<option value="grams">{{ __('diet.grams') }}</option>
<option value="milliliters">{{ __('diet.milliliters') }}</option>
<option value="pcs">{{ __('diet.pcs') }}</option>
</select>
</div>
</div>
</div>
@error('name') <span class="error">{{ $message }}</span> @enderror
@error('quantity') <span class="error">{{ $message }}</span> @enderror
@error('portion') <span class="error">{{ $message }}</span> @enderror
<div wire:click="addPortion('{{ $activeType }}')" class="mt-3" data-row="0"><button type="button" class="btn btn-lg btn-primary btn-block w-60px fs-6 --f_bold">+</button></div>
</div>
</div>
</div>
</div>