forked from aslan/applicant-site
Compare commits
14 Commits
feature/vi
...
main
Author | SHA1 | Date |
---|---|---|
aslan | 90d38a74ad | |
aslan | 4b5b29f8b9 | |
aslan | aaaec23a25 | |
aslan | b65cce5722 | |
aslan | b9dfe9669a | |
aslan | d6b07066de | |
aslan | 7206bab9c2 | |
aslan | 18df25c6a8 | |
aslan | 9f926f4ac5 | |
aslan | 73e6502e60 | |
aslan | 97f4cd68e6 | |
aslan | 0419aebe18 | |
aslan | 4093e2ce51 | |
aslan | 90fffa0279 |
|
@ -3,7 +3,9 @@
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Models\Direction;
|
use App\Models\Direction;
|
||||||
|
use App\Models\DirectionDescription;
|
||||||
use App\Models\DirectionProfile;
|
use App\Models\DirectionProfile;
|
||||||
|
use App\Models\Document;
|
||||||
use App\Models\EntranceExamination;
|
use App\Models\EntranceExamination;
|
||||||
use App\Models\ExaminationType;
|
use App\Models\ExaminationType;
|
||||||
use App\Models\Faculty;
|
use App\Models\Faculty;
|
||||||
|
@ -66,4 +68,16 @@ class PositionHelper
|
||||||
$maxPosition = EntranceExamination::max('position');
|
$maxPosition = EntranceExamination::max('position');
|
||||||
return $maxPosition >= 254 ? 255 : $maxPosition + 1;
|
return $maxPosition >= 254 ? 255 : $maxPosition + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function document()
|
||||||
|
{
|
||||||
|
$maxPosition = Document::max('position');
|
||||||
|
return $maxPosition >= 254 ? 255 : $maxPosition + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function directionDescription()
|
||||||
|
{
|
||||||
|
$maxPosition = DirectionDescription::max('position');
|
||||||
|
return $maxPosition >= 254 ? 255 : $maxPosition + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,11 @@ class NewsController extends Controller
|
||||||
public function update(UpdateNewsRequest $request, News $news)
|
public function update(UpdateNewsRequest $request, News $news)
|
||||||
{
|
{
|
||||||
$validated = $request->validated();
|
$validated = $request->validated();
|
||||||
|
$urlPhoto = Storage::put('public', $request->file('photo'));
|
||||||
|
|
||||||
$news->name = $validated['name'];
|
$news->name = $validated['name'];
|
||||||
$news->text = $validated['text'];
|
$news->text = $validated['text'];
|
||||||
|
$news->photo = Storage::url($urlPhoto);
|
||||||
$news->save();
|
$news->save();
|
||||||
return redirect()->route('news.index');
|
return redirect()->route('news.index');
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\admin\Catalog;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\admin\StoreDirectionDescriptionRequest;
|
||||||
|
use App\Http\Requests\admin\UpdateDirectionDescriptionRequest;
|
||||||
|
use App\Models\Direction;
|
||||||
|
use App\Models\DirectionDescription;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class DirectionDescriptionController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$directionDescriptions = DirectionDescription::all();
|
||||||
|
return view('admin.catalog.direction_description.index', compact('directionDescriptions'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$directionCodes = Direction::pluck('full_name', 'code');
|
||||||
|
return view('admin.catalog.direction_description.create', compact('directionCodes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(StoreDirectionDescriptionRequest $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
$fileName = $request->file('file')->getClientOriginalName();
|
||||||
|
$name = Storage::put('public', $request->file('file'));
|
||||||
|
|
||||||
|
$directionDescription = new DirectionDescription();
|
||||||
|
$directionDescription->url = Storage::url($name);
|
||||||
|
$directionDescription->direction_code = Direction::select('code', 'id')
|
||||||
|
->where('code', $validated['direction_code'])
|
||||||
|
->first()
|
||||||
|
->id;
|
||||||
|
$directionDescription->file_name = $fileName;
|
||||||
|
$directionDescription->position = $validated['position'];
|
||||||
|
$directionDescription->save();
|
||||||
|
return redirect()->route('direction_descriptions.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(DirectionDescription $directionDescription)
|
||||||
|
{
|
||||||
|
$directionCodes = Direction::pluck('full_name', 'code');
|
||||||
|
return view('admin.catalog.direction_description.edit', compact('directionDescription', 'directionCodes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(UpdateDirectionDescriptionRequest $request, DirectionDescription $directionDescription)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
$fileName = $request->file('file')->getClientOriginalName();
|
||||||
|
$name = Storage::put('public', $request->file('file'));
|
||||||
|
|
||||||
|
$directionDescription->url = Storage::url($name);
|
||||||
|
$directionDescription->direction_code = Direction::select('code', 'id')
|
||||||
|
->where('code', $validated['direction_code'])
|
||||||
|
->first()
|
||||||
|
->id;
|
||||||
|
$directionDescription->file_name = $fileName;
|
||||||
|
$directionDescription->position = $validated['position'];
|
||||||
|
$directionDescription->save();
|
||||||
|
return redirect()->route('direction_descriptions.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(DirectionDescription $directionDescription)
|
||||||
|
{
|
||||||
|
$directionDescription->delete();
|
||||||
|
return redirect()->route('direction_descriptions.index');
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,9 @@ class DocumentController extends Controller
|
||||||
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
|
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
|
||||||
{
|
{
|
||||||
$admissions = Admission::pluck('name', 'id');
|
$admissions = Admission::pluck('name', 'id');
|
||||||
return view('admin.documents.create', compact('admissions'));
|
$lastDocument = Document::latest()->first();
|
||||||
|
// dd($lastDocument->admission_id);
|
||||||
|
return view('admin.documents.create', compact('admissions', 'lastDocument'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(StoreDocumentRequest $request): RedirectResponse
|
public function store(StoreDocumentRequest $request): RedirectResponse
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class StoreDirectionDescriptionRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'direction_code' => 'required|string|max:255|exists:directions,code',
|
||||||
|
'file' => 'required|file',
|
||||||
|
'file_name' => 'nullable|string|max:255',
|
||||||
|
'position' => 'required|int|numeric|max:255',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,10 +16,30 @@ class StoreDocumentRequest extends FormRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255',
|
||||||
'description' => 'string',
|
'description' => 'string|nullable',
|
||||||
'position' => 'required|int|numeric|max:255',
|
'position' => 'required|int|numeric|max:255',
|
||||||
'document' => 'required|file',
|
'document' => 'required|file',
|
||||||
'admission_id' => 'required|int|numeric|max:1000',
|
'admission_id' => 'required|int|numeric|max:1000',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'position.required' => 'Поле позиция обязательно.',
|
||||||
|
'position.int' => 'Позиция должно быть целым числом.',
|
||||||
|
'position.numeric' => 'Позиция должно быть числом.',
|
||||||
|
'position.max' => 'Позиция не должен быть больше :max',
|
||||||
|
'name.required' => 'Поле название обязательно.',
|
||||||
|
'name.string' => 'Поле название должен быть строкой.',
|
||||||
|
'name.max' => 'Поле название не должен превышать :max символов.',
|
||||||
|
'name.unique' => 'Название уже занят.',
|
||||||
|
'description.string' => 'Поле описание должен быть строкой.',
|
||||||
|
'document.required' => 'Поле документ обязательно.',
|
||||||
|
'admission_id.required' => 'Поле Пункт приема обучения обязательно.',
|
||||||
|
'admission_id.int' => 'Стоимость Пункт приема должно быть целым числом.',
|
||||||
|
'admission_id.numeric' => 'Стоимость Пункт приема должно быть числом.',
|
||||||
|
'admission_id.max' => 'Стоимость Пункт приема не должен быть больше :max',
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class UpdateDirectionDescriptionRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'direction_code' => 'required|string|max:255|exists:directions,code',
|
||||||
|
'file' => 'required|file',
|
||||||
|
'file_name' => 'nullable|string|max:255',
|
||||||
|
'position' => 'required|int|numeric|max:255',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,8 +21,28 @@ class UpdateDocumentRequest extends FormRequest
|
||||||
"unique:documents,name,{$this->document->id}",
|
"unique:documents,name,{$this->document->id}",
|
||||||
],
|
],
|
||||||
'position' => 'required|int|numeric|max:255',
|
'position' => 'required|int|numeric|max:255',
|
||||||
'description' => 'string',
|
'description' => 'string|nullable',
|
||||||
'admission_id' => 'required|int|numeric|max:1000',
|
'admission_id' => 'required|int|numeric|max:1000',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'position.required' => 'Поле позиция обязательно.',
|
||||||
|
'position.int' => 'Позиция должно быть целым числом.',
|
||||||
|
'position.numeric' => 'Позиция должно быть числом.',
|
||||||
|
'position.max' => 'Позиция не должен быть больше :max',
|
||||||
|
'name.required' => 'Поле название обязательно.',
|
||||||
|
'name.string' => 'Поле название должен быть строкой.',
|
||||||
|
'name.max' => 'Поле название не должен превышать :max символов.',
|
||||||
|
'name.unique' => 'Название уже занят.',
|
||||||
|
'description.string' => 'Поле описание должен быть строкой.',
|
||||||
|
'document.required' => 'Поле документ обязательно.',
|
||||||
|
'admission_id.required' => 'Поле Пункт приема обучения обязательно.',
|
||||||
|
'admission_id.int' => 'Стоимость Пункт приема должно быть целым числом.',
|
||||||
|
'admission_id.numeric' => 'Стоимость Пункт приема должно быть числом.',
|
||||||
|
'admission_id.max' => 'Стоимость Пункт приема не должен быть больше :max',
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ class UpdateNewsRequest extends FormRequest
|
||||||
return [
|
return [
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255',
|
||||||
'text' => 'string',
|
'text' => 'string',
|
||||||
|
'photo' => 'required|file',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class DirectionDescription extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'direction_code',
|
||||||
|
'file_name',
|
||||||
|
'position',
|
||||||
|
'url'
|
||||||
|
];
|
||||||
|
}
|
|
@ -13,29 +13,29 @@
|
||||||
"fakerphp/faker": "^1.23.1",
|
"fakerphp/faker": "^1.23.1",
|
||||||
"guzzlehttp/guzzle": "^7.8.1",
|
"guzzlehttp/guzzle": "^7.8.1",
|
||||||
"imangazaliev/didom": "^2.0.1",
|
"imangazaliev/didom": "^2.0.1",
|
||||||
"laracasts/flash": "^3.2",
|
"laracasts/flash": "^3.2.3",
|
||||||
"laravel/framework": "^10.48.2",
|
"laravel/framework": "^10.48.12",
|
||||||
"laravel/sanctum": "^3.3.3",
|
"laravel/sanctum": "^3.3.3",
|
||||||
"laravel/tinker": "^2.9.0",
|
"laravel/tinker": "^2.9.0",
|
||||||
"laravel/ui": "^4.5.0",
|
"laravel/ui": "^4.5.2",
|
||||||
"laravelcollective/html": "^6.4.1",
|
"laravelcollective/html": "^6.4.1",
|
||||||
"league/flysystem": "^3.25.0",
|
"league/flysystem": "^3.28.0",
|
||||||
"maatwebsite/excel": "^3.1.55",
|
"maatwebsite/excel": "^3.1.55",
|
||||||
"rap2hpoutre/laravel-log-viewer": "^2.3",
|
"rap2hpoutre/laravel-log-viewer": "^2.4.0",
|
||||||
"spatie/laravel-query-builder": "^5.8",
|
"spatie/laravel-query-builder": "^5.8.1",
|
||||||
"twbs/bootstrap": "5.2.3"
|
"twbs/bootstrap": "5.2.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"laravel/breeze": "^1.29.1",
|
"laravel/breeze": "^1.29.1",
|
||||||
"laravel/pint": "^1.14.0",
|
"laravel/pint": "^1.16.0",
|
||||||
"laravel/sail": "^1.29.0",
|
"laravel/sail": "^1.29.2",
|
||||||
"mockery/mockery": "^1.6.9",
|
"mockery/mockery": "^1.6.12",
|
||||||
"nunomaduro/collision": "^7.10.0",
|
"nunomaduro/collision": "^7.10.0",
|
||||||
"phpunit/phpunit": "^10.5.13",
|
"phpunit/phpunit": "^10.5.21",
|
||||||
"spatie/laravel-ignition": "^2.4.2",
|
"spatie/laravel-ignition": "^2.8.0",
|
||||||
"barryvdh/laravel-ide-helper": "^2.15.1",
|
"barryvdh/laravel-ide-helper": "^2.15.1",
|
||||||
"squizlabs/php_codesniffer": "^3.9.0",
|
"squizlabs/php_codesniffer": "^3.10.1",
|
||||||
"phpstan/phpstan": "^1.10.62"
|
"phpstan/phpstan": "^1.11.5"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\DirectionDescription>
|
||||||
|
*/
|
||||||
|
class DirectionDescriptionFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'file_name' => fake()->name(),
|
||||||
|
'position' => 1,
|
||||||
|
'url' => fake()->url(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ return new class extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('documents', function (Blueprint $table) {
|
Schema::create('documents', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name', 255)->unique();
|
$table->string('name', 255);
|
||||||
$table->string('file_name')->nullable();
|
$table->string('file_name')->nullable();
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
$table->string('url', 255);
|
$table->string('url', 255);
|
||||||
|
|
|
@ -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('direction_descriptions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('direction_code')->constrained('directions');
|
||||||
|
$table->string('file_name', 255)->nullable();
|
||||||
|
$table->string('position', 255);
|
||||||
|
$table->string('url', 255);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('direction_descriptions');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DirectionDescriptionSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
@php use App\Helpers\PositionHelper; @endphp
|
||||||
|
@extends('layouts.admin_layout')
|
||||||
|
@section('content')
|
||||||
|
@auth()
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<h1 class="">Прикрепить файл</h1>
|
||||||
|
{{ Form::open(['url' => route('direction_descriptions.store'), 'method' => 'POST', 'files'=>'true', 'class' => 'needs-validation', 'novalidate']) }}
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('direction_code', 'Направление', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id')]) }}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::select('direction_code', $directionCodes, null, ['class' => 'form-select', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id'), 'required']) }}
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Поле "Направление" обязательно!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-danger">
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('direction_code') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('file', 'Путь к Файлу', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id')]) }}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::file('file', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id'), 'required']) }}
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Поле "Путь к документу" обязательно!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-danger">
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('file') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('file_name', 'Имя файла') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('file_name', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('name') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('position', 'Позиция') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('position', PositionHelper::directionDescription(), ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('position') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
|
{{ Form::submit('Загрузить файл', ['class' => 'btn btn-primary'])}}
|
||||||
|
</div>
|
||||||
|
{{Form::close()}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endauth
|
||||||
|
@endsection
|
|
@ -0,0 +1,71 @@
|
||||||
|
@extends('layouts.admin_layout')
|
||||||
|
@section('content')
|
||||||
|
@auth()
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<h1 class="">Заменить файл</h1>
|
||||||
|
{{ Form::open(['url' => route('direction_descriptions.update', $directionDescription), 'method' => 'PATCH', 'files'=>'true', 'class' => 'needs-validation', 'novalidate']) }}
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('direction_code', 'Направление', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id')]) }}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::select('direction_code', $directionCodes, null, ['class' => 'form-select', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id'), 'required']) }}
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Поле "Направление" обязательно!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-danger">
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('direction_code') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('file', 'Путь к Файлу', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id')]) }}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::file('file', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.direction.department_id'), 'required']) }}
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Поле "Путь к документу" обязательно!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-danger">
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('file') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('file_name', 'Имя файла') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('file_name', $directionDescription->file_name, ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('name') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('position', 'Позиция') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('position', $directionDescription->position, ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('position') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
|
{{ Form::submit('Загрузить файл', ['class' => 'btn btn-primary'])}}
|
||||||
|
</div>
|
||||||
|
{{Form::close()}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endauth
|
||||||
|
@endsection
|
|
@ -0,0 +1,35 @@
|
||||||
|
@php use App\Models\Direction; @endphp
|
||||||
|
@extends('layouts.admin_layout')
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<h2>Документы</h2>
|
||||||
|
<br>
|
||||||
|
<a href="{{ route('direction_descriptions.create') }}" class="btn btn-primary">Добавить документ</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<table class="table">
|
||||||
|
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Направление</th>
|
||||||
|
<th scope="col">файл</th>
|
||||||
|
<th scope="col">действия</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($directionDescriptions as $directionDescription)
|
||||||
|
<tr>
|
||||||
|
<td>{{ Str::limit(Direction::where('id', $directionDescription->direction_code)->first()->full_name, 50) }}</td>
|
||||||
|
<td>{{ $directionDescription->file_name }}</td>
|
||||||
|
<td><a href="{{ route("direction_descriptions.edit", $directionDescription) }}" class="btn btn-secondary">редактировать</a>
|
||||||
|
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
|
||||||
|
href="{{ route('direction_descriptions.destroy', $directionDescription) }}" class="btn btn-danger">
|
||||||
|
удалить
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
@endsection
|
|
@ -1,3 +1,4 @@
|
||||||
|
@php use App\Helpers\PositionHelper; @endphp
|
||||||
@extends('layouts.admin_layout')
|
@extends('layouts.admin_layout')
|
||||||
@section('content')
|
@section('content')
|
||||||
@auth()
|
@auth()
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
{{ Form::label('position', 'Позиция') }}
|
{{ Form::label('position', 'Позиция') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
{{ Form::text('position', 0, ['class' => 'form-control']) }}
|
{{ Form::text('position', PositionHelper::document(), ['class' => 'form-control']) }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
@ -53,7 +54,7 @@
|
||||||
{{ Form::label('admission_id', 'Пункт экрана приема') }}
|
{{ Form::label('admission_id', 'Пункт экрана приема') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
{{ Form::select('admission_id', $admissions, null, ['class' => 'form-select']) }}
|
{{ Form::select('admission_id', $admissions, $lastDocument->admission_id, ['class' => 'form-select']) }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
|
|
@ -40,6 +40,22 @@
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-2">
|
||||||
|
{{ Form::label('photo', 'Путь к фото') }}
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
{{ Form::file('photo', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.news.photo'), 'required']) }}
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Поле "Путь к фото" обязательно!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-danger">
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('photo') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,7 +56,9 @@
|
||||||
<li class="list-group-item {{ request()->is('admin/feedback*') && !request()->is('admin/feedback_statuses*') ? 'active' : '' }}"><a class="{{ request()->is('admin/feedback*') && !request()->is('admin/feedback_statuses*') ? 'link-light' : '' }}" href="{{ route('feedback.index') }}">Обратная связь</a></li>
|
<li class="list-group-item {{ request()->is('admin/feedback*') && !request()->is('admin/feedback_statuses*') ? 'active' : '' }}"><a class="{{ request()->is('admin/feedback*') && !request()->is('admin/feedback_statuses*') ? 'link-light' : '' }}" href="{{ route('feedback.index') }}">Обратная связь</a></li>
|
||||||
<li class="list-group-item {{ request()->is('admin/documents*') ? 'active' : '' }}"><a class="{{ request()->is('admin/documents*') ? 'link-light' : '' }}" href="{{ route('documents.index') }}">Документы</a></li>
|
<li class="list-group-item {{ request()->is('admin/documents*') ? 'active' : '' }}"><a class="{{ request()->is('admin/documents*') ? 'link-light' : '' }}" href="{{ route('documents.index') }}">Документы</a></li>
|
||||||
<li class="list-group-item {{ request()->is('admin/admissions*') ? 'active' : '' }}"><a class="{{ request()->is('admin/admissions*') ? 'link-light' : '' }}" href="{{ route('admissions.index') }}">Экран Приема</a></li>
|
<li class="list-group-item {{ request()->is('admin/admissions*') ? 'active' : '' }}"><a class="{{ request()->is('admin/admissions*') ? 'link-light' : '' }}" href="{{ route('admissions.index') }}">Экран Приема</a></li>
|
||||||
|
<li class="list-group-item"></li>
|
||||||
<li class="list-group-item {{ request()->is('admin/directions*') ? 'active' : '' }}"><a class="{{ request()->is('admin/directions*') ? 'link-light' : '' }}" href="{{ route('directions.index') }}">Направления</a></li>
|
<li class="list-group-item {{ request()->is('admin/directions*') ? 'active' : '' }}"><a class="{{ request()->is('admin/directions*') ? 'link-light' : '' }}" href="{{ route('directions.index') }}">Направления</a></li>
|
||||||
|
<li class="list-group-item {{ request()->is('admin/direction_descriptions*') ? 'active' : '' }}"><a class="{{ request()->is('admin/direction_descriptions*') ? 'link-light' : '' }}" href="{{ route('direction_descriptions.index') }}">Файлы для Направлений</a></li>
|
||||||
@can('viewAny', Auth::user())
|
@can('viewAny', Auth::user())
|
||||||
<li class="list-group-item"></li>
|
<li class="list-group-item"></li>
|
||||||
<li class="list-group-item {{ request()->is('admin/users*') ? 'active' : '' }}"><a class="{{ request()->is('admin/users*') ? 'link-light' : '' }}" href="{{ route('users.index') }}">Список администраторов</a></li>
|
<li class="list-group-item {{ request()->is('admin/users*') ? 'active' : '' }}"><a class="{{ request()->is('admin/users*') ? 'link-light' : '' }}" href="{{ route('users.index') }}">Список администраторов</a></li>
|
||||||
|
|
|
@ -10,6 +10,7 @@ use App\Http\Controllers\admin\Catalog\Direction\ExaminationTypeController;
|
||||||
use App\Http\Controllers\admin\Catalog\Direction\SubjectController;
|
use App\Http\Controllers\admin\Catalog\Direction\SubjectController;
|
||||||
use App\Http\Controllers\admin\Catalog\Direction\SubjectTypeController;
|
use App\Http\Controllers\admin\Catalog\Direction\SubjectTypeController;
|
||||||
use App\Http\Controllers\admin\Catalog\DirectionController;
|
use App\Http\Controllers\admin\Catalog\DirectionController;
|
||||||
|
use App\Http\Controllers\admin\Catalog\DirectionDescriptionController;
|
||||||
use App\Http\Controllers\admin\Catalog\EducationalInstitutionController;
|
use App\Http\Controllers\admin\Catalog\EducationalInstitutionController;
|
||||||
use App\Http\Controllers\admin\Catalog\FacultyController;
|
use App\Http\Controllers\admin\Catalog\FacultyController;
|
||||||
use App\Http\Controllers\admin\DocumentController;
|
use App\Http\Controllers\admin\DocumentController;
|
||||||
|
@ -69,6 +70,8 @@ Route::middleware(['auth', 'verified'])->prefix('admin')->group(function () {
|
||||||
|
|
||||||
Route::resource('/direction_profiles', DirectionProfileController::class)
|
Route::resource('/direction_profiles', DirectionProfileController::class)
|
||||||
->scoped(['direction_profile' => 'slug']);
|
->scoped(['direction_profile' => 'slug']);
|
||||||
|
Route::resource('/direction_descriptions', DirectionDescriptionController::class)
|
||||||
|
->scoped(['direction_descriptions' => 'slug']);
|
||||||
|
|
||||||
Route::resource('/feedback', FeedbackController::class)->only(['index', 'edit', 'update']);
|
Route::resource('/feedback', FeedbackController::class)->only(['index', 'edit', 'update']);
|
||||||
Route::resource('/feedback_statuses', FeedbackStatusController::class);
|
Route::resource('/feedback_statuses', FeedbackStatusController::class);
|
||||||
|
|
|
@ -79,9 +79,10 @@ class NewsTest extends TestCase
|
||||||
|
|
||||||
public function testUpdateNews(): void
|
public function testUpdateNews(): void
|
||||||
{
|
{
|
||||||
|
$file = UploadedFile::fake()->create('fake.jpg', 100);
|
||||||
$response = $this->actingAs($this->user)
|
$response = $this->actingAs($this->user)
|
||||||
->withSession(['banned' => false])
|
->withSession(['banned' => false])
|
||||||
->patch(route('news.update', $this->news), $this->data);
|
->patch(route('news.update', $this->news), [...$this->data, 'photo' => $file]);
|
||||||
|
|
||||||
$response->assertRedirect(route('news.index'));
|
$response->assertRedirect(route('news.index'));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue