docs module created
This commit is contained in:
parent
ccaeb45b93
commit
11670ab92e
72
app/Modules/Admin/Http/Controllers/AdminDocsController.php
Normal file
72
app/Modules/Admin/Http/Controllers/AdminDocsController.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use Modules\Docs\Models\Document;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class AdminDocsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$docs = Document::orderBy('name')->get();
|
||||
return view('admin::docs.index', [
|
||||
'docs' => $docs
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required',
|
||||
'description' => '',
|
||||
'file' => 'required|mimes:pdf,zip'
|
||||
]);
|
||||
$path = $request->file('file')->store('docs', ['disk' => 'local']);
|
||||
$request['path'] = $path;
|
||||
$document = Document::create(
|
||||
$request->only(['name', 'description', 'path'])
|
||||
);
|
||||
return to_route('admin.docs');
|
||||
}
|
||||
|
||||
public function edit(Document $document)
|
||||
{
|
||||
return view('admin::docs.edit', [
|
||||
'document' => $document
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request, Document $document)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required',
|
||||
'description' => '',
|
||||
'file' => 'mimes:pdf,zip'
|
||||
]);
|
||||
|
||||
if ($request->file('file'))
|
||||
{
|
||||
$path = $request->file('file')->store('docs', ['disk' => 'local']);
|
||||
$request['path'] = $path;
|
||||
}
|
||||
else
|
||||
{
|
||||
$reuqest['path'] = $document->path;
|
||||
}
|
||||
$document = $document->update(
|
||||
$request->only(['name', 'description', 'path'])
|
||||
);
|
||||
return to_route('admin.docs');
|
||||
}
|
||||
|
||||
public function delete(Document $document)
|
||||
{
|
||||
$document->delete();
|
||||
return to_route('admin.docs');
|
||||
}
|
||||
}
|
||||
@ -48,4 +48,10 @@
|
||||
Route::post('/admin/post/{post}/update', [Modules\Admin\Http\Controllers\AdminPostsController::class, 'update'])->name('admin.posts.update');
|
||||
Route::post('/admin/post/{post}/delete', [Modules\Admin\Http\Controllers\AdminPostsController::class, 'delete'])->name('admin.posts.delete');
|
||||
|
||||
Route::get('/admin/docs', [Modules\Admin\Http\Controllers\AdminDocsController::class, 'index'])->name('admin.docs');
|
||||
Route::get('/admin/docs/{document}/edit', [Modules\Admin\Http\Controllers\AdminDocsController::class, 'edit'])->name('admin.docs.edit');
|
||||
Route::post('/admin/docs/create', [Modules\Admin\Http\Controllers\AdminDocsController::class, 'store'])->name('admin.docs.create');
|
||||
Route::get('/admin/docs/{document}/edit', [Modules\Admin\Http\Controllers\AdminDocsController::class, 'edit'])->name('admin.docs.edit');
|
||||
Route::post('/admin/docs/{document}/update', [Modules\Admin\Http\Controllers\AdminDocsController::class, 'update'])->name('admin.docs.update');
|
||||
Route::post('/admin/docs/{document}/delete', [Modules\Admin\Http\Controllers\AdminDocsController::class, 'delete'])->name('admin.docs.delete');
|
||||
});
|
||||
35
app/Modules/Admin/Views/docs/edit.blade.php
Normal file
35
app/Modules/Admin/Views/docs/edit.blade.php
Normal file
@ -0,0 +1,35 @@
|
||||
@php($title = 'Документы / ' . $document->name)
|
||||
@extends('layouts.admin')
|
||||
@section('content')
|
||||
<form action="{{ route('admin.docs.update', ['document' => $document]) }}" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@csrf
|
||||
<div class="my-3">
|
||||
<label for="nameInput" class="form-label">Название файла</label>
|
||||
<input class="form-control" type="text" id="nameInput" name="name" value="{{ $document->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">{{ $document->description }}</textarea>
|
||||
@error('description')
|
||||
<div class="text-danger">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label for="file" class="form-label">Загруженный файл</label>
|
||||
<div class="mb-2">
|
||||
<x-document id="{{ $document->id }}" />
|
||||
</div>
|
||||
<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>
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
</form>
|
||||
@endsection
|
||||
100
app/Modules/Admin/Views/docs/index.blade.php
Normal file
100
app/Modules/Admin/Views/docs/index.blade.php
Normal file
@ -0,0 +1,100 @@
|
||||
@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
|
||||
@ -34,6 +34,12 @@ class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active"
|
||||
<li class="nav-item text-center m-2"><a
|
||||
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active"
|
||||
href="{{ route('admin.payments') }}">Вознаграждения</a></li>
|
||||
<li>
|
||||
<h6 class="dropdown-header text-uppercase">Прочее</h6>
|
||||
</li>
|
||||
<li class="nav-item text-center m-2"><a
|
||||
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active"
|
||||
href="{{ route('admin.docs') }}">Документы</a></li>
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
5
app/Modules/Docs/Config/config.php
Normal file
5
app/Modules/Docs/Config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('docs', function (Blueprint $table)
|
||||
{
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('description')->nullable();
|
||||
$table->string('path');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('docs');
|
||||
}
|
||||
};
|
||||
32
app/Modules/Docs/Http/Components/DocumentComponent.php
Normal file
32
app/Modules/Docs/Http/Components/DocumentComponent.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Docs\Http\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
use Modules\Docs\Models\Document;
|
||||
class DocumentComponent extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public $id
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view(
|
||||
'docs::components.document',
|
||||
[
|
||||
'document' => Document::find($this->id)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
24
app/Modules/Docs/Http/Controllers/DocsController.php
Normal file
24
app/Modules/Docs/Http/Controllers/DocsController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Docs\Http\Controllers;
|
||||
|
||||
use Modules\Docs\Models\Document;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
class DocsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$docs = Document::orderBy('name')->get();
|
||||
return view('docs::index', [
|
||||
'docs' => $docs
|
||||
]);
|
||||
}
|
||||
public function download(Document $document)
|
||||
{
|
||||
$ext = explode('.', $document->path);
|
||||
$ext = end($ext);
|
||||
return Storage::download($document->path, $document->name . '.' . $ext);
|
||||
}
|
||||
}
|
||||
20
app/Modules/Docs/Models/Document.php
Normal file
20
app/Modules/Docs/Models/Document.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Docs\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\ConfirmDelete;
|
||||
|
||||
class Document extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use ConfirmDelete;
|
||||
protected $table = 'docs';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'path'
|
||||
];
|
||||
}
|
||||
71
app/Modules/Docs/Providers/ModuleServiceProvider.php
Normal file
71
app/Modules/Docs/Providers/ModuleServiceProvider.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Docs\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Livewire\Livewire;
|
||||
|
||||
class ModuleServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Docs';
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
$this->registerViews();
|
||||
$this->registerLivewireViews();
|
||||
$this->registerMigrations();
|
||||
$this->registerConfig();
|
||||
$this->registerComponent();
|
||||
$this->registerLivewire();
|
||||
}
|
||||
|
||||
protected function registerViews()
|
||||
{
|
||||
$moduleViewsPath = __DIR__ . '/../Views';
|
||||
$this->loadViewsFrom(
|
||||
$moduleViewsPath,
|
||||
strtolower($this->moduleName)
|
||||
);
|
||||
}
|
||||
|
||||
protected function registerLivewireViews()
|
||||
{
|
||||
$moduleViewsPath = __DIR__ . '/../Views/livewire';
|
||||
$this->loadViewsFrom(
|
||||
$moduleViewsPath,
|
||||
strtolower($this->moduleName)
|
||||
);
|
||||
}
|
||||
|
||||
protected function registerMigrations()
|
||||
{
|
||||
$this->loadMigrationsFrom(
|
||||
app_path('Modules/' . $this->moduleName . '/Database/Migrations')
|
||||
);
|
||||
}
|
||||
|
||||
protected function registerConfig()
|
||||
{
|
||||
$path = app_path('Modules/' . $this->moduleName . '/Config/config.php');
|
||||
$this->mergeConfigFrom(
|
||||
$path,
|
||||
strtolower($this->moduleName)
|
||||
);
|
||||
}
|
||||
|
||||
protected function registerLivewire()
|
||||
{
|
||||
//Livewire::component('<name>', \Modules\<NAME>\Http\Livewire\<NAME>::class);
|
||||
}
|
||||
|
||||
protected function registerComponent()
|
||||
{
|
||||
Blade::component('document', \Modules\Docs\Http\Components\DocumentComponent::class);
|
||||
}
|
||||
}
|
||||
24
app/Modules/Docs/Providers/RouteServiceProvider.php
Normal file
24
app/Modules/Docs/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Docs\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
public function map()
|
||||
{
|
||||
$this->registerWebRoutes();
|
||||
}
|
||||
|
||||
protected function registerWebRoutes()
|
||||
{
|
||||
//Add Web Routes with web Guard
|
||||
Route::middleware('web')
|
||||
//Set Default Controllers Namespace
|
||||
->namespace('Modules\\Docs\\Http\\Controllers')
|
||||
->group(app_path('Modules/Docs/Routes/web.php'));
|
||||
}
|
||||
}
|
||||
12
app/Modules/Docs/Routes/web.php
Normal file
12
app/Modules/Docs/Routes/web.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Docs\Http\Controllers\DocsController;
|
||||
|
||||
Route::middleware(['auth'])->group(function ()
|
||||
{
|
||||
|
||||
Route::get('/doc', [DocsController::class, 'index'])->name('docs.index');
|
||||
Route::get('/docs/{document}/download', [DocsController::class, 'download'])->name('docs.download');
|
||||
|
||||
});
|
||||
18
app/Modules/Docs/Views/components/document.blade.php
Normal file
18
app/Modules/Docs/Views/components/document.blade.php
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="document-card d-flex border border-1 rounded-3 overflow-hidden">
|
||||
<div class="p-2 w-100 p-2">
|
||||
<h4>{{ $document->name }}</h4>
|
||||
<div class="fw-semibold">
|
||||
{{ $document->description }}
|
||||
</div>
|
||||
<div class="fw-lighter text-secondary">Загружен: {{ $document->created_at->diffForHumans() }}</div>
|
||||
</div>
|
||||
<div class="download d-flex align-items-center">
|
||||
<a href="{{ route('docs.download', ['document' => $document]) }}" class="m-auto text-white">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="currentColor"
|
||||
class="bi bi-arrow-down-circle" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd"
|
||||
d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293z" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
12
app/Modules/Docs/Views/index.blade.php
Normal file
12
app/Modules/Docs/Views/index.blade.php
Normal file
@ -0,0 +1,12 @@
|
||||
@php($title = 'Документы')
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="row g-2">
|
||||
@foreach ($docs as $document)
|
||||
<div class="col-6">
|
||||
<div class="p-3"><x-document id="{{ $document->id }}" /></div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@ -3,13 +3,22 @@
|
||||
namespace Modules\Post\Http\Controllers;
|
||||
|
||||
use Modules\Post\Models\Post;
|
||||
|
||||
use Modules\Post\Models\PostCategory;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PostController extends Controller
|
||||
{
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('post::index', [
|
||||
'categories' => PostCategory::cases(),
|
||||
'filter' => $request->filter ? $request->filter : []
|
||||
]);
|
||||
}
|
||||
|
||||
public function open(Post $post)
|
||||
{
|
||||
return view('post::list.card', [
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
class PostsList extends Component
|
||||
{
|
||||
public $count;
|
||||
public $filter;
|
||||
public $category;
|
||||
public function mount()
|
||||
{
|
||||
|
||||
@ -22,7 +22,15 @@ public function open($id)
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$posts = Post::all();
|
||||
$posts = Post::orderBy('id', 'desc');
|
||||
if ($this->category && $this->category != 'all')
|
||||
$posts = $posts->where('category', $this->category);
|
||||
|
||||
if ($this->count)
|
||||
$posts = $posts->take($this->count)->get();
|
||||
else
|
||||
$posts = $posts->take(10)->get();
|
||||
|
||||
return view('post::list.cards', [
|
||||
'posts' => $posts
|
||||
]);
|
||||
|
||||
@ -4,8 +4,5 @@
|
||||
|
||||
Route::middleware(['auth'])->group(function ()
|
||||
{
|
||||
|
||||
Route::get('/post/{post}', [Modules\Post\Http\Controllers\PostController::class, 'open'])->name('post.open');
|
||||
|
||||
|
||||
Route::get('/news', [Modules\Post\Http\Controllers\PostController::class, 'index'])->name('posts');
|
||||
});
|
||||
@ -1,4 +1,53 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<h1> Example views </h1>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<style>
|
||||
.btn-check:checked+.btn {
|
||||
background-color: rgb(231, 117, 11);
|
||||
color: white;
|
||||
}
|
||||
|
||||
td,
|
||||
h4 {
|
||||
color: #333c4e !important
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<div>
|
||||
<form class="d-lg-flex mb-3" method="GET" action="{{ route('posts') }}">
|
||||
<div class="p-2 border rounded-3 border-1 p-1 bg-white">
|
||||
<input type="radio" class="btn-check" onclick="this.form.submit()" name="filter[category]" value="all"
|
||||
id="option_all" autocomplete="off" checked>
|
||||
<label class="btn p-2 fs-5" for="option_all">Все</label>
|
||||
|
||||
@foreach ($categories as $category)
|
||||
<input type="radio" class="btn-check" onclick="this.form.submit()" name="filter[category]"
|
||||
value="{{ $category->value }}" id="cat_{{ $category->name }}" autocomplete="off"
|
||||
{{ isset($filter) && isset($filter['category']) && $filter['category'] == $category->value ? 'checked' : '' }}>
|
||||
<label class="btn p-2 fs-5" for="cat_{{ $category->name }}">{{ __($category->name) }}</label>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="ms-auto py-2 hstack gap-2">
|
||||
<select class="form-select form-select-lg bg-white" disabled aria-label="Large select example">
|
||||
<option selected>Город: любой</option>
|
||||
<option value="1">Иркутск</option>
|
||||
<option value="2">Владивосток</option>
|
||||
<option value="3">Красноярск</option>
|
||||
</select>
|
||||
<select class="form-select form-select-lg bg-white" disabled aria-label="Large select example">
|
||||
<option selected>Проект: все проекты</option>
|
||||
<option value="1">Проект 1</option>
|
||||
<option value="2">Проект 2</option>
|
||||
<option value="3">Проект 3</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@livewire('posts.list', $filter)
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
19
app/Traits/ConfirmDelete.php
Normal file
19
app/Traits/ConfirmDelete.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
trait ConfirmDelete
|
||||
{
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function ($item)
|
||||
{
|
||||
//$request = new Request();
|
||||
//dd($request->all());
|
||||
//return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
20
resources/css/docs.css
Normal file
20
resources/css/docs.css
Normal file
@ -0,0 +1,20 @@
|
||||
.document-card {
|
||||
transition: box-shadow .3s;
|
||||
}
|
||||
|
||||
.document-card:hover {
|
||||
box-shadow: 0 0 11px rgba(33, 33, 33, .2);
|
||||
}
|
||||
|
||||
.document-card .download {
|
||||
width: 70px;
|
||||
background-color: #b3b3b3
|
||||
}
|
||||
|
||||
.document-card:hover .download {
|
||||
background-color: #e6662a !important
|
||||
}
|
||||
|
||||
.document-card:hover h4 {
|
||||
color: #e6662a !important
|
||||
}
|
||||
@ -18,10 +18,10 @@
|
||||
уникальные</label>
|
||||
</div>
|
||||
<div class="ms-auto p-2">
|
||||
<select class="form-select form-select-lg" aria-label="Large select example">
|
||||
<select class="form-select form-select-lg" disabled aria-label="Large select example">
|
||||
<option selected="">Город: любой</option>
|
||||
@foreach ($cities as $city)
|
||||
<option selected="">{{ $city->name }}</option>
|
||||
<option value="{{ $city->id }}">{{ $city->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@ -48,7 +48,8 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="createClientModal" tabindex="-1" aria-labelledby="createAgentModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="createClientModal" tabindex="-1" aria-labelledby="createAgentModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -58,9 +59,9 @@
|
||||
<livewire:createClientForm />
|
||||
</div>
|
||||
<!--<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
|
||||
<input type="submit" class="btn btn-primary" value="Добавить">
|
||||
</div>-->
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
|
||||
<input type="submit" class="btn btn-primary" value="Добавить">
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
3
resources/views/components/document.blade.php
Normal file
3
resources/views/components/document.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<!-- Smile, breathe, and go slowly. - Thich Nhat Hanh -->
|
||||
</div>
|
||||
@ -15,7 +15,7 @@
|
||||
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
@vite(['resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css'])
|
||||
@vite(['resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css', 'resources/css/docs.css'])
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
@vite(['resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css'])
|
||||
@vite(['resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css', 'resources/css/docs.css'])
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -27,7 +27,8 @@
|
||||
<img src={{ url('/images/logo.png') }} alt="Logo" width="70">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col px-0 px-md-4 text-start text-truncate fw-bold fs-4 text-secondary" id="pageTitle">
|
||||
<div class="col px-0 px-md-4 text-start text-truncate fw-light fs-4 text-secondary text-uppercase"
|
||||
id="pageTitle">
|
||||
@isset($title)
|
||||
{{ $title }}
|
||||
@endisset
|
||||
|
||||
@ -27,7 +27,7 @@ class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" ar
|
||||
@endif
|
||||
|
||||
<li class="nav-item text-center m-2">
|
||||
<a href="/news" class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active"
|
||||
<a href="{{ route('posts') }}" class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active"
|
||||
aria-current="page">
|
||||
<i class="bi bi-layers"></i> <span class="d-none d-lg-inline">Новости</span>
|
||||
</a>
|
||||
@ -51,11 +51,18 @@ class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" ar
|
||||
</li>
|
||||
@endif
|
||||
|
||||
<li class="nav-item text-center m-2">
|
||||
<a href="{{ route('docs.index') }}"
|
||||
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" aria-current="page">
|
||||
<i class="bi bi-archive"></i> <span class="d-none d-lg-inline">Документы</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@if (in_array($roles::SUPER_ADMIN, $userRoles))
|
||||
<li class="nav-item text-center m-2">
|
||||
<a href="{{ route('admin.index') }}"
|
||||
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" aria-current="page">
|
||||
<i class="bi bi-gear11"></i> <span class="d-none d-lg-inline">Админка</span>
|
||||
<i class="bi bi-arrow-right-square"></i> <span class="d-none d-lg-inline">Админка</span>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@ -1,107 +0,0 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<style>
|
||||
.btn-check:checked+.btn {
|
||||
background-color: rgb(231, 117, 11);
|
||||
color: white;
|
||||
}
|
||||
|
||||
td,
|
||||
h4 {
|
||||
color: #333c4e !important
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<div>
|
||||
<div class="d-lg-flex mb-3">
|
||||
<div class="p-2 border rounded-3 border-1 p-1 bg-white">
|
||||
<input type="radio" class="btn-check" name="options-base" id="option5" autocomplete="off" checked>
|
||||
<label class="btn p-2 fs-5" for="option5">Все</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="options-base" id="option6" autocomplete="off">
|
||||
<label class="btn p-2 fs-5" for="option6">Проекты</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="options-base" id="option7" autocomplete="off">
|
||||
<label class="btn p-2 fs-5" for="option7">Скидки</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="options-base" id="option7" autocomplete="off">
|
||||
<label class="btn p-2 fs-5" for="option7">Ипотека</label>
|
||||
</div>
|
||||
<div class="ms-auto py-2 hstack gap-2">
|
||||
<select class="form-select form-select-lg bg-white" aria-label="Large select example">
|
||||
<option selected>Город: любой</option>
|
||||
<option value="1">Иркутск</option>
|
||||
<option value="2">Владивосток</option>
|
||||
<option value="3">Красноярск</option>
|
||||
</select>
|
||||
<select class="form-select form-select-lg bg-white" aria-label="Large select example">
|
||||
<option selected>Проект: все проекты</option>
|
||||
<option value="1">Проект 1</option>
|
||||
<option value="2">Проект 2</option>
|
||||
<option value="3">Проект 3</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@for ($i = 0; $i <= 3; $i++)
|
||||
<div class="d-lg-flex">
|
||||
<div class="card flex-fill border-0 p-2 m-2 bg-white" style="">
|
||||
<div class="card-img-top ratio ratio-16x9">
|
||||
<img src="https://img3.sibdom.ru/images/photo_crop_282_212/houses/photo_main/97/97be/97be2371dd0bba9c4605c3ea6f06e213.jpg"
|
||||
class="rounded" alt="...">
|
||||
<div class="position-absolute bottom-0 start-0 m-3">
|
||||
<span
|
||||
class="badge bg-light text-dark border-secondary bg-opacity-75 fs-6 rounded-pill">Новость</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="d-flex card-title fw-bold">
|
||||
<span class="">Рассрочка на 3 года</span>
|
||||
</h5>
|
||||
<p class="card-text">Быстро подберите вариант для клиента из нашего каталога</p>
|
||||
<p class="card-text text-secondary">10 августа 2024 г.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex-fill border-0 p-2 m-2 bg-white" style="">
|
||||
<div class="card-img-top ratio ratio-16x9">
|
||||
<img src="https://img3.sibdom.ru/images/photo_crop_282_212/houses/photo_main/97/97be/97be2371dd0bba9c4605c3ea6f06e213.jpg"
|
||||
class="rounded" alt="...">
|
||||
<div class="position-absolute bottom-0 start-0 m-3">
|
||||
<span
|
||||
class="badge bg-light text-dark border-secondary bg-opacity-75 fs-6 rounded-pill">Новость</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="d-flex card-title fw-bold">
|
||||
<span class="">Рассрочка на 3 года</span>
|
||||
</h5>
|
||||
<p class="card-text">Быстро подберите вариант для клиента из нашего каталога</p>
|
||||
<p class="card-text text-secondary">10 августа 2024 г.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex-fill border-0 p-2 m-2 bg-white" style="">
|
||||
<div class="card-img-top ratio ratio-16x9">
|
||||
<img src="https://img3.sibdom.ru/images/photo_crop_282_212/houses/photo_main/97/97be/97be2371dd0bba9c4605c3ea6f06e213.jpg"
|
||||
class="rounded" alt="...">
|
||||
<div class="position-absolute bottom-0 start-0 m-3">
|
||||
<span
|
||||
class="badge bg-light text-dark border-secondary bg-opacity-75 fs-6 rounded-pill">Новость</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="d-flex card-title fw-bold">
|
||||
<span class="">Рассрочка на 3 года</span>
|
||||
</h5>
|
||||
<p class="card-text">Быстро подберите вариант для клиента из нашего каталога</p>
|
||||
<p class="card-text text-secondary">10 августа 2024 г.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endfor
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@ -78,7 +78,9 @@ class="list-group-item list-group-item-action p-3 bg-white rounded border border
|
||||
<div class="fs-5 fw-bold">Новости</div>
|
||||
<div class="ms-auto p-2">Смотреть все</div>
|
||||
</div>
|
||||
@livewire(name: 'posts.list')
|
||||
@livewire('posts.list', [
|
||||
'count' => 3,
|
||||
])
|
||||
</div>
|
||||
<div class="mt-3 col-12">
|
||||
<div class="d-flex">
|
||||
|
||||
@ -56,11 +56,6 @@
|
||||
return view(view: 'makets.projects');
|
||||
});
|
||||
|
||||
Route::get('news', function ()
|
||||
{
|
||||
return view(view: 'makets.news');
|
||||
});
|
||||
|
||||
Route::get('profile', function ()
|
||||
{
|
||||
return view(view: 'user.profile');
|
||||
|
||||
@ -8,6 +8,7 @@ export default defineConfig({
|
||||
'resources/sass/app.scss',
|
||||
'resources/js/app.js',
|
||||
'resources/css/app.css',
|
||||
'resources/css/docs.css',
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user