101 lines
5.0 KiB
PHP
101 lines
5.0 KiB
PHP
@php($title = 'Документы')
|
|
@extends('layouts.admin')
|
|
@section('content')
|
|
<div class="d-flex mb-3">
|
|
<div class="ms-auto p-2">
|
|
<button class="btn btn-primary py-2 px-3 fs-5" data-bs-toggle="modal" data-bs-target="#createCityModal">
|
|
<i class="bi bi-plus"></i> Добавить документ
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3">
|
|
<table class="table m-0">
|
|
<thead>
|
|
<tr scope="col">
|
|
<th>Название</th>
|
|
<th>Описание</th>
|
|
<th>Дата создания</th>
|
|
<th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class=" ">
|
|
@foreach ($docs as $document)
|
|
<tr scope="row" class="">
|
|
<td class="align-middle">
|
|
{{ $document->name }}
|
|
</td>
|
|
<td class="align-middle">
|
|
{{ $document->description }}
|
|
</td>
|
|
<td>
|
|
{{ $document->created_at ? $document->created_at->diffForHumans() : '' }}
|
|
</td>
|
|
<td class="text-end">
|
|
<div class="dropdown" style="">
|
|
<button class="btn btn-light" type="button" id="dropdownMenuButton"
|
|
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
<i class="bi bi-three-dots-vertical"></i>
|
|
|
|
</button>
|
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
|
<a class="dropdown-item"
|
|
href="{{ route('docs.download', ['document' => $document]) }}">Скачать</a>
|
|
<a class="dropdown-item"
|
|
href="{{ route('admin.docs.edit', ['document' => $document]) }}">Редактировать</a>
|
|
<form method="post"
|
|
action="{{ route('admin.docs.delete', ['document' => $document]) }}"
|
|
onsubmit="return confirm('Вы уверены, что хотите удалить выбранный документ?');">
|
|
@csrf
|
|
<button class="dropdown-item" type="submit">Удалить</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="createCityModal" tabindex="-1" aria-labelledby="createCityModalLabel" aria-hidden="true">
|
|
|
|
<form class="modal-dialog modal-dialog-centered" action="{{ route('admin.docs.create') }}" method="post"
|
|
enctype="multipart/form-data">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h1 class="modal-title fs-5" id="createCityModalLabel">Загрузка документа</h1>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
@csrf
|
|
<div class="my-3">
|
|
<label for="nameInput" class="form-label">Название файла</label>
|
|
<input class="form-control" type="text" id="nameInput" name="name" required>
|
|
@error('name')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="my-3">
|
|
<label for="descriptionArea" class="form-label">Краткое описание</label>
|
|
<textarea class="form-control" id="descriptionArea" name="description" rows="3"></textarea>
|
|
@error('description')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="">
|
|
<label for="file" class="form-label">Файл</label>
|
|
<input class="form-control" type="file" id="file" name="file">
|
|
@error('file')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" class="btn btn-primary">Добавить</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection
|