Files
eatvio-infra/resources/views/diary/show.blade.php
Anatoliy Poloz a9601ab15d eating plan added
2022-07-27 14:53:16 +00:00

113 lines
5.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts/eatvio')
@section('main_section')
@php
$curMeals = $curDiary->meals()->orderBy('type')->get();
$typeNames = ['Завтрaк', 'Обед', 'Ужин', 'Ланч', 'Перекусы'];
$commentTypes = ['breakfast', 'dinner', 'supper', 'lunch', 'snacks', 'wakeup_time', 'total'];
$hasComments = $curDiary->hasComments;
$comments = $curDiary->consultant_comments()->pluck('comment', 'comment_type');
@endphp
<section class="py-5" id="main">
<div class="container d-flex justify-content-between align-items-center mb-4 px-4 py-2 --bg_white --shadow --radius --mw-1000">
<a href="{{ route('calendar.index') }}" class="d-flex align-items-center --f_bold --f_main"><svg width="17" height="16" class="me-2"><use xlink:href="#GoBack"></use></svg><span class="d-none d-md-inline">Календарь</span></a>
<div class="fs-5_5 text-center">
<div class="--f_bolder"><a class="link-dark" href="{{ route('calendar.index') }}">{{ $daysCount }} День</a></div>
<div class="--f_blue">{{ $curDiary->date }}</div>
</div>
</div>
<div class="container d-flex justify-content-between align-items-center mb-4 px-0 py-2 --mw-1000 flex-wrap flex-md-nowrap">
<div class="w-45 me-3 py-3 px-4 --bg_white --shadow --radius text-center --f_bold --no_wrap">
<p>Проснулись</p>
<div class="d-flex align-items-center justify-content-center">
<svg width="24" height="24" class="me-2"><use xlink:href="#Clock"></use></svg>
<span class="--f_blue">{{ $curDiary->wakeup }}</span>
</div>
</div>
<div class="w-45 py-3 px-4 --bg_white --shadow --radius text-center --f_bold --no_wrap">
<p>Легли спать</p>
<div class="d-flex align-items-center justify-content-center">
<svg width="26" height="24" class="me-2"><use xlink:href="#Sleep"></use></svg>
<span class="--f_blue">{{ $curDiary->retire }}</span>
</div>
</div>
@if($hasComments)
<div class="ms-md-4_5 mt-3 mt-md-0 py-3 px-4 fs-4_5 --bg_note --bordered --radius --f_bold flex-grow-1 --arr_right">
{{ $comments->get('retire') }}
</div>
@endif
</div>
@foreach($curMeals as $key => $meal)
<div class="container mb-4 pt-3 pb-2 overflow-hidden --bg_white --shadow --radius --mw-1000">
<div class="d-flex px-md-5 justify-content-between align-items-center flex-wrap flex-lg-nowrap flex-column-reverse flex-lg-row overflow-x-xs-scroll">
<h3>{{ $typeNames[$meal->type] }}</h3>
<div class="d-flex mb-3 mb-lg-0 align-items-center">
<div class="d-flex align-items-center">
<small>Сытность:</small><span class="ms-2 fs-5 --f_bold --f_blue">{{ $meal->satiety }}</span>
</div>
<div class="d-flex mx-3 align-items-center">
<small>Настроение:</small><span class="ms-2 fs-5 --f_bold --f_blue">{{ $meal->mood }}</span>
</div>
<div class="d-flex align-items-center">
<svg width="23" height="22"><use xlink:href="#Time"></use></svg>
<span class="ms-2 fs-5 --f_bold --f_blue">{{ $meal->time }}</span>
</div>
</div>
</div>
@if(count($meal->portions))
<div class="mt-3">
<div class="" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-0" role="tabpanel" aria-labelledby="pills-0-tab">
<table class="table --table_blue mb-0 fs-4_5 --f_bold">
@foreach($meal->portions as $portion)
<tr>
<td class="ps-md-5 w-50">{{ $portion->product_name }}</td>
<td class="pe-md-5 w-50 text-end">{{ $portion->quantity }} {{ $portion->portion }}</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
@endif
@if(count($meal->photos))
<div class="d-flex">
@foreach($meal->photos as $photo)
<img src="{{ $photo->path }}" width="100" height="80" class="img-thumbnail"/>
@endforeach
</div>
@endif
</div>
@php $curComment = $comments->get($commentTypes[$meal->type]) @endphp
@if( $curComment !== null)
<div class="container --mw-1000 mb-4 py-3 px-4 fs-4_5 --bg_note --bordered --radius --f_bold --arr_top">
{{ $curComment }}
</div>
@endif
@endforeach
<div class="container mb-4 px-4 py-4 --bg_white --shadow --radius --mw-1000 text-center">
<small>
<p>Дополнительная информация:</p>
<div class="--f_bold">{{ $curDiary->comment ?? '' }}</div>
</small>
</div>
@if($hasComments)
<div class="container --mw-1000 mb-4 py-3 px-4 fs-4_5 --bg_note --bordered --radius --f_bold --arr_top">
{{ $comments->get('total') }}
</div>
@endif
<div class="container p-0 --mw-1000">
<a href="{{ route('diary.edit', ['diary' => $curDiary]) }}" class="btn btn-lg btn-secondary btn-block w-100 --f_bolder" type="submit">РЕДАКТИРОВАТЬ ДЕНЬ</a>
</div>
</section>
@endsection