Commit d338f8db85cbf3789621f2dfc761e2ce40654241

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 33 changed files Side-by-side Diff

app/Classes/Tools.php
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +
  3 +
  4 +namespace App\Classes;
  5 +
  6 +
  7 +class Tools
  8 +{
  9 + static function generator_id($length = 6)
  10 + {
  11 + $word = '';
  12 + $arr = array(
  13 + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
  14 + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
  15 + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
  16 + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  17 + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
  18 + );
  19 +
  20 + for ($i = 0; $i < $length; $i++) {
  21 + $word .= $arr[random_int(0, count($arr) - 1)];
  22 + }
  23 + return $word;
  24 + }
  25 +}
app/Http/Controllers/Admin/Ad_EmployersController.php
... ... @@ -31,24 +31,58 @@ class Ad_EmployersController extends Controller
31 31 }
32 32 }
33 33  
34   - $ad_employers = Ad_employer::with('employer')->with('jobs')
35   - ->where('is_remove', '0')->OrderBy('updated_at', 'desc')->paginate(15);
  34 + $select_job = Job_title::query()->active()->get();
  35 + $all_ad = Ad_employer::with('employer')->with('jobs')
  36 + ->where('is_remove', '0')->get()->count();
  37 +
  38 + $ad_employers = Ad_employer::where('is_remove', '0');
  39 +
  40 + $find_job = "";
  41 + if (isset($request->category_job)) {
  42 + if ($request->category_job != 'Все вакансии') {
  43 + $find_job = $request->category_job;
  44 + $ad_employers = $ad_employers->WhereHas('jobs', function($query) use ($find_job){
  45 + return $query->where('name', 'LIKE', '%'.$find_job.'%');
  46 + });
  47 + }
  48 + } else {
  49 + $ad_employers = $ad_employers->with('jobs');
  50 + }
  51 +
  52 + $find_key = "";
  53 + if (isset($request->find)) {
  54 + $find_key = $request->find;
  55 + $ad_employers = $ad_employers->whereHas('employer', function($query) use($find_key) {
  56 + $query->Where('name_company', 'LIKE', "%$find_key%");
  57 + $query->orWhere('name', 'LIKE', "%$find_key%");
  58 + });
  59 +
  60 + } else {
  61 + $ad_employers = $ad_employers->with('employer');
  62 + }
  63 +
  64 + $ad_employers = $ad_employers->OrderBy('updated_at', 'desc')->paginate(15);
36 65  
37 66 if ($request->ajax()) {
38 67 return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params'));
39 68 } else {
40   - return view('admin.ad_employers.index', compact('ad_employers', 'title'));
  69 + return view('admin.ad_employers.index', compact('ad_employers',
  70 + 'title',
  71 + 'all_ad',
  72 + 'find_job',
  73 + 'find_key',
  74 + 'select_job'));
41 75 }
42 76 }
43 77  
44 78 /**
45   - * Show the form for creating a new resource.
46   - *
  79 + * Show the form for creating a new resource
47 80 * @return \Illuminate\Http\Response
48 81 */
49 82 public function create()
50 83 {
51   - //
  84 + $job_titles = Job_title::query()->active()->get();
  85 + return view('admin.ad_employers.add', compact('job_titles'));
52 86 }
53 87  
54 88 /**
... ... @@ -59,7 +93,31 @@ class Ad_EmployersController extends Controller
59 93 */
60 94 public function store(Request $request)
61 95 {
62   - //
  96 + $params = $request->all();
  97 + unset($params->position_work);
  98 + $rules = [
  99 + 'name' => 'required|min:3',
  100 + ];
  101 + $messages = [
  102 + 'required' => 'Укажите обязательное поле',
  103 + ];
  104 + $validator = Validator::make($params, $rules, $messages);
  105 +
  106 + if ($validator->fails()) {
  107 + return redirect()->route('admin.add-ad-employers')
  108 + ->withErrors($validator);
  109 + } else {
  110 + $ad_employer = new Ad_employer();
  111 + $params['employer_id'] = 1;
  112 + $data_ad = $ad_employer->create($params);
  113 + $data_ad->jobs()->sync($request->position_work);
  114 + //$ad_employer->jobs()->sync($request->position_work);
  115 +
  116 +
  117 + return redirect()->route('admin.ad-employers')
  118 + ->with('success', 'Данные были успешно сохранены');
  119 + }
  120 + return redirect()->route('admin.ad-employers');
63 121 }
64 122  
65 123 /**
... ... @@ -131,6 +189,9 @@ class Ad_EmployersController extends Controller
131 189 */
132 190 public function destroy(Ad_employer $ad_employer)
133 191 {
134   - //
  192 + $ad_employer->is_remove = 1;
  193 + $ad_employer->save();
  194 +
  195 + return redirect()->route('admin.ad-employers');
135 196 }
136 197 }
app/Http/Controllers/Admin/AdminController.php
... ... @@ -2,6 +2,7 @@
2 2  
3 3 namespace App\Http\Controllers\Admin;
4 4  
  5 +use App\Classes\Tools;
5 6 use App\Http\Controllers\Controller;
6 7 use App\Http\Requests\CompanyRequest;
7 8 use App\Models\Company;
... ... @@ -28,12 +29,15 @@ class AdminController extends Controller
28 29 }
29 30  
30 31 public function register() {
31   - return view('admin.register');
  32 + $code_emp = Tools::generator_id(10);
  33 + return view('admin.register', compact('code_emp'));
32 34 }
33 35  
34 36 public function create(Request $request) {
35 37  
36   - $rules = [
  38 + $params = $request->all();
  39 + unset($params['code_emp']);
  40 + $rules = [
37 41 'name' => 'required|string|max:255',
38 42 'email' => 'required|string|email|max:255|unique:users',
39 43 'password' => 'required|string|min:8|confirmed',
... ... @@ -54,23 +58,30 @@ class AdminController extends Controller
54 58 ],
55 59 ];
56 60  
57   - $validator = Validator::make($request->all(), $rules, $messages);
  61 + $validator = Validator::make($params, $rules, $messages);
58 62  
59 63 if ($validator->fails()) {
60   - return back()->withErrors($validator)->withInput(); //->route('admin.register')
  64 + return back()->withErrors($validator)->withInput();
61 65  
62 66 } else {
63   - $params = $request->all();
64   -
65   - User::create([
66   - 'name' => $request->name,
67   - 'email' => $request->email,
68   - 'password' => Hash::make($request->password),
69   - 'pubpassword' => base64_encode($request->password),
70   - 'admin' => '1',
71   - 'email_verified_at' => Carbon::now()
  67 + try {
  68 + $user = User::create([
  69 + 'name' => $request->name,
  70 + 'email' => $request->email,
  71 + 'password' => Hash::make($request->password),
  72 + 'pubpassword' => base64_encode($request->password),
  73 + 'admin' => '1',
  74 + 'is_worker' => '0',
  75 + 'email_verified_at' => Carbon::now()
  76 + ]);
  77 + } finally {
  78 + $emp = Employer::create([
  79 + 'name_company' => 'Администратор',
  80 + 'user_id' => $user->id,
  81 + 'code' => $request->code_emp
  82 + ]);
  83 + }
72 84  
73   - ]);
74 85 return redirect()
75 86 ->route('admin.login')
76 87 ->with('success', 'Вы успешно зарегистрировались');
app/Http/Controllers/Admin/EducationController.php
... ... @@ -70,14 +70,9 @@ class EducationController extends Controller
70 70 */
71 71 public function edit(Education $education)
72 72 {
73   - $program1 = ProgramEducation::query()->where('education_id', '=', $education->id)
74   - ->where('level', '=', '1')->get();
75   - $program2 = ProgramEducation::query()->where('education_id', '=', $education->id)
76   - ->where('level', '=', '2')->get();
77   - $program3 = ProgramEducation::query()->where('education_id', '=', $education->id)
78   - ->where('level', '=', '3')->get();
79   -
80   - return view('admin.education.edit', compact('education', 'program1', 'program2', 'program3'));
  73 + $program = ProgramEducation::query()->where('education_id', '=', $education->id)
  74 + ->orderBy('level')->get();
  75 + return view('admin.education.edit', compact('education', 'program'));
81 76 }
82 77  
83 78 /**
... ... @@ -113,8 +108,9 @@ class EducationController extends Controller
113 108 return redirect()->route('admin.education.index');
114 109 }
115 110  
116   - public function add_program(Education $education, int $level) {
117   - $id_education = $education->id;
  111 + public function add_program(Request $request) {
  112 + $id_education = $request->id;
  113 + $level = $request->level;
118 114 return view('admin.education.program', compact('id_education', 'level'));
119 115 }
120 116  
... ... @@ -125,4 +121,11 @@ class EducationController extends Controller
125 121 return redirect()->route('admin.education.edit', ['education' => $education]);
126 122 }
127 123  
  124 + public function delete_program(ProgramEducation $program, Education $education) {
  125 + $education = $education->id;
  126 + $program->delete();
  127 +
  128 + return redirect()->route('admin.education.edit', ['education' => $education]);
  129 + }
  130 +
128 131 }
app/Http/Controllers/Admin/EmployersController.php
... ... @@ -27,7 +27,7 @@ class EmployersController extends Controller
27 27  
28 28 $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.logo as emp_logo', 'emp.*'])
29 29 ->join('employers as emp','emp.user_id','users.id')
30   - ->where('users.is_worker', '0')->Realuser();
  30 + ->where('users.is_worker', '0')->Realuser()->Notadmin();
31 31 $all_employer = $users->count();
32 32  
33 33 $find_cat = "";
... ... @@ -57,7 +57,11 @@ class EmployersController extends Controller
57 57 if ($request->ajax()) {
58 58 return view('admin.employer.index_ajax', compact('users'));
59 59 } else {
60   - return view('admin.employer.index', compact('users', 'find_key', 'find_cat', 'all_employer', 'select_category'));
  60 + return view('admin.employer.index', compact('users',
  61 + 'find_key',
  62 + 'find_cat',
  63 + 'all_employer',
  64 + 'select_category'));
61 65 }
62 66 }
63 67  
... ... @@ -144,10 +148,17 @@ class EmployersController extends Controller
144 148 public function delete_employer(Employer $employer, User $user) {
145 149 try {
146 150 if (!empty($employer)) {
147   - $employer->ads()->delete();
148 151 if (!empty($employer->logo)) {
149 152 Storage::delete($employer->logo);
150 153 }
  154 +
  155 + foreach($employer->ads as $ad) {
  156 + $ads = Ad_employer::find($ad->id);
  157 + $ads->employer_id = 2;
  158 + $ads->is_remove = 1;
  159 + $ads->save();
  160 + }
  161 +
151 162 $employer->delete();
152 163 }
153 164 } finally {
app/Http/Controllers/Admin/UsersController.php
... ... @@ -4,7 +4,9 @@ namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
6 6 use App\Http\Requests\BaseUserRequest;
  7 +use App\Models\Job_title;
7 8 use App\Models\User;
  9 +use App\Models\Worker;
8 10 use Illuminate\Http\Request;
9 11 use Illuminate\Support\Facades\Auth;
10 12 use Illuminate\Support\Facades\Storage;
... ... @@ -62,26 +64,40 @@ class UsersController extends Controller
62 64 }
63 65  
64 66 public function add_bd() {
65   - return view('admin.users.add');
  67 + $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get();
  68 + return view('admin.users.add', compact('list_job_titles'));
66 69 }
67 70  
68 71 public function add_store_bd(BaseUserRequest $request) {
69 72 $params = $request->all();
  73 + $position_work = $request->position_work;
70 74  
71 75 if ($request->has('file')) {
72 76 $params['file'] = $request->file('file')->store('basedata', 'public');
73 77 }
74 78  
  79 + if (isset($request->name)) {
  80 + $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2;
  81 + }
  82 +
75 83 $user = User::create($params);
  84 + $user_id = $user->id;
  85 + $worker = new Worker();
  86 + $worker->position_work = $position_work;
  87 + $worker->user_id = $user_id;
  88 + $worker->save();
  89 +
76 90 return redirect()->route('admin.basedata');
77 91 }
78 92  
79 93 public function edit_bd(User $user) {
80   - return view('admin.users.edit', compact('user'));
  94 + $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get();
  95 + return view('admin.users.edit', compact('user', 'list_job_titles'));
81 96 }
82 97  
83 98 public function update_bd(BaseUserRequest $request, User $user) {
84 99 $params = $request->all();
  100 + $position_work = $request->position_work;
85 101  
86 102 if ($request->has('file')) {
87 103 if (!empty($user->file)) Storage::delete($user->file);
... ... @@ -90,7 +106,22 @@ class UsersController extends Controller
90 106 if (!empty($user->image)) $params['file'] = $user->file;
91 107 }
92 108  
  109 + if (isset($request->name)) {
  110 + $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2;
  111 + }
  112 +
93 113 $user->update($params);
  114 + if (isset($user->workers[0]->id)) {
  115 + $worker = Worker::find($user->workers[0]->id);
  116 + $worker->position_work = $position_work;
  117 + $worker->save();
  118 + } else {
  119 + $worker = new Worker();
  120 + $worker->user_id = $user->id;
  121 + $worker->position_work = $position_work;
  122 + $worker->save();
  123 + }
  124 +
94 125 return redirect()->route('admin.basedata');
95 126 }
96 127  
app/Http/Controllers/Admin/WorkersController.php
... ... @@ -33,7 +33,8 @@ class WorkersController extends Controller
33 33 }
34 34  
35 35 $status_work = Job_title::query()->active()->orderBy('name')->get();
36   - $users = User::with('jobtitles')->where('is_worker', '1');
  36 + $users = User::with('jobtitles')->worker()->realuser();
  37 + $all_worker = $users->count();
37 38  
38 39 $find_status_work = "";
39 40 if (isset($request->status_work)) {
... ... @@ -126,7 +127,8 @@ class WorkersController extends Controller
126 127 'find_key',
127 128 'find_status_work',
128 129 'status_work',
129   - 'status_wor'));
  130 + 'status_wor',
  131 + 'all_worker'));
130 132 }
131 133 }
132 134  
app/Http/Controllers/MediaController.php
... ... @@ -0,0 +1,24 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers;
  4 +
  5 +use App\Models\Media;
  6 +use Illuminate\Http\Request;
  7 +use Illuminate\Support\Facades\Storage;
  8 +
  9 +class MediaController extends Controller
  10 +{
  11 + public function index() {
  12 + $Media = Media::query()->OrderBy('id', 'desc')->paginate();
  13 + return view('admin.media.index', compact('Media'));
  14 + }
  15 +
  16 + public function delete(Media $media) {
  17 + if (!empty($media->file)){
  18 + Storage::delete($media->file);
  19 + }
  20 +
  21 + $media->delete();
  22 + return redirect()->route('admin.media');
  23 + }
  24 +}
app/Http/Requests/BaseUserRequest.php
... ... @@ -23,11 +23,17 @@ class BaseUserRequest extends FormRequest
23 23 */
24 24 public function rules()
25 25 {
  26 +
  27 + $unique ='|unique:users';
  28 + if (in_array($this->route()->getName(), ['admin.update-basedata'])) {
  29 + $unique = '|unique:users,email,'.$this->user->id;
  30 + }
  31 +
26 32 return [
27   - 'name' => 'required|min:3|max:255',
  33 + //'name' => 'required|min:3|max:255',
28 34 'surname' => 'required|min:3|max:255',
29 35 'name_man' => 'required|min:3|max:255',
30   - 'email' => 'required|email|min:5',
  36 + 'email' => 'required|email|min:5'.$unique,
31 37 ];
32 38 }
33 39  
... ... @@ -42,7 +48,8 @@ class BaseUserRequest extends FormRequest
42 48 'string' => 'Поле «:attribute» должно быть не больше :max символов',
43 49 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
44 50 ],
45   - 'email' => 'Введите корректный емайл'
  51 + 'email' => 'Введите корректный емайл',
  52 + 'unique' => 'Емайл должен быть уникальным',
46 53  
47 54 ];
48 55 }
app/Models/Employer.php
... ... @@ -27,6 +27,10 @@ class Employer extends Model
27 27 'oficial_status',
28 28 'social_is',
29 29 'sending_is',
  30 + 'category',
  31 + 'comment_admin',
  32 + 'code',
  33 + 'status_hidden'
30 34 ];
31 35  
32 36 /*
app/Models/Media.php
... ... @@ -0,0 +1,24 @@
  1 +<?php
  2 +
  3 +namespace App\Models;
  4 +
  5 +use Illuminate\Database\Eloquent\Factories\HasFactory;
  6 +use Illuminate\Database\Eloquent\Model;
  7 +
  8 +class Media extends Model
  9 +{
  10 + use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'user_id',
  14 + 'file',
  15 + ];
  16 +
  17 + /*
  18 + * Связь таблицы media с таблицей users
  19 + многие-к-одному
  20 + */
  21 + public function user() {
  22 + return $this->belongsTo(User::class, 'user_id');
  23 + }
  24 +}
... ... @@ -131,6 +131,10 @@ class User extends Authenticatable
131 131 return $query->where('is_remove', '=', '0');
132 132 }
133 133  
  134 + public function scopeWorker($query) {
  135 + return $query->where('is_worker', '=', '1');
  136 + }
  137 +
134 138 public function scopeBaseuser($query) {
135 139 return $query->where('is_bd', '=', '1');
136 140 }
... ... @@ -139,4 +143,12 @@ class User extends Authenticatable
139 143 return $query->where('is_bd', '=', '0');
140 144 }
141 145  
  146 + public function scopeAdmin($query) {
  147 + return $query->where('admin', '=', '1');
  148 + }
  149 +
  150 + public function scopeNotadmin($query) {
  151 + return $query->where('admin', '=', '0');
  152 + }
  153 +
142 154 }
database/migrations/2023_10_28_112853_create_media_table.php
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::create('media', function (Blueprint $table) {
  17 + $table->id();
  18 + $table->string('file', 255)->nullable(false);
  19 + $table->bigInteger('user_id')->nullable(false);
  20 + $table->timestamps();
  21 + });
  22 + }
  23 +
  24 + /**
  25 + * Reverse the migrations.
  26 + *
  27 + * @return void
  28 + */
  29 + public function down()
  30 + {
  31 + Schema::dropIfExists('media');
  32 + }
  33 +};
database/migrations/2023_10_31_060833_alter_table_employers.php
... ... @@ -0,0 +1,32 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('employers', function (Blueprint $table) {
  17 + $table->string('code', 100)->nullable(false);
  18 + });
  19 + }
  20 +
  21 + /**
  22 + * Reverse the migrations.
  23 + *
  24 + * @return void
  25 + */
  26 + public function down()
  27 + {
  28 + Schema::table('employers', function (Blueprint $table) {
  29 + $table->dropColumn('code');
  30 + });
  31 + }
  32 +};
resources/views/admin/ad_employers/add.blade.php
... ... @@ -0,0 +1,104 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Добавление вакансии'])
  2 +
  3 +@section('script')
  4 +
  5 +@endsection
  6 +
  7 +@section('content')
  8 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
  9 + Добавление вакансии
  10 + </h4>
  11 + <form method="POST" action="{{ route('admin.store-ad-employers')}}">
  12 + @csrf
  13 + <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  14 + <label class="block text-sm">
  15 + <span class="text-gray-700 dark:text-gray-400">Название вакансии</span>
  16 + <input name="name" id="name"
  17 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  18 + placeholder="Название вакансии" value="{{ old('name') ?? '' }}"
  19 + />
  20 + @error('name')
  21 + <span class="text-xs text-red-600 dark:text-red-400">
  22 + {{ $message }}
  23 + </span>
  24 + @enderror
  25 + </label>
  26 +
  27 + <label class="block mt-4 text-sm">
  28 + <span class="text-gray-700 dark:text-gray-400">
  29 + Категории должности
  30 + </span>
  31 + <select
  32 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  33 + multiple
  34 + name="position_work[]" id="position_work"
  35 + >
  36 + @foreach($job_titles as $job)
  37 + <option value="{{$job->id}}" @if (old('position_work') == $job->id) selected @endif >
  38 + {{ $job->name }} ({{$job->id}})
  39 + </option>
  40 + @endforeach
  41 + </select>
  42 + </label><br>
  43 +
  44 + <label class="block text-sm">
  45 + <span class="text-gray-700 dark:text-gray-400">Текст-описание вакансии</span>
  46 + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Описание вакансии (text/html)"
  47 + rows="10">{{ old('text') ?? '' }}</textarea>
  48 + @error('text')
  49 + <span class="text-xs text-red-600 dark:text-red-400">
  50 + {{ $message }}
  51 + </span>
  52 + @enderror
  53 + </label>
  54 +
  55 + <label class="block mt-4 text-sm">
  56 + <span class="text-gray-700 dark:text-gray-400">
  57 + Статус вакансии
  58 + </span>
  59 + <select
  60 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  61 + name="status" id="status"
  62 + >
  63 + <option value="Не задан" @if (old('status') == "Не задан") selected @endif >
  64 + Не задан
  65 + </option>
  66 + <option value="Открыта" @if (old('status') == "Открыта") selected @endif >
  67 + Открыта
  68 + </option>
  69 + <option value="Закрыта" @if (old('status') == "Закрыта") selected @endif >
  70 + Закрыта
  71 + </option>
  72 + </select>
  73 + </label><br>
  74 +
  75 + <label class="block text-sm">
  76 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Срочная вакансия</p>
  77 + <input type="hidden" name="sroch_vacancy" value="0" />
  78 + <input name="sroch_vacancy"
  79 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  80 + placeholder="" type="checkbox" value="1"
  81 + /><br>
  82 +
  83 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Избранная вакансия</p>
  84 + <input type="hidden" name="favorite_vacancy" value="0" />
  85 + <input name="favorite_vacancy" id="favorite_vacancy"
  86 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  87 + placeholder="" type="checkbox" value="1"
  88 + /><br>
  89 + </label>
  90 +
  91 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  92 + <div>
  93 + <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  94 + Сохранить
  95 + </button>
  96 + <a href="{{ route('admin.ad-employers') }}"
  97 + class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
  98 + style="display: -webkit-inline-box; height: 30px!important;"
  99 + >Назад</a>
  100 + </div>
  101 + </div>
  102 + </div>
  103 + </form>
  104 +@endsection
resources/views/admin/ad_employers/edit.blade.php
... ... @@ -39,6 +39,17 @@
39 39 </option>
40 40 @endforeach
41 41 </select>
  42 + </label><br>
  43 +
  44 + <label class="block text-sm">
  45 + <span class="text-gray-700 dark:text-gray-400">Текст-описание вакансии</span>
  46 + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Описание вакансии (text/html)"
  47 + rows="10">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea>
  48 + @error('text')
  49 + <span class="text-xs text-red-600 dark:text-red-400">
  50 + {{ $message }}
  51 + </span>
  52 + @enderror
42 53 </label>
43 54  
44 55 <label class="block mt-4 text-sm">
resources/views/admin/ad_employers/index.blade.php
... ... @@ -38,13 +38,38 @@
38 38 @endsection
39 39  
40 40 @section('search')
41   -
  41 + @include('admin.find_ad_employer', ['select_job' => $select_job])
42 42 @endsection
43 43  
44 44 @section('content')
45   - <button style="margin-bottom: 10px; width:165px" id="refresh_btn" name="refresh_btn" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
46   - Обновить вакансии
47   - </button>
  45 + <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
  46 +
  47 + <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
  48 + <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500">
  49 + <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
  50 + <path
  51 + d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path>
  52 + </svg>
  53 + </div>
  54 + <div>
  55 + <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
  56 + Всего вакансий
  57 + </p>
  58 + <p class="text-lg font-semibold text-gray-700 dark:text-gray-200">
  59 + {{ $all_ad }}
  60 + </p>
  61 + </div>
  62 + </div>
  63 + </div>
  64 +
  65 + <div>
  66 + <button style="margin-bottom: 10px; width:165px; display: inline-block;" id="refresh_btn" name="refresh_btn" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  67 + Обновить вакансии
  68 + </button>
  69 + <a href="{{ route('admin.add-ad-employers') }}" style="margin-bottom: 10px; width:310px; display: inline-block;" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  70 + Добавить вакансии от администратора
  71 + </a>
  72 + </div>
48 73 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
49 74 <div class="w-full overflow-x-auto">
50 75 <table class="w-full whitespace-no-wrap">
... ... @@ -160,9 +185,12 @@
160 185 </td>
161 186  
162 187 <td class="px-4 py-3 text-sm class10">
163   - <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}">
164   - Изменить
165   - </a>
  188 + <form action="{{ route('admin.delete-ad-employer', ['ad_employer' => $ad->id]) }}" method="POST">
  189 + <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}">Изменить</a> |
  190 + @csrf
  191 + @method('DELETE')
  192 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  193 + </form>
166 194 </td>
167 195 </tr>
168 196 @endforeach
resources/views/admin/education/add.blade.php
... ... @@ -2,6 +2,6 @@
2 2  
3 3 @section('content')
4 4 <form method="POST" action="{{ route('admin.education.store') }}" enctype="multipart/form-data">
5   - @include('admin.education.form')
  5 + @include('admin.education.form-add')
6 6 </form>
7 7 @endsection
resources/views/admin/education/edit.blade.php
1 1 @extends('layout.admin', ['title' => 'Админка - Редактирование образования'])
2 2  
3 3 @section('content')
4   - <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data">
5   - @include('admin.education.form')
6   - </form>
  4 + @include('admin.education.form')
7 5 @endsection
resources/views/admin/education/form-add.blade.php
... ... @@ -0,0 +1,108 @@
  1 +@csrf
  2 +
  3 +@isset($education)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  8 + <label class="block text-sm">
  9 + <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span>
  10 + <input name="name" id="name"
  11 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  12 + placeholder="Название учебного заведения" value="{{ old('name') ?? $education->name ?? '' }}"
  13 + />
  14 + @error('name')
  15 + <span class="text-xs text-red-600 dark:text-red-400">
  16 + {{ $message }}
  17 + </span>
  18 + @enderror
  19 + </label><br>
  20 +
  21 + <label class="block text-sm">
  22 + <span class="text-gray-700 dark:text-gray-400">Адрес</span>
  23 + <input name="address" id="address"
  24 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  25 + placeholder="Адрес" value="{{ old('address') ?? $education->address ?? '' }}"
  26 + />
  27 + @error('address')
  28 + <span class="text-xs text-red-600 dark:text-red-400">
  29 + {{ $message }}
  30 + </span>
  31 + @enderror
  32 + </label><br>
  33 +
  34 + <label class="block text-sm">
  35 + <span class="text-gray-700 dark:text-gray-400">Email</span>
  36 + <input name="email" id="email"
  37 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  38 + placeholder="Email" value="{{ old('email') ?? $education->email ?? '' }}"
  39 + />
  40 + @error('email')
  41 + <span class="text-xs text-red-600 dark:text-red-400">
  42 + {{ $message }}
  43 + </span>
  44 + @enderror
  45 + </label><br>
  46 +
  47 + <label class="block text-sm">
  48 + <span class="text-gray-700 dark:text-gray-400">Телефон</span>
  49 + <input name="telephone" id="telephone"
  50 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  51 + placeholder="Телефон" value="{{ old('telephone') ?? $education->telephone ?? '' }}"
  52 + />
  53 + @error('telephone')
  54 + <span class="text-xs text-red-600 dark:text-red-400">
  55 + {{ $message }}
  56 + </span>
  57 + @enderror
  58 + </label><br>
  59 +
  60 + <label class="block text-sm">
  61 + <span class="text-gray-700 dark:text-gray-400">Текст</span>
  62 + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor_" name="text" placeholder="Текст (html)" required
  63 + rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea>
  64 + @error('text')
  65 + <span class="text-xs text-red-600 dark:text-red-400">
  66 + {{ $message }}
  67 + </span>
  68 + @enderror
  69 + </label><br>
  70 +
  71 + <label class="block text-sm">
  72 + <span class="text-gray-700 dark:text-gray-400">Картинка</span>
  73 + <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
  74 + focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
  75 + dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  76 + id="image" name="image" accept="image/png, image/jpeg">
  77 + @error('image')
  78 + <span class="text-xs text-red-600 dark:text-red-400">
  79 + {{ $message }}
  80 + </span>
  81 + @enderror
  82 + @isset($education->image)
  83 + <img src="{{asset(Storage::url($education->image))}}" width="100px"/>
  84 + @endisset
  85 + </label><br>
  86 +
  87 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  88 + <div>
  89 + <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  90 + Сохранить
  91 + </button>
  92 + <a href="{{ route('admin.education.index') }}"
  93 + class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
  94 + style="display: -webkit-inline-box; height: 30px!important;"
  95 + >Назад</a>
  96 + </div>
  97 + </div>
  98 +</div>
  99 +<script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
  100 +
  101 +<!--<script src="{{ asset('./ckeditor/ckeditor.js') }}"></script>-->
  102 +<script>
  103 + CKEDITOR.replace( 'text', {
  104 + filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
  105 + filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
  106 + filebrowserUploadMethod: 'form'
  107 + });
  108 +</script>
resources/views/admin/education/form.blade.php
... ... @@ -5,6 +5,7 @@
5 5 @endisset
6 6  
7 7 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  8 + <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data">
8 9 <label class="block text-sm">
9 10 <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span>
10 11 <input name="name" id="name"
... ... @@ -59,7 +60,7 @@
59 60  
60 61 <label class="block text-sm">
61 62 <span class="text-gray-700 dark:text-gray-400">Текст</span>
62   - <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Текст (html)" required
  63 + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor_" name="text" placeholder="Текст (html)" required
63 64 rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea>
64 65 @error('text')
65 66 <span class="text-xs text-red-600 dark:text-red-400">
... ... @@ -84,66 +85,6 @@
84 85 @endisset
85 86 </label><br>
86 87  
87   -
88   - @isset($education)
89   - <div class="tabs">
90   - <input type="radio" name="tab-btn" id="tab-btn-1" value="" checked>
91   - <label for="tab-btn-1">Высшее образование</label>
92   - <input type="radio" name="tab-btn" id="tab-btn-2" value="">
93   - <label for="tab-btn-2">Средне-профессиональное образование</label>
94   - <input type="radio" name="tab-btn" id="tab-btn-3" value="">
95   - <label for="tab-btn-3">Дополнительное образование</label>
96   - <div id="content-1">
97   - <a id="add1" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
98   - href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 1]) }}"
99   - >Добавить специализацию</a><br>
100   - @if ((isset($program1)) && ($program1->count()))
101   - @foreach ($program1 as $prog1)
102   - <hr>
103   - <label class="block text-sm">
104   - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog1->name}}</h4>
105   - <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog1->text}}</span>
106   - </label><br>
107   - @endforeach
108   - @else
109   - <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
110   - @endif
111   - </div>
112   - <div id="content-2">
113   - <a id="add2" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
114   - href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 2]) }}"
115   - >Добавить специализацию</a><br>
116   - @if ((isset($program2)) && ($program2->count()))
117   - @foreach ($program2 as $prog2)
118   - <hr>
119   - <label class="block text-sm">
120   - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog2->name}}</h4>
121   - <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog2->text}}</span>
122   - </label><br>
123   - @endforeach
124   - @else
125   - <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
126   - @endif
127   - </div>
128   - <div id="content-3">
129   - <a id="add3" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
130   - href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 3]) }}"
131   - >Добавить специализацию</a><br>
132   - @if ((isset($program3)) && ($program3->count()))
133   - @foreach ($program3 as $prog3)
134   - <hr>
135   - <label class="block text-sm">
136   - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog3->name}}</h4>
137   - <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog3->text}}</span>
138   - </label><br>
139   - @endforeach
140   - @else
141   - <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
142   - @endif
143   - </div>
144   - </div><br>
145   - @endisset
146   -
147 88 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
148 89 <div>
149 90 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
... ... @@ -155,6 +96,59 @@
155 96 >Назад</a>
156 97 </div>
157 98 </div>
  99 + </form>
  100 +
  101 + @isset($education)
  102 + <hr>
  103 + <form method="GET" action="{{ route('admin.add-program-education') }}">
  104 + <label class="block text-sm">
  105 + <span class="text-gray-700 dark:text-gray-400">Категория образования</span>
  106 + <input type="hidden" name="id" value="{{ $education->id }}"/>
  107 + <input name="level" id="level"
  108 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  109 + placeholder="Новое образование" value=""
  110 + /><br>
  111 + <button type="submit" id="btn_education" name="btn_education" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  112 + Добавить
  113 + </button>
  114 + </label><br>
  115 + </form>
  116 + <hr>
  117 + @if ($program->count())
  118 + @php $bool = true;
  119 + $i = 1;
  120 + $level = "";
  121 + @endphp
  122 +
  123 + @foreach ($program as $pro)
  124 + @if ((!empty($level)) && ($level <> $pro->level ))
  125 + </div>
  126 + </div><br>
  127 + @php $bool = true; $i++; @endphp
  128 + @endif
  129 + @if ($bool == true)
  130 + <div class="tabs">
  131 + <input type="radio" name="tab-btn" id="tab-btn-{{$i}}" value="" checked>
  132 + <label for="tab-btn-{{$i}}">{{ $pro->level }}</label>
  133 + <div id="content-{{$i}}">
  134 +
  135 + @php $bool = false;
  136 + $level = $pro->level;
  137 + @endphp
  138 + @endif
  139 + <label class="block text-sm">
  140 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$pro->name}}</h4>
  141 + <span class="text-gray-700 dark:text-gray-400">Описание: {{$pro->text}}</span>
  142 + <a href="{{ route('admin.delete-program-education', ['program' => $pro->id, 'education' => $education->id]) }}">Удалить</a>
  143 + </label><br><hr>
  144 + @endforeach
  145 + </div>
  146 + </div><br>
  147 + @else
  148 + <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
  149 + @endif
  150 + @endisset
  151 +
158 152 </div>
159 153 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
160 154  
resources/views/admin/education/index.blade.php
... ... @@ -35,7 +35,7 @@
35 35 {{$cat->id}}
36 36 </td>
37 37 <td class="px-4 py-3">
38   - {{ $cat->name }}
  38 + {{ mb_strimwidth($cat->name, 0, 50, "...") }}
39 39 </td>
40 40  
41 41 <td class="px-4 py-3 text-sm_">
resources/views/admin/employer/index.blade.php
... ... @@ -43,7 +43,7 @@
43 43 console.log('click button');
44 44 let id = e.target.id;
45 45 let form = document.getElementById("form_modal_del");
46   - form.action = "<?=$_SERVER['APP_URL']?>admin/employers/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user');
  46 + form.action = "<?=$_SERVER['APP_URL']?>public/admin/employers/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user');
47 47 //document.getElementById("title_modal").innerHTML = id;
48 48 console.log(e.target.getAttribute('data-employer'));
49 49 console.log(e.target.getAttribute('data-user'));
... ... @@ -160,8 +160,9 @@
160 160 </td>
161 161 <td class="px-4 py-3 text-sm">
162 162 @if (!empty($user->emp_id))
163   - <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> |
164   - <a @click="openModal" style="cursor: pointer;" data-employer="{{$user->emp_id}}" data-user="{{$user->user_id}}" class="btn_del btn btn-danger">Удалить</a>
  163 + <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a>
  164 + @if ($user->emp_id > 2) | <a @click="openModal" style="cursor: pointer;" data-employer="{{$user->emp_id}}" data-user="{{$user->user_id}}" class="btn_del btn btn-danger">Удалить</a>
  165 + @endif
165 166 @endif
166 167 </td>
167 168 <!--<td class="px-4 py-3 text-sm">
resources/views/admin/find_ad_employer.blade.php
... ... @@ -0,0 +1,41 @@
  1 +<div class="absolute inset-y-0 flex items-center pl-2">
  2 + <svg
  3 + class="w-4 h-4"
  4 + aria-hidden="true"
  5 + fill="currentColor"
  6 + viewBox="0 0 20 20"
  7 + >
  8 + <path
  9 + fill-rule="evenodd"
  10 + d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
  11 + clip-rule="evenodd"
  12 + ></path>
  13 + </svg>
  14 +</div>
  15 +<form action="" method="GET">
  16 + <div style="float:left; margin-right:10px;" ><input
  17 + name="find" id="find"
  18 + class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
  19 + style="width: 200px"
  20 + type="text"
  21 + placeholder="Искать..."
  22 + aria-label="Search"
  23 + value="{{$find_key}}"
  24 + />
  25 + </div>
  26 + <div style="float:left; margin-top: -5px;">
  27 + <select
  28 + name="category_job" id="category_job"
  29 + placeholder="Вакансии"
  30 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  31 + >
  32 + <option value="Все вакансии">Все вакансии</option>
  33 + @foreach ($select_job as $job)
  34 + <option value="{{$job->name}}" @if ($find_job ==$job->name) selected @endif>{{$job->name}}</option>
  35 + @endforeach
  36 + </select>
  37 + </div>
  38 + <div style="float: left">
  39 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  40 + </div>
  41 +</form>
resources/views/admin/media/index.blade.php
... ... @@ -0,0 +1,103 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Медиа проекта'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('click', '.btn-eye', function () {
  7 + var this_ = $(this);
  8 + var status_ = this_.attr('data-status');
  9 + var id_ = this_.attr('data-id');
  10 + var ajax_block = $('#ajax_block');
  11 +
  12 + $.ajax({
  13 + type: "GET",
  14 + url: "{{ url()->full()}}",
  15 + data: "id=" + id_ + "&status=" + status_,
  16 + success: function (data) {
  17 + console.log('Обновление таблицы ');
  18 + //data = JSON.parse(data);
  19 + //console.log(data);
  20 + ajax_block.html(data);
  21 + },
  22 + headers: {
  23 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  24 + },
  25 + error: function (data) {
  26 + console.log('Error: ' + data);
  27 + }
  28 + });
  29 + });
  30 + });
  31 + </script>
  32 +@endsection
  33 +
  34 +@section('modal')
  35 +
  36 +@endsection
  37 +
  38 +@section('search')
  39 +
  40 +@endsection
  41 +
  42 +@section('content')
  43 +
  44 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  45 + <div class="w-full overflow-x-auto">
  46 + <table class="w-full whitespace-no-wrap">
  47 + <thead>
  48 + <tr
  49 + class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800"
  50 + >
  51 + <th class="px-4 py-3">№</th>
  52 + <th class="px-4 py-3">Картинка</th>
  53 + <th class="px-4 py-3">Юзер</th>
  54 + <th class="px-4 py-3">Дата загрузки</th>
  55 + <th class="px-4 py-3">Редактировать</th>
  56 + </tr>
  57 + </thead>
  58 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  59 + @foreach($Media as $img)
  60 + <tr class="text-gray-700 dark:text-gray-400">
  61 + <td class="px-4 py-3">
  62 + {{$img->id}}
  63 + </td>
  64 + <td class="px-4 py-3">
  65 + <img style="width: 50px" src="{{ asset(Storage::url($img->file)) }}" />
  66 + </td>
  67 +
  68 + <td class="px-4 py-3">
  69 + <div class="flex items-center text-sm">
  70 + <div>
  71 + @if (isset($img->user->id))
  72 + <p class="font-semibold">
  73 + {{$img->user->name_man}} {{$img->user->surname}} {{$img->user->surname2}}
  74 + </p>
  75 + <p class="text-xs text-gray-600 dark:text-gray-400">
  76 + ID: {{$img->id}}
  77 + </p>
  78 + @endif
  79 + </div>
  80 + </div>
  81 + </td>
  82 + <td class="px-4 py-3">
  83 + {{$img->created_at}}
  84 + </td>
  85 +
  86 + <td class="px-4 py-3 text-sm_">
  87 + <form action="{{ route('admin.delete-media', ['media' => $img->id]) }}" method="POST">
  88 + @csrf
  89 + @method('DELETE')
  90 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  91 + </form>
  92 + </td>
  93 + </tr>
  94 + @endforeach
  95 + </tbody>
  96 + </table>
  97 + </div>
  98 +
  99 + <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
  100 + <?=$Media->appends($_GET)->links('admin.pagginate'); ?>
  101 + </div>
  102 + </div>
  103 +@endsection
resources/views/admin/register.blade.php
... ... @@ -22,7 +22,13 @@
22 22 Создание аккаунта администратора
23 23 </h1>
24 24 <form method="POST" action="{{ route('admin.create') }}">
25   - @csrf
  25 + @csrf
  26 +
  27 + <input type="hidden" id="code_emp" name="code_emp"
  28 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  29 + placeholder="" value="{{ $code_emp }}"
  30 + />
  31 +
26 32 <label class="block text-sm">
27 33 <span class="text-gray-700 dark:text-gray-400">Имя</span>
28 34 <input id="name" name="name"
resources/views/admin/users/form.blade.php
1 1 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
2   - <label class="block text-sm">
  2 + <!--<label class="block text-sm">
3 3 <span class="text-gray-700 dark:text-gray-400">Имя/Псевдоним</span>
4 4 <input name="name" id="name"
5 5 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
... ... @@ -10,6 +10,34 @@
10 10 {{ $message }}
11 11 </span>
12 12 @enderror
  13 + </label><br>-->
  14 +
  15 + <input name="name" id="name" type="hidden"
  16 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  17 + placeholder="Имя/Псевдоним" value="{{ old('name') ?? $user->name ?? 'Пользователь базы данных' }}"
  18 + />
  19 +
  20 + <label class="block text-sm">
  21 + <span class="text-gray-700 dark:text-gray-400">Должность</span>
  22 + <select name="position_work" id="position_work" class="form-control block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  23 + ">
  24 + @isset($list_job_titles)
  25 + @foreach($list_job_titles as $job_title)
  26 + <option value="{{ $job_title->id }}"
  27 + @if (isset($user->workers[0]->position_work))
  28 + @if($job_title->id == $user->workers[0]->position_work)
  29 + selected
  30 + @endif
  31 + @endif
  32 + >{{ $job_title->name }} ({{ $job_title->id }})</option>
  33 + @endforeach
  34 + @endisset
  35 + </select>
  36 + @error('name')
  37 + <span class="text-xs text-red-600 dark:text-red-400">
  38 + {{ $message }}
  39 + </span>
  40 + @enderror
13 41 </label><br>
14 42  
15 43 <label class="block text-sm">
resources/views/admin/users/index.blade.php
... ... @@ -63,7 +63,7 @@
63 63 @if ($id_admin == 1)
64 64 <th class="px-4 py-3">Админ</th>
65 65 @endif
66   - <th class="px-4 py-3">Дата регистрации</th>
  66 + <th class="px-4 py-3">Дата регист.</th>
67 67 </tr>
68 68 </thead>
69 69 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
resources/views/admin/users/index_bd.blade.php
... ... @@ -58,7 +58,7 @@
58 58 <th class="px-4 py-3">№</th>
59 59 <th class="px-4 py-3">Имя</th>
60 60 <th class="px-4 py-3">Email/телефон</th>
61   - <th class="px-4 py-3">Статус</th>
  61 + <th class="px-4 py-3">Должность</th>
62 62 <th class="px-4 py-3">Анкета</th>
63 63 <th class="px-4 py-3">Дата регистрации</th>
64 64 <th class="px-4 py-3">Изменить</th>
... ... @@ -108,7 +108,7 @@
108 108 </div>
109 109 </td>
110 110  
111   - <td class="px-4 py-3 text-xs">
  111 + <!--<td class="px-4 py-3 text-xs">
112 112 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
113 113 @if ($user->is_worker)
114 114 Работник
... ... @@ -126,6 +126,14 @@
126 126 База данных
127 127 </span>
128 128 @endif
  129 + </td>-->
  130 +
  131 + <td class="px-4 py-3 text-xs">
  132 + @if (isset($user->jobtitles[0]->name))
  133 + {{ $user->jobtitles[0]->name }}
  134 + @else
  135 + -
  136 + @endif
129 137 </td>
130 138  
131 139 <td class="px-4 py-3 text-sm">
resources/views/admin/users/index_bd_ajax.blade.php
... ... @@ -6,9 +6,11 @@
6 6 >
7 7 <th class="px-4 py-3">№</th>
8 8 <th class="px-4 py-3">Имя</th>
9   - <th class="px-4 py-3">Email/логин</th>
10   - <th class="px-4 py-3">Статус</th>
  9 + <th class="px-4 py-3">Email/телефон</th>
  10 + <th class="px-4 py-3">Должность</th>
  11 + <th class="px-4 py-3">Анкета</th>
11 12 <th class="px-4 py-3">Дата регистрации</th>
  13 + <th class="px-4 py-3">Изменить</th>
12 14 </tr>
13 15 </thead>
14 16 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
... ... @@ -33,8 +35,11 @@
33 35 </div>
34 36 </div>
35 37 -->
36   - <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a>
  38 + <!--<a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}"></a>-->
  39 +
  40 + {{ $user->name }}
37 41 </td>
  42 +
38 43 <td class="px-4 py-3">
39 44 <div class="flex items-center text-sm">
40 45 <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
... ... @@ -51,29 +56,59 @@
51 56 </div>
52 57 </div>
53 58 </td>
54   - <td class="px-4 py-3 text-xs">
  59 +
  60 + <!--<td class="px-4 py-3 text-xs">
55 61 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
56 62 @if ($user->is_worker)
57 63 Работник
58 64 @else
59   - Работодатель
60   - @endif
  65 + Работодатель
  66 + @endif
61 67 </span>
62   - @if ($user->admin)
63   - <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600">
  68 + @if ($user->admin)
  69 + <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600">
64 70 Администратор
65 71 </span>
  72 + @endif
  73 + @if ($user->is_bd)
  74 + <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700">
  75 + База данных
  76 + </span>
  77 + @endif
  78 + </td>-->
  79 +
  80 + <td class="px-4 py-3 text-xs">
  81 + @if (isset($user->jobtitles[0]->name))
  82 + {{ $user->jobtitles[0]->name }}
  83 + @else
  84 + -
66 85 @endif
67   - @if ($user->is_bd)
68   - <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700">
69   - База данных
70   - </span>
  86 + </td>
  87 +
  88 + <td class="px-4 py-3 text-sm">
  89 + @if (isset($user->workers[0]->id))
  90 + <!--<a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Править</a> |-->
  91 + <!--<a href="{{ route('admin.doc-basedata', ['user' => $user->id]) }}">Скачать</a>-->
71 92 @endif
  93 + @isset($user->file)
  94 + <a class="text-gray-700 dark:text-gray-400" target="blank" href="{{ asset(Storage::url($user->file)) }}">Скачать</a>
  95 + @else
  96 + <p class="text-gray-700 dark:text-gray-400">-</p>
  97 + @endisset
72 98 </td>
73 99  
74 100 <td class="px-4 py-3 text-sm">
75 101 {{ date('d.m.Y', strtotime($user->created_at)) }}
76 102 </td>
  103 +
  104 + <td class="px-4 py-3 text-sm_">
  105 + <form action="{{ route('admin.delete-basedata', ['user' => $user->id]) }}" method="POST">
  106 + <a href="{{ route('admin.edit-basedata', ['user' => $user->id]) }}">Изменить</a> |
  107 + @csrf
  108 + @method('DELETE')
  109 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  110 + </form>
  111 + </td>
77 112 </tr>
78 113 @endforeach
79 114 </tbody>
resources/views/admin/worker/index.blade.php
... ... @@ -43,6 +43,26 @@
43 43 @endsection
44 44  
45 45 @section('content')
  46 + <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
  47 +
  48 + <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
  49 + <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500">
  50 + <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
  51 + <path
  52 + d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path>
  53 + </svg>
  54 + </div>
  55 + <div>
  56 + <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
  57 + Всего соискателей
  58 + </p>
  59 + <p class="text-lg font-semibold text-gray-700 dark:text-gray-200">
  60 + {{ $all_worker }}
  61 + </p>
  62 + </div>
  63 + </div>
  64 + </div>
  65 +
46 66 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
47 67 <div class="w-full overflow-x-auto">
48 68 <table class="w-full whitespace-no-wrap">
resources/views/layout/admin.blade.php
... ... @@ -234,6 +234,27 @@
234 234 <span class="ml-4">Группы пользователей</span>
235 235 </a>
236 236 </li>
  237 +
  238 + <li class="relative px-6 py-3">
  239 + <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.media') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.media') }}">
  240 + <svg
  241 + class="w-5 h-5"
  242 + aria-hidden="true"
  243 + fill="none"
  244 + stroke-linecap="round"
  245 + stroke-linejoin="round"
  246 + stroke-width="2"
  247 + viewBox="0 0 24 24"
  248 + stroke="currentColor"
  249 + >
  250 + <path
  251 + d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"
  252 + ></path>
  253 + </svg>
  254 + <span class="ml-4">Медиа</span>
  255 + </a>
  256 + </li>
  257 +
237 258 @if ($UserId == 1)
238 259 <li class="relative px-6 py-3">
239 260 <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.roles') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.roles') }}">
... ... @@ -729,6 +750,27 @@
729 750 <span class="ml-4">Группы пользователей</span>
730 751 </a>
731 752 </li>
  753 +
  754 + <li class="relative px-6 py-3">
  755 + <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.media') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.media') }}">
  756 + <svg
  757 + class="w-5 h-5"
  758 + aria-hidden="true"
  759 + fill="none"
  760 + stroke-linecap="round"
  761 + stroke-linejoin="round"
  762 + stroke-width="2"
  763 + viewBox="0 0 24 24"
  764 + stroke="currentColor"
  765 + >
  766 + <path
  767 + d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"
  768 + ></path>
  769 + </svg>
  770 + <span class="ml-4">Медиа</span>
  771 + </a>
  772 + </li>
  773 +
732 774 @if ($UserId == 1)
733 775 <li class="relative px-6 py-3">
734 776 <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.roles') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.roles') }}">
... ... @@ -14,6 +14,7 @@ use App\Http\Controllers\Auth\ForgotPasswordController;
14 14 use App\Http\Controllers\Auth\LoginController;
15 15 use App\Http\Controllers\Auth\RegisterController;
16 16 use App\Http\Controllers\CKEditorController;
  17 +use App\Http\Controllers\MediaController;
17 18 use App\Http\Controllers\WorkerController;
18 19 use App\Models\User;
19 20 use App\Http\Controllers\MainController;
... ... @@ -114,9 +115,9 @@ Route::group([
114 115 ], function () {
115 116 // Форма регистрации
116 117 Route::get('register', [AdminController::class, 'register'])->name('register');
117   -
118 118 // Создание пользователя
119 119 Route::post('register', [AdminController::class, 'create'])->name('create');
  120 +
120 121 //Форма входа
121 122 Route::get('login', [AdminController::class, 'login'])->name('login');
122 123  
... ... @@ -172,6 +173,9 @@ Route::group([
172 173 // кабинет профиль работник - сохранение формы
173 174 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
174 175  
  176 + // Медиа
  177 + Route::get('media', [MediaController::class, 'index'])->name('media');
  178 + Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media');
175 179  
176 180 // кабинет настройки сайта - форма
177 181 Route::get('config', [AdminController::class, 'config_form'])->name('config');
... ... @@ -203,8 +207,11 @@ Route::group([
203 207  
204 208 // кабинет - вакансии
205 209 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
  210 + Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers');
  211 + Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers');
206 212 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
207 213 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
  214 + Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer');
208 215  
209 216 // кабинет - категории
210 217 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
... ... @@ -219,8 +226,9 @@ Route::group([
219 226 // CRUD-операции над справочником Образование
220 227 Route::resource('education', EducationController::class, ['except' => ['show']]);
221 228  
222   - Route::get('program-education/{education}/{level}', [EducationController::class, 'add_program'])->name('add-program-education');
  229 + Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education');
223 230 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education');
  231 + Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education');
224 232  
225 233 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
226 234 /*