add form for ReceptionScreen

This commit is contained in:
aslan 2024-01-24 15:41:20 +03:00
parent 2ade2d5696
commit c1505ec84c
2 changed files with 86 additions and 22 deletions

View File

@ -18,13 +18,12 @@ class ReceptionScreenController extends Controller
return view('admin-reception-screen.index', compact('onlineDocuments')); return view('admin-reception-screen.index', compact('onlineDocuments'));
} }
public function create(ReceptionScreen $documentOnline): View public function create(): View
{ {
if (Auth::guest()) { if (Auth::guest()) {
abort(403); abort(403);
} }
$parent = $documentOnline; return view('admin-reception-screen.create');
return view('admin-reception-screen', compact('parent'));
} }
public function store(StoreReceptionScreenRequest $request) public function store(StoreReceptionScreenRequest $request)

View File

@ -1,23 +1,88 @@
@extends('layouts.admin-layout') @extends('layouts.admin-layout')
@section('content') @section('content')
@foreach($onlineDocuments as $onlineDocument) <div class="container">
<div> <h2>Экран Приема</h2>
{{ $onlineDocument->name }} <br>
{{ $onlineDocument->id }} <a href="{{ route('admin-reception-screen.create') }}" class="btn btn-primary">Создать пункт Экрана приема</a>
{{ $onlineDocument->position }} <br>
@foreach($onlineDocument->files as $file) <br>
<div> <table class="table">
{{ $file->name }} <thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
{{ $file->url }} <tr>
</div> <th scope="col">Позиция</th>
@endforeach <th scope="col">Название</th>
<th scope="col">действия</th>
</tr>
</thead>
<tbody>
@foreach($onlineDocuments as $onlineDocument)
<tr>
<th scope="row">{{ $onlineDocument->position }}</th>
<td>{{ $onlineDocument->name }}</td>
<td><a href="{{ route("admin-reception-screen.edit", $onlineDocument) }}" class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('admin-reception-screen.destroy', $onlineDocument) }}" class="btn btn-danger">
удалить
</a>
</td>
@if(count($onlineDocument->files) !== 0)
</tr>
<tr>
<td colspan="3">
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">Позиция</th>
<th scope="col">Имя Файла</th>
<th scope="col">действия</th>
</tr>
</thead>
<tbody>
</div> @foreach($onlineDocument->files->sortBy('position') as $file)
@endforeach <tr>
@php <th scope="row">{{ $file->position }}</th>
$files = \App\Models\File::all(); <td>{{ $file->name }}</td>
foreach ($files as $file) { <td><a href="{{ route("admin-reception-screen.edit", $file) }}"
echo ($file); class="btn btn-secondary">редактировать</a>
} <a rel="nofollow" data-method="delete"
@endphp data-confirm="Вы действительно хотите удалить?"
href="{{ route('admin-reception-screen.destroy', $file) }}"
class="btn btn-danger">
удалить
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="mb-2">
<a href="{{ route('admin-reception-screen.create') }}"
class="btn btn-primary">
Добавить файл
</a>
</div>
</td>
</tr>
@else
<tr>
<td colspan="3">
<a href="{{ route('admin-reception-screen.create') }}" class="btn btn-primary">Добавить
файл</a>
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<br>
<br>
{{ Form::open(array('url' => route('uploadfile'), 'method' => 'POST', 'files'=>'true')) }}
Select the file to upload.
{{ Form::file('image') }}
{{ Form::submit('Upload File')}}
{{Form::close()}}
</div>
@endsection @endsection